i2c: at91: Fix pinmux after devm_gpiod_get() for bus recovery
authorCodrin Ciubotariu <codrin.ciubotariu@microchip.com>
Wed, 15 Apr 2020 07:06:43 +0000 (10:06 +0300)
committerWolfram Sang <wsa@kernel.org>
Fri, 15 May 2020 09:23:33 +0000 (11:23 +0200)
commit7d66976fe7476d7c9eefae9815b5ce0c66e6f429
tree818b658693b6671d98000ab8d19b74622f75edf7
parent2f5a55c52c00fcded796db5f961057ba3fec8910
i2c: at91: Fix pinmux after devm_gpiod_get() for bus recovery

devm_gpiod_get() usually calls gpio_request_enable() for non-strict pinmux
drivers. These puts the pins in GPIO mode, whithout notifying the pinctrl
driver. At this point, the I2C bus no longer owns the pins. To mux the
pins back to the I2C bus, we use the pinctrl driver to change the state
of the pins to GPIO, before using devm_gpiod_get(). After the pins are
received as GPIOs, we switch theer pinctrl state back to the default
one,

Fixes: d3d3fdcc4c90 ("i2c: at91: implement i2c bus recovery")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-at91-master.c