RE: [PATCH v3 5/5] OMAP: I2C: Convert i2c driver to use PM runtime api's

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

 




> -----Original Message-----
> From: Russell King - ARM Linux [mailto:linux@xxxxxxxxxxxxxxxx]
> Sent: Tuesday, September 28, 2010 1:19 PM
> To: Nayak, Rajendra
> Cc: Ben Dooks; Paul Walmsley; Kevin Hilman; linux-i2c@xxxxxxxxxxxxxxx; ben-linux@xxxxxxxxx; khali@xxxxxxxxxxxx; linux-
> omap@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v3 5/5] OMAP: I2C: Convert i2c driver to use PM runtime api's
> 
> On Tue, Sep 28, 2010 at 12:29:01PM +0530, Nayak, Rajendra wrote:
> > <snip>...
> > > > >
> > > > >  static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > > > @@ -356,6 +333,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > > >  	unsigned long fclk_rate = 12000000;
> > > > >  	unsigned long timeout;
> > > > >  	unsigned long internal_clk = 0;
> > > > > +	struct clk *fclk;
> > > > >
> > > > >  	if (dev->rev >= OMAP_I2C_REV_2) {
> > > > >  		/* Disable I2C controller before soft reset */
> > > > > @@ -414,7 +392,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > > >  		 * always returns 12MHz for the functional clock, we can
> > > > >  		 * do this bit unconditionally.
> > > > >  		 */
> > > > > -		fclk_rate = clk_get_rate(dev->fclk);
> > > > > +		fclk = clk_get(dev->dev, "fck");
> > > > > +		fclk_rate = clk_get_rate(fclk);
> > > > >
> > > > >  		/* TRM for 5912 says the I2C clock must be prescaled to be
> > > > >  		 * between 7 - 12 MHz. The XOR input clock is typically
> > > > > @@ -443,7 +422,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> > > > >  			internal_clk = 9600;
> > > > >  		else
> > > > >  			internal_clk = 4000;
> > > > > -		fclk_rate = clk_get_rate(dev->fclk) / 1000;
> > > > > +		fclk = clk_get(dev->dev, "fck");
> > > > > +		fclk_rate = clk_get_rate(fclk) / 1000;
> > > >
> > > > You don't put the clk after getting it and using it once?
> > >
> > > clk_get needs an equivalent clk_put and not clk_get_rate. clk_get_rate
> > > is used to merely know the existing rate of the clock.
> >
> > Sorry, I guess you did mean the clk_get above the clk_get_rate does not have
> > an equivalent clk_put.
> > I could put a clk_put for readability, but a clk_put on OMAP actually does map
> > to an empty function.
> > See arch/arm/plat-omap/include/plat/clkdev.h
> > clk_get merely returns a pointer to the clk struct and does not do any usecounting,
> > hence a clk_put does not do anything.
> 
> That's no reason to avoid using it.

Ok, I'll post an updated patch with the matching clk_put's in place.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux