mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
62 lines
1.8 KiB
Diff
62 lines
1.8 KiB
Diff
From 54d4b6b3014f3122a2235533e6511b0d6ca2cd45 Mon Sep 17 00:00:00 2001
|
|
From: Finley Xiao <finley.xiao@rock-chips.com>
|
|
Date: Wed, 12 Oct 2022 19:25:38 +0800
|
|
Subject: [PATCH] soc: rockchip: power-domain: Add always on configuration for
|
|
power domain
|
|
|
|
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
|
|
Change-Id: Ic57f7f3a564f7d71b680e3c435d0460474b5a4a0
|
|
---
|
|
drivers/pmdomain/rockchip/pm-domains.c | 41 +++++++++++++++++++++++--------
|
|
1 file changed, 31 insertions(+), 10 deletions(-)
|
|
|
|
--- a/drivers/pmdomain/rockchip/pm-domains.c
|
|
+++ b/drivers/pmdomain/rockchip/pm-domains.c
|
|
@@ -49,6 +49,7 @@ struct rockchip_domain_info {
|
|
int clk_ungate_mask;
|
|
int mem_status_mask;
|
|
int repair_status_mask;
|
|
+ bool always_on;
|
|
u32 pwr_offset;
|
|
u32 mem_offset;
|
|
u32 req_offset;
|
|
@@ -662,6 +663,26 @@ static void rockchip_pd_detach_dev(struc
|
|
pm_clk_destroy(dev);
|
|
}
|
|
|
|
+static int rockchip_pd_add_alwasy_on_flag(struct rockchip_pm_domain *pd)
|
|
+{
|
|
+ int error;
|
|
+
|
|
+ if (pd->genpd.flags & GENPD_FLAG_ALWAYS_ON)
|
|
+ return 0;
|
|
+ pd->genpd.flags |= GENPD_FLAG_ALWAYS_ON;
|
|
+ if (!rockchip_pmu_domain_is_on(pd)) {
|
|
+ error = rockchip_pd_power(pd, true);
|
|
+ if (error) {
|
|
+ dev_err(pd->pmu->dev,
|
|
+ "failed to power on domain '%s': %d\n",
|
|
+ pd->genpd.name, error);
|
|
+ return error;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
|
|
struct device_node *node)
|
|
{
|
|
@@ -779,6 +800,11 @@ static int rockchip_pm_add_one_domain(st
|
|
pd->genpd.flags = GENPD_FLAG_PM_CLK;
|
|
if (pd_info->active_wakeup)
|
|
pd->genpd.flags |= GENPD_FLAG_ACTIVE_WAKEUP;
|
|
+ if (pd_info->always_on) {
|
|
+ error = rockchip_pd_add_alwasy_on_flag(pd);
|
|
+ if (error)
|
|
+ goto err_unprepare_clocks;
|
|
+ }
|
|
pm_genpd_init(&pd->genpd, NULL,
|
|
!rockchip_pmu_domain_is_on(pd) ||
|
|
(pd->info->mem_status_mask && !rockchip_pmu_domain_is_mem_on(pd)));
|