[PATCH 15/17] i3c: master: Introduce optional Runtime PM support
Adrian Hunter
adrian.hunter at intel.com
Sat Dec 20 06:50:40 PST 2025
On 19/12/2025 19:08, Frank Li wrote:
> On Fri, Dec 19, 2025 at 04:45:32PM +0200, Adrian Hunter wrote:
>> Master drivers currently manage Runtime PM individually, but all require
>> runtime resume for bus operations. This can be centralized in common code.
>>
>> Add optional Runtime PM support to ensure the parent device is runtime
>> resumed before bus operations and auto-suspended afterward.
>>
>> Notably, do not call ->bus_cleanup() if runtime resume fails. Master
>> drivers that opt-in to core runtime PM support must take that into account.
>>
>> Also provide an option to allow IBIs and hot-joins while runtime suspended.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter at intel.com>
>> ---
>> drivers/i3c/device.c | 46 +++++++++++++++++--
>> drivers/i3c/internals.h | 4 ++
>> drivers/i3c/master.c | 93 +++++++++++++++++++++++++++++++++++---
>> include/linux/i3c/master.h | 4 ++
>> 4 files changed, 138 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c
>> index 8a156f5ad692..101eaa77de68 100644
>> --- a/drivers/i3c/device.c
>> +++ b/drivers/i3c/device.c
>> @@ -46,10 +46,16 @@ int i3c_device_do_xfers(struct i3c_device *dev, struct i3c_xfer *xfers,
>> return -EINVAL;
>> }
>>
>> + ret = i3c_bus_rpm_get(dev->bus);
>
> Is it i3c_bus_rpm_get(dev)? dev->bus is parent of dev. in case i3c
> periphal need enable clock or other run time pm enable call back?
>
>> + if (ret)
>> + return ret;
>> +
>> i3c_bus_normaluse_lock(dev->bus);
>> ret = i3c_dev_do_xfers_locked(dev->desc, xfers, nxfers, mode);
>> i3c_bus_normaluse_unlock(dev->bus);
>>
>> + i3c_bus_rpm_put(dev->bus);
>> +
>> return ret;
>> }
> ...
>>
>> +static int __must_check i3c_master_rpm_get(struct i3c_master_controller *master)
>> +{
>> + int ret = master->rpm_allowed ? pm_runtime_resume_and_get(master->dev.parent) : 0;
>
> I think rpm_allowed is not necessary. If don't allow rpm, i3c bus driver
> should disable runtime_pm.
>
> I remember pm_runtime_resume_and_get() do nothing if runtime_pm disabled
> (need double check).
Yes that would be OK for drivers that do not enable runtime PM,
but the drivers that do enable runtime PM (i.e. dw-i3c-master.c
and svc-i3c-master.c) might be affected.
More information about the linux-i3c
mailing list