Re: [PATCH 3/3] PM: i2c-designware-platdrv: System sleep handling rework

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

 



On Tuesday, August 29, 2017 6:38:11 PM CEST Rafael J. Wysocki wrote:
> On Tuesday, August 29, 2017 2:59:49 AM CEST Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> > 
> > Rework the power management part of the i2c-designware-platdrv driver
> > so that its ->suspend and ->resume callbacks do not point to the
> > callback routines used by it for runtime PM.  Instead, point its late
> > suspend and early resume callbacks to pm_runtime_force_suspend() and
> > pm_runtime_force_resume(), respectively, and make it set the
> > SAFE_SUSPEND driver flag (introduced earlier) to instruct the generic
> > ACPI PM domain code that the driver can cope with runtime suspended
> > devices in its system sleep callbacks.
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> > ---
> >  drivers/i2c/busses/i2c-designware-platdrv.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > Index: linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c
> > ===================================================================
> > --- linux-pm.orig/drivers/i2c/busses/i2c-designware-platdrv.c
> > +++ linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c
> > @@ -358,6 +358,7 @@ static int dw_i2c_plat_probe(struct plat
> >  	if (dev->pm_disabled) {
> >  		pm_runtime_forbid(&pdev->dev);
> >  	} else {
> > +		dev->power.driver_flags = DPM_FLAG_SAFE_SUSPEND;
> >  		pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
> >  		pm_runtime_use_autosuspend(&pdev->dev);
> >  		pm_runtime_set_active(&pdev->dev);
> > @@ -455,7 +456,8 @@ static int dw_i2c_plat_resume(struct dev
> >  static const struct dev_pm_ops dw_i2c_dev_pm_ops = {
> >  	.prepare = dw_i2c_plat_prepare,
> >  	.complete = dw_i2c_plat_complete,
> > -	SET_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume)
> > +	SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> > +				     pm_runtime_force_resume)
> >  	SET_RUNTIME_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume, NULL)
> >  };
> 
> This isn't going to work, because pm_runtime_force_suspend() will invoke
> the bus type callback and not the driver's one.
> 
> So scratch this, please.

BTW, I don't think it is OK to mess up with bus type _runtime_suspend and
_runtime_resume and try to make them magically handle the system suspend
case as well.  There has to be a different way ...

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux