[PATCH 2/8] remoteproc: qcom_q6v5_mss: Handle platforms with only single power domain

From: Matti Lehtimäki
Date: Thu Jan 12 2023 - 15:54:31 EST


From: Luca Weiss <luca@xxxxxxxxx>

For example MSM8226 has only one power domain (cx) which is attached
internally in power domain and cannot be attached in this driver.

Signed-off-by: Luca Weiss <luca@xxxxxxxxx>
Signed-off-by: Matti Lehtimäki <matti.lehtimaki@xxxxxxxxx>
---
drivers/remoteproc/qcom_q6v5_mss.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c
index 2f4027664a0e..745627a36bcf 100644
--- a/drivers/remoteproc/qcom_q6v5_mss.c
+++ b/drivers/remoteproc/qcom_q6v5_mss.c
@@ -1820,6 +1820,13 @@ static int q6v5_pds_attach(struct device *dev, struct device **devs,
if (!pd_names)
return 0;

+ /* Handle single power domain */
+ if (dev->pm_domain) {
+ devs[0] = dev;
+ pm_runtime_enable(dev);
+ return 1;
+ }
+
while (pd_names[num_pds])
num_pds++;

@@ -1843,8 +1850,15 @@ static int q6v5_pds_attach(struct device *dev, struct device **devs,
static void q6v5_pds_detach(struct q6v5 *qproc, struct device **pds,
size_t pd_count)
{
+ struct device *dev = qproc->dev;
int i;

+ /* Handle single power domain */
+ if (dev->pm_domain && pd_count) {
+ pm_runtime_disable(dev);
+ return;
+ }
+
for (i = 0; i < pd_count; i++)
dev_pm_domain_detach(pds[i], false);
}
--
2.34.1