[PATCH v4 3/3] can: c_can: Add runtime PM support to Bosch C_CAN/D_CAN controller

AnilKumar, Chimata anilkumar at ti.com
Tue Aug 7 20:39:47 EST 2012


Hi Vaibhav,

Thanks for the review.

On Mon, Aug 06, 2012 at 12:18:32, Hiremath, Vaibhav wrote:
> On Sat, Aug 04, 2012 at 00:39:25, Marc Kleine-Budde wrote:
> > On 08/03/2012 08:32 AM, Hiremath, Vaibhav wrote:
> > > On Thu, Aug 02, 2012 at 18:43:11, AnilKumar, Chimata wrote:
> > >> Add Runtime PM support to C_CAN/D_CAN controller. The runtime PM
> > >> APIs control clocks for C_CAN/D_CAN IP and prevent access to the
> > >> register of C_CAN/D_CAN IP when clock is turned off.
> > >>
> > >> Signed-off-by: AnilKumar Ch <anilkumar at ti.com>
> > >> ---
> > >>  drivers/net/can/c_can/c_can_platform.c |    8 ++++++++
> > >>  1 file changed, 8 insertions(+)
> > >>
> > >> diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
> > >> index d0a66cf..83a1e17 100644
> > >> --- a/drivers/net/can/c_can/c_can_platform.c
> > >> +++ b/drivers/net/can/c_can/c_can_platform.c
> > >> @@ -32,6 +32,7 @@
> > >>  #include <linux/clk.h>
> > >>  #include <linux/of.h>
> > >>  #include <linux/of_device.h>
> > >> +#include <linux/pm_runtime.h>
> > >>  
> > >>  #include <linux/can/dev.h>
> > >>  
> > >> @@ -177,6 +178,9 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
> > >>  		goto exit_free_device;
> > >>  	}
> > >>  
> > >> +	pm_runtime_enable(&pdev->dev);
> > >> +	pm_runtime_get_sync(&pdev->dev);
> > >> +
> > > 
> > > If module is inserted or built into the kernel, module stays in enabled 
> > > state always, isn't that wrong?
> > > Ideally, you should enable the module when it is required or being used.
> > 
> > Good point.
> > 
> > If you don't access the module's registers in the probe- (or its
> > subroutines) it should be enough to enable the module in the open()
> > function. Have a look at clk_prepare_enable / clk_disable_unprepare in
> > the flexcan driver.
> > 
> 
> Yeah Marc, something similar, above runtime pm api's should be moved to 
> open-n-close.
> 

Not all APIs, only *_get_sync and *_put_sync to appropriate positions.
I will send next version after fixing this.

Regards
AnilKumar


More information about the devicetree-discuss mailing list