Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+7
+7
drivers/soc/apple/apple-pmgr-pwrstate.c
··· 20 20 #define APPLE_PMGR_RESET BIT(31) 21 21 #define APPLE_PMGR_AUTO_ENABLE BIT(28) 22 22 #define APPLE_PMGR_PS_AUTO GENMASK(27, 24) 23 + #define APPLE_PMGR_PS_MIN GENMASK(19, 16) 23 24 #define APPLE_PMGR_PARENT_OFF BIT(11) 24 25 #define APPLE_PMGR_DEV_DISABLE BIT(10) 25 26 #define APPLE_PMGR_WAS_CLKGATED BIT(9) ··· 43 42 struct reset_controller_dev rcdev; 44 43 struct regmap *regmap; 45 44 u32 offset; 45 + u32 min_state; 46 46 }; 47 47 48 48 #define genpd_to_apple_pmgr_ps(_genpd) container_of(_genpd, struct apple_pmgr_ps, genpd) ··· 225 223 ps->genpd.name = name; 226 224 ps->genpd.power_on = apple_pmgr_ps_power_on; 227 225 ps->genpd.power_off = apple_pmgr_ps_power_off; 226 + 227 + ret = of_property_read_u32(node, "apple,min-state", &ps->min_state); 228 + if (ret == 0 && ps->min_state <= APPLE_PMGR_PS_ACTIVE) 229 + regmap_update_bits(regmap, ps->offset, APPLE_PMGR_FLAGS | APPLE_PMGR_PS_MIN, 230 + FIELD_PREP(APPLE_PMGR_PS_MIN, ps->min_state)); 228 231 229 232 active = apple_pmgr_ps_is_active(ps); 230 233 if (of_property_read_bool(node, "apple,always-on")) {