diff mbox series

[2/3] soc: mediatek: Allow gaps in SCP PDs

Message ID 20180903200816.GA6752@xn--njmtys-xxab.info (mailing list archive)
State New, archived
Headers show
Series Fix scpsys on MT6797 | expand

Commit Message

Jasper Mattsson Sept. 3, 2018, 8:08 p.m. UTC
The power domains array for MT6797 contains gaps, since most MFG-related
power domains are missing. This causes a lookup for a regulator with
a NULL name fail, and this will cause the probe of SCPSYS to fail. This
patch skips gaps in the array by detecting if the power domain name is
NULL. This could all be easily solved by reordering the #defines in
dt-bindings, but that could break existing DTBs.

Signed-off-by: Jasper Mattsson <jasu@njomotys.info>
---
 drivers/soc/mediatek/mtk-scpsys.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index 4808d71c5..c60a17e56 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -402,6 +402,9 @@  static struct scp *init_scp(struct platform_device *pdev,
 		struct scp_domain *scpd = &scp->domains[i];
 		const struct scp_domain_data *data = &scp_domain_data[i];
 
+		if (!data->name)
+			continue;
+
 		scpd->supply = devm_regulator_get_optional(&pdev->dev, data->name);
 		if (IS_ERR(scpd->supply)) {
 			if (PTR_ERR(scpd->supply) == -ENODEV)
@@ -420,6 +423,9 @@  static struct scp *init_scp(struct platform_device *pdev,
 		struct generic_pm_domain *genpd = &scpd->genpd;
 		const struct scp_domain_data *data = &scp_domain_data[i];
 
+		if (!data->name)
+			continue;
+
 		pd_data->domains[i] = genpd;
 		scpd->scp = scp;
 
@@ -457,6 +463,9 @@  static void mtk_register_power_domains(struct platform_device *pdev,
 		struct scp_domain *scpd = &scp->domains[i];
 		struct generic_pm_domain *genpd = &scpd->genpd;
 
+		if (!genpd->name)
+			continue;
+
 		/*
 		 * Initially turn on all domains to make the domains usable
 		 * with !CONFIG_PM and to get the hardware in sync with the