Skip to content

Commit 8285182

Browse files
ahunter6alexandrebelloni
authored andcommitted
i3c: mipi-i3c-hci: Allow parent to manage runtime PM
Some platforms implement the MIPI I3C HCI Multi-Bus Instance capability, where a single parent device hosts multiple I3C controller instances. In such designs, the parent - not the individual child instances - may need to coordinate runtime PM so that all controllers runtime PM callbacks are invoked in a controlled and synchronized manner. For example, if the parent enables IBI-wakeup when transitioning into a low-power state, every bus instance must remain able to receive IBIs up until that point. This requires deferring the individual controllers' runtime suspend callbacks (which disable bus activity) until the parent decides it is safe for all instances to suspend together. To support this usage model: * Export the low-level runtime PM suspend and resume helpers so that the parent can explicitly invoke them. * Add a new quirk, HCI_QUIRK_RPM_PARENT_MANAGED, allowing platforms to bypass per-instance runtime PM callbacks and delegate control to the parent device. * Move DEFAULT_AUTOSUSPEND_DELAY_MS into the header so it can be shared by parent-managed PM implementations. The new quirk allows platforms with multi-bus parent-managed PM infrastructure to correctly coordinate runtime PM across all I3C HCI instances. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260306085338.62955-4-adrian.hunter@intel.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 5fe77a6 commit 8285182

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

drivers/i3c/master/mipi-i3c-hci/core.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ static int i3c_hci_reset_and_init(struct i3c_hci *hci)
759759
return 0;
760760
}
761761

762-
static int i3c_hci_runtime_suspend(struct device *dev)
762+
int i3c_hci_rpm_suspend(struct device *dev)
763763
{
764764
struct i3c_hci *hci = dev_get_drvdata(dev);
765765
int ret;
@@ -776,8 +776,9 @@ static int i3c_hci_runtime_suspend(struct device *dev)
776776

777777
return 0;
778778
}
779+
EXPORT_SYMBOL_GPL(i3c_hci_rpm_suspend);
779780

780-
static int i3c_hci_runtime_resume(struct device *dev)
781+
int i3c_hci_rpm_resume(struct device *dev)
781782
{
782783
struct i3c_hci *hci = dev_get_drvdata(dev);
783784
int ret;
@@ -800,6 +801,27 @@ static int i3c_hci_runtime_resume(struct device *dev)
800801

801802
return 0;
802803
}
804+
EXPORT_SYMBOL_GPL(i3c_hci_rpm_resume);
805+
806+
static int i3c_hci_runtime_suspend(struct device *dev)
807+
{
808+
struct i3c_hci *hci = dev_get_drvdata(dev);
809+
810+
if (hci->quirks & HCI_QUIRK_RPM_PARENT_MANAGED)
811+
return 0;
812+
813+
return i3c_hci_rpm_suspend(dev);
814+
}
815+
816+
static int i3c_hci_runtime_resume(struct device *dev)
817+
{
818+
struct i3c_hci *hci = dev_get_drvdata(dev);
819+
820+
if (hci->quirks & HCI_QUIRK_RPM_PARENT_MANAGED)
821+
return 0;
822+
823+
return i3c_hci_rpm_resume(dev);
824+
}
803825

804826
static int i3c_hci_suspend(struct device *dev)
805827
{
@@ -844,8 +866,6 @@ static int i3c_hci_restore(struct device *dev)
844866
return i3c_hci_resume_common(dev, true);
845867
}
846868

847-
#define DEFAULT_AUTOSUSPEND_DELAY_MS 1000
848-
849869
static void i3c_hci_rpm_enable(struct device *dev)
850870
{
851871
struct i3c_hci *hci = dev_get_drvdata(dev);

drivers/i3c/master/mipi-i3c-hci/hci.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ struct i3c_hci_dev_data {
151151
#define HCI_QUIRK_RESP_BUF_THLD BIT(4) /* Set resp buf thld to 0 for AMD platforms */
152152
#define HCI_QUIRK_RPM_ALLOWED BIT(5) /* Runtime PM allowed */
153153
#define HCI_QUIRK_RPM_IBI_ALLOWED BIT(6) /* IBI and Hot-Join allowed while runtime suspended */
154+
#define HCI_QUIRK_RPM_PARENT_MANAGED BIT(7) /* Runtime PM managed by parent device */
154155

155156
/* global functions */
156157
void mipi_i3c_hci_resume(struct i3c_hci *hci);
@@ -161,4 +162,9 @@ void amd_set_resp_buf_thld(struct i3c_hci *hci);
161162
void i3c_hci_sync_irq_inactive(struct i3c_hci *hci);
162163
int i3c_hci_process_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n);
163164

165+
#define DEFAULT_AUTOSUSPEND_DELAY_MS 1000
166+
167+
int i3c_hci_rpm_suspend(struct device *dev);
168+
int i3c_hci_rpm_resume(struct device *dev);
169+
164170
#endif

0 commit comments

Comments
 (0)