summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2021-12-15 15:58:00 +0100
committerArnd Bergmann <arnd@arndb.de>2021-12-15 15:58:00 +0100
commitd9bd3e9aca6786d0be523bf6732e48ab764eb8ad (patch)
tree8c9461cdfa0ccd4ea1b653b5b368150489d944a9 /drivers/soc
parente8f7875680aeddb717248e0467bd533243d326ef (diff)
parent8e136c5ea43ae08c5d672deb1c3f494782a4392a (diff)
downloadlwn-d9bd3e9aca6786d0be523bf6732e48ab764eb8ad.tar.gz
lwn-d9bd3e9aca6786d0be523bf6732e48ab764eb8ad.zip
Merge tag 'asahi-soc-pmgr-5.17-v2' of https://github.com/AsahiLinux/linux into arm/drivers
Apple SoC PMGR driver updates for 5.17 * Adds an auto-PM feature that is necessary for a single device * Disables module builds, which were broken anyway * tag 'asahi-soc-pmgr-5.17-v2' of https://github.com/AsahiLinux/linux: soc: apple: apple-pmgr-pwrstate: Do not build as a module soc: apple: apple-pmgr-pwrstate: Add auto-PM min level support Link: https://lore.kernel.org/r/660f6f7f-0857-b54c-c415-79bcb93f0e02@marcan.st Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/apple/Kconfig2
-rw-r--r--drivers/soc/apple/apple-pmgr-pwrstate.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig
index 3eb14abf8d33..9b8de31d6a8f 100644
--- a/drivers/soc/apple/Kconfig
+++ b/drivers/soc/apple/Kconfig
@@ -5,7 +5,7 @@ if ARCH_APPLE || COMPILE_TEST
menu "Apple SoC drivers"
config APPLE_PMGR_PWRSTATE
- tristate "Apple SoC PMGR power state control"
+ bool "Apple SoC PMGR power state control"
depends on PM
select REGMAP
select MFD_SYSCON
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;