diff mbox series

[1/3] i2c: designware: Enable async suspend / resume of designware devices

Message ID 20211022022859.1888836-2-rajatja@google.com
State Superseded
Headers show
Series i2c: Enable async resume for i2c devices | expand

Commit Message

Rajat Jain Oct. 22, 2021, 2:28 a.m. UTC
Mark the designware devices for asynchronous suspend. With this, the
resume for designware devices does not get stuck behind other unrelated
devices (e.g. intel_backlight that takes hundreds of ms to resume,
waiting for its parent devices).

Signed-off-by: Rajat Jain <rajatja@google.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jarkko Nikula Oct. 22, 2021, 11:37 a.m. UTC | #1
On 10/22/21 5:28 AM, Rajat Jain wrote:
> Mark the designware devices for asynchronous suspend. With this, the
> resume for designware devices does not get stuck behind other unrelated
> devices (e.g. intel_backlight that takes hundreds of ms to resume,
> waiting for its parent devices).
> 
> Signed-off-by: Rajat Jain <rajatja@google.com>
> ---
>   drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 21113665ddea..2bd81abc86f6 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -293,6 +293,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
>   					DPM_FLAG_MAY_SKIP_RESUME);
>   	}
>   
> +	device_enable_async_suspend(&pdev->dev);
> +
>   	/* The code below assumes runtime PM to be disabled. */
>   	WARN_ON(pm_runtime_enabled(&pdev->dev));
>   
I guess same can be done to i2c_dw_pci_probe() too. I don't have any 
strong opinion should it be done in this patch or somewhere in the future.

Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Dmitry Torokhov Oct. 22, 2021, 4:53 p.m. UTC | #2
Hi Jarkko,

On Fri, Oct 22, 2021 at 4:37 AM Jarkko Nikula
<jarkko.nikula@linux.intel.com> wrote:
>
> On 10/22/21 5:28 AM, Rajat Jain wrote:
> > Mark the designware devices for asynchronous suspend. With this, the
> > resume for designware devices does not get stuck behind other unrelated
> > devices (e.g. intel_backlight that takes hundreds of ms to resume,
> > waiting for its parent devices).
> >
> > Signed-off-by: Rajat Jain <rajatja@google.com>
> > ---
> >   drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> > index 21113665ddea..2bd81abc86f6 100644
> > --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> > @@ -293,6 +293,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
> >                                       DPM_FLAG_MAY_SKIP_RESUME);
> >       }
> >
> > +     device_enable_async_suspend(&pdev->dev);
> > +
> >       /* The code below assumes runtime PM to be disabled. */
> >       WARN_ON(pm_runtime_enabled(&pdev->dev));
> >
> I guess same can be done to i2c_dw_pci_probe() too. I don't have any
> strong opinion should it be done in this patch or somewhere in the future.

All PCI devices are marked for asynchronous suspend/resume by default.
See drivers/pci/pci.c::pci_pm_init().

Thanks,
Dmitry
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 21113665ddea..2bd81abc86f6 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -293,6 +293,8 @@  static int dw_i2c_plat_probe(struct platform_device *pdev)
 					DPM_FLAG_MAY_SKIP_RESUME);
 	}
 
+	device_enable_async_suspend(&pdev->dev);
+
 	/* The code below assumes runtime PM to be disabled. */
 	WARN_ON(pm_runtime_enabled(&pdev->dev));