aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorHector Martin <marcan@marcan.st>2021-12-09 13:45:00 +0900
committerHector Martin <marcan@marcan.st>2021-12-12 10:32:10 +0900
commitcc1fe1e54ba565aaec0006796db65b7c3b1ccd69 (patch)
treece66b354d9b2bc8fe2d74029184d6d4446b07290 /drivers/soc
parentsoc: apple: Add driver for Apple PMGR power state controls (diff)
downloadlinux-dev-cc1fe1e54ba565aaec0006796db65b7c3b1ccd69.tar.xz
linux-dev-cc1fe1e54ba565aaec0006796db65b7c3b1ccd69.zip
soc: apple: apple-pmgr-pwrstate: Add auto-PM min level support
This is seemingly required for DCP/DCPEXT, without which they refuse to boot properly. They need to be set to minimum state 4 (clock gated). Reviewed-by: Sven Peter <sven@svenpeter.dev> Signed-off-by: Hector Martin <marcan@marcan.st>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/apple/apple-pmgr-pwrstate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/soc/apple/apple-pmgr-pwrstate.c b/drivers/soc/apple/apple-pmgr-pwrstate.c
index 8ad9d5fdefbf..e1122288409a 100644
--- a/drivers/soc/apple/apple-pmgr-pwrstate.c
+++ b/drivers/soc/apple/apple-pmgr-pwrstate.c
@@ -20,6 +20,7 @@
#define APPLE_PMGR_RESET BIT(31)
#define APPLE_PMGR_AUTO_ENABLE BIT(28)
#define APPLE_PMGR_PS_AUTO GENMASK(27, 24)
+#define APPLE_PMGR_PS_MIN GENMASK(19, 16)
#define APPLE_PMGR_PARENT_OFF BIT(11)
#define APPLE_PMGR_DEV_DISABLE BIT(10)
#define APPLE_PMGR_WAS_CLKGATED BIT(9)
@@ -42,6 +43,7 @@ struct apple_pmgr_ps {
struct reset_controller_dev rcdev;
struct regmap *regmap;
u32 offset;
+ u32 min_state;
};
#define genpd_to_apple_pmgr_ps(_genpd) container_of(_genpd, struct apple_pmgr_ps, genpd)
@@ -224,6 +226,11 @@ static int apple_pmgr_ps_probe(struct platform_device *pdev)
ps->genpd.power_on = apple_pmgr_ps_power_on;
ps->genpd.power_off = apple_pmgr_ps_power_off;
+ ret = of_property_read_u32(node, "apple,min-state", &ps->min_state);
+ if (ret == 0 && ps->min_state <= APPLE_PMGR_PS_ACTIVE)
+ regmap_update_bits(regmap, ps->offset, APPLE_PMGR_FLAGS | APPLE_PMGR_PS_MIN,
+ FIELD_PREP(APPLE_PMGR_PS_MIN, ps->min_state));
+
active = apple_pmgr_ps_is_active(ps);
if (of_property_read_bool(node, "apple,always-on")) {
ps->genpd.flags |= GENPD_FLAG_ALWAYS_ON;