[PATCH RFC] i2c: rk3x: handle dynamic clock rate changes correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Addy,

On Wednesday 10 September 2014 at 16:16:10, Addy wrote:
> > @@ -724,16 +816,28 @@ static int rk3x_i2c_probe(struct platform_device
> > *pdev)
> > 
> >        return ret;
> >    
> >    }
> > 
> > +    i2c->clk_rate_nb.notifier_call = rk3x_i2c_clk_notifier_cb;
> > +    ret = clk_notifier_register(i2c->clk, &i2c->clk_rate_nb);
> > +    if (ret != 0) {
> > +        dev_err(&pdev->dev, "Unable to register clock notifier\n");
> > +        goto err_clk;
> > +    }
> > +
> > +    i2c->clk_freq = clk_get_rate(i2c->clk);
> > +    rk3x_i2c_set_scl_rate(i2c, i2c->scl_frequency);
> 
> I have tested on rk3288-pinky board:
> I2c clock must be enabled before driver call rk3x_i2c_set_scl_rate()
> to write div value to CLKDIV register. If not, system will crash.
> 
> So we need call clk_enable() before rk3x_i2c_set_scl_rate().

Interesting. It works without problems on RK3188. Do you know if the clock has 
to be kept enabled for some time? Or is it okay to do it like this?

clk_enable(i2c->clk);
rk3x_i2c_set_scl_rate(i2c, i2c->scl_frequency);
clk_disable(i2c->clk);

Cheers,
  Max



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux