Skip to contentSkip to conversation

Support regulators coupling on NVIDIA Tegra20/30

PATCH In review Dmitry Osipenko 4 participants 12 messages Jul 25, 2019 – Oct 29, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Support regulators coupling on NVIDIA Tegra20/30

Hello,

The voltage regulators need to be coupled on NVIDIA Tegra20 and Tegra30 SoCs in order to provide voltage scaling functionality in a generic way. All necessary regulator-core patches that added support for the regulators coupling are already have been merge into mainline kernel. This series adds customized voltage couplers for Tegra20/30 SoCs, paving the way for a refined CPUFreq driver that will utilize voltage scaling and other neat features. This is a resend of a leftover patches from a previous series
[1] that was partially applied by Mark Brown. Please review, thanks in advance!

[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=115626

Changelog:

v2: - Some days ago OPP framework got a change that makes CPU regulator
to be enabled at the time of CPUFreq's driver initializing OPPs. In a result the CPU's voltage is dropped to a minimum value on CPUFreq's setting up because there are no consumers at the time of regulator's enabling, thus CPU is getting into a big trouble. This problem is now resolved in the couplers code by assuming that min_uV=current_uV for CPU's regulator if it doesn't have any active consumers.

Dmitry Osipenko (3):
dt-bindings: regulator: Document regulators coupling of NVIDIA

    Tegra20/30 SoCs

soc/tegra: regulators: Add regulators coupler for Tegra20 soc/tegra: regulators: Add regulators coupler for Tegra30

 .../nvidia,tegra-regulators-coupling.txt      |  65 ++++
 drivers/soc/tegra/Kconfig                     |  10 +
 drivers/soc/tegra/Makefile                    |   2 +
 drivers/soc/tegra/regulators-tegra20.c        | 364 ++++++++++++++++++
 drivers/soc/tegra/regulators-tegra30.c        | 316 +++++++++++++++
 5 files changed, 757 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt
 create mode 100644 drivers/soc/tegra/regulators-tegra20.c
 create mode 100644 drivers/soc/tegra/regulators-tegra30.c
Signature · 1 line
2.22.0
#1 lore raw

PATCH v2 1/3 dt-bindings: regulator: Document regulators coupling of NVIDIA Tegra20/30 SoCs

There is voltage coupling between three regulators on Tegra20 boards and between two on Tegra30. The voltage coupling is a SoC-level feature and thus it is mandatory and common for all of the Tegra boards.

---
 .../nvidia,tegra-regulators-coupling.txt      | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt
Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt new file +65 -0
new file mode 100644
index 000000000000..4bf2dbf7c6cc
@@ -0,0 +1,65 @@
+NVIDIA Tegra Regulators Coupling
+================================
+
+NVIDIA Tegra SoC's have a mandatory voltage-coupling between regulators.
+Thus on Tegra20 there are 3 coupled regulators and on NVIDIA Tegra30
+there are 2.
+
+Tegra20 voltage coupling
+------------------------
+
+On Tegra20 SoC's there are 3 coupled regulators: CORE, RTC and CPU.
+The CORE and RTC voltages shall be in a range of 170mV from each other
+and they both shall be higher than the CPU voltage by at least 120mV.
+
+Tegra30 voltage coupling
+------------------------
+
+On Tegra30 SoC's there are 2 coupled regulators: CORE and CPU. The CORE
+and CPU voltages shall be in a range of 300mV from each other and CORE
+voltage shall be higher than the CPU by N mV, where N depends on the CPU
+voltage.
+
+Required properties:
+- nvidia,tegra-core-regulator: Boolean property that designates regulator
+  as the "Core domain" voltage regulator.
+- nvidia,tegra-rtc-regulator: Boolean property that designates regulator
+  as the "RTC domain" voltage regulator.
+- nvidia,tegra-cpu-regulator: Boolean property that designates regulator
+  as the "CPU domain" voltage regulator.
+
+Example:
+
+	pmic {
+		regulators {
+			core_vdd_reg: core {
+				regulator-name = "vdd_core";
+				regulator-min-microvolt = <950000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-coupled-with = <&rtc_vdd_reg &cpu_vdd_reg>;
+				regulator-coupled-max-spread = <170000 550000>;
+
+				nvidia,tegra-core-regulator;
+			};
+
+			rtc_vdd_reg: rtc {
+				regulator-name = "vdd_rtc";
+				regulator-min-microvolt = <950000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-coupled-with = <&core_vdd_reg &cpu_vdd_reg>;
+				regulator-coupled-max-spread = <170000 550000>;
+
+				nvidia,tegra-rtc-regulator;
+			};
+
+			cpu_vdd_reg: cpu {
+				regulator-name = "vdd_cpu";
+				regulator-min-microvolt = <750000>;
+				regulator-max-microvolt = <1125000>;
+				regulator-coupled-with = <&core_vdd_reg &rtc_vdd_reg>;
+				regulator-coupled-max-spread = <550000 550000>;
+
+				nvidia,tegra-cpu-regulator;
+			};
+		};
+	};
Signature · 1 line
2.22.0
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: regulator: Document regulators coupling of NVIDIA Tegra20/30 SoCs

25.07.2019 18:18, Dmitry Osipenko пишет:

Quoted 72 lines

There is voltage coupling between three regulators on Tegra20 boards and between two on Tegra30. The voltage coupling is a SoC-level feature and thus it is mandatory and common for all of the Tegra boards.

---
 .../nvidia,tegra-regulators-coupling.txt      | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt
Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt new file +55 -0
new file mode 100644
index 000000000000..4bf2dbf7c6cc
@@ -0,0 +1,65 @@
+NVIDIA Tegra Regulators Coupling
+================================
+
+NVIDIA Tegra SoC's have a mandatory voltage-coupling between regulators.
+Thus on Tegra20 there are 3 coupled regulators and on NVIDIA Tegra30
+there are 2.
+
+Tegra20 voltage coupling
+------------------------
+
+On Tegra20 SoC's there are 3 coupled regulators: CORE, RTC and CPU.
+The CORE and RTC voltages shall be in a range of 170mV from each other
+and they both shall be higher than the CPU voltage by at least 120mV.
+
+Tegra30 voltage coupling
+------------------------
+
+On Tegra30 SoC's there are 2 coupled regulators: CORE and CPU. The CORE
+and CPU voltages shall be in a range of 300mV from each other and CORE
+voltage shall be higher than the CPU by N mV, where N depends on the CPU
+voltage.
+
+Required properties:
+- nvidia,tegra-core-regulator: Boolean property that designates regulator
+  as the "Core domain" voltage regulator.
+- nvidia,tegra-rtc-regulator: Boolean property that designates regulator
+  as the "RTC domain" voltage regulator.
+- nvidia,tegra-cpu-regulator: Boolean property that designates regulator
+  as the "CPU domain" voltage regulator.
+
+Example:
+
+	pmic {
+		regulators {
+			core_vdd_reg: core {
+				regulator-name = "vdd_core";
+				regulator-min-microvolt = <950000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-coupled-with = <&rtc_vdd_reg &cpu_vdd_reg>;
+				regulator-coupled-max-spread = <170000 550000>;
+
+				nvidia,tegra-core-regulator;
+			};
+
+			rtc_vdd_reg: rtc {
+				regulator-name = "vdd_rtc";
+				regulator-min-microvolt = <950000>;
+				regulator-max-microvolt = <1300000>;
+				regulator-coupled-with = <&core_vdd_reg &cpu_vdd_reg>;
+				regulator-coupled-max-spread = <170000 550000>;
+
+				nvidia,tegra-rtc-regulator;
+			};
+
+			cpu_vdd_reg: cpu {

Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt line 65

Quoted 10 lines
Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt new file +10 -0
+				regulator-name = "vdd_cpu";
+				regulator-min-microvolt = <750000>;
+				regulator-max-microvolt = <1125000>;
+				regulator-coupled-with = <&core_vdd_reg &rtc_vdd_reg>;
+				regulator-coupled-max-spread = <550000 550000>;
+
+				nvidia,tegra-cpu-regulator;
+			};
+		};
+	};

Hello Rob,

Are you okay with this patch? We just need to mark the SoC voltage regulators appropriately and regulators themselves vary from board to board, hence this binding is not something that could be done using YAML, I guess.

maintainer Reviewed-by on v2 1/3
#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: regulator: Document regulators coupling of NVIDIA Tegra20/30 SoCs

In reply to Dmitry Osipenko
Quoted 10 lines · Dmitry Osipenko

There is voltage coupling between three regulators on Tegra20 boards and between two on Tegra30. The voltage coupling is a SoC-level feature and thus it is mandatory and common for all of the Tegra boards.

---
 .../nvidia,tegra-regulators-coupling.txt      | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/nvidia,tegra-regulators-coupling.txt
#4 lore raw

PATCH v2 2/3 soc/tegra: regulators: Add regulators coupler for Tegra20

In reply to Dmitry Osipenko

Add regulators coupler for Tegra20 SoCs that performs voltage balancing of a coupled regulators and thus provides voltage scaling functionality.

There are 3 coupled regulators on all Tegra20 SoCs: CORE, RTC and CPU. The CORE and RTC voltages shall be in range of 170mV from each other and they both shall be higher than the CPU voltage by at least 120mV. This sounds like it could be handle by a generic voltage balancer, but the CORE voltage scaling isn't implemented in any of the upstream drivers yet. It will take quite some time and effort to hook up voltage scaling for all of the drivers, hence we will use a custom coupler that will manage the CPU voltage scaling for the starter.

---
 drivers/soc/tegra/Kconfig              |   6 +
 drivers/soc/tegra/Makefile             |   1 +
 drivers/soc/tegra/regulators-tegra20.c | 364 +++++++++++++++++++++++++
 3 files changed, 371 insertions(+)
 create mode 100644 drivers/soc/tegra/regulators-tegra20.c
drivers/soc/tegra/Kconfig +6 -0
index d98c69efb7e0..7986ab80e07a 100644
@@ -14,6 +14,7 @@ config ARCH_TEGRA_2x_SOC
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select SOC_TEGRA_FLOWCTRL
 	select SOC_TEGRA_PMC
+	select SOC_TEGRA20_VOLTAGE_COUPLER
 	select TEGRA_TIMER
 	help
 	  Support for NVIDIA Tegra AP20 and T20 processors, based on the
@@ -134,3 +135,8 @@ config SOC_TEGRA_POWERGATE_BPMP
 	def_bool y
 	depends on PM_GENERIC_DOMAINS
 	depends on TEGRA_BPMP
+
+config SOC_TEGRA20_VOLTAGE_COUPLER
+	bool "Voltage scaling support for Tegra20 SoCs"
+	depends on ARCH_TEGRA_2x_SOC || COMPILE_TEST
+
drivers/soc/tegra/Makefile +1 -0
index 902759fe5f4d..9f0bdd53bef8 100644
@@ -5,3 +5,4 @@ obj-y += common.o
 obj-$(CONFIG_SOC_TEGRA_FLOWCTRL) += flowctrl.o
 obj-$(CONFIG_SOC_TEGRA_PMC) += pmc.o
 obj-$(CONFIG_SOC_TEGRA_POWERGATE_BPMP) += powergate-bpmp.o
+obj-$(CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER) += regulators-tegra20.o
drivers/soc/tegra/regulators-tegra20.c new file +364 -0

364 lines not on this page · raw message

Signature · 1 line
2.22.0
#5 lore raw

PATCH v2 3/3 soc/tegra: regulators: Add regulators coupler for Tegra30

In reply to Dmitry Osipenko

Add regulators coupler for Tegra30 SoCs that performs voltage balancing of a coupled regulators and thus provides voltage scaling functionality.

There are 2 coupled regulators on all Tegra30 SoCs: CORE and CPU. The coupled regulator voltages shall be in a range of 300mV from each other and CORE voltage shall be higher than the CPU by N mV, where N depends on the CPU voltage.

---
 drivers/soc/tegra/Kconfig              |   4 +
 drivers/soc/tegra/Makefile             |   1 +
 drivers/soc/tegra/regulators-tegra30.c | 316 +++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/soc/tegra/regulators-tegra30.c
drivers/soc/tegra/Kconfig +4 -0
index 7986ab80e07a..bc86dc2f4198 100644
@@ -28,6 +28,7 @@ config ARCH_TEGRA_3x_SOC
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select SOC_TEGRA_FLOWCTRL
 	select SOC_TEGRA_PMC
+	select SOC_TEGRA30_VOLTAGE_COUPLER
 	select TEGRA_TIMER
 	help
 	  Support for NVIDIA Tegra T30 processor family, based on the
@@ -140,3 +141,6 @@ config SOC_TEGRA20_VOLTAGE_COUPLER
 	bool "Voltage scaling support for Tegra20 SoCs"
 	depends on ARCH_TEGRA_2x_SOC || COMPILE_TEST
 
+config SOC_TEGRA30_VOLTAGE_COUPLER
+	bool "Voltage scaling support for Tegra30 SoCs"
+	depends on ARCH_TEGRA_3x_SOC || COMPILE_TEST
drivers/soc/tegra/Makefile +1 -0
index 9f0bdd53bef8..9c809c1814bd 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_SOC_TEGRA_FLOWCTRL) += flowctrl.o
 obj-$(CONFIG_SOC_TEGRA_PMC) += pmc.o
 obj-$(CONFIG_SOC_TEGRA_POWERGATE_BPMP) += powergate-bpmp.o
 obj-$(CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER) += regulators-tegra20.o
+obj-$(CONFIG_SOC_TEGRA30_VOLTAGE_COUPLER) += regulators-tegra30.o
drivers/soc/tegra/regulators-tegra30.c new file +316 -0

316 lines not on this page · raw message

Signature · 1 line
2.22.0
#6 lore raw

Re: [PATCH v2 3/3] soc/tegra: regulators: Add regulators coupler for Tegra30

Quoted 16 lines · Dmitry Osipenko

Add regulators coupler for Tegra30 SoCs that performs voltage balancing of a coupled regulators and thus provides voltage scaling functionality.

There are 2 coupled regulators on all Tegra30 SoCs: CORE and CPU. The coupled regulator voltages shall be in a range of 300mV from each other and CORE voltage shall be higher than the CPU by N mV, where N depends on the CPU voltage.

---
 drivers/soc/tegra/Kconfig              |   4 +
 drivers/soc/tegra/Makefile             |   1 +
 drivers/soc/tegra/regulators-tegra30.c | 316 +++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/soc/tegra/regulators-tegra30.c

...

Quoted 8 lines
drivers/soc/tegra/regulators-tegra30.c new file +8 -0
+
+static int tegra30_core_cpu_limit(int cpu_uV)
+{
+	if (cpu_uV < 800000)
+		return 950000;
+
+	if (cpu_uV < 900000)
+		return 1000000;

drivers/soc/tegra/regulators-tegra30.c line 82

Quoted 10 lines
drivers/soc/tegra/regulators-tegra30.c new file +10 -0
+
+	if (cpu_uV < 1000000)
+		return 1100000;
+
+	if (cpu_uV < 1100000)
+		return 1200000;
+
+	if (cpu_uV < 1250000) {
+		switch (tegra_sku_info.cpu_speedo_id) {
+		case 0 ... 1:

Aren't we supposed to add /* fall through */ here now?

drivers/soc/tegra/regulators-tegra30.c line 91

Quoted 9 lines
drivers/soc/tegra/regulators-tegra30.c new file +9 -0
+		case 4:
+		case 7 ... 8:
+			return 1200000;
+
+		default:
+			return 1300000;
+		}
+	}
+

Other than that, this looks ok to me.

Peter.

#7 lore raw

Re: [PATCH v2 3/3] soc/tegra: regulators: Add regulators coupler for Tegra30

02.08.2019 17:05, Peter De Schrijver пишет:

Quoted 30 lines · Dmitry Osipenko
Quoted 16 lines

Add regulators coupler for Tegra30 SoCs that performs voltage balancing of a coupled regulators and thus provides voltage scaling functionality.

There are 2 coupled regulators on all Tegra30 SoCs: CORE and CPU. The coupled regulator voltages shall be in a range of 300mV from each other and CORE voltage shall be higher than the CPU by N mV, where N depends on the CPU voltage.

---
 drivers/soc/tegra/Kconfig              |   4 +
 drivers/soc/tegra/Makefile             |   1 +
 drivers/soc/tegra/regulators-tegra30.c | 316 +++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/soc/tegra/regulators-tegra30.c

...

Quoted 11 lines
drivers/soc/tegra/regulators-tegra30.c new file +11 -0
+
+static int tegra30_core_cpu_limit(int cpu_uV)
+{
+	if (cpu_uV < 800000)
+		return 950000;
+
+	if (cpu_uV < 900000)
+		return 1000000;
+
+	if (cpu_uV < 1000000)
+		return 1100000;
Quoted 8 lines

drivers/soc/tegra/regulators-tegra30.c line 82

Quoted 7 lines
drivers/soc/tegra/regulators-tegra30.c new file +7 -0
+
+	if (cpu_uV < 1100000)
+		return 1200000;
+
+	if (cpu_uV < 1250000) {
+		switch (tegra_sku_info.cpu_speedo_id) {
+		case 0 ... 1:

Aren't we supposed to add /* fall through */ here now?

There is no compiler warning if there is nothing in-between of the case-switches, so annotation isn't really necessary here. Of course it is possible to add an explicit annotation just to make clear the fall-through intention.

Quoted 11 lines

drivers/soc/tegra/regulators-tegra30.c line 91

Quoted 9 lines
drivers/soc/tegra/regulators-tegra30.c new file +9 -0
+		case 4:
+		case 7 ... 8:
+			return 1200000;
+
+		default:
+			return 1300000;
+		}
+	}
+

Other than that, this looks ok to me.

Awesome, thank you very much! Explicit ACK will be appreciated as well.

#8 lore raw

Re: [PATCH v2 3/3] soc/tegra: regulators: Add regulators coupler for Tegra30

Quoted 40 lines · Dmitry Osipenko

02.08.2019 17:05, Peter De Schrijver пишет:

Quoted 30 lines · Dmitry Osipenko
Quoted 16 lines

Add regulators coupler for Tegra30 SoCs that performs voltage balancing of a coupled regulators and thus provides voltage scaling functionality.

There are 2 coupled regulators on all Tegra30 SoCs: CORE and CPU. The coupled regulator voltages shall be in a range of 300mV from each other and CORE voltage shall be higher than the CPU by N mV, where N depends on the CPU voltage.

---
 drivers/soc/tegra/Kconfig              |   4 +
 drivers/soc/tegra/Makefile             |   1 +
 drivers/soc/tegra/regulators-tegra30.c | 316 +++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/soc/tegra/regulators-tegra30.c

...

Quoted 11 lines
drivers/soc/tegra/regulators-tegra30.c new file +11 -0
+
+static int tegra30_core_cpu_limit(int cpu_uV)
+{
+	if (cpu_uV < 800000)
+		return 950000;
+
+	if (cpu_uV < 900000)
+		return 1000000;
+
+	if (cpu_uV < 1000000)
+		return 1100000;
Quoted 8 lines

drivers/soc/tegra/regulators-tegra30.c line 82

Quoted 7 lines
drivers/soc/tegra/regulators-tegra30.c new file +7 -0
+
+	if (cpu_uV < 1100000)
+		return 1200000;
+
+	if (cpu_uV < 1250000) {
+		switch (tegra_sku_info.cpu_speedo_id) {
+		case 0 ... 1:

Aren't we supposed to add /* fall through */ here now?

Quoted 5 lines

There is no compiler warning if there is nothing in-between of the case-switches, so annotation isn't really necessary here. Of course it is possible to add an explicit annotation just to make clear the fall-through intention.

Ah. Ok. Whatever you want then :)

Quoted 12 lines
Quoted 11 lines

drivers/soc/tegra/regulators-tegra30.c line 91

Quoted 9 lines
drivers/soc/tegra/regulators-tegra30.c new file +9 -0
+		case 4:
+		case 7 ... 8:
+			return 1200000;
+
+		default:
+			return 1300000;
+		}
+	}
+

Other than that, this looks ok to me.

Quoted 1 line

Awesome, thank you very much! Explicit ACK will be appreciated as well.

#9 lore raw

Re: [PATCH v2 3/3] soc/tegra: regulators: Add regulators coupler for Tegra30

05.08.2019 11:33, Peter De Schrijver пишет:

Quoted 41 lines · Dmitry Osipenko
Quoted 40 lines

02.08.2019 17:05, Peter De Schrijver пишет:

Quoted 38 lines · Dmitry Osipenko
Quoted 16 lines

Add regulators coupler for Tegra30 SoCs that performs voltage balancing of a coupled regulators and thus provides voltage scaling functionality.

There are 2 coupled regulators on all Tegra30 SoCs: CORE and CPU. The coupled regulator voltages shall be in a range of 300mV from each other and CORE voltage shall be higher than the CPU by N mV, where N depends on the CPU voltage.

---
 drivers/soc/tegra/Kconfig              |   4 +
 drivers/soc/tegra/Makefile             |   1 +
 drivers/soc/tegra/regulators-tegra30.c | 316 +++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/soc/tegra/regulators-tegra30.c

...

Quoted 8 lines
drivers/soc/tegra/regulators-tegra30.c new file +8 -0
+
+static int tegra30_core_cpu_limit(int cpu_uV)
+{
+	if (cpu_uV < 800000)
+		return 950000;
+
+	if (cpu_uV < 900000)
+		return 1000000;

drivers/soc/tegra/regulators-tegra30.c line 82

Quoted 10 lines
drivers/soc/tegra/regulators-tegra30.c new file +10 -0
+
+	if (cpu_uV < 1000000)
+		return 1100000;
+
+	if (cpu_uV < 1100000)
+		return 1200000;
+
+	if (cpu_uV < 1250000) {
+		switch (tegra_sku_info.cpu_speedo_id) {
+		case 0 ... 1:

Aren't we supposed to add /* fall through */ here now?

Quoted 7 lines
Quoted 5 lines

There is no compiler warning if there is nothing in-between of the case-switches, so annotation isn't really necessary here. Of course it is possible to add an explicit annotation just to make clear the fall-through intention.

Ah. Ok. Whatever you want then :)

I'll add the comments if there will be a need to re-spin this series.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

drivers/soc/tegra/regulators-tegra30.c line 91

Quoted 9 lines
drivers/soc/tegra/regulators-tegra30.c new file +9 -0
+		case 4:
+		case 7 ... 8:
+			return 1200000;
+
+		default:
+			return 1300000;
+		}
+	}
+

Other than that, this looks ok to me.

Quoted 3 lines
Quoted 1 line

Awesome, thank you very much! Explicit ACK will be appreciated as well.

Thank you again! Could you please also clarify whether the ACK is for this patch only or for all of three patches?

#10 lore raw

Re: [PATCH v2 3/3] soc/tegra: regulators: Add regulators coupler for Tegra30

Quoted 48 lines · Dmitry Osipenko

05.08.2019 11:33, Peter De Schrijver пишет:

Quoted 47 lines · Dmitry Osipenko
Quoted 45 lines

02.08.2019 17:05, Peter De Schrijver пишет:

Quoted 30 lines · Dmitry Osipenko
Quoted 16 lines

Add regulators coupler for Tegra30 SoCs that performs voltage balancing of a coupled regulators and thus provides voltage scaling functionality.

There are 2 coupled regulators on all Tegra30 SoCs: CORE and CPU. The coupled regulator voltages shall be in a range of 300mV from each other and CORE voltage shall be higher than the CPU by N mV, where N depends on the CPU voltage.

---
 drivers/soc/tegra/Kconfig              |   4 +
 drivers/soc/tegra/Makefile             |   1 +
 drivers/soc/tegra/regulators-tegra30.c | 316 +++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/soc/tegra/regulators-tegra30.c

...

Quoted 11 lines
drivers/soc/tegra/regulators-tegra30.c new file +11 -0
+
+static int tegra30_core_cpu_limit(int cpu_uV)
+{
+	if (cpu_uV < 800000)
+		return 950000;
+
+	if (cpu_uV < 900000)
+		return 1000000;
+
+	if (cpu_uV < 1000000)
+		return 1100000;
Quoted 8 lines

drivers/soc/tegra/regulators-tegra30.c line 82

Quoted 7 lines
drivers/soc/tegra/regulators-tegra30.c new file +7 -0
+
+	if (cpu_uV < 1100000)
+		return 1200000;
+
+	if (cpu_uV < 1250000) {
+		switch (tegra_sku_info.cpu_speedo_id) {
+		case 0 ... 1:

Aren't we supposed to add /* fall through */ here now?

There is no compiler warning if there is nothing in-between of the case-switches, so annotation isn't really necessary here. Of course it is possible to add an explicit annotation just to make clear the fall-through intention.

Quoted 19 lines
Quoted 1 line

Ah. Ok. Whatever you want then :)

I'll add the comments if there will be a need to re-spin this series.

Quoted 15 lines
Quoted 12 lines
Quoted 11 lines

drivers/soc/tegra/regulators-tegra30.c line 91

Quoted 9 lines
drivers/soc/tegra/regulators-tegra30.c new file +9 -0
+		case 4:
+		case 7 ... 8:
+			return 1200000;
+
+		default:
+			return 1300000;
+		}
+	}
+

Other than that, this looks ok to me.

Quoted 1 line

Awesome, thank you very much! Explicit ACK will be appreciated as well.

All of them.

Peter.

#11 lore raw
In reply to Dmitry Osipenko
Quoted 25 lines · Dmitry Osipenko

Hello,

The voltage regulators need to be coupled on NVIDIA Tegra20 and Tegra30 SoCs in order to provide voltage scaling functionality in a generic way. All necessary regulator-core patches that added support for the regulators coupling are already have been merge into mainline kernel. This series adds customized voltage couplers for Tegra20/30 SoCs, paving the way for a refined CPUFreq driver that will utilize voltage scaling and other neat features. This is a resend of a leftover patches from a previous series
[1] that was partially applied by Mark Brown. Please review, thanks in advance!

[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=115626

Changelog:

v2: - Some days ago OPP framework got a change that makes CPU regulator
to be enabled at the time of CPUFreq's driver initializing OPPs. In a result the CPU's voltage is dropped to a minimum value on CPUFreq's setting up because there are no consumers at the time of regulator's enabling, thus CPU is getting into a big trouble. This problem is now resolved in the couplers code by assuming that min_uV=current_uV for CPU's regulator if it doesn't have any active consumers.

Quoted 5 lines

Dmitry Osipenko (3):
dt-bindings: regulator: Document regulators coupling of NVIDIA

    Tegra20/30 SoCs

soc/tegra: regulators: Add regulators coupler for Tegra20 soc/tegra: regulators: Add regulators coupler for Tegra30

All three patches applied, thanks.

Thierry