Re: [PATCH] i2c: rcar: call rcar_i2c_init() after pm_runtime_get_sync()

2015-10-29 Thread Geert Uytterhoeven
On Thu, Oct 29, 2015 at 10:37 AM, Kuninori Morimoto
 wrote:
> From: Kuninori Morimoto 
>
> rcar_i2c_init() initializes I2C device, but it should be called
> *after* pm_runtime_get_sync(). Otherwise it outputs very hi speed
> clock. This patch solved this issue,
> This patch also removes pointless rcar_i2c_init()
> from rcar_i2c_probe()
>
> Signed-off-by: Kuninori Morimoto 
> ---
>  drivers/i2c/busses/i2c-rcar.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 616433d..edbfefc 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -474,6 +474,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
>
> pm_runtime_get_sync(dev);
>
> +   rcar_i2c_init(priv);

Hence now it's done again for every transfer?

What about moving it just before the call to i2c_add_numbered_adapter(),
and wrapping it inside pm_runtime_get_sync(dev)/pm_runtime_put()?

Wolfram, what do you think?

> +
> ret = rcar_i2c_bus_barrier(priv);
> if (ret < 0)
> goto out;
> @@ -612,8 +614,6 @@ static int rcar_i2c_probe(struct platform_device *pdev)
> if (IS_ERR(priv->io))
> return PTR_ERR(priv->io);
>
> -   rcar_i2c_init(priv);
> -
> irq = platform_get_irq(pdev, 0);
> init_waitqueue_head(>wait);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: rcar: call rcar_i2c_init() after pm_runtime_get_sync()

2015-10-29 Thread Wolfram Sang

> Hence now it's done again for every transfer?
> 
> What about moving it just before the call to i2c_add_numbered_adapter(),
> and wrapping it inside pm_runtime_get_sync(dev)/pm_runtime_put()?
> 
> Wolfram, what do you think?

I'd prefer the latter. Sending a tested patch in a second...



signature.asc
Description: Digital signature


Re: [PATCH] i2c: rcar: call rcar_i2c_init() after pm_runtime_get_sync()

2015-10-29 Thread Kuninori Morimoto

Hi Geert

> > From: Kuninori Morimoto 
> >
> > rcar_i2c_init() initializes I2C device, but it should be called
> > *after* pm_runtime_get_sync(). Otherwise it outputs very hi speed
> > clock. This patch solved this issue,
> > This patch also removes pointless rcar_i2c_init()
> > from rcar_i2c_probe()
> >
> > Signed-off-by: Kuninori Morimoto 
> > ---
> >  drivers/i2c/busses/i2c-rcar.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> > index 616433d..edbfefc 100644
> > --- a/drivers/i2c/busses/i2c-rcar.c
> > +++ b/drivers/i2c/busses/i2c-rcar.c
> > @@ -474,6 +474,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter 
> > *adap,
> >
> > pm_runtime_get_sync(dev);
> >
> > +   rcar_i2c_init(priv);
> 
> Hence now it's done again for every transfer?
> 
> What about moving it just before the call to i2c_add_numbered_adapter(),
> and wrapping it inside pm_runtime_get_sync(dev)/pm_runtime_put()?

In my experience, it should be called again for every transfer.
Because SoC/IP might doesn't keep register setting value if you call 
pm_runtime_put()
(I fought with this behavior when sh_mobile IP :P )
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html