Add support for NVIDIA Tegra SoC core power domain
Subsystems (2)
v5 cover Add support for NVIDIA Tegra SoC core power domain
Add GENPD driver for the core power domain of NVIDIA Tegra SoCs. It's needed for enabling of SoC core voltage scaling, resolving overheating problems of the Tegra SoCs.
Note that this series is made on top of [1]. It doesn't have any other dependencies, core PD and voltage scaling will become active once all other related patches will be applied, meaning that this series could be applied at any time.
[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=244075
These and other power-related patches got more testing on more devices, like Transformer and Lenovo tablets. I haven't updated tested-bys since these devices are out-of-tree yet.
Ouya Tegra30 game console runs at 40C during system idle in oppose to going over 60C with the enabled core voltage scaling. Matt Merhar collected temperature stats on his Ouya [2], showing a very significant improvement.
[2] https://imgur.com/a/z4NDWqk
Changelog:
v5: - The core power domain node is now placed within the PMC PDs.
This was suggested by Thierry Reding to v4, we don't need to add a virtual device-tree node for the domain anymore.
v4: - Rebased on top of a new version of the OPP patches [1].
- Fixed new DT binding warning which was reported by the bot for v3.
v3: - This series is a continuation of [3][4]. I factored out and grouped
these soc/tegra patches since they have a common dependency on the OPP API patches [1] and the rest of PM patches depend on this series.
[3] https://lore.kernel.org/lkml/[email protected]/
[4] https://lore.kernel.org/linux-pm/[email protected]/
- Added locking around regulators syncing, which was previously done by the OPP core, but then we (me and Viresh) figured out that it will be better to do it within the PD driver.
- The Core-PD driver now restores the boot voltage level before shutdown/reboot, which may help some devices not to hang on reboot, like Nexus 7 for example.
- Added r-b from Ulf Hansson to "regulators: Support Core domain state syncing" patch, which he gave to v2.
- It should be cleaner to add the Core OPP tables and power domain to the device-trees once all drivers will get the PM support, so this series adds the driver and the binding for now.
- Added t-b from Paul Fertser, who tested the complete patchset on his AC100 netbook and helped to spot compatibility problem with older DTBs in the patch that will add PM support to the GPU driver.
- The DT binding now follows the power-domain spec, which was suggested by Krzysztof Kozlowski in his comment to v2.
Dmitry Osipenko (3):
dt-bindings: soc: tegra-pmc: Document core power domain soc/tegra: pmc: Add core power domain soc/tegra: regulators: Support Core domain state syncing
.../arm/tegra/nvidia,tegra20-pmc.yaml | 35 +++++ drivers/soc/tegra/Kconfig | 14 ++ drivers/soc/tegra/pmc.c | 143 ++++++++++++++++++ drivers/soc/tegra/regulators-tegra20.c | 19 ++- drivers/soc/tegra/regulators-tegra30.c | 18 ++- include/soc/tegra/common.h | 6 + 6 files changed, 233 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.2
PATCH v5 1/3 dt-bindings: soc: tegra-pmc: Document core power domain
All NVIDIA Tegra SoCs have a core power domain where majority of hardware blocks reside. Document the new core power domain properties.
--- .../arm/tegra/nvidia,tegra20-pmc.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.yaml +35 -0
@@ -301,6 +301,33 @@ patternProperties: additionalProperties: false + core-domain: + type: object + description: | + The vast majority of hardware blocks of Tegra SoC belong to a + Core power domain, which has a dedicated voltage rail that powers + the blocks. + + properties: + operating-points-v2: + description: + Should contain level, voltages and opp-supported-hw property. + The supported-hw is a bitfield indicating SoC speedo or process + ID mask. + + "#power-domain-cells": + const: 0 + + required: + - operating-points-v2 + - "#power-domain-cells" + + additionalProperties: false + + core-supply: + description: + Phandle to voltage regulator connected to the SoC Core power rail. + required: - compatible - reg
@@ -325,6 +352,7 @@ examples: tegra_pmc: pmc@7000e400 { compatible = "nvidia,tegra210-pmc"; reg = <0x7000e400 0x400>; + core-supply = <®ulator>; clocks = <&tegra_car TEGRA210_CLK_PCLK>, <&clk32k_in>; clock-names = "pclk", "clk32k_in"; #clock-cells = <1>;
@@ -338,17 +366,24 @@ examples: nvidia,core-power-req-active-high; nvidia,sys-clock-req-active-high; + pd_core: core-domain { + operating-points-v2 = <&core_opp_table>; + #power-domain-cells = <0>; + }; + powergates { pd_audio: aud { clocks = <&tegra_car TEGRA210_CLK_APE>, <&tegra_car TEGRA210_CLK_APB2APE>; resets = <&tegra_car 198>; + power-domains = <&pd_core>; #power-domain-cells = <0>; }; pd_xusbss: xusba { clocks = <&tegra_car TEGRA210_CLK_XUSB_SS>; resets = <&tegra_car TEGRA210_CLK_XUSB_SS>; + power-domains = <&pd_core>; #power-domain-cells = <0>; }; };
Signature · 1 line
2.30.2
Re: [PATCH v5 1/3] dt-bindings: soc: tegra-pmc: Document core power domain
Quoted 8 lines · Dmitry Osipenko
All NVIDIA Tegra SoCs have a core power domain where majority of hardware blocks reside. Document the new core power domain properties.
Signed-off-by Dmitry Osipenko <[email protected]>--- .../arm/tegra/nvidia,tegra20-pmc.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+)
PATCH v5 2/3 soc/tegra: pmc: Add core power domain
In reply to Dmitry OsipenkoNVIDIA Tegra SoCs have multiple power domains, each domain corresponds to an external SoC power rail. Core power domain covers vast majority of hardware blocks within a Tegra SoC. The voltage of a power domain should be set to a level which satisfies all devices within the power domain. Add support for the core power domain which controls voltage state of the domain. This allows us to support system-wide DVFS on Tegra20-210 SoCs. The PMC powergate domains now are sub-domains of the core domain, this requires device-tree updating, older DTBs are unaffected.
--- drivers/soc/tegra/Kconfig | 14 ++++ drivers/soc/tegra/pmc.c | 143 +++++++++++++++++++++++++++++++++++++ include/soc/tegra/common.h | 6 ++ 3 files changed, 163 insertions(+)
drivers/soc/tegra/Kconfig +14 -0
@@ -13,6 +13,7 @@ config ARCH_TEGRA_2x_SOC select PINCTRL_TEGRA20 select PL310_ERRATA_727915 if CACHE_L2X0 select PL310_ERRATA_769419 if CACHE_L2X0 + select SOC_TEGRA_COMMON select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_PMC select SOC_TEGRA20_VOLTAGE_COUPLER
@@ -27,6 +28,7 @@ config ARCH_TEGRA_3x_SOC select ARM_ERRATA_764369 if SMP select PINCTRL_TEGRA30 select PL310_ERRATA_769419 if CACHE_L2X0 + select SOC_TEGRA_COMMON select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_PMC select SOC_TEGRA30_VOLTAGE_COUPLER
@@ -40,6 +42,7 @@ config ARCH_TEGRA_114_SOC select ARM_ERRATA_798181 if SMP select HAVE_ARM_ARCH_TIMER select PINCTRL_TEGRA114 + select SOC_TEGRA_COMMON select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_PMC select TEGRA_TIMER
@@ -51,6 +54,7 @@ config ARCH_TEGRA_124_SOC bool "Enable support for Tegra124 family" select HAVE_ARM_ARCH_TIMER select PINCTRL_TEGRA124 + select SOC_TEGRA_COMMON select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_PMC select TEGRA_TIMER
@@ -66,6 +70,7 @@ if ARM64 config ARCH_TEGRA_132_SOC bool "NVIDIA Tegra132 SoC" select PINCTRL_TEGRA124 + select SOC_TEGRA_COMMON select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_PMC help
@@ -77,6 +82,7 @@ config ARCH_TEGRA_132_SOC config ARCH_TEGRA_210_SOC bool "NVIDIA Tegra210 SoC" select PINCTRL_TEGRA210 + select SOC_TEGRA_COMMON select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_PMC select TEGRA_TIMER
@@ -99,6 +105,7 @@ config ARCH_TEGRA_186_SOC select TEGRA_BPMP select TEGRA_HSP_MBOX select TEGRA_IVC + select SOC_TEGRA_COMMON select SOC_TEGRA_PMC help Enable support for the NVIDIA Tegar186 SoC. The Tegra186 features a
@@ -115,6 +122,7 @@ config ARCH_TEGRA_194_SOC select TEGRA_BPMP select TEGRA_HSP_MBOX select TEGRA_IVC + select SOC_TEGRA_COMMON select SOC_TEGRA_PMC help Enable support for the NVIDIA Tegra194 SoC.
@@ -125,6 +133,7 @@ config ARCH_TEGRA_234_SOC select TEGRA_BPMP select TEGRA_HSP_MBOX select TEGRA_IVC + select SOC_TEGRA_COMMON select SOC_TEGRA_PMC help Enable support for the NVIDIA Tegra234 SoC.
@@ -132,6 +141,11 @@ config ARCH_TEGRA_234_SOC endif endif +config SOC_TEGRA_COMMON + bool + select PM_OPP + select PM_GENERIC_DOMAINS + config SOC_TEGRA_FUSE def_bool y depends on ARCH_TEGRA
drivers/soc/tegra/pmc.c +143 -0
191 lines not on this page · raw message
include/soc/tegra/common.h +6 -0
@@ -22,6 +22,7 @@ struct tegra_core_opp_params {#ifdef CONFIG_ARCH_TEGRA bool soc_is_tegra (void ); +bool tegra_soc_core_domain_state_synced (void );int devm_tegra_core_dev_init_opp_table (struct device *dev,struct tegra_core_opp_params *params);#else
@@ -30,6 +31,11 @@ static inline bool soc_is_tegra(void)return false; } +static inline bool tegra_soc_core_domain_state_synced (void ) +{ +return false; +} +static inline int devm_tegra_core_dev_init_opp_table (struct device *dev,struct tegra_core_opp_params *params)
Signature · 1 line
2.30.2
Re: [PATCH v5 2/3] soc/tegra: pmc: Add core power domain
Quoted 14 lines · Dmitry Osipenko
NVIDIA Tegra SoCs have multiple power domains, each domain corresponds to an external SoC power rail. Core power domain covers vast majority of hardware blocks within a Tegra SoC. The voltage of a power domain should be set to a level which satisfies all devices within the power domain. Add support for the core power domain which controls voltage state of the domain. This allows us to support system-wide DVFS on Tegra20-210 SoCs. The PMC powergate domains now are sub-domains of the core domain, this requires device-tree updating, older DTBs are unaffected.
Quoted 5 lines
--- drivers/soc/tegra/Kconfig | 14 ++++ drivers/soc/tegra/pmc.c | 143 +++++++++++++++++++++++++++++++++++++ include/soc/tegra/common.h | 6 ++ 3 files changed, 163 insertions(+)
Since this power domain code is all dealt with within the PMC driver, and the PMC driver is enabled on all platforms, how about if we avoid creating the additional SOC_TEGRA_COMMON kconfig option and instead make SOC_TEGRA_PMC list the dependencies?
No need to resend, I can make that change when I apply, if you agree.
Thierry
Re: [PATCH v5 2/3] soc/tegra: pmc: Add core power domain
31.05.2021 15:36, Thierry Reding пишет:
Quoted 21 lines · Dmitry Osipenko
Quoted 14 lines
NVIDIA Tegra SoCs have multiple power domains, each domain corresponds to an external SoC power rail. Core power domain covers vast majority of hardware blocks within a Tegra SoC. The voltage of a power domain should be set to a level which satisfies all devices within the power domain. Add support for the core power domain which controls voltage state of the domain. This allows us to support system-wide DVFS on Tegra20-210 SoCs. The PMC powergate domains now are sub-domains of the core domain, this requires device-tree updating, older DTBs are unaffected.
Quoted 5 lines
--- drivers/soc/tegra/Kconfig | 14 ++++ drivers/soc/tegra/pmc.c | 143 +++++++++++++++++++++++++++++++++++++ include/soc/tegra/common.h | 6 ++ 3 files changed, 163 insertions(+)
Quoted 6 lines
Since this power domain code is all dealt with within the PMC driver, and the PMC driver is enabled on all platforms, how about if we avoid creating the additional
SOC_TEGRA_COMMONkconfig option and instead makeSOC_TEGRA_PMClist the dependencies?No need to resend, I can make that change when I apply, if you agree.
This can be done. I'll send v6 with the fixed compile-testing anyways, so will apply this change there too.
The most recent version of this patch is found in [1]. Sorry for sending so many versions and creating confusion, I settled on a unified series that takes all build dependencies into account.
[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=246158
Thank you for the review.
PATCH v5 3/3 soc/tegra: regulators: Support Core domain state syncing
In reply to Dmitry OsipenkoThe core voltage shall not drop until state of Core domain is synced, i.e. all device drivers that use Core domain are loaded and ready.
Support Core domain state syncing. The Core domain driver invokes the core-regulator voltage syncing once the state of domain is synced, at this point the Core voltage is allowed to go lower than the level left after bootloader.
--- drivers/soc/tegra/regulators-tegra20.c | 19 ++++++++++++++++++- drivers/soc/tegra/regulators-tegra30.c | 18 +++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-)
drivers/soc/tegra/regulators-tegra20.c +18 -1
@@ -17,6 +17,8 @@#include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <soc/tegra/common.h> +struct tegra_regulator_coupler {struct regulator_coupler coupler;struct regulator_dev *core_rdev;
@@ -42,6 +44,21 @@ static int tegra20_core_limit(struct tegra_regulator_coupler *tegra,int core_cur_uV;int err; +/* +* Tegra20 SoC has critical DVFS-capable devices that are +* permanently-active or active at a boot time, like EMC +* (DRAM controller) or Display controller for example. +* +* The voltage of a CORE SoC power domain shall not be dropped below +* a minimum level, which is determined by device's clock rate. +* This means that we can't fully allow CORE voltage scaling until +* the state of all DVFS-critical CORE devices is synced. +*/ +if (tegra_soc_core_domain_state_synced () && !tegra->sys_reboot_mode) { +pr_info_once ("voltage state synced\n" ); +return 0 ; + } +if (tegra->core_min_uV >0 )return tegra->core_min_uV;
@@ -62,7 +79,7 @@ static int tegra20_core_limit(struct tegra_regulator_coupler *tegra,*/ tegra->core_min_uV = core_max_uV; -pr_info ("core minimum voltage limited to %duV\n" , tegra->core_min_uV); +pr_info ("core voltage initialized to %duV\n" , tegra->core_min_uV);return tegra->core_min_uV; }
drivers/soc/tegra/regulators-tegra30.c +17 -1
@@ -17,6 +17,7 @@#include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <soc/tegra/common.h> #include <soc/tegra/fuse.h> struct tegra_regulator_coupler {
@@ -43,6 +44,21 @@ static int tegra30_core_limit(struct tegra_regulator_coupler *tegra,int core_cur_uV;int err; +/* +* Tegra30 SoC has critical DVFS-capable devices that are +* permanently-active or active at a boot time, like EMC +* (DRAM controller) or Display controller for example. +* +* The voltage of a CORE SoC power domain shall not be dropped below +* a minimum level, which is determined by device's clock rate. +* This means that we can't fully allow CORE voltage scaling until +* the state of all DVFS-critical CORE devices is synced. +*/ +if (tegra_soc_core_domain_state_synced () && !tegra->sys_reboot_mode) { +pr_info_once ("voltage state synced\n" ); +return 0 ; + } +if (tegra->core_min_uV >0 )return tegra->core_min_uV;
@@ -63,7 +79,7 @@ static int tegra30_core_limit(struct tegra_regulator_coupler *tegra,*/ tegra->core_min_uV = core_max_uV; -pr_info ("core minimum voltage limited to %duV\n" , tegra->core_min_uV); +pr_info ("core voltage initialized to %duV\n" , tegra->core_min_uV);return tegra->core_min_uV; }
Signature · 1 line
2.30.2