Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 29391d9

Browse files
Mukesh Kumar Savaliyaalexandrebelloni
authored andcommitted
i3c: master: Enable runtime PM for master controller
Enable runtime PM for i3c master node during master registration time. Sometimes i3c client device driver may want to control the PM of the parent (master) to perform the transactions and save the power in an efficient way by controlling the session. Hence device can call PM APIs by passing the parent node. Here, I3C target device when calls pm_runtime_get_sync(dev->parent) couldn't invoke master drivers runtime PM callback registered by the master driver because parent's PM status was disabled in the Master node. Also call pm_runtime_no_callbacks() and pm_suspend_ignore_children() for the master node to not have any callback addition and ignore the children to have runtime PM work just locally in the driver. This should be generic and common change for all i3c devices and should not have any other impact. With these changes, I3C client device works and able to invoke master driver registered runtime PM callbacks. Signed-off-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com> Link: https://lore.kernel.org/r/20240228093407.4038399-1-quic_msavaliy@quicinc.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 38baed9 commit 29391d9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/i3c/master.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/kernel.h>
1414
#include <linux/list.h>
1515
#include <linux/of.h>
16+
#include <linux/pm_runtime.h>
1617
#include <linux/slab.h>
1718
#include <linux/spinlock.h>
1819
#include <linux/workqueue.h>
@@ -2812,6 +2813,10 @@ int i3c_master_register(struct i3c_master_controller *master,
28122813

28132814
i3c_bus_notify(i3cbus, I3C_NOTIFY_BUS_ADD);
28142815

2816+
pm_runtime_no_callbacks(&master->dev);
2817+
pm_suspend_ignore_children(&master->dev, true);
2818+
pm_runtime_enable(&master->dev);
2819+
28152820
/*
28162821
* We're done initializing the bus and the controller, we can now
28172822
* register I3C devices discovered during the initial DAA.
@@ -2849,6 +2854,7 @@ void i3c_master_unregister(struct i3c_master_controller *master)
28492854
i3c_master_i2c_adapter_cleanup(master);
28502855
i3c_master_unregister_i3c_devs(master);
28512856
i3c_master_bus_cleanup(master);
2857+
pm_runtime_disable(&master->dev);
28522858
device_unregister(&master->dev);
28532859
}
28542860
EXPORT_SYMBOL_GPL(i3c_master_unregister);

0 commit comments

Comments
 (0)