Skip to content

Commit 418da6e

Browse files
committed
Merge tag 'pmdomain-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm
Pull pmdomain updates from Ulf Hansson: "pmdomain core: - Add residency reflection for domain-idlestates to debugfs - Add genpd helper to correct the usage/rejected counters pmdomain providers: - mediatek: Add support for Dimensity 1200 MT6893 - qcom: Add support for SM4450 power domains - rockchip: Add support for RK3562 SoC - sunxi: Add support for Allwinner H6/H616 PRCM PPU - ti: Fix STANDBY handling of OMAP2+ PER power domain cpuidle-psci: - Correct the domain-idlestate statistics in debugfs" * tag 'pmdomain-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm: (23 commits) pmdomain: ti: Fix STANDBY handling of PER power domain pmdomain: amlogic: Constify some structures pmdomain: core: Use genpd->opp_table to simplify error/remove path pmdomain: core: Simplify return statement in genpd_power_off() pmdomain: core: Convert genpd_power_off() to void pmdomain: core: Convert to device_awake_path() pmdomain: mediatek: Add error messages for missing regmaps pmdomain: arm: Do not enable by default during compile testing pmdomain: qcom: rpmhpd: Add SM4450 power domains dt-bindings: power: qcom,rpmpd: Add SM4450 compatible pmdomain: sunxi: add H6 PRCM PPU driver dt-bindings: power: Add Allwinner H6/H616 PRCM PPU pmdomain: bcm: bcm2835-power: Use devm_clk_get_optional pmdomain: rockchip: Add support for RK3562 SoC dt-bindings: power: rockchip: Add support for RK3562 SoC pmdomain: mediatek: Add support for Dimensity 1200 MT6893 pmdomain: mediatek: Bump maximum bus protect data array elements dt-bindings: power: mediatek: Support Dimensity 1200 MT6893 MTCMOS pmdomain: core: Reset genpd->states to avoid freeing invalid data pmdomain: core: Add residency reflection for domain-idlestates to debugfs ...
2 parents c7c1863 + 3679554 commit 418da6e

24 files changed

+1185
-115
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/power/allwinner,sun50i-h6-prcm-ppu.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Allwinner SoCs PRCM power domain controller
8+
9+
maintainers:
10+
- Andre Przywara <andre.przywara@arm.com>
11+
12+
description:
13+
The Allwinner Power Reset Clock Management (PRCM) unit contains bits to
14+
control a few power domains.
15+
16+
properties:
17+
compatible:
18+
enum:
19+
- allwinner,sun50i-h6-prcm-ppu
20+
- allwinner,sun50i-h616-prcm-ppu
21+
- allwinner,sun55i-a523-prcm-ppu
22+
23+
reg:
24+
maxItems: 1
25+
26+
'#power-domain-cells':
27+
const: 1
28+
29+
required:
30+
- compatible
31+
- reg
32+
- '#power-domain-cells'
33+
34+
additionalProperties: false
35+
36+
examples:
37+
- |
38+
prcm_ppu: power-controller@7010210 {
39+
compatible = "allwinner,sun50i-h616-prcm-ppu";
40+
reg = <0x7010210 0x10>;
41+
#power-domain-cells = <1>;
42+
};

Documentation/devicetree/bindings/power/mediatek,power-controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ properties:
2525
enum:
2626
- mediatek,mt6735-power-controller
2727
- mediatek,mt6795-power-controller
28+
- mediatek,mt6893-power-controller
2829
- mediatek,mt8167-power-controller
2930
- mediatek,mt8173-power-controller
3031
- mediatek,mt8183-power-controller
@@ -88,6 +89,7 @@ $defs:
8889
description: |
8990
Power domain index. Valid values are defined in:
9091
"include/dt-bindings/power/mt6795-power.h" - for MT8167 type power domain.
92+
"include/dt-bindings/power/mediatek,mt6893-power.h" - for MT6893 type power domain.
9193
"include/dt-bindings/power/mt8167-power.h" - for MT8167 type power domain.
9294
"include/dt-bindings/power/mt8173-power.h" - for MT8173 type power domain.
9395
"include/dt-bindings/power/mt8183-power.h" - for MT8183 type power domain.

Documentation/devicetree/bindings/power/qcom,rpmpd.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ properties:
5050
- qcom,sdx55-rpmhpd
5151
- qcom,sdx65-rpmhpd
5252
- qcom,sdx75-rpmhpd
53+
- qcom,sm4450-rpmhpd
5354
- qcom,sm6115-rpmpd
5455
- qcom,sm6125-rpmpd
5556
- qcom,sm6350-rpmhpd

Documentation/devicetree/bindings/power/rockchip,power-controller.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ properties:
4040
- rockchip,rk3366-power-controller
4141
- rockchip,rk3368-power-controller
4242
- rockchip,rk3399-power-controller
43+
- rockchip,rk3562-power-controller
4344
- rockchip,rk3568-power-controller
4445
- rockchip,rk3576-power-controller
4546
- rockchip,rk3588-power-controller

drivers/cpuidle/cpuidle-psci-domain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static int psci_pd_power_off(struct generic_pm_domain *pd)
4343

4444
/* OSI mode is enabled, set the corresponding domain state. */
4545
pd_state = state->data;
46-
psci_set_domain_state(*pd_state);
46+
psci_set_domain_state(pd, pd->state_idx, *pd_state);
4747

4848
return 0;
4949
}

drivers/cpuidle/cpuidle-psci.c

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,30 @@ struct psci_cpuidle_data {
3636
struct device *dev;
3737
};
3838

39+
struct psci_cpuidle_domain_state {
40+
struct generic_pm_domain *pd;
41+
unsigned int state_idx;
42+
u32 state;
43+
};
44+
3945
static DEFINE_PER_CPU_READ_MOSTLY(struct psci_cpuidle_data, psci_cpuidle_data);
40-
static DEFINE_PER_CPU(u32, domain_state);
46+
static DEFINE_PER_CPU(struct psci_cpuidle_domain_state, psci_domain_state);
4147
static bool psci_cpuidle_use_syscore;
4248
static bool psci_cpuidle_use_cpuhp;
4349

44-
void psci_set_domain_state(u32 state)
50+
void psci_set_domain_state(struct generic_pm_domain *pd, unsigned int state_idx,
51+
u32 state)
4552
{
46-
__this_cpu_write(domain_state, state);
53+
struct psci_cpuidle_domain_state *ds = this_cpu_ptr(&psci_domain_state);
54+
55+
ds->pd = pd;
56+
ds->state_idx = state_idx;
57+
ds->state = state;
4758
}
4859

49-
static inline u32 psci_get_domain_state(void)
60+
static inline void psci_clear_domain_state(void)
5061
{
51-
return __this_cpu_read(domain_state);
62+
__this_cpu_write(psci_domain_state.state, 0);
5263
}
5364

5465
static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
@@ -58,7 +69,8 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
5869
struct psci_cpuidle_data *data = this_cpu_ptr(&psci_cpuidle_data);
5970
u32 *states = data->psci_states;
6071
struct device *pd_dev = data->dev;
61-
u32 state;
72+
struct psci_cpuidle_domain_state *ds;
73+
u32 state = states[idx];
6274
int ret;
6375

6476
ret = cpu_pm_enter();
@@ -71,9 +83,9 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
7183
else
7284
pm_runtime_put_sync_suspend(pd_dev);
7385

74-
state = psci_get_domain_state();
75-
if (!state)
76-
state = states[idx];
86+
ds = this_cpu_ptr(&psci_domain_state);
87+
if (ds->state)
88+
state = ds->state;
7789

7890
trace_psci_domain_idle_enter(dev->cpu, state, s2idle);
7991
ret = psci_cpu_suspend_enter(state) ? -1 : idx;
@@ -86,8 +98,12 @@ static __cpuidle int __psci_enter_domain_idle_state(struct cpuidle_device *dev,
8698

8799
cpu_pm_exit();
88100

101+
/* Correct domain-idlestate statistics if we failed to enter. */
102+
if (ret == -1 && ds->state)
103+
pm_genpd_inc_rejected(ds->pd, ds->state_idx);
104+
89105
/* Clear the domain state to start fresh when back from idle. */
90-
psci_set_domain_state(0);
106+
psci_clear_domain_state();
91107
return ret;
92108
}
93109

@@ -121,7 +137,7 @@ static int psci_idle_cpuhp_down(unsigned int cpu)
121137
if (pd_dev) {
122138
pm_runtime_put_sync(pd_dev);
123139
/* Clear domain state to start fresh at next online. */
124-
psci_set_domain_state(0);
140+
psci_clear_domain_state();
125141
}
126142

127143
return 0;
@@ -147,7 +163,7 @@ static void psci_idle_syscore_switch(bool suspend)
147163

148164
/* Clear domain state to re-start fresh. */
149165
if (!cleared) {
150-
psci_set_domain_state(0);
166+
psci_clear_domain_state();
151167
cleared = true;
152168
}
153169
}

drivers/cpuidle/cpuidle-psci.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#define __CPUIDLE_PSCI_H
55

66
struct device_node;
7+
struct generic_pm_domain;
78

8-
void psci_set_domain_state(u32 state);
9+
void psci_set_domain_state(struct generic_pm_domain *pd, unsigned int state_idx,
10+
u32 state);
911
int psci_dt_parse_state_node(struct device_node *np, u32 *state);
1012

1113
#endif /* __CPUIDLE_PSCI_H */

0 commit comments

Comments
 (0)