Re: [PATCH] pinctrl: freescale: avoid overwriting pin config when freeing GPIO

From: Viresh Kumar
Date: Wed Sep 28 2016 - 00:15:22 EST


On 27-09-16, 20:38, Stefan Agner wrote:
> The i.MX I2C driver touches the pinctrl in its prepare/unprepare
> callbacks.
>
> So, on a i.MX or Vybrid, the call chain looks like this:
>
> i2c_generic_gpio_recovery
> -> i2c_get_gpios_for_recovery
> -> gpio_request_one
> -> i2c_generic_recovery
> -> prepare_recovery (i2c_imx_prepare_recovery)
> -> pinctrl_select_state [gpio]

Why is this done here? And not in gpio_request_one?

> -> unprepare_recovery (i2c_imx_unprepare_recovery)
> -> pinctrl_select_state [default]
> -> i2c_put_gpios_for_recovery
> -> gpio_free
>
>
> And for the pinctrl/GPIO driver of Vybrid this is actually a problem
> because gpio_free disables the output driver of the pad, and when that
> happens after the (I2C) default pinctrl state gets selected the pad is
> no longer active.
>
> --
> Stefan

--
viresh