Skip to content

Commit 65991ea

Browse files
mlehtimaandersson
authored andcommitted
remoteproc: qcom_wcnss: Handle platforms with only single power domain
Both MSM8974 and MSM8226 have only CX as power domain with MX & PX being handled as regulators. Handle this case by reodering pd_names to have CX first, and handling that the driver core will already attach a single power domain internally. Signed-off-by: Matti Lehtimäki <[email protected]> [luca: minor changes] Signed-off-by: Luca Weiss <[email protected]> Link: https://lore.kernel.org/r/[email protected] [bjorn: Added missing braces to else after multi-statement if] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 14198a0 commit 65991ea

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

drivers/remoteproc/qcom_wcnss.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ static const struct wcnss_data pronto_v1_data = {
117117
.pmu_offset = 0x1004,
118118
.spare_offset = 0x1088,
119119

120-
.pd_names = { "mx", "cx" },
120+
.pd_names = { "cx", "mx" },
121121
.vregs = (struct wcnss_vreg_info[]) {
122-
{ "vddmx", 950000, 1150000, 0 },
123122
{ "vddcx", .super_turbo = true},
123+
{ "vddmx", 950000, 1150000, 0 },
124124
{ "vddpx", 1800000, 1800000, 0 },
125125
},
126126
.num_pd_vregs = 2,
@@ -131,10 +131,10 @@ static const struct wcnss_data pronto_v2_data = {
131131
.pmu_offset = 0x1004,
132132
.spare_offset = 0x1088,
133133

134-
.pd_names = { "mx", "cx" },
134+
.pd_names = { "cx", "mx" },
135135
.vregs = (struct wcnss_vreg_info[]) {
136-
{ "vddmx", 1287500, 1287500, 0 },
137136
{ "vddcx", .super_turbo = true },
137+
{ "vddmx", 1287500, 1287500, 0 },
138138
{ "vddpx", 1800000, 1800000, 0 },
139139
},
140140
.num_pd_vregs = 2,
@@ -397,8 +397,17 @@ static irqreturn_t wcnss_stop_ack_interrupt(int irq, void *dev)
397397
static int wcnss_init_pds(struct qcom_wcnss *wcnss,
398398
const char * const pd_names[WCNSS_MAX_PDS])
399399
{
400+
struct device *dev = wcnss->dev;
400401
int i, ret;
401402

403+
/* Handle single power domain */
404+
if (dev->pm_domain) {
405+
wcnss->pds[0] = dev;
406+
wcnss->num_pds = 1;
407+
pm_runtime_enable(dev);
408+
return 0;
409+
}
410+
402411
for (i = 0; i < WCNSS_MAX_PDS; i++) {
403412
if (!pd_names[i])
404413
break;
@@ -418,8 +427,15 @@ static int wcnss_init_pds(struct qcom_wcnss *wcnss,
418427

419428
static void wcnss_release_pds(struct qcom_wcnss *wcnss)
420429
{
430+
struct device *dev = wcnss->dev;
421431
int i;
422432

433+
/* Handle single power domain */
434+
if (wcnss->num_pds == 1 && dev->pm_domain) {
435+
pm_runtime_disable(dev);
436+
return;
437+
}
438+
423439
for (i = 0; i < wcnss->num_pds; i++)
424440
dev_pm_domain_detach(wcnss->pds[i], false);
425441
}
@@ -437,10 +453,13 @@ static int wcnss_init_regulators(struct qcom_wcnss *wcnss,
437453
* the regulators for the power domains. For old device trees we need to
438454
* reserve extra space to manage them through the regulator interface.
439455
*/
440-
if (wcnss->num_pds)
441-
info += num_pd_vregs;
442-
else
456+
if (wcnss->num_pds) {
457+
info += wcnss->num_pds;
458+
/* Handle single power domain case */
459+
num_vregs += num_pd_vregs - wcnss->num_pds;
460+
} else {
443461
num_vregs += num_pd_vregs;
462+
}
444463

445464
bulk = devm_kcalloc(wcnss->dev,
446465
num_vregs, sizeof(struct regulator_bulk_data),

0 commit comments

Comments
 (0)