ARM: sunxi: Support cpufreq on sun[457]i
Subsystems (9)
cover ARM: sunxi: Support cpufreq on sun[457]i
Hi everyone,
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:
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.
Patch 1 registers the cpufreq-dt platform device for all known single cluster (all cores sharing the same supply and clock line) sunxi platforms with a late init call.
Patch 2 makes the sunxi mux clocks propagate clk_set_rate calls to parents. This is needed as the cpu clocks are simple mux clocks. The actual changing part is the parent PLL.
Patch 3 adds thermal zone sensor support to sun4i-ts, which already has hwmon support. This is used for thermal throttling.
Patch 4 adds a dtsi file for the AXP209 PMIC, which holds a list of regulators and some common properties.
Patch 5 adds #thermal-sensor-cells to sun[457]i dtsi files for the thermal framework.
Patch 6 adds the cpu clock and OPP to sun7i dtsi. At this point cpufreq is usable. However the OPP does have points with over-voltage (> 1.4V). Without the regulator reference, bumping the frequency up may be unstable.
Patch 7 adds thermal zones for passive cooling to sun7i dtsi. This includes a constant which should be a macro. Maxime is working on cleaning up the sunxi dts files, so I'll leave this bit for later to avoid repeated work and conflicts.
Patch 8 and 9 adds the axp209 regulator constraints and references for cubieboard2 and cubietruck.
Patches 10~15 do the same as 7~9, except for sun4i and sun5i.
Patch 16 enables support for cpufreq and thermal throttling in sunxi_defconfig.
Patch 17 does the same for multi_v7_defconfig.
The thermal sensor bits are pretty standard. Nevertheless I've included the thermal subsystem supporters.
Dmitry, could you pick up patch 3?
Maxime, could you take a look at the rest?
Thanks
ChenYu
Chen-Yu Tsai (17):
ARM: sunxi: Register cpufreq-dt for sun[45678]i
clk: sunxi: Propagate rate changes to parent for mux clocks
Input: sun4i-ts: Add thermal zone sensor support
ARM: dts: sunxi: Add dtsi for AXP209 PMIC
ARM: dts: sunxi: Enable thermal sensor support for RTP on sun[457]i
ARM: dts: sun7i: Add cpu clock reference and operating points to dtsi
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 clock reference and operating points to dtsi
ARM: dts: sun5i: Add cpu thermal zones to dtsi
ARM: dts: sun5i: hsg-h702: add axp209 regulator nodes
ARM: dts: sun4i: Add cpu clock reference and operating points to dtsi
ARM: dts: sun4i: Add cpu thermal zones to dtsi
ARM: dts: sun4i: cubieboard: add axp209 regulator nodes
ARM: sunxi_defconfig: Enable TOUCHSCREEN_SUN4I, CPUFREQ_DT,
CPU_THERMAL
ARM: multi_v7_defconfig: Enable TOUCHSCREEN_SUN4I, CPU_THERMAL
.../bindings/input/touchscreen/sun4i.txt | 1 + arch/arm/boot/dts/axp209.dtsi | 91 ++++++++++++++++++++++ arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 35 ++++++++- arch/arm/boot/dts/sun4i-a10.dtsi | 48 +++++++++++- arch/arm/boot/dts/sun5i-a10s.dtsi | 1 + arch/arm/boot/dts/sun5i-a13-hsg-h702.dts | 46 +++++++++-- arch/arm/boot/dts/sun5i-a13.dtsi | 51 +++++++++++- 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 | 51 +++++++++++- arch/arm/configs/multi_v7_defconfig | 2 + arch/arm/configs/sunxi_defconfig | 7 +- arch/arm/mach-sunxi/sunxi.c | 10 +++ drivers/clk/sunxi/clk-sunxi.c | 2 +- drivers/input/touchscreen/sun4i-ts.c | 27 +++++++ 15 files changed, 417 insertions(+), 25 deletions(-) create mode 100644 arch/arm/boot/dts/axp209.dtsi
Signature · 1 line
2.1.4
PATCH 1/17 ARM: sunxi: Register cpufreq-dt for sun[45678]i
On sun[45678]i, we have one cluster of identical cores sharing a clock, which is ideal for using cpufreq-dt. Register a platform device for cpufreq-dt.
--- arch/arm/mach-sunxi/sunxi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-sunxi/sunxi.c +10 -0
@@ -13,9 +13,15 @@#include <linux/clk-provider.h> #include <linux/clocksource.h> #include <linux/init.h> +#include <linux/platform_device.h> #include <asm/mach/arch.h> +static void __init sunxi_dt_cpufreq_init (void ) +{ +platform_device_register_simple ("cpufreq-dt" ,-1 ,NULL ,0 ); +} +static const char *const sunxi_board_dt_compat[] = {"allwinner,sun4i-a10" ,"allwinner,sun5i-a10s" ,
@@ -25,6 +31,7 @@ static const char * const sunxi_board_dt_compat[] = {DT_MACHINE_START (SUNXI_DT ,"Allwinner A1X (Device Tree)" ) .dt_compat = sunxi_board_dt_compat, + .init_late = sunxi_dt_cpufreq_init, MACHINE_ENDstatic const char *const sun6i_board_dt_compat[] = {
@@ -45,6 +52,7 @@ static void __init sun6i_timer_init(void)DT_MACHINE_START (SUN6I_DT ,"Allwinner sun6i (A31) Family" ) .init_time = sun6i_timer_init, .dt_compat = sun6i_board_dt_compat, + .init_late = sunxi_dt_cpufreq_init, MACHINE_ENDstatic const char *const sun7i_board_dt_compat[] = {
@@ -54,6 +62,7 @@ static const char * const sun7i_board_dt_compat[] = {DT_MACHINE_START (SUN7I_DT ,"Allwinner sun7i (A20) Family" ) .dt_compat = sun7i_board_dt_compat, + .init_late = sunxi_dt_cpufreq_init, MACHINE_ENDstatic const char *const sun8i_board_dt_compat[] = {
@@ -63,6 +72,7 @@ static const char * const sun8i_board_dt_compat[] = {DT_MACHINE_START (SUN8I_DT ,"Allwinner sun8i (A23) Family" ) .dt_compat = sun8i_board_dt_compat, + .init_late = sunxi_dt_cpufreq_init, MACHINE_ENDstatic const char *const sun9i_board_dt_compat[] = {
Signature · 1 line
2.1.4
PATCH 1/17 ARM: sunxi: Register cpufreq-dt for sun[45678]i
Hi,
Quoted 5 lines · Chen-Yu Tsai
On sun[45678]i, we have one cluster of identical cores sharing a clock, which is ideal for using cpufreq-dt. Register a platform device for cpufreq-dt.
Signed-off-by Chen-Yu Tsai <[email protected]>
While I don't have anything against this patch, I seem to recall that it was not necessary anymore, or that there was some work in the direction of removing that kind of code, have you looked into that?
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/20150106/b24f0ed7/attachment.sig>
PATCH 1/17 ARM: sunxi: Register cpufreq-dt for sun[45678]i
Hi,
Quoted 7 lines · Maxime Ripard
Hi,
Quoted 4 lines · Chen-Yu Tsai
On sun[45678]i, we have one cluster of identical cores sharing a clock, which is ideal for using cpufreq-dt. Register a platform device for cpufreq-dt.
Quoted 5 lines
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>While I don't have anything against this patch, I seem to recall that it was not necessary anymore, or that there was some work in the direction of removing that kind of code, have you looked into that?
I believe you are referring to the work done by Viresh Kumar (CCed), specifically the 2 series "[RFC V1 0/8] CPUFreq: create platform-dev for DT based cpufreq drivers" and "[RFC] OPP: Redefine bindings to overcome shortcomings". So far the new code has not appeared in linux-next. If it does, I will happily use it.
ChenYu
PATCH 1/17 ARM: sunxi: Register cpufreq-dt for sun[45678]i
Quoted 5 lines · Chen-Yu Tsai
I believe you are referring to the work done by Viresh Kumar (CCed), specifically the 2 series "[RFC V1 0/8] CPUFreq: create platform-dev for DT based cpufreq drivers" and "[RFC] OPP: Redefine bindings to overcome shortcomings". So far the new code has not appeared in linux-next. If it does, I will happily use it.
Yes. You still have to create these platform devices for cpufreq-dt.
Maxime Ripard
AppliedPATCH 1/17 ARM: sunxi: Register cpufreq-dt for sun[45678]i
In reply to Chen-Yu TsaiQuoted 5 lines · Chen-Yu Tsai
On sun[45678]i, we have one cluster of identical cores sharing a clock, which is ideal for using cpufreq-dt. Register a platform device for cpufreq-dt.
Signed-off-by Chen-Yu Tsai <[email protected]>
Applied, 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/20150107/aeefe19e/attachment-0001.sig>
PATCH 2/17 clk: sunxi: Propagate rate changes to parent for mux clocks
In reply to Chen-Yu TsaiThe cpu clock on sunxi machines is just a mux clock, which is normally fed by the main PLL, but can be muxed to the main or low power oscillator.
Make the mux clock propagate rate changes to its parent, so we can change the clock rate of the PLL, and thus actually implement rate changing on the cpu clock.
This patch also removes the no reparenting limit.
--- drivers/clk/sunxi/clk-sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi/clk-sunxi.c +1 -1
@@ -778,7 +778,7 @@ static void __init sunxi_mux_clk_setup(struct device_node *node,of_property_read_string (node,"clock-output-names" , &clk_name); clk =clk_register_mux (NULL , clk_name, parents, i, -CLK_SET_RATE_NO_REPARENT , reg, +CLK_SET_RATE_PARENT , reg, data->shift,SUNXI_MUX_GATE_WIDTH ,0 , &clk_lock);
Signature · 1 line
2.1.4
Maxime Ripard
AppliedPATCH 2/17 clk: sunxi: Propagate rate changes to parent for mux clocks
Quoted 10 lines · Chen-Yu Tsai
The cpu clock on sunxi machines is just a mux clock, which is normally fed by the main PLL, but can be muxed to the main or low power oscillator.
Make the mux clock propagate rate changes to its parent, so we can change the clock rate of the PLL, and thus actually implement rate changing on the cpu clock.
This patch also removes the no reparenting limit.
Signed-off-by Chen-Yu Tsai <[email protected]>
Applied, 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/20150106/2182b9dc/attachment.sig>
PATCH 3/17 Input: sun4i-ts: Add thermal zone sensor support
In reply to Chen-Yu TsaiThe 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.
--- .../bindings/input/touchscreen/sun4i.txt | 1 + drivers/input/touchscreen/sun4i-ts.c | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +1 -0
@@ -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
drivers/input/touchscreen/sun4i-ts.c +27 -0
@@ -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,6 +182,23 @@ static void sun4i_ts_close(struct input_dev *dev)writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC ); } +static int get_temp (void *data,long *temp) +{ +struct sun4i_ts_data *ts = data; + +/* No temp_data until the first irq */ +if (ts->temp_data ==-1 ) +return -EAGAIN ; + + *temp = (ts->temp_data -1447 ) *100 ; + +return 0 ; +} + +static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = { + .get_temp = get_temp, +}; +static ssize_t show_temp (struct device *dev,struct device_attribute *devattr,char *buf) {
@@ -288,6 +307,11 @@ static int sun4i_ts_probe(struct platform_device *pdev)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) {
@@ -310,6 +334,9 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); +if (ts->tz) +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
PATCH 3/17 Input: sun4i-ts: Add thermal zone sensor support
Hello Chen-Yu,
Quoted 17 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../bindings/input/touchscreen/sun4i.txt | 1 + drivers/input/touchscreen/sun4i-ts.c | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt Required properties: · line 9
Quoted 5 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +1
-0@@ -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
You may want to update your Example section too, below. Example:
rtp: rtp at 01c25000 {
compatible = "allwinner,sun4i-a10-ts";
reg = <0x01c25000 0x100>;
interrupts = <29>;
allwinner,ts-attached;
#thermal-sensor-cells = <0>;
};Quoted 26 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Optional properties: - allwinner,ts-attached: boolean indicating that an actual touchscreen isdrivers/input/touchscreen/sun4i-ts.c +2
-0@@ -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,6 +182,23 @@ static void sun4i_ts_close(struct input_dev *dev)writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC ); }
drivers/input/touchscreen/sun4i-ts.c static void sun4i_ts_close(struct input_dev *dev) · line 194
Quoted 10 lines
drivers/input/touchscreen/sun4i-ts.c +10
-0+static int get_temp (void *data,long *temp) +{ +struct sun4i_ts_data *ts = data; + +/* No temp_data until the first irq */ +if (ts->temp_data ==-1 ) +return -EAGAIN ; + + *temp = (ts->temp_data -1447 ) *100 ; +
Care to explain the formula in a simple comment?
Quoted 12 lines
drivers/input/touchscreen/sun4i-ts.c +7
-0+return 0 ; +} + +static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = { + .get_temp = get_temp, +}; +static ssize_t show_temp (struct device *dev,struct device_attribute *devattr,char *buf) {@@ -288,6 +307,11 @@ static int sun4i_ts_probe(struct platform_device *pdev)if (IS_ERR (hwmon))
drivers/input/touchscreen/sun4i-ts.c static int sun4i_ts_probe(struct platform_device *pdev) · line 317
Quoted 10 lines
drivers/input/touchscreen/sun4i-ts.c +5
-0return 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) {
here.. if input_register_device fails, you will keep an orphan thermal zone registered in your system:
error = input_register_device(ts->input);
if (error) {
writel(0, ts->base + TP_INT_FIFOC);
return error;
}
...Quoted 13 lines
drivers/input/touchscreen/sun4i-ts.c +3
-0@@ -310,6 +334,9 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); +if (ts->tz) +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/20150106/3f91471b/attachment.sig>
PATCH 3/17 Input: sun4i-ts: Add thermal zone sensor support
Hi,
Quoted 30 lines · Eduardo Valentin
Hello Chen-Yu,
Quoted 17 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../bindings/input/touchscreen/sun4i.txt | 1 + drivers/input/touchscreen/sun4i-ts.c | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Documentation/devicetree/bindings/input/touchscreen/sun4i.txt Required properties: · line 9
Quoted 5 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +1
-0@@ -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 0You may want to update your Example section too, below. Example:
Quoted 7 lines
rtp: rtp at 01c25000 {
compatible = "allwinner,sun4i-a10-ts";
reg = <0x01c25000 0x100>;
interrupts = <29>;
allwinner,ts-attached;
#thermal-sensor-cells = <0>;
};Ok.
Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Optional properties: - allwinner,ts-attached: boolean indicating that an actual touchscreen isdrivers/input/touchscreen/sun4i-ts.c +2
-0@@ -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,6 +182,23 @@ static void sun4i_ts_close(struct input_dev *dev)writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC ); }
Quoted 12 lines
drivers/input/touchscreen/sun4i-ts.c static void sun4i_ts_close(struct input_dev *dev) · line 194
Quoted 10 lines
drivers/input/touchscreen/sun4i-ts.c +10
-0+static int get_temp (void *data,long *temp) +{ +struct sun4i_ts_data *ts = data; + +/* No temp_data until the first irq */ +if (ts->temp_data ==-1 ) +return -EAGAIN ; + + *temp = (ts->temp_data -1447 ) *100 ; +Care to explain the formula in a simple comment?
This was just copied from the hwmon section. AFAIK there is no documentation for the formula. It was probably copied from Allwinner's SDK code.
Hans? Do you remember where you got this?
Quoted 21 lines
Quoted 21 lines
drivers/input/touchscreen/sun4i-ts.c +12
-0+return 0 ; +} + +static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = { + .get_temp = get_temp, +}; +static ssize_t show_temp (struct device *dev,struct device_attribute *devattr,char *buf) {@@ -288,6 +307,11 @@ static int sun4i_ts_probe(struct platform_device *pdev)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 );
Quoted 8 lines
drivers/input/touchscreen/sun4i-ts.c static int sun4i_ts_probe(struct platform_device *pdev) · line 317
Quoted 1 line
drivers/input/touchscreen/sun4i-ts.c +0
-0if (ts_attached) {here.. if
input_register_devicefails, you will keep an orphan thermal zone registered in your system:error = input_register_device(ts->input); if (error) { writel(0, ts->base + TP_INT_FIFOC);
Will add an unregister call here.
Thanks for the review.
ChenYu
Quoted 18 lines
return error; } ...Quoted 13 lines
drivers/input/touchscreen/sun4i-ts.c +3
-1@@ -310,6 +334,9 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); +if (ts->tz) +thermal_zone_of_sensor_unregister (ts->dev, ts->tz); +/* Deactivate all IRQs */ writel (0 , ts->base +TP_INT_FIFOC ); --2.1.4
PATCH 3/17 Input: sun4i-ts: Add thermal zone sensor support
Quoted 84 lines · Chen-Yu Tsai
Hi,
Quoted 30 lines · Eduardo Valentin
Hello Chen-Yu,
Quoted 17 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../bindings/input/touchscreen/sun4i.txt | 1 + drivers/input/touchscreen/sun4i-ts.c | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Documentation/devicetree/bindings/input/touchscreen/sun4i.txt Required properties: · line 9
Quoted 5 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +1
-0@@ -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 0You may want to update your Example section too, below. Example:
Quoted 7 lines
rtp: rtp at 01c25000 { compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; allwinner,ts-attached; #thermal-sensor-cells = <0>; };Ok.
Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Optional properties: - allwinner,ts-attached: boolean indicating that an actual touchscreen isdrivers/input/touchscreen/sun4i-ts.c +2
-0@@ -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,6 +182,23 @@ static void sun4i_ts_close(struct input_dev *dev)writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC ); }Quoted 12 lines
drivers/input/touchscreen/sun4i-ts.c static void sun4i_ts_close(struct input_dev *dev) · line 194
Quoted 10 lines
drivers/input/touchscreen/sun4i-ts.c +10
-0+static int get_temp (void *data,long *temp) +{ +struct sun4i_ts_data *ts = data; + +/* No temp_data until the first irq */ +if (ts->temp_data ==-1 ) +return -EAGAIN ; + + *temp = (ts->temp_data -1447 ) *100 ; +Care to explain the formula in a simple comment?
Quoted 4 lines
This was just copied from the hwmon section. AFAIK there is no documentation for the formula. It was probably copied from Allwinner's SDK code.
Hans? Do you remember where you got this?
So this is from the AXP209 datasheet. The Allwinner SoC datasheets don't mention the formula to calculate the temperature. But since Allwinner and X-powers are affiliated, it's possible they use the same formula.
http://comments.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/3838
Quoted 55 lines
Quoted 21 lines
Quoted 21 lines
drivers/input/touchscreen/sun4i-ts.c +12
-0+return 0 ; +} + +static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = { + .get_temp = get_temp, +}; +static ssize_t show_temp (struct device *dev,struct device_attribute *devattr,char *buf) {@@ -288,6 +307,11 @@ static int sun4i_ts_probe(struct platform_device *pdev)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 );Quoted 8 lines
drivers/input/touchscreen/sun4i-ts.c static int sun4i_ts_probe(struct platform_device *pdev) · line 317
Quoted 1 line
drivers/input/touchscreen/sun4i-ts.c +0
-0if (ts_attached) {here.. if
input_register_devicefails, you will keep an orphan thermal zone registered in your system:error = input_register_device(ts->input); if (error) { writel(0, ts->base + TP_INT_FIFOC);Will add an unregister call here.
Thanks for the review.
ChenYu
Quoted 18 lines
return error; } ...Quoted 13 lines
drivers/input/touchscreen/sun4i-ts.c +3
-1@@ -310,6 +334,9 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); +if (ts->tz) +thermal_zone_of_sensor_unregister (ts->dev, ts->tz); +/* Deactivate all IRQs */ writel (0 , ts->base +TP_INT_FIFOC ); --2.1.4
PATCH 3/17 Input: sun4i-ts: Add thermal zone sensor support
Quoted 88 lines · Chen-Yu Tsai
Quoted 87 lines · Chen-Yu Tsai
Hi,
Quoted 30 lines · Eduardo Valentin
Hello Chen-Yu,
Quoted 17 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../bindings/input/touchscreen/sun4i.txt | 1 + drivers/input/touchscreen/sun4i-ts.c | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Documentation/devicetree/bindings/input/touchscreen/sun4i.txt Required properties: · line 9
Quoted 5 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +1
-0@@ -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 0You may want to update your Example section too, below. Example:
Quoted 7 lines
rtp: rtp at 01c25000 { compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; allwinner,ts-attached; #thermal-sensor-cells = <0>; };Ok.
Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Optional properties: - allwinner,ts-attached: boolean indicating that an actual touchscreen isdrivers/input/touchscreen/sun4i-ts.c +2
-0@@ -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,6 +182,23 @@ static void sun4i_ts_close(struct input_dev *dev)writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC ); }Quoted 12 lines
drivers/input/touchscreen/sun4i-ts.c static void sun4i_ts_close(struct input_dev *dev) · line 194
Quoted 10 lines
drivers/input/touchscreen/sun4i-ts.c +10
-0+static int get_temp (void *data,long *temp) +{ +struct sun4i_ts_data *ts = data; + +/* No temp_data until the first irq */ +if (ts->temp_data ==-1 ) +return -EAGAIN ; + + *temp = (ts->temp_data -1447 ) *100 ; +Care to explain the formula in a simple comment?
This was just copied from the hwmon section. AFAIK there is no documentation for the formula. It was probably copied from Allwinner's SDK code.
Quoted 7 lines
Quoted 1 line
Hans? Do you remember where you got this?
So this is from the AXP209 datasheet. The Allwinner SoC datasheets don't mention the formula to calculate the temperature. But since Allwinner and X-powers are affiliated, it's possible they use the same formula.
http://comments.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/3838
Ok. We use in the thermal framework miliCelsius as the temperature unit. Can you make sure the resulting temperature is in miliCelsius?
Cheers,
Quoted 53 lines
Quoted 53 lines
Quoted 22 lines
Quoted 22 lines
drivers/input/touchscreen/sun4i-ts.c +12
-0+return 0 ; +} + +static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = { + .get_temp = get_temp, +}; +static ssize_t show_temp (struct device *dev,struct device_attribute *devattr,char *buf) {@@ -288,6 +307,11 @@ static int sun4i_ts_probe(struct platform_device *pdev)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 );Quoted 8 lines
drivers/input/touchscreen/sun4i-ts.c static int sun4i_ts_probe(struct platform_device *pdev) · line 317
Quoted 1 line
drivers/input/touchscreen/sun4i-ts.c +0
-0if (ts_attached) {here.. if
input_register_devicefails, you will keep an orphan thermal zone registered in your system:error = input_register_device(ts->input); if (error) { writel(0, ts->base + TP_INT_FIFOC);Will add an unregister call here.
Thanks for the review.
ChenYu
Quoted 15 lines
return error; } ...Quoted 10 lines
drivers/input/touchscreen/sun4i-ts.c +3
-0@@ -310,6 +334,9 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); +if (ts->tz) +thermal_zone_of_sensor_unregister (ts->dev, ts->tz); +/* Deactivate all IRQs */ writel (0 , ts->base +TP_INT_FIFOC );
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
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/20150109/5441b647/attachment.sig>
PATCH 3/17 Input: sun4i-ts: Add thermal zone sensor support
Quoted 91 lines · Eduardo Valentin
Quoted 90 lines · Chen-Yu Tsai
Quoted 88 lines · Chen-Yu Tsai
Hi,
Quoted 30 lines · Eduardo Valentin
Hello Chen-Yu,
Quoted 17 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../bindings/input/touchscreen/sun4i.txt | 1 + drivers/input/touchscreen/sun4i-ts.c | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Documentation/devicetree/bindings/input/touchscreen/sun4i.txt Required properties: · line 9
Quoted 5 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +1
-0@@ -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 0You may want to update your Example section too, below. Example:
Quoted 7 lines
rtp: rtp at 01c25000 { compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; allwinner,ts-attached; #thermal-sensor-cells = <0>; };Ok.
Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +0
-0Optional properties: - allwinner,ts-attached: boolean indicating that an actual touchscreen isdrivers/input/touchscreen/sun4i-ts.c +2
-0@@ -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,6 +182,23 @@ static void sun4i_ts_close(struct input_dev *dev)writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC ); }Quoted 12 lines
drivers/input/touchscreen/sun4i-ts.c static void sun4i_ts_close(struct input_dev *dev) · line 194
Quoted 10 lines
drivers/input/touchscreen/sun4i-ts.c +10
-0+static int get_temp (void *data,long *temp) +{ +struct sun4i_ts_data *ts = data; + +/* No temp_data until the first irq */ +if (ts->temp_data ==-1 ) +return -EAGAIN ; + + *temp = (ts->temp_data -1447 ) *100 ; +Care to explain the formula in a simple comment?
This was just copied from the hwmon section. AFAIK there is no documentation for the formula. It was probably copied from Allwinner's SDK code.
Hans? Do you remember where you got this?
Quoted 8 lines
Quoted 5 lines
So this is from the AXP209 datasheet. The Allwinner SoC datasheets don't mention the formula to calculate the temperature. But since Allwinner and X-powers are affiliated, it's possible they use the same formula.
http://comments.gmane.org/gmane.comp.hardware.netbook.arm.sunxi/3838
Ok. We use in the thermal framework miliCelsius as the temperature unit. Can you make sure the resulting temperature is in miliCelsius?
Yes the result is in miliCelsius.
Quoted 56 lines
Quoted 56 lines
Quoted 56 lines
Quoted 22 lines
Quoted 22 lines
drivers/input/touchscreen/sun4i-ts.c +12
-0+return 0 ; +} + +static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = { + .get_temp = get_temp, +}; +static ssize_t show_temp (struct device *dev,struct device_attribute *devattr,char *buf) {@@ -288,6 +307,11 @@ static int sun4i_ts_probe(struct platform_device *pdev)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 );Quoted 8 lines
drivers/input/touchscreen/sun4i-ts.c static int sun4i_ts_probe(struct platform_device *pdev) · line 317
Quoted 1 line
drivers/input/touchscreen/sun4i-ts.c +0
-0if (ts_attached) {here.. if
input_register_devicefails, you will keep an orphan thermal zone registered in your system:error = input_register_device(ts->input); if (error) { writel(0, ts->base + TP_INT_FIFOC);Will add an unregister call here.
Thanks for the review.
ChenYu
Quoted 18 lines
return error; } ...Quoted 13 lines
drivers/input/touchscreen/sun4i-ts.c +3
-1@@ -310,6 +334,9 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); +if (ts->tz) +thermal_zone_of_sensor_unregister (ts->dev, ts->tz); +/* Deactivate all IRQs */ writel (0 , ts->base +TP_INT_FIFOC ); --2.1.4
PATCH 4/17 ARM: dts: sunxi: Add dtsi for AXP209 PMIC
In reply to Chen-Yu TsaiThe 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.
--- arch/arm/boot/dts/axp209.dtsi | 87 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 arch/arm/boot/dts/axp209.dtsi
arch/arm/boot/dts/axp209.dtsi new file +87 -0
@@ -0,0 +1,87 @@ +/* + * 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 { + regulators { + /* Default work frequency for buck regulators */ + x-powers,dcdc-freq = <1500>; + + /* This section lists all the regulators */ + reg_dcdc2: dcdc2 { + }; + + reg_dcdc3: dcdc3 { + }; + + reg_ldo1: ldo1 { + /* LDO1 is a fixed output regulator */ + regulator-always-on; + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <1300000>; + }; + + reg_ldo2: ldo2 { + }; + + reg_ldo3: ldo3 { + }; + + reg_ldo4: ldo4 { + }; + + reg_ldo5: ldo5 { + }; + }; +};
Signature · 1 line
2.1.4
PATCH 4/17 ARM: dts: sunxi: Add dtsi for AXP209 PMIC
Hi,
Quoted 67 lines · 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/axp209.dtsi | 87 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 arch/arm/boot/dts/axp209.dtsiarch/arm/boot/dts/axp209.dtsi new file +51
-0@@ -0,0 +1,87 @@ +/* + * 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
arch/arm/boot/dts/axp209.dtsi line 61
Quoted 10 lines
arch/arm/boot/dts/axp209.dtsi new file +10
-0+ * http://www.x-powers.com/product/AXP20X.php + * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf + */ + +&axp209 { + regulators { + /* Default work frequency for buck regulators */ + x-powers,dcdc-freq = <1500>; + + /* This section lists all the regulators */
I don't think this comment is necessary.
Quoted 14 lines
arch/arm/boot/dts/axp209.dtsi new file +14
-0+ reg_dcdc2: dcdc2 { + }; + + reg_dcdc3: dcdc3 { + }; + + reg_ldo1: ldo1 { + /* LDO1 is a fixed output regulator */ + regulator-always-on; + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <1300000>; + }; + + reg_ldo2: ldo2 {
arch/arm/boot/dts/axp209.dtsi line 85
Quoted 10 lines
arch/arm/boot/dts/axp209.dtsi new file +10
-0+ }; + + reg_ldo3: ldo3 { + }; + + reg_ldo4: ldo4 { + }; + + reg_ldo5: ldo5 { + };
Some default names for the regulator would be great!
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/20150106/f7efc798/attachment.sig>
PATCH 4/17 ARM: dts: sunxi: Add dtsi for AXP209 PMIC
Hi,
Quoted 101 lines · Maxime Ripard
Hi,
Quoted 67 lines · 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.
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/axp209.dtsi | 87 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 arch/arm/boot/dts/axp209.dtsiarch/arm/boot/dts/axp209.dtsi new file +51
-0@@ -0,0 +1,87 @@ +/* + * 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 Chiparch/arm/boot/dts/axp209.dtsi line 61
Quoted 10 lines
arch/arm/boot/dts/axp209.dtsi new file +10
-0+ * http://www.x-powers.com/product/AXP20X.php + * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf + */ + +&axp209 { + regulators { + /* Default work frequency for buck regulators */ + x-powers,dcdc-freq = <1500>; + + /* This section lists all the regulators */I don't think this comment is necessary.
Quoted 18 lines
arch/arm/boot/dts/axp209.dtsi new file +18
-0+ reg_dcdc2: dcdc2 { + }; + + reg_dcdc3: dcdc3 { + }; + + reg_ldo1: ldo1 { + /* LDO1 is a fixed output regulator */ + regulator-always-on; + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <1300000>; + }; + + reg_ldo2: ldo2 { + }; + + reg_ldo3: ldo3 { + };
Quoted 8 lines
arch/arm/boot/dts/axp209.dtsi line 85
Quoted 6 lines
arch/arm/boot/dts/axp209.dtsi new file +6
-0+ + reg_ldo4: ldo4 { + }; + + reg_ldo5: ldo5 { + };Some default names for the regulator would be great!
Default names are already given through the regulator driver. They are full uppercase names, like in the datasheet.
I could add lowercase names here for the default.
ChenYu
PATCH 5/17 ARM: dts: sunxi: Enable thermal sensor support for RTP on sun[457]i
In reply to Chen-Yu TsaiNow that the resistive touchpanel driver supports thermal sensors, add the "#thermal-sensor-cells" property as required by the thermal framework.
--- arch/arm/boot/dts/sun4i-a10.dtsi | 1 + arch/arm/boot/dts/sun5i-a10s.dtsi | 1 + arch/arm/boot/dts/sun5i-a13.dtsi | 1 + arch/arm/boot/dts/sun7i-a20.dtsi | 1 + 4 files changed, 4 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +1 -0
@@ -712,6 +712,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; + #thermal-sensor-cells = <0>; }; uart0: serial at 01c28000 {
arch/arm/boot/dts/sun5i-a10s.dtsi +1 -0
@@ -535,6 +535,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; + #thermal-sensor-cells = <0>; }; uart0: serial at 01c28000 {
arch/arm/boot/dts/sun5i-a13.dtsi +1 -0
@@ -469,6 +469,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; + #thermal-sensor-cells = <0>; }; uart1: serial at 01c28400 {
arch/arm/boot/dts/sun7i-a20.dtsi +1 -0
@@ -926,6 +926,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <0 29 4>; + #thermal-sensor-cells = <0>; }; uart0: serial at 01c28000 {
Signature · 1 line
2.1.4
PATCH 5/17 ARM: dts: sunxi: Enable thermal sensor support for RTP on sun[457]i
Quoted 5 lines · Chen-Yu Tsai
Now that the resistive touchpanel driver supports thermal sensors, add the "#thermal-sensor-cells" property as required by the thermal framework.
Signed-off-by Chen-Yu Tsai <[email protected]>
Quoted 58 lines
--- arch/arm/boot/dts/sun4i-a10.dtsi | 1 + arch/arm/boot/dts/sun5i-a10s.dtsi | 1 + arch/arm/boot/dts/sun5i-a13.dtsi | 1 + arch/arm/boot/dts/sun7i-a20.dtsi | 1 + 4 files changed, 4 insertions(+)arch/arm/boot/dts/sun4i-a10.dtsi +1
-0@@ -712,6 +712,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; + #thermal-sensor-cells = <0>; }; uart0: serial at 01c28000 {arch/arm/boot/dts/sun5i-a10s.dtsi +1
-0@@ -535,6 +535,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; + #thermal-sensor-cells = <0>; }; uart0: serial at 01c28000 {arch/arm/boot/dts/sun5i-a13.dtsi +1
-0@@ -469,6 +469,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; + #thermal-sensor-cells = <0>; }; uart1: serial at 01c28400 {arch/arm/boot/dts/sun7i-a20.dtsi +1
-0@@ -926,6 +926,7 @@ compatible = "allwinner,sun4i-a10-ts"; reg = <0x01c25000 0x100>; interrupts = <0 29 4>; + #thermal-sensor-cells = <0>; }; uart0: serial at 01c28000 {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/20150106/d93ec1a3/attachment.sig>
Maxime Ripard
AppliedPATCH 5/17 ARM: dts: sunxi: Enable thermal sensor support for RTP on sun[457]i
In reply to Chen-Yu TsaiQuoted 5 lines · Chen-Yu Tsai
Now that the resistive touchpanel driver supports thermal sensors, add the "#thermal-sensor-cells" property as required by the thermal framework.
Signed-off-by Chen-Yu Tsai <[email protected]>
Applied, 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/20150106/6ba7e47b/attachment.sig>
PATCH 6/17 ARM: dts: sun7i: Add cpu clock reference and operating points to dtsi
In reply to Chen-Yu TsaiThe cpu core is clocked from the "cpu" clock. Add a reference to it in the first cpu node. Also add "cpu0" label to the node.
The operating points were taken from the A20 FEX files in the sunxi-boards repository. Not all boards have the same settings. The settings in this patch are the most generic ones.
--- arch/arm/boot/dts/sun7i-a20.dtsi | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun7i-a20.dtsi +17 -1
@@ -82,10 +82,26 @@ #address-cells = <1>; #size-cells = <0>; - cpu at 0 { + cpu0: cpu at 0 { compatible = "arm,cortex-a7"; device_type = "cpu"; reg = <0>; + clocks = <&cpu>; + clock-latency = <244144>; /* 8 32k periods */ + operating-points = < + /* kHz uV */ + 1008000 1450000 + 960000 1400000 + 912000 1400000 + 864000 1300000 + 720000 1200000 + 528000 1100000 + 312000 1000000 + 144000 900000 + >; + #cooling-cells = <2>; + cooling-min-level = <0>; + cooling-max-level = <7>; }; cpu at 1 {
Signature · 1 line
2.1.4
Maxime Ripard
AppliedPATCH 6/17 ARM: dts: sun7i: Add cpu clock reference and operating points to dtsi
Quoted 8 lines · Chen-Yu Tsai
The cpu core is clocked from the "cpu" clock. Add a reference to it in the first cpu node. Also add "cpu0" label to the node.
The operating points were taken from the A20 FEX files in the sunxi-boards repository. Not all boards have the same settings. The settings in this patch are the most generic ones.
Signed-off-by Chen-Yu Tsai <[email protected]>
Applied, 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/20150106/b70a5fc1/attachment.sig>
PATCH 7/17 ARM: dts: sun7i: Add cpu thermal zones to dtsi
In reply to Chen-Yu TsaiThe core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).
--- arch/arm/boot/dts/sun7i-a20.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +32 -0
@@ -111,6 +111,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 (-1) (-1)>; + }; + }; + + 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
PATCH 7/17 ARM: dts: sun7i: Add cpu thermal zones to dtsi
Quoted 17 lines · Chen-Yu Tsai
The core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/sun7i-a20.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)arch/arm/boot/dts/sun7i-a20.dtsi +1
-0@@ -111,6 +111,38 @@ }; }; + thermal-zones {
arch/arm/boot/dts/sun7i-a20.dtsi line 124
Quoted 10 lines
arch/arm/boot/dts/sun7i-a20.dtsi +10
-0+ cpu_thermal { + /* milliseconds */ + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&rtp>; + + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&cpu0 (-1) (-1)>;
Could you please:
+#include <dt-bindings/thermal/thermal.h>
and
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
?
Quoted 27 lines
arch/arm/boot/dts/sun7i-a20.dtsi +21
-0+ }; + }; + + 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
-------------- 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/20150106/43e80cde/attachment.sig>
PATCH 8/17 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes
In reply to Chen-Yu TsaiThis 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.
--- arch/arm/boot/dts/axp209.dtsi | 4 ++++ arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 35 +++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)
arch/arm/boot/dts/axp209.dtsi +4 -0
@@ -54,6 +54,10 @@ */ &axp209 { + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; + regulators { /* Default work frequency for buck regulators */ x-powers,dcdc-freq = <1500>;
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +31 -4
@@ -84,13 +84,9 @@ status = "okay"; axp209: pmic at 34 { - compatible = "x-powers,axp209"; reg = <0x34>; interrupt-parent = <&nmi_intc>; interrupts = <0 8>; - - interrupt-controller; - #interrupt-cells = <1>; }; };
@@ -141,3 +137,34 @@ status = "okay"; }; }; + +/include/ "axp209.dtsi" + +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1450000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "vdd-int-dll"; +}; + +®_ldo1 { + regulator-name = "vdd-rtc"; +}; + +®_ldo2 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "avcc"; +};
Signature · 1 line
2.1.4
PATCH 8/17 ARM: dts: sun7i: cubieboard2: add axp209 regulator nodes
Hi,
Quoted 25 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.Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/axp209.dtsi | 4 ++++ arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 35 +++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-)arch/arm/boot/dts/axp209.dtsi +0
-0
arch/arm/boot/dts/axp209.dtsi line 60
Quoted 7 lines
arch/arm/boot/dts/axp209.dtsi +4
-0@@ -54,6 +54,10 @@ */ &axp209 { + compatible = "x-powers,axp209"; + interrupt-controller; + #interrupt-cells = <1>; +
This should be in your patch adding the AXP DTSI.
Quoted 22 lines
arch/arm/boot/dts/axp209.dtsi +0
-0regulators { /* Default work frequency for buck regulators */ x-powers,dcdc-freq = <1500>;arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +0
-4@@ -84,13 +84,9 @@ status = "okay"; axp209: pmic at 34 { - compatible = "x-powers,axp209"; reg = <0x34>; interrupt-parent = <&nmi_intc>; interrupts = <0 8>; - - interrupt-controller; - #interrupt-cells = <1>; }; };
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts line 141
Quoted 5 lines
arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +2
-0@@ -141,3 +137,34 @@ status = "okay"; }; }; + +/include/ "axp209.dtsi"
We've switched to preprocessor includes, please use them instead.
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/20150106/c2eb17ee/attachment.sig>
PATCH 9/17 ARM: dts: sun7i: cubietruck: add axp209 regulator nodes
In reply to Chen-Yu TsaiThis 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.
--- 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
@@ -126,13 +126,9 @@ status = "okay"; axp209: pmic at 34 { - compatible = "x-powers,axp209"; reg = <0x34>; interrupt-parent = <&nmi_intc>; interrupts = <0 8>; - - interrupt-controller; - #interrupt-cells = <1>; }; };
@@ -218,3 +214,34 @@ gpio = <&pio 7 9 0>; }; }; + +/include/ "axp209.dtsi" + +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1450000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "vdd-int-dll"; +}; + +®_ldo1 { + regulator-name = "vdd-rtc"; +}; + +®_ldo2 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "avcc"; +};
Signature · 1 line
2.1.4
PATCH 10/17 ARM: dts: sun5i: Add cpu clock reference and operating points to dtsi
In reply to Chen-Yu TsaiThe cpu core is clocked from the "cpu" clock. Add a reference to it in the first cpu node. Also add "cpu0" label to the node.
The operating points were taken from the A13 FEX files in the sunxi-boards repository. All FEX files have the same settings.
--- arch/arm/boot/dts/sun5i-a13.dtsi | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun5i-a13.dtsi +17 -1
@@ -24,10 +24,26 @@ cpus { #address-cells = <1>; #size-cells = <0>; - cpu at 0 { + + cpu0: cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a8"; reg = <0x0>; + clocks = <&cpu>; + clock-latency = <244144>; /* 8 32k periods */ + operating-points = < + /* kHz uV */ + 1104000 1500000 + 1008000 1400000 + 912000 1350000 + 864000 1300000 + 624000 1200000 + 576000 1200000 + 432000 1200000 + >; + #cooling-cells = <2>; + cooling-min-level = <0>; + cooling-max-level = <6>; }; };
Signature · 1 line
2.1.4
PATCH 11/17 ARM: dts: sun5i: Add cpu thermal zones to dtsi
In reply to Chen-Yu TsaiThe core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).
--- arch/arm/boot/dts/sun5i-a13.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm/boot/dts/sun5i-a13.dtsi +32 -0
@@ -47,6 +47,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 (-1) (-1)>; + }; + }; + + 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
PATCH 11/17 ARM: dts: sun5i: Add cpu thermal zones to dtsi
Quoted 17 lines · Chen-Yu Tsai
The core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/sun5i-a13.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)arch/arm/boot/dts/sun5i-a13.dtsi +1
-0@@ -47,6 +47,38 @@ }; }; + thermal-zones {
arch/arm/boot/dts/sun5i-a13.dtsi line 60
Quoted 10 lines
arch/arm/boot/dts/sun5i-a13.dtsi +10
-0+ cpu_thermal { + /* milliseconds */ + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&rtp>; + + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&cpu0 (-1) (-1)>;
same
Could you please:
+#include <dt-bindings/thermal/thermal.h>
and
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
?
Quoted 27 lines
arch/arm/boot/dts/sun5i-a13.dtsi +21
-0+ }; + }; + + 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
-------------- 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/20150106/f78fded6/attachment.sig>
PATCH 12/17 ARM: dts: sun5i: hsg-h702: add axp209 regulator nodes
In reply to Chen-Yu TsaiThis 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.
--- 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
@@ -65,11 +65,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 = <®_vcc5v0>; + usb1_vbus-supply = <®_ldo3>; status = "okay"; };
@@ -102,11 +98,8 @@ status = "okay"; axp209: pmic at 34 { - compatible = "x-powers,axp209"; reg = <0x34>; interrupts = <0>; - interrupt-controller; - #interrupt-cells = <1>; }; };
@@ -128,3 +121,40 @@ }; }; }; + +/include/ "axp209.dtsi" + +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1500000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "vdd-int-dll"; +}; + +®_ldo1 { + regulator-name = "vdd-rtc"; +}; + +®_ldo2 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "avcc"; +}; + +®_ldo3 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi"; +};
Signature · 1 line
2.1.4
PATCH 13/17 ARM: dts: sun4i: Add cpu clock reference and operating points to dtsi
In reply to Chen-Yu TsaiThe cpu core is clocked from the "cpu" clock. Add a reference to it in the first cpu node. Also add "cpu0" label to the node.
The operating points were taken from the A10 FEX files in the sunxi-boards repository. All FEX files have the same settings.
--- arch/arm/boot/dts/sun4i-a10.dtsi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun4i-a10.dtsi +14 -1
@@ -44,10 +44,23 @@ cpus { #address-cells = <1>; #size-cells = <0>; - cpu at 0 { + cpu0: cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a8"; reg = <0x0>; + clocks = <&cpu>; + clock-latency = <244144>; /* 8 32k periods */ + operating-points = < + /* kHz uV */ + 1056000 1500000 + 1008000 1400000 + 912000 1350000 + 864000 1300000 + 624000 1250000 + >; + #cooling-cells = <2>; + cooling-min-level = <0>; + cooling-max-level = <4>; }; };
Signature · 1 line
2.1.4
PATCH 14/17 ARM: dts: sun4i: Add cpu thermal zones to dtsi
In reply to Chen-Yu TsaiThe core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).
--- arch/arm/boot/dts/sun4i-a10.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +32 -0
@@ -64,6 +64,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 (-1) (-1)>; + }; + }; + + 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
PATCH 14/17 ARM: dts: sun4i: Add cpu thermal zones to dtsi
Quoted 17 lines · Chen-Yu Tsai
The core temperature sensor now supports thermal zones. Add a thermal zone mapping for the cpus with passive cooling (cpufreq throttling).
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/boot/dts/sun4i-a10.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)arch/arm/boot/dts/sun4i-a10.dtsi +1
-0@@ -64,6 +64,38 @@ }; }; + thermal-zones {
arch/arm/boot/dts/sun4i-a10.dtsi line 77
Quoted 10 lines
arch/arm/boot/dts/sun4i-a10.dtsi +10
-0+ cpu_thermal { + /* milliseconds */ + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&rtp>; + + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&cpu0 (-1) (-1)>;
same
Could you please:
+#include <dt-bindings/thermal/thermal.h>
and
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
?
Quoted 27 lines
arch/arm/boot/dts/sun4i-a10.dtsi +21
-0+ }; + }; + + 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
-------------- 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/20150106/dc0232f6/attachment-0001.sig>
PATCH 15/17 ARM: dts: sun4i: cubieboard: add axp209 regulator nodes
In reply to Chen-Yu TsaiThis 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.
--- 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
@@ -134,12 +134,8 @@ status = "okay"; axp209: pmic at 34 { - compatible = "x-powers,axp209"; reg = <0x34>; interrupts = <0>; - - interrupt-controller; - #interrupt-cells = <1>; }; };
@@ -185,3 +181,34 @@ status = "okay"; }; }; + +/include/ "axp209.dtsi" + +&cpu0 { + cpu-supply = <®_dcdc2>; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1450000>; + regulator-name = "vdd-cpu"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "vdd-int-dll"; +}; + +®_ldo1 { + regulator-name = "vdd-rtc"; +}; + +®_ldo2 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "avcc"; +};
Signature · 1 line
2.1.4
PATCH 16/17 ARM: sunxi_defconfig: Enable TOUCHSCREEN_SUN4I, CPUFREQ_DT, CPU_THERMAL
In reply to Chen-Yu TsaiThis patch enables TOUCHSCREEN_SUN4I, CPUFREQ_DT, and CPU_THERMAL to enable cpufreq support with passive cpu cooling (thermal throttling) by default.
--- arch/arm/configs/sunxi_defconfig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/configs/sunxi_defconfig +6 -1
@@ -9,6 +9,8 @@ CONFIG_HIGHMEM=y CONFIG_HIGHPTE=y CONFIG_ARM_APPENDED_DTB=y CONFIG_ARM_ATAG_DTB_COMPAT=y +CONFIG_CPU_FREQ=y +CONFIG_CPUFREQ_DT=y CONFIG_VFP=y CONFIG_NEON=y CONFIG_PM=y
@@ -54,6 +56,8 @@ CONFIG_STMMAC_ETH=y # CONFIG_INPUT_MOUSEDEV is not set # CONFIG_INPUT_KEYBOARD is not set # CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_SUN4I=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_NR_UARTS=8
@@ -71,7 +75,8 @@ CONFIG_GPIO_SYSFS=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_SUN6I=y -# CONFIG_HWMON is not set +CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y CONFIG_WATCHDOG=y CONFIG_SUNXI_WATCHDOG=y CONFIG_MFD_AXP20X=y
Signature · 1 line
2.1.4
PATCH 16/17 ARM: sunxi_defconfig: Enable TOUCHSCREEN_SUN4I, CPUFREQ_DT, CPU_THERMAL
Quoted 5 lines · Chen-Yu Tsai
This patch enables
TOUCHSCREEN_SUN4I,CPUFREQ_DT, andCPU_THERMALto enable cpufreq support with passive cpu cooling (thermal throttling) by default.Signed-off-by Chen-Yu Tsai <[email protected]>
For the thermal part:
Quoted 39 lines
--- arch/arm/configs/sunxi_defconfig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)arch/arm/configs/sunxi_defconfig +6
-1@@ -9,6 +9,8 @@ CONFIG_HIGHMEM=y CONFIG_HIGHPTE=y CONFIG_ARM_APPENDED_DTB=y CONFIG_ARM_ATAG_DTB_COMPAT=y +CONFIG_CPU_FREQ=y +CONFIG_CPUFREQ_DT=y CONFIG_VFP=y CONFIG_NEON=y CONFIG_PM=y@@ -54,6 +56,8 @@ CONFIG_STMMAC_ETH=y # CONFIG_INPUT_MOUSEDEV is not set # CONFIG_INPUT_KEYBOARD is not set # CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_SUN4I=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_NR_UARTS=8@@ -71,7 +75,8 @@ CONFIG_GPIO_SYSFS=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_SUN6I=y -# CONFIG_HWMON is not set +CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y CONFIG_WATCHDOG=y CONFIG_SUNXI_WATCHDOG=y CONFIG_MFD_AXP20X=ySignature · 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/20150106/b14c1176/attachment.sig>
Maxime Ripard
AppliedPATCH 16/17 ARM: sunxi_defconfig: Enable TOUCHSCREEN_SUN4I, CPUFREQ_DT, CPU_THERMAL
In reply to Chen-Yu TsaiQuoted 5 lines · Chen-Yu Tsai
This patch enables
TOUCHSCREEN_SUN4I,CPUFREQ_DT, andCPU_THERMALto enable cpufreq support with passive cpu cooling (thermal throttling) by default.Signed-off-by Chen-Yu Tsai <[email protected]>
Applied, 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/20150106/334f594f/attachment-0001.sig>
PATCH 17/17 ARM: multi_v7_defconfig: Enable TOUCHSCREEN_SUN4I, CPU_THERMAL
In reply to Chen-Yu TsaiThis patch enables TOUCHSCREEN_SUN4I and CPU_THERMAL to enable cpufreq support with passive cpu cooling (thermal throttling) on sunxi by default.
--- arch/arm/configs/multi_v7_defconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/configs/multi_v7_defconfig +2 -0
@@ -189,6 +189,7 @@ CONFIG_MOUSE_PS2_ELANTECH=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ATMEL_MXT=y CONFIG_TOUCHSCREEN_STMPE=y +CONFIG_TOUCHSCREEN_SUN4I=y CONFIG_INPUT_MISC=y CONFIG_INPUT_MPU3050=y CONFIG_SERIO_AMBAKMI=y
@@ -267,6 +268,7 @@ CONFIG_POWER_RESET_SUN6I=y CONFIG_SENSORS_LM90=y CONFIG_SENSORS_LM95245=y CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y CONFIG_ARMADA_THERMAL=y CONFIG_ST_THERMAL_SYSCFG=y CONFIG_ST_THERMAL_MEMMAP=y
Signature · 1 line
2.1.4
PATCH 17/17 ARM: multi_v7_defconfig: Enable TOUCHSCREEN_SUN4I, CPU_THERMAL
Quoted 4 lines · Chen-Yu Tsai
This patch enables
TOUCHSCREEN_SUN4IandCPU_THERMALto enable cpufreq support with passive cpu cooling (thermal throttling) on sunxi by default.Signed-off-by Chen-Yu Tsai <[email protected]>
for the CPU_THERMAL
Quoted 27 lines
--- arch/arm/configs/multi_v7_defconfig | 2 ++ 1 file changed, 2 insertions(+)arch/arm/configs/multi_v7_defconfig +2
-0@@ -189,6 +189,7 @@ CONFIG_MOUSE_PS2_ELANTECH=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_TOUCHSCREEN_ATMEL_MXT=y CONFIG_TOUCHSCREEN_STMPE=y +CONFIG_TOUCHSCREEN_SUN4I=y CONFIG_INPUT_MISC=y CONFIG_INPUT_MPU3050=y CONFIG_SERIO_AMBAKMI=y@@ -267,6 +268,7 @@ CONFIG_POWER_RESET_SUN6I=y CONFIG_SENSORS_LM90=y CONFIG_SENSORS_LM95245=y CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y CONFIG_ARMADA_THERMAL=y CONFIG_ST_THERMAL_SYSCFG=y CONFIG_ST_THERMAL_MEMMAP=ySignature · 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/20150106/5c411822/attachment.sig>
Maxime Ripard
AppliedPATCH 17/17 ARM: multi_v7_defconfig: Enable TOUCHSCREEN_SUN4I, CPU_THERMAL
In reply to Chen-Yu TsaiQuoted 4 lines · Chen-Yu Tsai
This patch enables
TOUCHSCREEN_SUN4IandCPU_THERMALto enable cpufreq support with passive cpu cooling (thermal throttling) on sunxi by default.Signed-off-by Chen-Yu Tsai <[email protected]>
Applied, 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/20150106/b04f3a59/attachment-0001.sig>