[PATCH v5] i2c: imx: make bus recovery through pinctrl optional
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Fri Sep 9 13:59:26 PDT 2016
Hello,
On Fri, Sep 09, 2016 at 01:34:31PM -0700, Stefan Agner wrote:
> Yeah it is a bit a wording thing: In my understanding, pinctrl is
> required on SoC's witch have a pin controller... It is just that the
> driver does not need to get the pinctrl by itself because the stack is
> taking care of it implicitly. And yes, that makes the particular example
> not a real world example.
At first I thought, too, that it's a fatal problem if getting the
pinctrl stuff fails. IMHO that shows that the comments (or the code) are
still not good enough.
Maybe we should do something like that:
/*
* As the IP doesn't support bus recovery, we have to switch SCL and SDA
* to their GPIO function and do some bitbanging. These alternative
* pinmux settings can be described in the device tree by a separate
* pinctrl state "gpio". If this is missing this is not a big problem,
* the only implication is that we can't do bus recovery.
*/
static void i2c_imx_init_recovery_info(...)
{
...
and then put
i2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev);
if (IS_ERR(i2c_imx->pinctrl))
return;
into this function (and remove it from i2c_imx_probe). This makes it
more obvious that .pinctrl is only ever used for recovery and as
i2c_imx_init_recovery_info is void there is no error to propagate.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the linux-arm-kernel
mailing list