[PATCH v5 0/3] PM: domains: Detach on device_unbind_cleanup()

Claudiu posted 3 patches 3 months ago
drivers/amba/bus.c                       |  4 ++--
drivers/base/auxiliary.c                 |  2 +-
drivers/base/dd.c                        |  2 ++
drivers/base/platform.c                  |  9 +++------
drivers/base/power/common.c              |  9 ++++++---
drivers/clk/qcom/apcs-sdx55.c            |  2 +-
drivers/gpu/drm/display/drm_dp_aux_bus.c |  2 +-
drivers/i2c/i2c-core-base.c              |  2 +-
drivers/mmc/core/sdio_bus.c              |  2 +-
drivers/rpmsg/rpmsg_core.c               |  2 +-
drivers/soundwire/bus_type.c             |  2 +-
drivers/spi/spi.c                        |  2 +-
drivers/tty/serdev/core.c                |  2 +-
include/linux/pm.h                       |  1 +
include/linux/pm_domain.h                | 10 ++++++++--
15 files changed, 31 insertions(+), 22 deletions(-)
[PATCH v5 0/3] PM: domains: Detach on device_unbind_cleanup()
Posted by Claudiu 3 months ago
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Hi,

Series drops the dev_pm_domain_detach() from platform bus remove and
adds it in device_unbind_cleanup() to avoid runtime resumming the device
after it was detached from its PM domain.

Please provide your feedback.

Thank you,
Claudiu

Changes in v5:
- added PD_FLAG_ATTACH_POWER_ON, PD_FLAG_DETACH_POWER_OFF;
  due to this a new patch was introduced
  "PM: domains: Add flags to specify power on attach/detach"

Changes in v4:
- added a flag in dev_pm_info that is saved in dev_pm_domain_attach()
  and used in device_unbind_cleanup()

Changes in v3:
- add devm_pm_domain_attach()

Changes in v2:
- dropped the devres group open/close approach and use
  devm_pm_domain_attach()
- adjusted patch description to reflect the new approach


Claudiu Beznea (3):
  PM: domains: Add flags to specify power on attach/detach
  PM: domains: Detach on device_unbind_cleanup()
  driver core: platform: Drop dev_pm_domain_detach() call

 drivers/amba/bus.c                       |  4 ++--
 drivers/base/auxiliary.c                 |  2 +-
 drivers/base/dd.c                        |  2 ++
 drivers/base/platform.c                  |  9 +++------
 drivers/base/power/common.c              |  9 ++++++---
 drivers/clk/qcom/apcs-sdx55.c            |  2 +-
 drivers/gpu/drm/display/drm_dp_aux_bus.c |  2 +-
 drivers/i2c/i2c-core-base.c              |  2 +-
 drivers/mmc/core/sdio_bus.c              |  2 +-
 drivers/rpmsg/rpmsg_core.c               |  2 +-
 drivers/soundwire/bus_type.c             |  2 +-
 drivers/spi/spi.c                        |  2 +-
 drivers/tty/serdev/core.c                |  2 +-
 include/linux/pm.h                       |  1 +
 include/linux/pm_domain.h                | 10 ++++++++--
 15 files changed, 31 insertions(+), 22 deletions(-)

-- 
2.43.0
Re: [PATCH v5 0/3] PM: domains: Detach on device_unbind_cleanup()
Posted by Ulf Hansson 3 months ago
On Thu, 3 Jul 2025 at 13:27, Claudiu <claudiu.beznea@tuxon.dev> wrote:
>
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Hi,
>
> Series drops the dev_pm_domain_detach() from platform bus remove and
> adds it in device_unbind_cleanup() to avoid runtime resumming the device
> after it was detached from its PM domain.
>
> Please provide your feedback.
>
> Thank you,
> Claudiu
>
> Changes in v5:
> - added PD_FLAG_ATTACH_POWER_ON, PD_FLAG_DETACH_POWER_OFF;
>   due to this a new patch was introduced
>   "PM: domains: Add flags to specify power on attach/detach"
>
> Changes in v4:
> - added a flag in dev_pm_info that is saved in dev_pm_domain_attach()
>   and used in device_unbind_cleanup()
>
> Changes in v3:
> - add devm_pm_domain_attach()
>
> Changes in v2:
> - dropped the devres group open/close approach and use
>   devm_pm_domain_attach()
> - adjusted patch description to reflect the new approach
>
>
> Claudiu Beznea (3):
>   PM: domains: Add flags to specify power on attach/detach
>   PM: domains: Detach on device_unbind_cleanup()
>   driver core: platform: Drop dev_pm_domain_detach() call
>
>  drivers/amba/bus.c                       |  4 ++--
>  drivers/base/auxiliary.c                 |  2 +-
>  drivers/base/dd.c                        |  2 ++
>  drivers/base/platform.c                  |  9 +++------
>  drivers/base/power/common.c              |  9 ++++++---
>  drivers/clk/qcom/apcs-sdx55.c            |  2 +-
>  drivers/gpu/drm/display/drm_dp_aux_bus.c |  2 +-
>  drivers/i2c/i2c-core-base.c              |  2 +-
>  drivers/mmc/core/sdio_bus.c              |  2 +-
>  drivers/rpmsg/rpmsg_core.c               |  2 +-
>  drivers/soundwire/bus_type.c             |  2 +-
>  drivers/spi/spi.c                        |  2 +-
>  drivers/tty/serdev/core.c                |  2 +-
>  include/linux/pm.h                       |  1 +
>  include/linux/pm_domain.h                | 10 ++++++++--
>  15 files changed, 31 insertions(+), 22 deletions(-)
>
> --
> 2.43.0
>

The series looks good to me, please add:
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Rafael, do you intend to pick this via your tree?

Another note, the similar thing that is being done in patch3 from the
platform bus, is needed for other buses too (at least the amba bus for
sure). Claudiu, are you planning to do that as a step on top - or are
you expecting others to help out?

Kind regards
Uffe
Re: [PATCH v5 0/3] PM: domains: Detach on device_unbind_cleanup()
Posted by Rafael J. Wysocki 3 months ago
On Fri, Jul 4, 2025 at 1:16 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Thu, 3 Jul 2025 at 13:27, Claudiu <claudiu.beznea@tuxon.dev> wrote:
> >
> > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> >
> > Hi,
> >
> > Series drops the dev_pm_domain_detach() from platform bus remove and
> > adds it in device_unbind_cleanup() to avoid runtime resumming the device
> > after it was detached from its PM domain.
> >
> > Please provide your feedback.
> >
> > Thank you,
> > Claudiu
> >
> > Changes in v5:
> > - added PD_FLAG_ATTACH_POWER_ON, PD_FLAG_DETACH_POWER_OFF;
> >   due to this a new patch was introduced
> >   "PM: domains: Add flags to specify power on attach/detach"
> >
> > Changes in v4:
> > - added a flag in dev_pm_info that is saved in dev_pm_domain_attach()
> >   and used in device_unbind_cleanup()
> >
> > Changes in v3:
> > - add devm_pm_domain_attach()
> >
> > Changes in v2:
> > - dropped the devres group open/close approach and use
> >   devm_pm_domain_attach()
> > - adjusted patch description to reflect the new approach
> >
> >
> > Claudiu Beznea (3):
> >   PM: domains: Add flags to specify power on attach/detach
> >   PM: domains: Detach on device_unbind_cleanup()
> >   driver core: platform: Drop dev_pm_domain_detach() call
> >
> >  drivers/amba/bus.c                       |  4 ++--
> >  drivers/base/auxiliary.c                 |  2 +-
> >  drivers/base/dd.c                        |  2 ++
> >  drivers/base/platform.c                  |  9 +++------
> >  drivers/base/power/common.c              |  9 ++++++---
> >  drivers/clk/qcom/apcs-sdx55.c            |  2 +-
> >  drivers/gpu/drm/display/drm_dp_aux_bus.c |  2 +-
> >  drivers/i2c/i2c-core-base.c              |  2 +-
> >  drivers/mmc/core/sdio_bus.c              |  2 +-
> >  drivers/rpmsg/rpmsg_core.c               |  2 +-
> >  drivers/soundwire/bus_type.c             |  2 +-
> >  drivers/spi/spi.c                        |  2 +-
> >  drivers/tty/serdev/core.c                |  2 +-
> >  include/linux/pm.h                       |  1 +
> >  include/linux/pm_domain.h                | 10 ++++++++--
> >  15 files changed, 31 insertions(+), 22 deletions(-)
> >
> > --
> > 2.43.0
> >
>
> The series looks good to me, please add:
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Rafael, do you intend to pick this via your tree?

I do in general, but I haven't looked at this version yet.  I'll get
to it early next week.
Re: [PATCH v5 0/3] PM: domains: Detach on device_unbind_cleanup()
Posted by Rafael J. Wysocki 3 months ago
On Fri, Jul 4, 2025 at 9:53 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Fri, Jul 4, 2025 at 1:16 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > On Thu, 3 Jul 2025 at 13:27, Claudiu <claudiu.beznea@tuxon.dev> wrote:
> > >
> > > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> > >
> > > Hi,
> > >
> > > Series drops the dev_pm_domain_detach() from platform bus remove and
> > > adds it in device_unbind_cleanup() to avoid runtime resumming the device
> > > after it was detached from its PM domain.
> > >
> > > Please provide your feedback.
> > >
> > > Thank you,
> > > Claudiu
> > >
> > > Changes in v5:
> > > - added PD_FLAG_ATTACH_POWER_ON, PD_FLAG_DETACH_POWER_OFF;
> > >   due to this a new patch was introduced
> > >   "PM: domains: Add flags to specify power on attach/detach"
> > >
> > > Changes in v4:
> > > - added a flag in dev_pm_info that is saved in dev_pm_domain_attach()
> > >   and used in device_unbind_cleanup()
> > >
> > > Changes in v3:
> > > - add devm_pm_domain_attach()
> > >
> > > Changes in v2:
> > > - dropped the devres group open/close approach and use
> > >   devm_pm_domain_attach()
> > > - adjusted patch description to reflect the new approach
> > >
> > >
> > > Claudiu Beznea (3):
> > >   PM: domains: Add flags to specify power on attach/detach
> > >   PM: domains: Detach on device_unbind_cleanup()
> > >   driver core: platform: Drop dev_pm_domain_detach() call
> > >
> > >  drivers/amba/bus.c                       |  4 ++--
> > >  drivers/base/auxiliary.c                 |  2 +-
> > >  drivers/base/dd.c                        |  2 ++
> > >  drivers/base/platform.c                  |  9 +++------
> > >  drivers/base/power/common.c              |  9 ++++++---
> > >  drivers/clk/qcom/apcs-sdx55.c            |  2 +-
> > >  drivers/gpu/drm/display/drm_dp_aux_bus.c |  2 +-
> > >  drivers/i2c/i2c-core-base.c              |  2 +-
> > >  drivers/mmc/core/sdio_bus.c              |  2 +-
> > >  drivers/rpmsg/rpmsg_core.c               |  2 +-
> > >  drivers/soundwire/bus_type.c             |  2 +-
> > >  drivers/spi/spi.c                        |  2 +-
> > >  drivers/tty/serdev/core.c                |  2 +-
> > >  include/linux/pm.h                       |  1 +
> > >  include/linux/pm_domain.h                | 10 ++++++++--
> > >  15 files changed, 31 insertions(+), 22 deletions(-)
> > >
> > > --
> > > 2.43.0
> > >
> >
> > The series looks good to me, please add:
> > Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> >
> > Rafael, do you intend to pick this via your tree?
>
> I do in general, but I haven't looked at this version yet.  I'll get
> to it early next week.

Now applied as 6.17 material, thanks!
Re: [PATCH v5 0/3] PM: domains: Detach on device_unbind_cleanup()
Posted by Wolfram Sang 3 months ago
> > The series looks good to me, please add:
> > Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> >
> > Rafael, do you intend to pick this via your tree?
> 
> I do in general, but I haven't looked at this version yet.  I'll get
> to it early next week.

For the I2C part:

Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Re: [PATCH v5 0/3] PM: domains: Detach on device_unbind_cleanup()
Posted by Claudiu Beznea 3 months ago
Hi, Ulf,

On 04.07.2025 14:15, Ulf Hansson wrote:
> On Thu, 3 Jul 2025 at 13:27, Claudiu <claudiu.beznea@tuxon.dev> wrote:
>>
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> Hi,
>>
>> Series drops the dev_pm_domain_detach() from platform bus remove and
>> adds it in device_unbind_cleanup() to avoid runtime resumming the device
>> after it was detached from its PM domain.
>>
>> Please provide your feedback.
>>
>> Thank you,
>> Claudiu
>>
>> Changes in v5:
>> - added PD_FLAG_ATTACH_POWER_ON, PD_FLAG_DETACH_POWER_OFF;
>>   due to this a new patch was introduced
>>   "PM: domains: Add flags to specify power on attach/detach"
>>
>> Changes in v4:
>> - added a flag in dev_pm_info that is saved in dev_pm_domain_attach()
>>   and used in device_unbind_cleanup()
>>
>> Changes in v3:
>> - add devm_pm_domain_attach()
>>
>> Changes in v2:
>> - dropped the devres group open/close approach and use
>>   devm_pm_domain_attach()
>> - adjusted patch description to reflect the new approach
>>
>>
>> Claudiu Beznea (3):
>>   PM: domains: Add flags to specify power on attach/detach
>>   PM: domains: Detach on device_unbind_cleanup()
>>   driver core: platform: Drop dev_pm_domain_detach() call
>>
>>  drivers/amba/bus.c                       |  4 ++--
>>  drivers/base/auxiliary.c                 |  2 +-
>>  drivers/base/dd.c                        |  2 ++
>>  drivers/base/platform.c                  |  9 +++------
>>  drivers/base/power/common.c              |  9 ++++++---
>>  drivers/clk/qcom/apcs-sdx55.c            |  2 +-
>>  drivers/gpu/drm/display/drm_dp_aux_bus.c |  2 +-
>>  drivers/i2c/i2c-core-base.c              |  2 +-
>>  drivers/mmc/core/sdio_bus.c              |  2 +-
>>  drivers/rpmsg/rpmsg_core.c               |  2 +-
>>  drivers/soundwire/bus_type.c             |  2 +-
>>  drivers/spi/spi.c                        |  2 +-
>>  drivers/tty/serdev/core.c                |  2 +-
>>  include/linux/pm.h                       |  1 +
>>  include/linux/pm_domain.h                | 10 ++++++++--
>>  15 files changed, 31 insertions(+), 22 deletions(-)
>>
>> --
>> 2.43.0
>>
> 
> The series looks good to me, please add:
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> 
> Rafael, do you intend to pick this via your tree?
> 
> Another note, the similar thing that is being done in patch3 from the
> platform bus, is needed for other buses too (at least the amba bus for
> sure). Claudiu, are you planning to do that as a step on top - or are
> you expecting others to help out?

My plan was to take care of it once the approach here (or something
similar, if any) will end up in a release.

Thank you,
Claudiu

> 
> Kind regards
> Uffe