Skip to contentSkip to conversation

ARM: sunxi: Support cpufreq on sun[457]i

PATCH New Chen-Yu Tsai 3 participants 18 messages Jan 12, 2015 – Jan 14, 2015

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

v3 cover ARM: sunxi: Support cpufreq on sun[457]i

Hi,

This is v3 of the cpufreq support series for sunxi. The series has been rebased onto the latest sunxi-next. I've dropped all the patches Maxime merged. This includes "ARM: sunxi: Register cpufreq-dt for sun[45678]i" which was merged but not published yet.

Individual changes since v2 are listed within each patch.

Original cover letter follows:

This series adds support cpufreq support for sun[457]i using cpufreq-dt. This also supports passive cpu cooling (thermal throttling) using thermal zones with the temperature sensor in the SoC.

The operating points for the supported platforms were taken from the linux-sunxi FEX files repository. The majority of boards use the same settings. Only with sun7i do we see slight variations, either disabling some frequencies, or bumping up the voltage a bit. In either case this can be done by limiting the constraints for the supply regulator, or overriding the OPP table in the board dts file.

On sun7i, there is an additional operating point not found in the FEX files, 960 MHz @ 1.4V, which is the full speed setting in both u-boot-sunxi and mainline u-boot.

The series has been tested on the 4 boards I have. With cpufreq active, the effects are visible as a decrease in SoC internal temperature. Stability for the operating points has been tested using:

http://linux-sunxi.org/Hardware_Reliability_Tests#Reliability_of_cpufreq_voltage.2Ffrequency_settings

More real world usage feedback is appreciated. Thermal throttling hasn't been tested much, due to not being able to generate enough load without the GPU for the SoC to heat up. Also on sun4i, the temperature sensor still hasn't been calibrated, so the readings are highly inaccurate.

Chen-Yu Tsai (9):
Input: sun4i-ts: Add thermal zone sensor support
ARM: dts: sunxi: Add dtsi for AXP209 PMIC
ARM: dts: sun7i: Add cpu thermal zones to dtsi
ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes
ARM: dts: sun7i: cubietruck: add axp209 regulator nodes
ARM: dts: sun5i: Add cpu thermal zones to dtsi
ARM: dts: sun5i: hsg-h702: add axp209 regulator nodes
ARM: dts: sun4i: Add cpu thermal zones to dtsi
ARM: dts: sun4i: cubieboard: add axp209 regulator nodes

 .../bindings/input/touchscreen/sun4i.txt           |  2 +
 arch/arm/boot/dts/axp209.dtsi                      | 97 ++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts         | 35 +++++++-
 arch/arm/boot/dts/sun4i-a10.dtsi                   | 34 ++++++++
 arch/arm/boot/dts/sun5i-a13-hsg-h702.dts           | 46 ++++++++--
 arch/arm/boot/dts/sun5i-a13.dtsi                   | 34 ++++++++
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts        | 35 +++++++-
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts         | 35 +++++++-
 arch/arm/boot/dts/sun7i-a20.dtsi                   | 33 ++++++++
 drivers/input/touchscreen/sun4i-ts.c               | 54 +++++++++++-
 10 files changed, 381 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm/boot/dts/axp209.dtsi
Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 1/9 Input: sun4i-ts: Add thermal zone sensor support

The touchscreen controller has a temperature sensor embedded in the SoC, which already has hwmon support in the driver.

Add DT thermal zone support so we can use it with cpufreq for thermal throttling.

This also adds a comment stating that we do not know the actual formula for calculating the temperature.

---

changes since v2:

- Use common function for temperature calculation

changes since v1:

- clean up thermal zone sensor when input device register fails
- unconditionally unregister thermal zone sensor on removal. the unregister function checks the pointers passed in.
- add comment explaining the lack of documents for the temperature calculation formula

---
 .../bindings/input/touchscreen/sun4i.txt           |  2 +
 drivers/input/touchscreen/sun4i-ts.c               | 54 ++++++++++++++++++++--
 2 files changed, 52 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +2 -0
index aef57791f40b..a8405bab6c00 100644
@@ -5,6 +5,7 @@ Required properties:
  - compatible: "allwinner,sun4i-a10-ts"
  - reg: mmio address range of the chip
  - interrupts: interrupt to which the chip is connected
+ - #thermal-sensor-cells: shall be 0
 
 Optional properties:
  - allwinner,ts-attached: boolean indicating that an actual touchscreen is
@@ -17,4 +18,5 @@ Example:
 		reg = <0x01c25000 0x100>;
 		interrupts = <29>;
 		allwinner,ts-attached;
+		#thermal-sensor-cells = <0>;
 	};
drivers/input/touchscreen/sun4i-ts.c +50 -4

101 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

PATCH v3 1/9 Input: sun4i-ts: Add thermal zone sensor support

Quoted 10 lines · Chen-Yu Tsai

The touchscreen controller has a temperature sensor embedded in the SoC, which already has hwmon support in the driver.

Add DT thermal zone support so we can use it with cpufreq for thermal throttling.

This also adds a comment stating that we do not know the actual formula for calculating the temperature.

Quoted 150 lines

---

changes since v2:

- Use common function for temperature calculation

changes since v1:

- clean up thermal zone sensor when input device register fails
- unconditionally unregister thermal zone sensor on removal. the unregister function checks the pointers passed in.
- add comment explaining the lack of documents for the temperature calculation formula

---
 .../bindings/input/touchscreen/sun4i.txt           |  2 +
 drivers/input/touchscreen/sun4i-ts.c               | 54 ++++++++++++++++++++--
 2 files changed, 52 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +2 -0
index aef57791f40b..a8405bab6c00 100644
@@ -5,6 +5,7 @@ Required properties:
  - compatible: "allwinner,sun4i-a10-ts"
  - reg: mmio address range of the chip
  - interrupts: interrupt to which the chip is connected
+ - #thermal-sensor-cells: shall be 0
 
 Optional properties:
  - allwinner,ts-attached: boolean indicating that an actual touchscreen is
@@ -17,4 +18,5 @@ Example:
 		reg = <0x01c25000 0x100>;
 		interrupts = <29>;
 		allwinner,ts-attached;
+		#thermal-sensor-cells = <0>;
 	};
drivers/input/touchscreen/sun4i-ts.c +50 -4
index 28a06749ae42..5851aa0bd78b 100644
@@ -34,6 +34,7 @@
 
 #include <linux/err.h>
 #include <linux/hwmon.h>
+#include <linux/thermal.h>
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
@@ -107,6 +108,7 @@
 struct sun4i_ts_data {
 	struct device *dev;
 	struct input_dev *input;
+	struct thermal_zone_device *tz;
 	void __iomem *base;
 	unsigned int irq;
 	bool ignore_fifo_data;
@@ -180,16 +182,48 @@ static void sun4i_ts_close(struct input_dev *dev)
 	writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
 }
 
+static int get_temp(const struct sun4i_ts_data *ts, long *temp)
+{
+	/* No temp_data until the first irq */
+	if (ts->temp_data == -1)
+		return -EAGAIN;
+
+	/*
+	 * The user manuals do not contain the formula for calculating
+	 * the temperature. The formula used here is from the AXP209,
+	 * which is designed by X-Powers, an affiliate of Allwinner:
+	 *
+	 *     temperature = -144.7 + (value * 0.1)
+	 *
+	 * This should be replaced with the correct one if such information
+	 * becomes available.
+	 */
+	*temp = (ts->temp_data - 1447) * 100;
+
+	return 0;
+}
+
+static int get_tz_temp(void *data, long *temp)
+{
+	return get_temp(data, temp);
+}
+
+static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = {
+	.get_temp = get_tz_temp,
+};
+
 static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
 			 char *buf)
 {
 	struct sun4i_ts_data *ts = dev_get_drvdata(dev);
+	long temp;
+	int ret;
 
-	/* No temp_data until the first irq */
-	if (ts->temp_data == -1)
-		return -EAGAIN;
+	ret = get_temp(ts, &temp);
+	if (ret)
+		return ret;
 
-	return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100);
+	return sprintf(buf, "%ld\n", temp);
 }
 
 static ssize_t show_temp_label(struct device *dev,
@@ -283,17 +317,27 @@ static int sun4i_ts_probe(struct platform_device *pdev)
 	writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1),
 	       ts->base + TP_CTRL1);
 
+	/*
+	 * The thermal core does not register hwmon devices for DT-based
+	 * thermal zone sensors, such as this one.
+	 */
 	hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts",
 						       ts, sun4i_ts_groups);
 	if (IS_ERR(hwmon))
 		return PTR_ERR(hwmon);
 
+	ts->tz = thermal_zone_of_sensor_register(ts->dev, 0, ts,
+						 &sun4i_ts_tz_ops);
+	if (IS_ERR(ts->tz))
+		ts->tz = NULL;
+
 	writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC);
 
 	if (ts_attached) {
 		error = input_register_device(ts->input);
 		if (error) {
 			writel(0, ts->base + TP_INT_FIFOC);
+			thermal_zone_of_sensor_unregister(ts->dev, ts->tz);
 			return error;
 		}
 	}
@@ -310,6 +354,8 @@ static int sun4i_ts_remove(struct platform_device *pdev)
 	if (ts->input)
 		input_unregister_device(ts->input);
 
+	thermal_zone_of_sensor_unregister(ts->dev, ts->tz);
+
 	/* Deactivate all IRQs */
 	writel(0, ts->base + TP_INT_FIFOC);
 
Signature · 1 line
2.1.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150112/4ca2517d/attachment.sig>

#3 lore raw

PATCH v3 2/9 ARM: dts: sunxi: Add dtsi for AXP209 PMIC

In reply to Chen-Yu Tsai

The AXP209 PMIC is used with some Allwinner SoCs. This patch adds a dtsi file listing all the regulator nodes. The regulators are initialized based on their device node names.

---

changes since v2:

none

changes since v1:

- Moved interrupt controller properties to this patch
- Added default names for all the regulators
- Removed needless comment above regulators section

---
 arch/arm/boot/dts/axp209.dtsi | 97 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 arch/arm/boot/dts/axp209.dtsi
arch/arm/boot/dts/axp209.dtsi new file +97 -0
new file mode 100644
index 000000000000..c20cf537f5a5
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2015 Chen-Yu Tsai
+ *
+ * Chen-Yu Tsai <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ *     You should have received a copy of the GNU General Public
+ *     License along with this file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * AXP202/209 Integrated Power Management Chip
+ * http://www.x-powers.com/product/AXP20X.php
+ * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf
+ */
+
+&axp209 {
+	compatible = "x-powers,axp209";
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	regulators {
+		/* Default work frequency for buck regulators */
+		x-powers,dcdc-freq = <1500>;
+
+		reg_dcdc2: dcdc2 {
+			regulator-name = "dcdc2";
+		};
+
+		reg_dcdc3: dcdc3 {
+			regulator-name = "dcdc3";
+		};
+
+		reg_ldo1: ldo1 {
+			/* LDO1 is a fixed output regulator */
+			regulator-always-on;
+			regulator-min-microvolt = <1300000>;
+			regulator-max-microvolt = <1300000>;
+			regulator-name = "ldo1";
+		};
+
+		reg_ldo2: ldo2 {
+			regulator-name = "ldo2";
+		};
+
+		reg_ldo3: ldo3 {
+			regulator-name = "ldo3";
+		};
+
+		reg_ldo4: ldo4 {
+			regulator-name = "ldo4";
+		};
+
+		reg_ldo5: ldo5 {
+			regulator-name = "ldo5";
+		};
+	};
+};
Signature · 1 line
2.1.4
#4 lore raw

PATCH v3 3/9 ARM: dts: sun7i: Add cpu thermal zones to dtsi

In reply to Chen-Yu Tsai

The core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).

---

changes since v2:

- Added Acked-by from Eduardo

changes since v1:

- Use thermal dt bindings macros in cooling-device

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +33 -0
index c2e964939991..61780b144745 100644
@@ -50,6 +50,7 @@
 #include "skeleton.dtsi"
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/thermal/thermal.h>
 
 #include <dt-bindings/dma/sun4i-a10.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
@@ -116,6 +117,38 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal {
+			/* milliseconds */
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&rtp>;
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					/* milliCelsius */
+					temperature = <75000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit: cpu_crit {
+					/* milliCelsius */
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	memory {
 		reg = <0x40000000 0x80000000>;
 	};
Signature · 1 line
2.1.4
#5 lore raw

PATCH v3 4/9 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes

In reply to Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2

none

changes since v1:

- Use preprocessor include for axp209.dtsi
- Remove incorrectly squashed axp209.dtsi patch

---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 35 +++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +31 -4
index 18fc5db9c976..ec1fc2c8b3e3 100644
@@ -88,13 +88,9 @@
 			status = "okay";
 
 			axp209: pmic at 34 {
-				compatible = "x-powers,axp209";
 				reg = <0x34>;
 				interrupt-parent = <&nmi_intc>;
 				interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-				interrupt-controller;
-				#interrupt-cells = <1>;
 			};
 		};
 
@@ -145,3 +141,34 @@
 		status = "okay";
 	};
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1450000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+	regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "avcc";
+};
Signature · 1 line
2.1.4
#6 lore raw

PATCH v3 4/9 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes

Hi Chen-Yu,

Quoted 73 lines · Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2

none

changes since v1:

- Use preprocessor include for axp209.dtsi
- Remove incorrectly squashed axp209.dtsi patch

---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 35 +++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +21 -4
index 18fc5db9c976..ec1fc2c8b3e3 100644
@@ -88,13 +88,9 @@
 			status = "okay";
 
 			axp209: pmic at 34 {
-				compatible = "x-powers,axp209";
 				reg = <0x34>;
 				interrupt-parent = <&nmi_intc>;
 				interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-				interrupt-controller;
-				#interrupt-cells = <1>;
 			};
 		};
 
@@ -145,3 +141,34 @@
 		status = "okay";
 	};
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1450000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-int-dll";
+};
+

arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 174

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +10 -0
+&reg_ldo1 {
+	regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "avcc";
+};

How do reg_vcc3v3 and the other reg used in this DT (ahci, USB) fit into that?

Eventually, I think we would be able to remove sunxi-common-regulators.dtsi, or at least, expose the proper regulator hierarchy.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150112/dc3ee794/attachment-0001.sig>
#7 lore raw

PATCH v3 4/9 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes

Hi,

Quoted 81 lines · Maxime Ripard

Hi Chen-Yu,

Quoted 78 lines · Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2

none

changes since v1:

- Use preprocessor include for axp209.dtsi
- Remove incorrectly squashed axp209.dtsi patch

---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 35 +++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +26 -4
index 18fc5db9c976..ec1fc2c8b3e3 100644
@@ -88,13 +88,9 @@
                      status = "okay";
 
                      axp209: pmic at 34 {
-                             compatible = "x-powers,axp209";
                              reg = <0x34>;
                              interrupt-parent = <&nmi_intc>;
                              interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-                             interrupt-controller;
-                             #interrupt-cells = <1>;
                      };
              };
 
@@ -145,3 +141,34 @@
              status = "okay";
      };
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+     cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+     regulator-always-on;
+     regulator-min-microvolt = <1000000>;
+     regulator-max-microvolt = <1450000>;
+     regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+     regulator-always-on;
+     regulator-min-microvolt = <1000000>;
+     regulator-max-microvolt = <1400000>;
+     regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+     regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
Quoted 8 lines

arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 174

Quoted 5 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +5 -0
+     regulator-always-on;
+     regulator-min-microvolt = <3000000>;
+     regulator-max-microvolt = <3000000>;
+     regulator-name = "avcc";
+};

How do reg_vcc3v3 and the other reg used in this DT (ahci, USB) fit into that?

The following applies to boards that use AXP209.

reg_vcc3v3 or reg_vcc3v0 is an external buck regulator with it's enable pin tied to EXTEN on the AXP. This pin is controllable, but we do not have the driver for it. It is possible that multiple regulators are tied to this pin. I suggest not touching it without the correct schematics.

The source for usb and ahci regulators, or reg_vcc5v if you will, is either the unregulated 5v from the power supply or the usb otg port. For the Cubietruck, there's an additional uncontrollable boost regulator that boosts the lipo battery's power up to 5v.

On some of the Olimex boards that use higher input voltages, they use an uncontrollable buck regulator to step down the voltage to 5v. The Olinuxino-Micro also has a boost regulator for the battery, tied to EXTEN.

The AXP209 simply does not have enough outputs for all the needed voltages.

You could probably chain the regulators in the DT via xxx-supply if it helps. But beyond that, it is hard to do anything meaningful at this point. Modeling them as fixed regulators beyond our control is simpler. We also do not have an IPSOUT regulator for the AXP.

Quoted 3 lines

Eventually, I think we would be able to remove sunxi-common-regulators.dtsi, or at least, expose the proper regulator hierarchy.

The USB and SATA regulators are just GPIO enabled switches (MOSFETs) or current limiters. I think these will always exist because of the reference designs. Or do you want to move them back into the board dts files? FWIW, I like it the way it is now. Not that I don't like it to be accurate.

ChenYu

#8 lore raw

PATCH v3 4/9 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes

Hi,

Quoted 107 lines · Chen-Yu Tsai

Hi,

Quoted 81 lines · Maxime Ripard

Hi Chen-Yu,

Quoted 78 lines · Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2

none

changes since v1:

- Use preprocessor include for axp209.dtsi
- Remove incorrectly squashed axp209.dtsi patch

---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 35 +++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +26 -4
index 18fc5db9c976..ec1fc2c8b3e3 100644
@@ -88,13 +88,9 @@
                      status = "okay";
 
                      axp209: pmic at 34 {
-                             compatible = "x-powers,axp209";
                              reg = <0x34>;
                              interrupt-parent = <&nmi_intc>;
                              interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-                             interrupt-controller;
-                             #interrupt-cells = <1>;
                      };
              };
 
@@ -145,3 +141,34 @@
              status = "okay";
      };
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+     cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+     regulator-always-on;
+     regulator-min-microvolt = <1000000>;
+     regulator-max-microvolt = <1450000>;
+     regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+     regulator-always-on;
+     regulator-min-microvolt = <1000000>;
+     regulator-max-microvolt = <1400000>;
+     regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+     regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
Quoted 8 lines

arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 174

Quoted 5 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +5 -0
+     regulator-always-on;
+     regulator-min-microvolt = <3000000>;
+     regulator-max-microvolt = <3000000>;
+     regulator-name = "avcc";
+};

How do reg_vcc3v3 and the other reg used in this DT (ahci, USB) fit into that?

The following applies to boards that use AXP209.

reg_vcc3v3 or reg_vcc3v0 is an external buck regulator with it's enable pin tied to EXTEN on the AXP. This pin is controllable, but we do not have the driver for it. It is possible that multiple regulators are tied to this pin. I suggest not touching it without the correct schematics.

The source for usb and ahci regulators, or reg_vcc5v if you will, is either the unregulated 5v from the power supply or the usb otg port. For the Cubietruck, there's an additional uncontrollable boost regulator that boosts the lipo battery's power up to 5v.

Quoted 7 lines

On some of the Olimex boards that use higher input voltages, they use an uncontrollable buck regulator to step down the voltage to 5v. The Olinuxino-Micro also has a boost regulator for the battery, tied to EXTEN.

The AXP209 simply does not have enough outputs for all the needed voltages.

Hmm, yes, ok. It makes sense.

Quoted 9 lines

You could probably chain the regulators in the DT via xxx-supply if it helps. But beyond that, it is hard to do anything meaningful at this point. Modeling them as fixed regulators beyond our control is simpler. We also do not have an IPSOUT regulator for the AXP.

Quoted 3 lines

Eventually, I think we would be able to remove sunxi-common-regulators.dtsi, or at least, expose the proper regulator hierarchy.

Quoted 5 lines

The USB and SATA regulators are just GPIO enabled switches (MOSFETs) or current limiters. I think these will always exist because of the reference designs. Or do you want to move them back into the board dts files? FWIW, I like it the way it is now. Not that I don't like it to be accurate.

At least providing the right hierarchy at the board level would be great. Adding the -supply property to all our fixed regulators wouldn't take too much code, and would be enough to model properly the regulator trees.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150113/8911096f/attachment-0001.sig>
#9 lore raw

PATCH v3 4/9 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes

Quoted 115 lines · Maxime Ripard

Hi,

Quoted 112 lines · Chen-Yu Tsai

Hi,

Quoted 81 lines · Maxime Ripard

Hi Chen-Yu,

Quoted 78 lines · Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2

none

changes since v1:

- Use preprocessor include for axp209.dtsi
- Remove incorrectly squashed axp209.dtsi patch

---
 arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 35 +++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +26 -4
index 18fc5db9c976..ec1fc2c8b3e3 100644
@@ -88,13 +88,9 @@
                      status = "okay";
 
                      axp209: pmic at 34 {
-                             compatible = "x-powers,axp209";
                              reg = <0x34>;
                              interrupt-parent = <&nmi_intc>;
                              interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-                             interrupt-controller;
-                             #interrupt-cells = <1>;
                      };
              };
 
@@ -145,3 +141,34 @@
              status = "okay";
      };
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+     cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+     regulator-always-on;
+     regulator-min-microvolt = <1000000>;
+     regulator-max-microvolt = <1450000>;
+     regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+     regulator-always-on;
+     regulator-min-microvolt = <1000000>;
+     regulator-max-microvolt = <1400000>;
+     regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+     regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
Quoted 8 lines

arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 174

Quoted 5 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +5 -0
+     regulator-always-on;
+     regulator-min-microvolt = <3000000>;
+     regulator-max-microvolt = <3000000>;
+     regulator-name = "avcc";
+};

How do reg_vcc3v3 and the other reg used in this DT (ahci, USB) fit into that?

The following applies to boards that use AXP209.

reg_vcc3v3 or reg_vcc3v0 is an external buck regulator with it's enable pin tied to EXTEN on the AXP. This pin is controllable, but we do not have the driver for it. It is possible that multiple regulators are tied to this pin. I suggest not touching it without the correct schematics.

The source for usb and ahci regulators, or reg_vcc5v if you will, is either the unregulated 5v from the power supply or the usb otg port. For the Cubietruck, there's an additional uncontrollable boost regulator that boosts the lipo battery's power up to 5v.

On some of the Olimex boards that use higher input voltages, they use an uncontrollable buck regulator to step down the voltage to 5v. The Olinuxino-Micro also has a boost regulator for the battery, tied to EXTEN.

Quoted 4 lines
Quoted 2 lines

The AXP209 simply does not have enough outputs for all the needed voltages.

Hmm, yes, ok. It makes sense.

IPSOUT and the battery stuff should be revisited once we have a power supply driver.

Quoted 15 lines
Quoted 9 lines

You could probably chain the regulators in the DT via xxx-supply if it helps. But beyond that, it is hard to do anything meaningful at this point. Modeling them as fixed regulators beyond our control is simpler. We also do not have an IPSOUT regulator for the AXP.

Quoted 3 lines

Eventually, I think we would be able to remove sunxi-common-regulators.dtsi, or at least, expose the proper regulator hierarchy.

Quoted 5 lines

The USB and SATA regulators are just GPIO enabled switches (MOSFETs) or current limiters. I think these will always exist because of the reference designs. Or do you want to move them back into the board dts files? FWIW, I like it the way it is now. Not that I don't like it to be accurate.

Quoted 4 lines

At least providing the right hierarchy at the board level would be great. Adding the -supply property to all our fixed regulators wouldn't take too much code, and would be enough to model properly the regulator trees.

These are all unrelated to axp209. You'd end up with

    vin-supply = <&reg_vcc5v>;

for the usb and sata power regulators. You could put these in sunxi-common-regulators, and override them for boards that actually have something controllable.

ChenYu

#10 lore raw

PATCH v3 4/9 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes

Quoted 20 lines · Chen-Yu Tsai
Quoted 15 lines
Quoted 9 lines

You could probably chain the regulators in the DT via xxx-supply if it helps. But beyond that, it is hard to do anything meaningful at this point. Modeling them as fixed regulators beyond our control is simpler. We also do not have an IPSOUT regulator for the AXP.

Quoted 3 lines

Eventually, I think we would be able to remove sunxi-common-regulators.dtsi, or at least, expose the proper regulator hierarchy.

Quoted 5 lines

The USB and SATA regulators are just GPIO enabled switches (MOSFETs) or current limiters. I think these will always exist because of the reference designs. Or do you want to move them back into the board dts files? FWIW, I like it the way it is now. Not that I don't like it to be accurate.

Quoted 4 lines

At least providing the right hierarchy at the board level would be great. Adding the -supply property to all our fixed regulators wouldn't take too much code, and would be enough to model properly the regulator trees.

Quoted 7 lines

These are all unrelated to axp209. You'd end up with

    vin-supply = <&reg_vcc5v>;

for the usb and sata power regulators. You could put these in sunxi-common-regulators, and override them for boards that actually have something controllable.

Ok. Fine then.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150114/387122b6/attachment.sig>
#11 lore raw

PATCH v3 5/9 ARM: dts: sun7i: cubietruck: add axp209 regulator nodes

In reply to Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2:

none

changes since v1:

- Use preprocessor include for axp209.dtsi

---
 arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 35 ++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun7i-a20-cubietruck.dts +31 -4
index 77bc7e79cab9..5f817b65ceea 100644
@@ -130,13 +130,9 @@
 			status = "okay";
 
 			axp209: pmic at 34 {
-				compatible = "x-powers,axp209";
 				reg = <0x34>;
 				interrupt-parent = <&nmi_intc>;
 				interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-
-				interrupt-controller;
-				#interrupt-cells = <1>;
 			};
 		};
 
@@ -222,3 +218,34 @@
 		gpio = <&pio 7 9 GPIO_ACTIVE_HIGH>;
 	};
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1450000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+	regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "avcc";
+};
Signature · 1 line
2.1.4
#12 lore raw

PATCH v3 6/9 ARM: dts: sun5i: Add cpu thermal zones to dtsi

In reply to Chen-Yu Tsai

The core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).

---

changes since v2:

- Added Acked-by from Eduardo

changes since v1:

- Use thermal dt bindings macros in cooling-device

---
 arch/arm/boot/dts/sun5i-a13.dtsi | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/arm/boot/dts/sun5i-a13.dtsi +34 -0
index dee2aa5bc9ed..c26f58ea0850 100644
@@ -13,6 +13,8 @@
 
 #include "skeleton.dtsi"
 
+#include <dt-bindings/thermal/thermal.h>
+
 #include <dt-bindings/dma/sun4i-a10.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
 
@@ -50,6 +52,38 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal {
+			/* milliseconds */
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&rtp>;
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					/* milliCelsius */
+					temperature = <850000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit: cpu_crit {
+					/* milliCelsius */
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	memory {
 		reg = <0x40000000 0x20000000>;
 	};
Signature · 1 line
2.1.4
#13 lore raw

PATCH v3 7/9 ARM: dts: sun5i: hsg-h702: add axp209 regulator nodes

In reply to Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

LDO3 powers the USB WiFi module. This patch also references it from the usb-phy node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2:

none

changes since v1:

- Use preprocessor include for axp209.dtsi

---
 arch/arm/boot/dts/sun5i-a13-hsg-h702.dts | 46 ++++++++++++++++++++++++++------
 1 file changed, 38 insertions(+), 8 deletions(-)
arch/arm/boot/dts/sun5i-a13-hsg-h702.dts +38 -8
index 99a5968720b4..82637db1c55a 100644
@@ -68,11 +68,7 @@
 		};
 
 		usbphy: phy at 01c13400 {
-			/*
-			 * There doesn't seem to be a GPIO for controlling
-			 * usb1 vbus, despite the fex file saying otherwise.
-			 */
-			usb1_vbus-supply = <&reg_vcc5v0>;
+			usb1_vbus-supply = <&reg_ldo3>;
 			status = "okay";
 		};
 
@@ -105,11 +101,8 @@
 			status = "okay";
 
 			axp209: pmic at 34 {
-				compatible = "x-powers,axp209";
 				reg = <0x34>;
 				interrupts = <0>;
-				interrupt-controller;
-				#interrupt-cells = <1>;
 			};
 		};
 
@@ -131,3 +124,40 @@
 		};
 	};
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1500000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+	regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "avcc";
+};
+
+&reg_ldo3 {
+	regulator-min-microvolt = <3300000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-name = "vcc-wifi";
+};
Signature · 1 line
2.1.4
#14 lore raw

PATCH v3 8/9 ARM: dts: sun4i: Add cpu thermal zones to dtsi

In reply to Chen-Yu Tsai

The core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).

---

changes since v2:

none

changes since v1:

- Use thermal dt bindings macros in cooling-device

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +34 -0
index 7fb4e912f510..f0dc246dc69e 100644
@@ -12,6 +12,8 @@
 
 #include "skeleton.dtsi"
 
+#include <dt-bindings/thermal/thermal.h>
+
 #include <dt-bindings/dma/sun4i-a10.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
 
@@ -67,6 +69,38 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal {
+			/* milliseconds */
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&rtp>;
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					/* milliCelsius */
+					temperature = <850000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_crit: cpu_crit {
+					/* milliCelsius */
+					temperature = <100000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	memory {
 		reg = <0x40000000 0x80000000>;
 	};
Signature · 1 line
2.1.4
#15 lore raw

PATCH v3 9/9 ARM: dts: sun4i: cubieboard: add axp209 regulator nodes

In reply to Chen-Yu Tsai

This patch adds the regulator nodes for the axp209 by including the axp209 dtsi. As the inputs of these regulators are from the axp209's PS output, which is basically just a mux over the 2 inputs, it is considered to be unregulated. Thus we do not provide input supply properties for them.

The regulator names and constraints are based on the board schematics and the SoC datasheet.

DCDC2 is used as the cpu power supply. This patch also references it from the cpu node.

Also get rid of axp209 properties already set in axp209.dtsi.

---

changes since v2:

none

changes since v1:

- Use preprocessor include for axp209.dtsi

---
 arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 35 ++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun4i-a10-cubieboard.dts +31 -4
index 87ac84db836d..4260c2b47607 100644
@@ -137,12 +137,8 @@
 			status = "okay";
 
 			axp209: pmic at 34 {
-				compatible = "x-powers,axp209";
 				reg = <0x34>;
 				interrupts = <0>;
-
-				interrupt-controller;
-				#interrupt-cells = <1>;
 			};
 		};
 
@@ -188,3 +184,34 @@
 		status = "okay";
 	};
 };
+
+#include "axp209.dtsi"
+
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1450000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+	regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "avcc";
+};
Signature · 1 line
2.1.4
#16 lore raw

v3 cover ARM: sunxi: Support cpufreq on sun[457]i

In reply to Chen-Yu Tsai
Quoted 31 lines · Chen-Yu Tsai

Hi,

This is v3 of the cpufreq support series for sunxi. The series has been rebased onto the latest sunxi-next. I've dropped all the patches Maxime merged. This includes "ARM: sunxi: Register cpufreq-dt for sun[45678]i" which was merged but not published yet.

Individual changes since v2 are listed within each patch.

Original cover letter follows:

This series adds support cpufreq support for sun[457]i using cpufreq-dt. This also supports passive cpu cooling (thermal throttling) using thermal zones with the temperature sensor in the SoC.

The operating points for the supported platforms were taken from the linux-sunxi FEX files repository. The majority of boards use the same settings. Only with sun7i do we see slight variations, either disabling some frequencies, or bumping up the voltage a bit. In either case this can be done by limiting the constraints for the supply regulator, or overriding the OPP table in the board dts file.

On sun7i, there is an additional operating point not found in the FEX files, 960 MHz @ 1.4V, which is the full speed setting in both u-boot-sunxi and mainline u-boot.

The series has been tested on the 4 boards I have. With cpufreq active, the effects are visible as a decrease in SoC internal temperature. Stability for the operating points has been tested using:

Quoted 6 lines

http://linux-sunxi.org/Hardware_Reliability_Tests#Reliability_of_cpufreq_voltage.2Ffrequency_settings

More real world usage feedback is appreciated. Thermal throttling hasn't been tested much, due to not being able to generate enough load without the GPU for the SoC to heat up. Also on sun4i, the temperature sensor still hasn't been calibrated, so the readings are highly inaccurate.

Applied 2, 3, 6 and 8.

There's still some discussions about the boards regulators, that apply to all of them, even though I commented on one in particular.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150112/85077dc8/attachment.sig>
#17 lore raw

v3 cover ARM: sunxi: Support cpufreq on sun[457]i

Quoted 32 lines · Maxime Ripard
Quoted 31 lines · Chen-Yu Tsai

Hi,

This is v3 of the cpufreq support series for sunxi. The series has been rebased onto the latest sunxi-next. I've dropped all the patches Maxime merged. This includes "ARM: sunxi: Register cpufreq-dt for sun[45678]i" which was merged but not published yet.

Individual changes since v2 are listed within each patch.

Original cover letter follows:

This series adds support cpufreq support for sun[457]i using cpufreq-dt. This also supports passive cpu cooling (thermal throttling) using thermal zones with the temperature sensor in the SoC.

The operating points for the supported platforms were taken from the linux-sunxi FEX files repository. The majority of boards use the same settings. Only with sun7i do we see slight variations, either disabling some frequencies, or bumping up the voltage a bit. In either case this can be done by limiting the constraints for the supply regulator, or overriding the OPP table in the board dts file.

On sun7i, there is an additional operating point not found in the FEX files, 960 MHz @ 1.4V, which is the full speed setting in both u-boot-sunxi and mainline u-boot.

The series has been tested on the 4 boards I have. With cpufreq active, the effects are visible as a decrease in SoC internal temperature. Stability for the operating points has been tested using:

Quoted 8 lines
Quoted 6 lines

http://linux-sunxi.org/Hardware_Reliability_Tests#Reliability_of_cpufreq_voltage.2Ffrequency_settings

More real world usage feedback is appreciated. Thermal throttling hasn't been tested much, due to not being able to generate enough load without the GPU for the SoC to heat up. Also on sun4i, the temperature sensor still hasn't been calibrated, so the readings are highly inaccurate.

Applied 2, 3, 6 and 8.

And I just applied 4, 5, 7 and 9.

Thanks!

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150113/09ad7620/attachment.sig>