i2c: imx: implement master_xfer_atomic callback
authorStefan Lengfeld <contact@stefanchrist.eu>
Mon, 20 Jan 2020 09:36:50 +0000 (10:36 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Wed, 26 Feb 2020 10:06:42 +0000 (11:06 +0100)
commit3a5ee18d2a32bda6b9a1260136f6805848e3839d
tree3982aa2c6c75043c1f3e97c74d55891a0af5c465
parentd3d3fdcc4c90fed42b400999721a5b535a310533
i2c: imx: implement master_xfer_atomic callback

Rework the read and write code paths in the driver to support operation
in atomic contexts. To achieve this, the driver must not rely on IRQs
and not call schedule(), e.g. via a sleep routine, in these cases.

With this patch the driver supports normal operation, DMA transfers and
now the polling mode or also called sleep-free or IRQ-less operation. It
makes the code not simpler or easier to read, but atomic I2C transfers
are needed on some hardware configurations, e.g. to trigger reboots on
an external PMIC chip.

Signed-off-by: Stefan Lengfeld <contact@stefanchrist.eu>
[m.felsch@pengutronix.de: integrate https://patchwork.ozlabs.org/patch/1085943/ review feedback]
[m.felsch@pengutronix.de: adapt commit message]
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Tested-by: Stefan Lengfeld <contact@stefanchrist.eu>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-imx.c