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
--
2.1.4
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.
Signed-off-by: Chen-Yu Tsai <redacted>
---
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(-)
@@ -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
@@ -180,16 +182,48 @@ static void sun4i_ts_close(struct input_dev *dev)writel(TEMP_IRQ_EN(1),ts->base+TP_INT_FIFOC);}+staticintget_temp(conststructsun4i_ts_data*ts,long*temp)+{+/* No temp_data until the first irq */+if(ts->temp_data==-1)+return-EAGAIN;++/*+*Theusermanualsdonotcontaintheformulaforcalculating+*thetemperature.TheformulausedhereisfromtheAXP209,+*whichisdesignedbyX-Powers,anaffiliateofAllwinner:+*+*temperature=-144.7+(value*0.1)+*+*Thisshouldbereplacedwiththecorrectoneifsuchinformation+*becomesavailable.+*/+*temp=(ts->temp_data-1447)*100;++return0;+}++staticintget_tz_temp(void*data,long*temp)+{+returnget_temp(data,temp);+}++staticstructthermal_zone_of_device_opssun4i_ts_tz_ops={+.get_temp=get_tz_temp,+};+staticssize_tshow_temp(structdevice*dev,structdevice_attribute*devattr,char*buf){structsun4i_ts_data*ts=dev_get_drvdata(dev);+longtemp;+intret;-/* No temp_data until the first irq */-if(ts->temp_data==-1)-return-EAGAIN;+ret=get_temp(ts,&temp);+if(ret)+returnret;-returnsprintf(buf,"%d\n",(ts->temp_data-1447)*100);+returnsprintf(buf,"%ld\n",temp);}staticssize_tshow_temp_label(structdevice*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);+/*+*ThethermalcoredoesnotregisterhwmondevicesforDT-based+*thermalzonesensors,suchasthisone.+*/hwmon=devm_hwmon_device_register_with_groups(ts->dev,"sun4i_ts",ts,sun4i_ts_groups);if(IS_ERR(hwmon))returnPTR_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);returnerror;}}
@@ -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);
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 <redacted>
---
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
@@ -0,0 +1,97 @@+/*+*Copyright2015Chen-YuTsai+*+*Chen-YuTsai<wens@csie.org>+*+*Thisfileisdual-licensed:youcanuseiteitherundertheterms+*oftheGPLortheX11license,atyouroption.Notethatthisdual+*licensingonlyappliestothisfile,andnotthisprojectasa+*whole.+*+*a)Thisfileisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicenseas+*publishedbytheFreeSoftwareFoundation;eitherversion2ofthe+*License,or(atyouroption)anylaterversion.+*+*Thisfileisdistributedinthehopethatitwillbeuseful,+*butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe+*GNUGeneralPublicLicenseformoredetails.+*+*YoushouldhavereceivedacopyoftheGNUGeneralPublic+*Licensealongwiththisfile;ifnot,writetotheFree+*SoftwareFoundation,Inc.,51FranklinSt,FifthFloor,Boston,+*MA02110-1301USA+*+*Or,alternatively,+*+*b)Permissionisherebygranted,freeofcharge,toanyperson+*obtainingacopyofthissoftwareandassociateddocumentation+*files(the"Software"),todealintheSoftwarewithout+*restriction,includingwithoutlimitationtherightstouse,+*copy,modify,merge,publish,distribute,sublicense,and/or+*sellcopiesoftheSoftware,andtopermitpersonstowhomthe+*Softwareisfurnishedtodoso,subjecttothefollowing+*conditions:+*+*Theabovecopyrightnoticeandthispermissionnoticeshallbe+*includedinallcopiesorsubstantialportionsoftheSoftware.+*+*THESOFTWAREISPROVIDED"AS IS",WITHOUTWARRANTYOFANYKIND,+*EXPRESSORIMPLIED,INCLUDINGBUTNOTLIMITEDTOTHEWARRANTIES+*OFMERCHANTABILITY,FITNESSFORAPARTICULARPURPOSEAND+*NONINFRINGEMENT.INNOEVENTSHALLTHEAUTHORSORCOPYRIGHT+*HOLDERSBELIABLEFORANYCLAIM,DAMAGESOROTHERLIABILITY,+*WHETHERINANACTIONOFCONTRACT,TORTOROTHERWISE,ARISING+*FROM,OUTOFORINCONNECTIONWITHTHESOFTWAREORTHEUSEOR+*OTHERDEALINGSINTHESOFTWARE.+*/++/*+*AXP202/209IntegratedPowerManagementChip+*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";+};+};+};
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 <redacted>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
---
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(+)
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 <redacted>
---
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(-)
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 <redacted>
---
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(-)
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 <redacted>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
---
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(+)
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.
Signed-off-by: Chen-Yu Tsai <redacted>
---
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(-)
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 <redacted>
---
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(+)
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 <redacted>
---
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(-)
From: Maxime Ripard <hidden> Date: 2015-01-12 09:06:03
Hi Chen-Yu,
On Mon, Jan 12, 2015 at 12:34:04PM +0800, Chen-Yu Tsai wrote:
quoted hunk
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 <redacted>
---
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(-)
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
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
From: Maxime Ripard <hidden> Date: 2015-01-12 09:10:20
On Mon, Jan 12, 2015 at 12:34:00PM +0800, Chen-Yu Tsai wrote:
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.
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
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Hi,
On Mon, Jan 12, 2015 at 5:06 PM, Maxime Ripard
[off-list ref] wrote:
Hi Chen-Yu,
On Mon, Jan 12, 2015 at 12:34:04PM +0800, Chen-Yu Tsai wrote:
quoted
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 <redacted>
---
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(-)
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.
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
On Mon, Jan 12, 2015 at 12:34:01PM +0800, Chen-Yu Tsai wrote:
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.
Signed-off-by: Chen-Yu Tsai <redacted>
Acked-by: Eduardo Valentin <edubezval@gmail.com>
quoted hunk
---
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(-)
@@ -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
@@ -180,16 +182,48 @@ static void sun4i_ts_close(struct input_dev *dev)writel(TEMP_IRQ_EN(1),ts->base+TP_INT_FIFOC);}+staticintget_temp(conststructsun4i_ts_data*ts,long*temp)+{+/* No temp_data until the first irq */+if(ts->temp_data==-1)+return-EAGAIN;++/*+*Theusermanualsdonotcontaintheformulaforcalculating+*thetemperature.TheformulausedhereisfromtheAXP209,+*whichisdesignedbyX-Powers,anaffiliateofAllwinner:+*+*temperature=-144.7+(value*0.1)+*+*Thisshouldbereplacedwiththecorrectoneifsuchinformation+*becomesavailable.+*/+*temp=(ts->temp_data-1447)*100;++return0;+}++staticintget_tz_temp(void*data,long*temp)+{+returnget_temp(data,temp);+}++staticstructthermal_zone_of_device_opssun4i_ts_tz_ops={+.get_temp=get_tz_temp,+};+staticssize_tshow_temp(structdevice*dev,structdevice_attribute*devattr,char*buf){structsun4i_ts_data*ts=dev_get_drvdata(dev);+longtemp;+intret;-/* No temp_data until the first irq */-if(ts->temp_data==-1)-return-EAGAIN;+ret=get_temp(ts,&temp);+if(ret)+returnret;-returnsprintf(buf,"%d\n",(ts->temp_data-1447)*100);+returnsprintf(buf,"%ld\n",temp);}staticssize_tshow_temp_label(structdevice*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);+/*+*ThethermalcoredoesnotregisterhwmondevicesforDT-based+*thermalzonesensors,suchasthisone.+*/hwmon=devm_hwmon_device_register_with_groups(ts->dev,"sun4i_ts",ts,sun4i_ts_groups);if(IS_ERR(hwmon))returnPTR_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);returnerror;}}
@@ -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);
From: Maxime Ripard <hidden> Date: 2015-01-13 09:40:36
Hi,
On Mon, Jan 12, 2015 at 05:38:12PM +0800, Chen-Yu Tsai wrote:
Hi,
On Mon, Jan 12, 2015 at 5:06 PM, Maxime Ripard
[off-list ref] wrote:
quoted
Hi Chen-Yu,
On Mon, Jan 12, 2015 at 12:34:04PM +0800, Chen-Yu Tsai wrote:
quoted
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 <redacted>
---
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(-)
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.
Hmm, yes, ok. It makes sense.
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
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.
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
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
On Tue, Jan 13, 2015 at 5:40 PM, Maxime Ripard
[off-list ref] wrote:
Hi,
On Mon, Jan 12, 2015 at 05:38:12PM +0800, Chen-Yu Tsai wrote:
quoted
Hi,
On Mon, Jan 12, 2015 at 5:06 PM, Maxime Ripard
[off-list ref] wrote:
quoted
Hi Chen-Yu,
On Mon, Jan 12, 2015 at 12:34:04PM +0800, Chen-Yu Tsai wrote:
quoted
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 <redacted>
---
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(-)
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.
Hmm, yes, ok. It makes sense.
IPSOUT and the battery stuff should be revisited once we have
a power supply driver.
quoted
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
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.
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 = <®_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
From: Maxime Ripard <hidden> Date: 2015-01-13 13:53:12
On Mon, Jan 12, 2015 at 10:10:20AM +0100, Maxime Ripard wrote:
On Mon, Jan 12, 2015 at 12:34:00PM +0800, Chen-Yu Tsai wrote:
quoted
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.
Applied 2, 3, 6 and 8.
And I just applied 4, 5, 7 and 9.
Thanks!
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
From: Maxime Ripard <hidden> Date: 2015-01-14 19:30:08
On Tue, Jan 13, 2015 at 06:30:51PM +0800, Chen-Yu Tsai wrote:
quoted
quoted
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
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.
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 = <®_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
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com