]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit1267be615ae6fd35d72776b147b7838fc4a67cb7
tree818b658693b6671d98000ab8d19b74622f75edf7
parentaf2916f2f963add4a75b03067ce4140d32bb4ac5
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: b4c5ef83b2dc ("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