Exynos5422 odroidxu3 pwm-fan control using thermal sensors
Subsystems (4)
This work depeds upon work done by Lukasz Majewski <[email protected]>
and Sjoerd Simons <[email protected]> regarding the pwm-fan.
-Anand Moon
PATCH 1/6 ARM: dts :exynos5422-odroidxu3 Add pwm-fan node to the Odroid-XU3 board.
Add pwm-fan node to the OdroidXU3 board.
Tested on OdroidXU3 board.
--- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/boot/dts/exynos5422-odroidxu3.dts +16 -0
@@ -278,6 +278,15 @@ rtc at 101E0000 { status = "okay"; }; + + fan0: pwm-fan { + compatible = "pwm-fan"; + pwms = <&pwm 0 20972 0>; + cooling-min-state = <0>; + cooling-max-state = <3>; + #cooling-cells = <2>; + cooling-levels = <0 90 130 170 230>; + }; }; &hdmi {
@@ -369,3 +378,10 @@ shunt-resistor = <10000>; }; }; + +&pwm { + pinctrl-0 = <&pwm0_out>; + pinctrl-names = "default"; + samsung,pwm-outputs = <0>; + status = "okay"; +};
Signature · 1 line
1.9.1
Re: [PATCH 1/6] ARM: dts :exynos5422-odroidxu3 Add pwm-fan node to the Odroid-XU3 board.
Hi Anand,
Quoted 30 lines
Add pwm-fan node to the OdroidXU3 board.
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsindex a519c86..eaec006 100644 ---a/arch/arm/boot/dts/exynos5422-odroidxu3.dts+++b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsarch/arm/boot/dts/exynos5422-odroidxu3.dts +9
-0@@ -278,6 +278,15 @@ rtc at 101E0000 { status = "okay"; }; + + fan0: pwm-fan { + compatible = "pwm-fan"; + pwms = <&pwm 0 20972 0>; + cooling-min-state = <0>; + cooling-max-state = <3>; + #cooling-cells = <2>; + cooling-levels = <0 90 130 170 230>; + }; }; &hdmi {
arch/arm/boot/dts/exynos5422-odroidxu3.dts line 387
Quoted 10 lines
arch/arm/boot/dts/exynos5422-odroidxu3.dts +7
-0@@ -369,3 +378,10 @@ shunt-resistor = <10000>; }; }; + +&pwm { + pinctrl-0 = <&pwm0_out>; + pinctrl-names = "default"; + samsung,pwm-outputs = <0>; + status = "okay"; +};
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 2/6 ARM: dts exynos5420 update the cooling cells for core cpu0
In reply to Anand Moonupdate the cooling level for cpu0 to avoid following message.
root at odroidxu3:~# dmesg | grep ther
[ 0.241511] /thermal-zones/cpu-thermal/cooling-maps/map0: could not get #cooling-cells for /cpus/cpu at 0
--- arch/arm/boot/dts/exynos5420.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/exynos5420.dtsi +4 -0
@@ -61,6 +61,10 @@ reg = <0x0>; clock-frequency = <1800000000>; cci-control-port = <&cci_control1>; + + cooling-min-level = <10>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu1: cpu at 1 {
Signature · 1 line
1.9.1
Re: [PATCH 2/6] ARM: dts exynos5420 update the cooling cells for core cpu0
Hi Anand,
Quoted 16 lines
update the cooling level for cpu0 to avoid following message.
root at odroidxu3:~# dmesg | grep ther
[ 0.241511] /thermal-zones/cpu-thermal/cooling-maps/map0: could not get #cooling-cells for /cpus/cpu at 0Signed-off-by Anand Moon <[email protected]>--- arch/arm/boot/dts/exynos5420.dtsi | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5420.dtsiindex c0e98cf..6b49f3c 100644
arch/arm/boot/dts/exynos5420.dtsi line 70
Quoted 10 lines
arch/arm/boot/dts/exynos5420.dtsi +4
-0@@ -61,6 +61,10 @@ reg = <0x0>; clock-frequency = <1800000000>; cci-control-port = <&cci_control1>; + + cooling-min-level = <10>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu1: cpu at 1 {
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 3/6 ARM:dts exynos5422 Update the thermal sensor for tmu_cpu0
In reply to Anand MoonMove the registration of thermal sensors for tmu_cpu0 from exynos5420.dtsi to exynos5-cpu-thermal.dtsi, to avoid duplicate registration of the sensors.
Tested on OdroidXU3 board.
--- arch/arm/boot/dts/exynos5-cpu-thermal.dtsi | 58 ++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5420.dtsi | 4 --- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 1 + 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 arch/arm/boot/dts/exynos5-cpu-thermal.dtsi
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +58 -0
@@ -0,0 +1,58 @@ +/* + * Device tree sources for Exynos5 thermal zone + * + * Copyright (c) 2014 Lukasz Majewski <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include <dt-bindings/thermal/thermal.h> + +/ { + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmu_cpu0>; + polling-delay-passive = <0>; + polling-delay = <0>; + trips { + cpu_alert0: cpu-alert-0 { + temperature = <48000>; /* ms */ + hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_alert1: cpu-alert-1 { + temperature = <53000>; /* ms */ + hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_alert2: cpu-alert-2 { + temperature = <59000>; /* ms */ + hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_crit0: cpu-crit-0 { + temperature = <75000>; /* ms */ + hysteresis = <0>; /* ms */ + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&fan0 0 1>; + }; + map1 { + trip = <&cpu_alert1>; + cooling-device = <&fan0 1 2>; + }; + map2 { + trip = <&cpu_alert2>; + cooling-device = <&fan0 2 3>; + }; + }; + }; + }; +};
arch/arm/boot/dts/exynos5420.dtsi +0 -4
@@ -827,10 +827,6 @@ }; thermal-zones { - cpu0_thermal: cpu0-thermal { - thermal-sensors = <&tmu_cpu0>; - #include "exynos5420-trip-points.dtsi" - }; cpu1_thermal: cpu1-thermal { thermal-sensors = <&tmu_cpu1>; #include "exynos5420-trip-points.dtsi"
arch/arm/boot/dts/exynos5422-odroidxu3.dts +1 -0
@@ -12,6 +12,7 @@ /dts-v1/; #include "exynos5800.dtsi" +#include "exynos5-cpu-thermal.dtsi" / { model = "Hardkernel Odroid XU3";
Signature · 1 line
1.9.1
Re: [PATCH 3/6] ARM:dts exynos5422 Update the thermal sensor for tmu_cpu0
Hi Anand,
Quoted 21 lines
Move the registration of thermal sensors for
tmu_cpu0fromexynos5420.dtsitoexynos5-cpu-thermal.dtsi, to avoid duplicate registration of the sensors.Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- arch/arm/boot/dts/exynos5-cpu-thermal.dtsi | 58 ++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5420.dtsi | 4 --- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 1 + 3 files changed, 59insertions(+), 4 deletions(-) create mode 100644
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5-cpu-thermal.dtsinew file mode 100644 index 0000000..8fede70
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 4
Quoted 4 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0@@ -0,0 +1,58 @@ +/* + * Device tree sources for Exynos5 thermal zone + * + * Copyright (c) 2014 Lukasz Majewski <[email protected]>
^^^^^^^^^^^^^^^^ Could you update this line :-). I'm just reviewer here :-)
Quoted 20 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ * + * This program is free software; you can redistribute it and/ormodify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +12
-0+ +#include <dt-bindings/thermal/thermal.h> + +/ { + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmu_cpu0>; + polling-delay-passive = <0>; + polling-delay = <0>; + trips { + cpu_alert0: cpu-alert-0 { + temperature = <48000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi
Quoted 1 line
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +1
-0+ hysteresis = <3000>; /* ms */
^^^^^^^^^
We already have "millicelsius" instead od ms
Quoted 17 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0+ type = "active"; + }; + cpu_alert1: cpu-alert-1 { + temperature = <53000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_alert2: cpu-alert-2 { + temperature = <59000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_crit0: cpu-crit-0 { + temperature = <75000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 39
Quoted 2 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ hysteresis = <0>; /* ms */ + type = "critical";
Is there any special reasons why we need special values for cpu0_thermal sensor at XU3? Is something wrong with default values defined at exynos4-cpu-thermal.dtsi?
If this is Odroid XU3 specific, then IMHO it should be added to exynos5422-odroidxu3.dts
Quoted 24 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +19
-0+ }; + }; + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&fan0 0 1>; + }; + map1 { + trip = <&cpu_alert1>; + cooling-device = <&fan0 1 2>; + }; + map2 { + trip = <&cpu_alert2>; + cooling-device = <&fan0 2 3>; + }; + }; + }; + }; +};(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5420.dtsiindex 6b49f3c..eb0f16c 100644
arch/arm/boot/dts/exynos5420.dtsi line 832
Quoted 6 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-3@@ -827,10 +827,6 @@ }; thermal-zones { - cpu0_thermal: cpu0-thermal { - thermal-sensors = <&tmu_cpu0>; - #include "exynos5420-trip-points.dtsi"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
arch/arm/boot/dts/exynos5422-odroidxu3.dts line 15
Quoted 13 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-1- }; cpu1_thermal: cpu1-thermal { thermal-sensors = <&tmu_cpu1>; #include "exynos5420-trip-points.dtsi"(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsindex eaec006..c8b3e3e 100644 ---a/arch/arm/boot/dts/exynos5422-odroidxu3.dts+++b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsarch/arm/boot/dts/exynos5422-odroidxu3.dts +1
-0@@ -12,6 +12,7 @@ /dts-v1/; #include "exynos5800.dtsi" +#include "exynos5-cpu-thermal.dtsi"
I would prefer to stick to convention proposed at [1]. It keeps the locality of the include with respective thermal zone.
arch/arm/boot/dts/exynos5422-odroidxu3.dts line 18
Quoted 3 lines
arch/arm/boot/dts/exynos5422-odroidxu3.dts +0
-0/ { model = "Hardkernel Odroid XU3";
DTS changes should be added to Samsung tree by Samsung maintainer - Mr. Kukjin Kim.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 3/6] ARM:dts exynos5422 Update the thermal sensor for tmu_cpu0
Hi Lukasz,
On Odroidxu3 board critical temp is 85.0 C. Below is the sensors output.
therm_zone0-virtual-0
Adapter: Virtual device
temp1: +39.0??C (crit = +85.0??C)
temp2: +38.0??C (crit = +85.0??C)
temp3: +40.0??C (crit = +85.0??C)
temp4: +49.0??C (crit = +85.0??C)
temp5: +29.0??C (crit = +85.0??C)
I have observed cpu shutdown as we do test pm-qa thermal testing.
So I propose the temperature values to be 50000, 65000 ,80000 and 85000 Critical temperature.
Please share your thoughts.
-Anand Moon
Quoted 145 lines · Lukasz Majewski
Hi Anand,
Quoted 21 lines
Move the registration of thermal sensors for
tmu_cpu0fromexynos5420.dtsitoexynos5-cpu-thermal.dtsi, to avoid duplicate registration of the sensors.Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- arch/arm/boot/dts/exynos5-cpu-thermal.dtsi | 58 ++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5420.dtsi | 4 --- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 1 + 3 files changed, 59insertions(+), 4 deletions(-) create mode 100644
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5-cpu-thermal.dtsinew file mode 100644 index 0000000..8fede70arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 4
Quoted 4 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0@@ -0,0 +1,58 @@ +/* + * Device tree sources for Exynos5 thermal zone + * + * Copyright (c) 2014 Lukasz Majewski <[email protected]>^^^^^^^^^^^^^^^^ Could you update this line :-). I'm just reviewer here :-)
Quoted 19 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ * + * This program is free software; you can redistribute it and/ormodify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +12
-0+ +#include <dt-bindings/thermal/thermal.h> + +/ { + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmu_cpu0>; + polling-delay-passive = <0>; + polling-delay = <0>; + trips { + cpu_alert0: cpu-alert-0 { + temperature = <48000>; /* msQuoted 2 lines
*/
+ hysteresis = <3000>; /* ms */^^^^^^^^^
We already have "millicelsius" instead od msQuoted 17 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0+ type = "active"; + }; + cpu_alert1: cpu-alert-1 { + temperature = <53000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_alert2: cpu-alert-2 { + temperature = <59000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_crit0: cpu-crit-0 { + temperature = <75000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 39
Quoted 2 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ hysteresis = <0>; /* ms */ + type = "critical";Is there any special reasons why we need special values for
cpu0_thermalsensor at XU3? Is something wrong with default values defined atexynos4-cpu-thermal.dtsi?If this is Odroid XU3 specific, then IMHO it should be added to
exynos5422-odroidxu3.dtsQuoted 24 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +19
-0+ }; + }; + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&fan0 0 1>; + }; + map1 { + trip = <&cpu_alert1>; + cooling-device = <&fan0 1 2>; + }; + map2 { + trip = <&cpu_alert2>; + cooling-device = <&fan0 2 3>; + }; + }; + }; + }; +};(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5420.dtsiindex 6b49f3c..eb0f16c 100644arch/arm/boot/dts/exynos5420.dtsi line 832
Quoted 6 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-3@@ -827,10 +827,6 @@ }; thermal-zones { - cpu0_thermal: cpu0-thermal { - thermal-sensors = <&tmu_cpu0>; - #include "exynos5420-trip-points.dtsi"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]arch/arm/boot/dts/exynos5422-odroidxu3.dts line 15
Quoted 13 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-1- }; cpu1_thermal: cpu1-thermal { thermal-sensors = <&tmu_cpu1>; #include "exynos5420-trip-points.dtsi"(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsindex eaec006..c8b3e3e 100644 ---a/arch/arm/boot/dts/exynos5422-odroidxu3.dts+++b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsarch/arm/boot/dts/exynos5422-odroidxu3.dts +1
-0@@ -12,6 +12,7 @@ /dts-v1/; #include "exynos5800.dtsi" +#include "exynos5-cpu-thermal.dtsi"I would prefer to stick to convention proposed at [1]. It keeps the locality of the include with respective thermal zone.
arch/arm/boot/dts/exynos5422-odroidxu3.dts line 18
Quoted 3 lines
arch/arm/boot/dts/exynos5422-odroidxu3.dts +0
-0/ { model = "Hardkernel Odroid XU3";DTS changes should be added to Samsung tree by Samsung maintainer - Mr. Kukjin Kim.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 3/6] ARM:dts exynos5422 Update the thermal sensor for tmu_cpu0
Hi Anand,
Quoted 4 lines
Hi Lukasz,
On Odroidxu3 board critical temp is 85.0 C. Below is the sensors output.
Do you have XU3 with a fan?
Quoted 9 lines
therm_zone0-virtual-0
Adapter: Virtual device
temp1: +39.0??C (crit = +85.0??C)
temp2: +38.0??C (crit = +85.0??C)
temp3: +40.0??C (crit = +85.0??C)
temp4: +49.0??C (crit = +85.0??C)
temp5: +29.0??C (crit = +85.0??C)
Quoted 5 lines
I have observed cpu shutdown as we do test pm-qa thermal testing.
So I propose the temperature values to be 50000, 65000 ,80000 and 85000 Critical temperature.
This seems strange - since other Samsung's SoC have higher work temperatures (both exynos5 and exynos4).
I will try to check those thresholds on my XU3. Have anybody else experienced overheating at XU3?
Sjoerd? Kukjin?
Quoted 158 lines
Please share your thoughts.
-Anand Moon
Quoted 141 lines · Lukasz Majewski
Hi Anand,
Quoted 21 lines
Move the registration of thermal sensors for
tmu_cpu0fromexynos5420.dtsitoexynos5-cpu-thermal.dtsi, to avoid duplicate registration of the sensors.Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- arch/arm/boot/dts/exynos5-cpu-thermal.dtsi | 58 ++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5420.dtsi | 4 --- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 1 + 3 files changed,59 insertions(+), 4 deletions(-) create mode 100644
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5-cpu-thermal.dtsinew file mode 100644 index 0000000..8fede70arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 4
Quoted 4 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0@@ -0,0 +1,58 @@ +/* + * Device tree sources for Exynos5 thermal zone + * + * Copyright (c) 2014 Lukasz Majewski <[email protected]>^^^^^^^^^^^^^^^^ Could you update this line :-). I'm just reviewer here :-)
Quoted 20 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ * + * This program is free software; you can redistribute it and/ormodify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +12
-0+ +#include <dt-bindings/thermal/thermal.h> + +/ { + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmu_cpu0>; + polling-delay-passive = <0>; + polling-delay = <0>; + trips { + cpu_alert0: cpu-alert-0 { + temperature = <48000>; /* msQuoted 2 lines
*/
+ hysteresis = <3000>; /* ms */^^^^^^^^^ We alreadyhave "millicelsius"
instead od
msQuoted 17 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0+ type = "active"; + }; + cpu_alert1: cpu-alert-1 { + temperature = <53000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_alert2: cpu-alert-2 { + temperature = <59000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_crit0: cpu-crit-0 { + temperature = <75000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 39
Quoted 2 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ hysteresis = <0>; /* ms */ + type = "critical";Is there any special reasons why we need special
values forcpu0_thermalsensor at XU3? Is something wrong with
default values defined atexynos4-cpu-thermal.dtsi?If this is Odroid XU3 specific, then IMHO it should
be added toexynos5422-odroidxu3.dtsQuoted 24 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +19
-0+ }; + }; + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&fan0 0 1>; + }; + map1 { + trip = <&cpu_alert1>; + cooling-device = <&fan0 1 2>; + }; + map2 { + trip = <&cpu_alert2>; + cooling-device = <&fan0 2 3>; + }; + }; + }; + }; +};(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5420.dtsiindex 6b49f3c..eb0f16c 100644arch/arm/boot/dts/exynos5420.dtsi line 832
Quoted 6 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-3@@ -827,10 +827,6 @@ }; thermal-zones { - cpu0_thermal: cpu0-thermal { - thermal-sensors = <&tmu_cpu0>; - #include "exynos5420-trip-points.dtsi"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]arch/arm/boot/dts/exynos5422-odroidxu3.dts line 15
Quoted 13 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-1- }; cpu1_thermal: cpu1-thermal { thermal-sensors = <&tmu_cpu1>; #include "exynos5420-trip-points.dtsi"(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsindex eaec006..c8b3e3e 100644 ---a/arch/arm/boot/dts/exynos5422-odroidxu3.dts+++b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsarch/arm/boot/dts/exynos5422-odroidxu3.dts +1
-0@@ -12,6 +12,7 @@ /dts-v1/; #include "exynos5800.dtsi" +#include "exynos5-cpu-thermal.dtsi"I would prefer to stick to convention proposed at [1]. It keeps the locality of the include with respective thermal zone.
arch/arm/boot/dts/exynos5422-odroidxu3.dts line 18
Quoted 3 lines
arch/arm/boot/dts/exynos5422-odroidxu3.dts +0
-0/ { model = "Hardkernel Odroid XU3";DTS changes should be added to Samsung tree by Samsung maintainer - Mr. Kukjin Kim.
Quoted 6 lines
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
_______________________________________________
linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 3/6] ARM:dts exynos5422 Update the thermal sensor for tmu_cpu0
Hi Lukasz,
I have Odroidxu3 board with fan. Odroid xu3 board and run on high temperature.
As per my understating as the sensors temperature cross the first alert it triggers fan to run.
I was doing some stress testing to trigger this overheating with my changes.
-Anand Moon
Quoted 199 lines · Lukasz Majewski
Hi Anand,
Quoted 4 lines
Hi Lukasz,
On Odroidxu3 board critical temp is 85.0 C. Below is the sensors output.
Do you have XU3 with a fan?
Quoted 9 lines
therm_zone0-virtual-0
Adapter: Virtual device
temp1: +39.0??C (crit = +85.0??C)
temp2: +38.0??C (crit = +85.0??C)
temp3: +40.0??C (crit = +85.0??C)
temp4: +49.0??C (crit = +85.0??C)
temp5: +29.0??C (crit = +85.0??C)Quoted 5 lines
I have observed cpu shutdown as we do test pm-qa thermal testing.
So I propose the temperature values to be 50000, 65000 ,80000 and 85000 Critical temperature.
This seems strange - since other Samsung's SoC have higher work temperatures (both exynos5 and exynos4).
I will try to check those thresholds on my XU3. Have anybody else experienced overheating at XU3?
Sjoerd? Kukjin?
Quoted 150 lines
Please share your thoughts.
-Anand Moon
Quoted 144 lines · Lukasz Majewski
Hi Anand,
Quoted 21 lines
Move the registration of thermal sensors for
tmu_cpu0fromexynos5420.dtsitoexynos5-cpu-thermal.dtsi, to avoid duplicate registration of the sensors.Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- arch/arm/boot/dts/exynos5-cpu-thermal.dtsi | 58 ++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5420.dtsi | 4 --- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 1 + 3 files changed,59 insertions(+), 4 deletions(-) create mode 100644
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5-cpu-thermal.dtsinew file mode 100644 index 0000000..8fede70arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 4
Quoted 4 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0@@ -0,0 +1,58 @@ +/* + * Device tree sources for Exynos5 thermal zone + * + * Copyright (c) 2014 Lukasz Majewski <[email protected]>^^^^^^^^^^^^^^^^ Could you update this line :-). I'm just reviewer here :-)
Quoted 20 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ * + * This program is free software; you can redistribute it and/ormodify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +12
-0+ +#include <dt-bindings/thermal/thermal.h> + +/ { + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmu_cpu0>; + polling-delay-passive = <0>; + polling-delay = <0>; + trips { + cpu_alert0: cpu-alert-0 { + temperature = <48000>; /* msQuoted 2 lines
*/
+ hysteresis = <3000>; /* ms */^^^^^^^^^ We alreadyhave "millicelsius"
instead od
msQuoted 17 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +4
-0+ type = "active"; + }; + cpu_alert1: cpu-alert-1 { + temperature = <53000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_alert2: cpu-alert-2 { + temperature = <59000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +5
-0+ hysteresis = <3000>; /* ms */ + type = "active"; + }; + cpu_crit0: cpu-crit-0 { + temperature = <75000>; /* ms*/
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi line 39
Quoted 2 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +2
-0+ hysteresis = <0>; /* ms */ + type = "critical";Is there any special reasons why we need special
values forcpu0_thermalsensor at XU3? Is something wrong with
default values defined atexynos4-cpu-thermal.dtsi?If this is Odroid XU3 specific, then IMHO it should
be added toexynos5422-odroidxu3.dtsQuoted 24 lines
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +19
-0+ }; + }; + cooling-maps { + map0 { + trip = <&cpu_alert0>; + cooling-device = <&fan0 0 1>; + }; + map1 { + trip = <&cpu_alert1>; + cooling-device = <&fan0 1 2>; + }; + map2 { + trip = <&cpu_alert2>; + cooling-device = <&fan0 2 3>; + }; + }; + }; + }; +};(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5420.dtsiindex 6b49f3c..eb0f16c 100644arch/arm/boot/dts/exynos5420.dtsi line 832
Quoted 6 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-3@@ -827,10 +827,6 @@ }; thermal-zones { - cpu0_thermal: cpu0-thermal { - thermal-sensors = <&tmu_cpu0>; - #include "exynos5420-trip-points.dtsi"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]arch/arm/boot/dts/exynos5422-odroidxu3.dts line 15
Quoted 13 lines
arch/arm/boot/dts/exynos5420.dtsi +0
-1- }; cpu1_thermal: cpu1-thermal { thermal-sensors = <&tmu_cpu1>; #include "exynos5420-trip-points.dtsi"(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsindex eaec006..c8b3e3e 100644 ---a/arch/arm/boot/dts/exynos5422-odroidxu3.dts+++b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsarch/arm/boot/dts/exynos5422-odroidxu3.dts +1
-0@@ -12,6 +12,7 @@ /dts-v1/; #include "exynos5800.dtsi" +#include "exynos5-cpu-thermal.dtsi"I would prefer to stick to convention proposed at [1]. It keeps the locality of the include with respective thermal zone.
arch/arm/boot/dts/exynos5422-odroidxu3.dts line 18
Quoted 3 lines
arch/arm/boot/dts/exynos5422-odroidxu3.dts +0
-0/ { model = "Hardkernel Odroid XU3";DTS changes should be added to Samsung tree by Samsung maintainer - Mr. Kukjin Kim.
--
Best regards,Quoted 8 lines
Quoted 3 lines
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
_______________________________________________
linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 4/6 ARM: dts: OdroidXU3: Enable TMU at Exynos5422 base.
In reply to Anand MoonThis commit enables TMU IP block on the Exynos5422 OdroidXU3 device.
Tested on OdroidXU3 board.
--- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
arch/arm/boot/dts/exynos5422-odroidxu3.dts +25 -0
@@ -288,6 +288,31 @@ #cooling-cells = <2>; cooling-levels = <0 90 130 170 230>; }; + + tmu at 10060000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; + + tmu at 10064000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; + + tmu at 10068000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; + + tmu at 1006c000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; + + tmu at 100a0000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; }; &hdmi {
Signature · 1 line
1.9.1
Re: [PATCH 4/6] ARM: dts: OdroidXU3: Enable TMU at Exynos5422 base.
Hi Anand,
Quoted 36 lines
This commit enables TMU IP block on the Exynos5422 OdroidXU3 device.
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- arch/arm/boot/dts/exynos5422-odroidxu3.dts | 25+++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsindex c8b3e3e..e1635b5 100644 ---a/arch/arm/boot/dts/exynos5422-odroidxu3.dts+++b/arch/arm/boot/dts/exynos5422-odroidxu3.dtsarch/arm/boot/dts/exynos5422-odroidxu3.dts +18
-0@@ -288,6 +288,31 @@ #cooling-cells = <2>; cooling-levels = <0 90 130 170 230>; }; + + tmu at 10060000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; + + tmu at 10064000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; + + tmu at 10068000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; + + tmu at 1006c000 { + vtmu-supply = <&ldo10_reg>;
arch/arm/boot/dts/exynos5422-odroidxu3.dts line 318
Quoted 10 lines
arch/arm/boot/dts/exynos5422-odroidxu3.dts +7
-0+ status = "okay"; + }; + + tmu at 100a0000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; }; &hdmi {
This seems correct. However please consider my comment to the previous patch.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 5/6 pwm: samsung: Fix output race on disabling
In reply to Anand MoonFrom: Sjoerd Simons <[email protected]>
When disabling the samsung PWM the output state remains at the level it was in the end of a pwm cycle. In other words, calling pwm_disable when at 100% duty will keep the output active, while at all other setting the output will go/stay inactive. On top of that the samsung PWM settings are double-buffered, which means the new settings only get applied at the start of a new PWM cycle.
This results in a race if the PWM is at 100% duty and a driver calls:
pwm_config (pwm, 0, period);
pwm_disable (pwm);
In this case the PWMs output will unexpectedly stay active, unless a new PWM cycle happened to start between the register writes in _config and _disable. As far as i can tell this is a regression introduced by 3bdf878, before that a call to pwm_config would call pwm_samsung_enable which, while heavy-handed, made sure the expected settings were live.
To resolve this, while not re-introducing the issues 3bdf878 (flickering as the PWM got reset while in a PWM cycle). Only force an update of the settings when at 100% duty, which shouldn't have a noticeable effect on the output but is enough to ensure the behaviour is as expected on disable.
--- drivers/pwm/pwm-samsung.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
drivers/pwm/pwm-samsung.c +30 -1
@@ -269,12 +269,31 @@ static void pwm_samsung_disable(struct pwm_chip *chip, struct pwm_device *pwm)spin_unlock_irqrestore (&samsung_pwm_lock, flags); } +static void pwm_samsung_manual_update (struct samsung_pwm_chip *chip, +struct pwm_device *pwm) +{ +unsigned int tcon_chan =to_tcon_channel (pwm->hwpwm); +u32 tcon; +unsigned long flags; + +spin_lock_irqsave (&samsung_pwm_lock, flags); + + tcon =readl (chip->base +REG_TCON ); + tcon |=TCON_MANUALUPDATE (tcon_chan); +writel (tcon, chip->base +REG_TCON ); + + tcon &= ~TCON_MANUALUPDATE (tcon_chan); +writel (tcon, chip->base +REG_TCON ); + +spin_unlock_irqrestore (&samsung_pwm_lock, flags); +} +static int pwm_samsung_config (struct pwm_chip *chip,struct pwm_device *pwm,int duty_ns,int period_ns) {struct samsung_pwm_chip *our_chip =to_samsung_pwm_chip (chip);struct samsung_pwm_channel *chan =pwm_get_chip_data (pwm); -u32 tin_ns = chan->tin_ns, tcnt, tcmp; +u32 tin_ns = chan->tin_ns, tcnt, tcmp, oldtcmp;/* * We currently avoid using 64bit arithmetic by using the
@@ -288,6 +307,7 @@ static int pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm,return 0 ; tcnt =readl (our_chip->base +REG_TCNTB (pwm->hwpwm)); + oldtcmp =readl (our_chip->base +REG_TCMPB (pwm->hwpwm));/* We need tick count for calculation, not last tick. */ ++tcnt;
@@ -335,6 +355,15 @@ static int pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm,writel (tcnt, our_chip->base +REG_TCNTB (pwm->hwpwm));writel (tcmp, our_chip->base +REG_TCMPB (pwm->hwpwm)); +/* In case the PWM is currently at 100% duty, force a manual update +* to prevent the signal staying high in the pwm is disabled shortly +* afer this update (before it autoreloaded the new values) . +*/ +if (oldtcmp == (u32) -1 ) { +dev_dbg (our_chip->chip.dev,"Forcing manual update" ); +pwm_samsung_manual_update (our_chip, pwm); + } + chan->period_ns = period_ns; chan->tin_ns = tin_ns; chan->duty_ns = duty_ns;
Signature · 1 line
1.9.1
Re: [PATCH 5/6] pwm: samsung: Fix output race on disabling
Hi Anand,
Quoted 83 lines
From: Sjoerd Simons <[email protected]>
When disabling the samsung PWM the output state remains at the level it was in the end of a pwm cycle. In other words, calling
pwm_disablewhen at 100% duty will keep the output active, while at all other setting the output will go/stay inactive. On top of that the samsung PWM settings are double-buffered, which means the new settings only get applied at the start of a new PWM cycle.This results in a race if the PWM is at 100% duty and a driver calls:
pwm_config(pwm, 0, period);
pwm_disable(pwm);In this case the PWMs output will unexpectedly stay active, unless a new PWM cycle happened to start between the register writes in
_configand_disable. As far as i can tell this is a regression introduced by 3bdf878, before that a call topwm_configwould callpwm_samsung_enablewhich, while heavy-handed, made sure the expected settings were live.To resolve this, while not re-introducing the issues 3bdf878 (flickering as the PWM got reset while in a PWM cycle). Only force an update of the settings when at 100% duty, which shouldn't have a noticeable effect on the output but is enough to ensure the behaviour is as expected on disable.
Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Anand Moon <[email protected]>--- drivers/pwm/pwm-samsung.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)drivers/pwm/pwm-samsung.c +19
-0@@ -269,12 +269,31 @@ static void pwm_samsung_disable(struct pwm_chip *chip, struct pwm_device *pwm)spin_unlock_irqrestore (&samsung_pwm_lock, flags); } +static void pwm_samsung_manual_update (struct samsung_pwm_chip *chip, +struct pwm_device *pwm) +{ +unsigned int tcon_chan =to_tcon_channel (pwm->hwpwm); +u32 tcon; +unsigned long flags; + +spin_lock_irqsave (&samsung_pwm_lock, flags); + + tcon =readl (chip->base +REG_TCON ); + tcon |=TCON_MANUALUPDATE (tcon_chan); +writel (tcon, chip->base +REG_TCON ); + + tcon &= ~TCON_MANUALUPDATE (tcon_chan); +writel (tcon, chip->base +REG_TCON ); + +spin_unlock_irqrestore (&samsung_pwm_lock, flags); +} +static int pwm_samsung_config (struct pwm_chip *chip,struct pwm_device *pwm,int duty_ns,int period_ns) { struct samsung_pwm_chip *our_chip =
to_samsung_pwm_chip(chip); structsamsung_pwm_channel*chan =pwm_get_chip_data(pwm);drivers/pwm/pwm-samsung.c +2
-1-u32 tin_ns = chan->tin_ns, tcnt, tcmp; +u32 tin_ns = chan->tin_ns, tcnt, tcmp, oldtcmp;/* * We currently avoid using 64bit arithmetic by using the @@ -288,6 +307,7 @@ static int pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm, return 0; tcnt =readl (our_chip->base +REG_TCNTB (pwm->hwpwm)); + oldtcmp =readl (our_chip->base +REG_TCMPB (pwm->hwpwm));/* We need tick count for calculation, not last tick. */ ++tcnt;@@ -335,6 +355,15 @@ static int pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm, writel(tcnt, our_chip->base +
REG_TCNTB(pwm->hwpwm));writel(tcmp, our_chip->base + REG_TCMPB(pwm->hwpwm));drivers/pwm/pwm-samsung.c +1
-0+/* In case the PWM is currently at 100% duty, force a manual
Quoted 1 line
update
Cosmetic comment:
Wasn't checkpatch complaining about this comment style? /* .....
* .....
instead of:
/*
* .....
* .....
drivers/pwm/pwm-samsung.c static int pwm_samsung_config(struct pwm_chip *chip, struct pwm_device *pwm, · line 369
Quoted 12 lines
drivers/pwm/pwm-samsung.c +1
-0+* to prevent the signal staying high in the pwm is disabled shortly
drivers/pwm/pwm-samsung.c +7
-0+* afer this update (before it autoreloaded the new values) . +*/ +if (oldtcmp == (u32) -1 ) { +dev_dbg (our_chip->chip.dev,"Forcing manual update" ); +pwm_samsung_manual_update (our_chip, pwm); + } + chan->period_ns = period_ns; chan->tin_ns = tin_ns; chan->duty_ns = duty_ns;
Despite the above,
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 5/6] pwm: samsung: Fix output race on disabling
Quoted 9 lines · Lukasz Majewski
Hi Anand,
Quoted 7 lines
From: Sjoerd Simons <[email protected]>
When disabling the samsung PWM the output state remains at the level it was in the end of a pwm cycle. In other words, callingpwm_disablewhen at 100% duty will keep the output active, while at all other setting the output will go/stay inactive. On top of that the samsung PWM settings are double-buffered, which means the new settings only get applied at the start of a new PWM cycle.
This patch is already in the linux-pwm for-next tree so should probably be dropped form this patchset to prevent conflicts.
Signature · 2 lines
Sjoerd Simons <[email protected]> Collabora Ltd.
Re: [PATCH 5/6] pwm: samsung: Fix output race on disabling
Hi Sjoerd,
Correct. Will do so. I just included in this series. As it relevant to my changes and testing.
-Anand Moon
Quoted 19 lines · Sjoerd Simons
Quoted 9 lines · Lukasz Majewski
Hi Anand,
Quoted 7 lines
From: Sjoerd Simons <[email protected]>
When disabling the samsung PWM the output state remains at the level it was in the end of a pwm cycle. In other words, callingpwm_disablewhen at 100% duty will keep the output active, while at all other setting the output will go/stay inactive. On top of that the samsung PWM settings are double-buffered, which means the new settings only get applied at the start of a new PWM cycle.This patch is already in the linux-pwm for-next tree so should probably be dropped form this patchset to prevent conflicts.
--
Sjoerd Simons <[email protected]>
Collabora Ltd.
PATCH 6/6 hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
In reply to Anand MoonBelow changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/
Update the pwm_config with duty then update the pwm_disable to poweroff the cpu fan.
Tested on OdroidXU3 board.
--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/hwmon/pwm-fan.c +4 -6
@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm)int ret =0 ;mutex_lock (&ctx->lock); +if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);
Signature · 1 line
1.9.1
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Hi Anand,
Quoted 38 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +4
-5@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;mutex_lock (&ctx->lock); +if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);
BTW: I've added Guenter to CC.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Guenter Roeck
maintainerRe: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Quoted 46 lines · Lukasz Majewski
Hi Anand,
Quoted 44 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +4
-5@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;mutex_lock (&ctx->lock); +if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; }
Quoted 9 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) · line 67
Quoted 4 lines
drivers/hwmon/pwm-fan.c +0
-1-exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
I don't have a copy of the original patch, so I can't apply it.
Guenter
Guenter Roeck
maintainerRe: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
In reply to Lukasz MajewskiQuoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.
Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
Guenter
Quoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;
Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +
[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Guenter Roeck
maintainerRe: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 87 lines
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 105 lines · Guenter Roeck
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 87 lines
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Hi Guenter/Lukasz,
Earlier I send v2 version of the patch spiking this one.
Markus Riechl came back to me with below mail.
So This patch confirms fixes the bug.
I will send v3 version of the patch. Earlier I was in delima about the bug.
-Anand Moon
-------------------------------------------
Hi Anand,
I tested your patch.
After booting the fan is spinning despite only 44?C.
/sys/class/thermal/cooling_device0/curstate is 0./sys/class/hwmon/hwmon4/pwm1 is 0
when I echo 1 > cur_state and then echo 0 > cur_state again, the fan switches to off and behaves as expected.
It looks like there is a bug in initializing the pwm output immediately after booting.
Best Regards,
--
Markus Reichl
Quoted 121 lines · Anand Moon
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 105 lines · Guenter Roeck
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 87 lines
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Hey Anand,
Quoted 17 lines · Anand Moon
Hi Guenter/Lukasz,
Earlier I send v2 version of the patch spiking this one.
Markus Riechl came back to me with below mail.
So This patch confirms fixes the bug.I will send v3 version of the patch. Earlier I was in delima about the bug.
-Anand Moon
-------------------------------------------
Hi Anand,I tested your patch.
After booting the fan is spinning despite only 44?C.
Quoted 8 lines
/sys/class/thermal/cooling_device0/curstateis 0./sys/class/hwmon/hwmon4/pwm1is 0when I echo 1 >
cur_stateand then echo 0 >cur_stateagain, the fan switches to off and behaves as expected.It looks like there is a bug in initializing the pwm output immediately after booting.
The problem here will be that at boot the PWM runs at full duty. With the current exynos PWM drive if you disable the PWM it will stop pulsing but remain high if it was at 100% duty. My patch on which you depend upon fixed a race where disabling the pwm right after changing the duty cycle (e.g. to 0%) also kept the signal high.
Quoted 1 line
From looking at other PWM users at the time it seemed that most if not
all always first set to duty to 0% and then disable the pwm. Which should work fine on exynos now. However iirc Thierry recently clarified that the expected result of pwm_disable is not just that the modulation stops but also that the output signal goes low, although that's not very explicit in the current pwm documentation.. The exynos PWM driver will need another fix tweak to make that true.
Quoted 129 lines
Best Regards,
--
Markus ReichlQuoted 121 lines · Anand Moon
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 105 lines · Guenter Roeck
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 87 lines
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Hi Sjoerd,
I don't much advance knowledge on internal signaling of pwm-samsung module.
So do I need to send this patch again ?
-Anand Moon
Quoted 176 lines · Sjoerd Simons
Hey Anand,
Quoted 17 lines · Anand Moon
Hi Guenter/Lukasz,
Earlier I send v2 version of the patch spiking this one.
Markus Riechl came back to me with below mail.
So This patch confirms fixes the bug.I will send v3 version of the patch. Earlier I was in delima about the bug.
-Anand Moon
-------------------------------------------
Hi Anand,I tested your patch.
After booting the fan is spinning despite only 44?C.
Quoted 8 lines
/sys/class/thermal/cooling_device0/curstateis 0./sys/class/hwmon/hwmon4/pwm1is 0when I echo 1 >
cur_stateand then echo 0 >cur_stateagain, the fan switches to off and behaves as expected.It looks like there is a bug in initializing the pwm output immediately after booting.
The problem here will be that at boot the PWM runs at full duty. With the current exynos PWM drive if you disable the PWM it will stop pulsing but remain high if it was at 100% duty. My patch on which you depend upon fixed a race where disabling the pwm right after changing the duty cycle (e.g. to 0%) also kept the signal high.
From looking at other PWM users at the time it seemed that most if not all always first set to duty to 0% and then disable the pwm. Which should work fine on exynos now. However iirc Thierry recently clarified that the expected result of
pwm_disableis not just that the modulation stops but also that the output signal goes low, although that's not very explicit in the current pwm documentation.. The exynos PWM driver will need another fix tweak to make that true.Quoted 129 lines
Best Regards,
--
Markus ReichlQuoted 121 lines · Anand Moon
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 105 lines · Guenter Roeck
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 87 lines
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Guenter Roeck
maintainerRe: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Quoted 6 lines · Anand Moon
Hi Sjoerd,
I don't much advance knowledge on internal signaling of pwm-samsung module.
So do I need to send this patch again ?
From the context, it seems that the fix in hwmon would only paint
over a problem in the actual pwm driver, correct ?
If you resubmit the patch I would expect you to explain this in the commit log.
Guenter
Quoted 181 lines
-Anand Moon
Quoted 176 lines · Sjoerd Simons
Hey Anand,
Quoted 17 lines · Anand Moon
Hi Guenter/Lukasz,
Earlier I send v2 version of the patch spiking this one.
Markus Riechl came back to me with below mail.
So This patch confirms fixes the bug.I will send v3 version of the patch. Earlier I was in delima about the bug.
-Anand Moon
-------------------------------------------
Hi Anand,I tested your patch.
After booting the fan is spinning despite only 44?C.
Quoted 8 lines
/sys/class/thermal/cooling_device0/curstateis 0./sys/class/hwmon/hwmon4/pwm1is 0when I echo 1 >
cur_stateand then echo 0 >cur_stateagain, the fan switches to off and behaves as expected.It looks like there is a bug in initializing the pwm output immediately after booting.
The problem here will be that at boot the PWM runs at full duty. With the current exynos PWM drive if you disable the PWM it will stop pulsing but remain high if it was at 100% duty. My patch on which you depend upon fixed a race where disabling the pwm right after changing the duty cycle (e.g. to 0%) also kept the signal high.
From looking at other PWM users at the time it seemed that most if not
all always first set to duty to 0% and then disable the pwm. Which should work fine on exynos now. However iirc Thierry recently clarified that the expected result ofpwm_disableis not just that the modulation stops but also that the output signal goes low, although that's not very explicit in the current pwm documentation.. The exynos PWM driver will need another fix tweak to make that true.Quoted 129 lines
Best Regards,
--
Markus ReichlQuoted 121 lines · Anand Moon
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 105 lines · Guenter Roeck
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 87 lines
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Hi Guenter,
I will do so.
-Anand Moon
Quoted 224 lines · Guenter Roeck
Quoted 8 lines · Anand Moon
Hi Sjoerd,
I don't much advance knowledge on internal signaling of pwm-samsung module.
So do I need to send this patch again ?
From the context, it seems that the fix in hwmon would only paint over a problem in the actual pwm driver, correct ?
If you resubmit the patch I would expect you to explain this in the commit log.
Guenter
Quoted 204 lines
-Anand Moon
Quoted 198 lines · Sjoerd Simons
Hey Anand,
Quoted 19 lines · Anand Moon
Hi Guenter/Lukasz,
Earlier I send v2 version of the patch spiking this one.
Markus Riechl came back to me with below mail.
So This patch confirms fixes the bug.I will send v3 version of the patch. Earlier I was in delima about the bug.
-Anand Moon
-------------------------------------------
Hi Anand,I tested your patch.
After booting the fan is spinning despite only 44?C.
Quoted 8 lines
/sys/class/thermal/cooling_device0/curstateis 0./sys/class/hwmon/hwmon4/pwm1is 0when I echo 1 >
cur_stateand then echo 0 >cur_stateagain, the fan switches to off and behaves as expected.It looks like there is a bug in initializing the pwm output immediately after booting.
The problem here will be that at boot the PWM runs at full duty. With the current exynos PWM drive if you disable the PWM it will stop pulsing but remain high if it was at 100% duty. My patch on which you depend upon fixed a race where disabling the pwm right after changing the duty cycle (e.g. to 0%) also kept the signal high.
From looking at other PWM users at the time it seemed that most if not
all always first set to duty to 0% and then disable the pwm. Which should work fine on exynos now. However iirc Thierry recently clarified that the expected result ofpwm_disableis not just that the modulation stops but also that the output signal goes low, although that's not very explicit in the current pwm documentation.. The exynos PWM driver will need another fix tweak to make that true.Quoted 146 lines
Best Regards,
--
Markus ReichlQuoted 137 lines · Anand Moon
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 120 lines · Guenter Roeck
Quoted 7 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Quoted 7 lines
Once the temperature sensor is reached to alert temperature it changes state.
With the state change the fan cools the CPU and then stop'sI have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing
with this patch. What behavior is wrong with the current code, and how does your
patch fix it ?Guenter
Quoted 96 lines
-Anand Moon
Quoted 93 lines · Guenter Roeck
Quoted 9 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ?
Does it fix a bug ? If yes, pelase describe the bug. If not, what is the
purpose of this patch ?Maybe that is all explained in patch 0/6, which I was not copied on. Even
if so, the reationale will be needed in the changelog to explain to future
developers why this change was made.Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 38 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
In reply to Guenter RoeckQuoted 10 lines · Guenter Roeck
Quoted 6 lines · Anand Moon
Hi Sjoerd,
I don't much advance knowledge on internal signaling of pwm-samsung module.
So do I need to send this patch again ?
From the context, it seems that the fix in hwmon would only paint
over a problem in the actual pwm driver, correct ?
Yes/no/maybe :). Imho this is something to clarify in the pwm API documentation. As currently all it says is:
"pwm_disable - stop a PWM output toggling",
Which is what the exynos driver does.
Thierry, could you clearify what the intention is here? I'm happy to prepare a pwm driver patch if needed to solve this?
Quoted 187 lines
If you resubmit the patch I would expect you to explain this in the commit log.
Guenter
Quoted 181 lines
-Anand Moon
Quoted 176 lines · Sjoerd Simons
Hey Anand,
Quoted 17 lines · Anand Moon
Hi Guenter/Lukasz,
Earlier I send v2 version of the patch spiking this one.
Markus Riechl came back to me with below mail.
So This patch confirms fixes the bug.I will send v3 version of the patch. Earlier I was in delima about the bug.
-Anand Moon
-------------------------------------------
Hi Anand,I tested your patch.
After booting the fan is spinning despite only 44?C.
Quoted 8 lines
/sys/class/thermal/cooling_device0/curstateis 0./sys/class/hwmon/hwmon4/pwm1is 0when I echo 1 >
cur_stateand then echo 0 >cur_stateagain, the fan switches to off and behaves as expected.It looks like there is a bug in initializing the pwm output immediately after booting.
The problem here will be that at boot the PWM runs at full duty. With the current exynos PWM drive if you disable the PWM it will stop pulsing but remain high if it was at 100% duty. My patch on which you depend upon fixed a race where disabling the pwm right after changing the duty cycle (e.g. to 0%) also kept the signal high.
From looking at other PWM users at the time it seemed that most if not
all always first set to duty to 0% and then disable the pwm. Which should work fine on exynos now. However iirc Thierry recently clarified that the expected result ofpwm_disableis not just that the modulation stops but also that the output signal goes low, although that's not very explicit in the current pwm documentation.. The exynos PWM driver will need another fix tweak to make that true.Quoted 129 lines
Best Regards,
--
Markus ReichlQuoted 121 lines · Anand Moon
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 105 lines · Guenter Roeck
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 87 lines
-Anand Moon
Quoted 84 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 37 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Quoted 12 lines · Sjoerd Simons
Quoted 10 lines · Guenter Roeck
Quoted 6 lines · Anand Moon
Hi Sjoerd,
I don't much advance knowledge on internal signaling of pwm-samsung module.
So do I need to send this patch again ?
From the context, it seems that the fix in hwmon would only paint
over a problem in the actual pwm driver, correct ?
Quoted 8 lines
Yes/no/maybe :). Imho this is something to clarify in the pwm API documentation. As currently all it says is:
"pwm_disable- stop a PWM output toggling",Which is what the exynos driver does.
Thierry, could you clearify what the intention is here? I'm happy to prepare a pwm driver patch if needed to solve this?
I think the safest thing to do is for users to do both. You call pwm_config() with a zero duty cycle to make it clear what the status is that you want. Then you call pwm_disable() to state that you don't need the output signal anymore, so that any clocks needed by the PWM can be stopped. Doing so gives the driver the most information and should make the user more resilient against any possible quirks in drivers.
Drivers that on pwm_disable() still invert the signal should still be fixed, though. In the cases that I'm aware of the sequence of setting the duty cycle to 0 and calling pwm_disable() won't actually paper over any bugs. It's precisely that sequence that triggers the bug. Merely calling pwm_disable() should trigger it as well, pwm_config(0) without pwm_disable() would hide it.
Thierry
Quoted 180 lines
Quoted 180 lines
If you resubmit the patch I would expect you to explain this in the commit log.
Guenter
Quoted 175 lines
-Anand Moon
Quoted 171 lines · Sjoerd Simons
Hey Anand,
Quoted 17 lines · Anand Moon
Hi Guenter/Lukasz,
Earlier I send v2 version of the patch spiking this one.
Markus Riechl came back to me with below mail.
So This patch confirms fixes the bug.I will send v3 version of the patch. Earlier I was in delima about the bug.
-Anand Moon
-------------------------------------------
Hi Anand,I tested your patch.
After booting the fan is spinning despite only 44?C.
Quoted 8 lines
/sys/class/thermal/cooling_device0/curstateis 0./sys/class/hwmon/hwmon4/pwm1is 0when I echo 1 >
cur_stateand then echo 0 >cur_stateagain, the fan switches to off and behaves as expected.It looks like there is a bug in initializing the pwm output immediately after booting.
The problem here will be that at boot the PWM runs at full duty. With the current exynos PWM drive if you disable the PWM it will stop pulsing but remain high if it was at 100% duty. My patch on which you depend upon fixed a race where disabling the pwm right after changing the duty cycle (e.g. to 0%) also kept the signal high.
From looking at other PWM users at the time it seemed that most if not
all always first set to duty to 0% and then disable the pwm. Which should work fine on exynos now. However iirc Thierry recently clarified that the expected result ofpwm_disableis not just that the modulation stops but also that the output signal goes low, although that's not very explicit in the current pwm documentation.. The exynos PWM driver will need another fix tweak to make that true.Quoted 126 lines
Best Regards,
--
Markus ReichlQuoted 118 lines · Anand Moon
Hi Guenter,
Sorry my blunder mistake. Sorry for the noise.
I just tested with spiking this patch and my observation and testing were wrong we can skip this patch.
I will send an v2 patch series removing the patch 5 and patch 6.
With correct dts changes.
Thanks for pointing my mistake.
-Anand Moon
Quoted 102 lines · Guenter Roeck
Quoted 11 lines · Anand Moon
Hi Guenter,
Initially the board bootup the cooling level state is 0. So update the duty cycle and this power off the fan. As their is no state change the fan will not spin.
Once the temperature sensor is reached to alert temperature it changes state. With the state change the fan cools the CPU and then stop's
I have observed this state change with tmon utility in linux/tools/thermal/tmon/
Sorry, I am missing something. I still don't see what problem you are fixing with this patch. What behavior is wrong with the current code, and how does your patch fix it ?
Guenter
Quoted 84 lines
-Anand Moon
Quoted 81 lines · Guenter Roeck
Quoted 8 lines · Lukasz Majewski
Hi Anand,
Quoted 6 lines
Below changes depend on following patch.
https://patchwork.kernel.org/patch/5944061/Update the
pwm_configwith duty then update thepwm_disableto poweroff the cpu fan.Unfortunately, the patch does not include an explanation why it is needed.
The original code presumably did not update the duty cycle because pwm was about to be disabled anyway. That kind of made sense to me. Updating the duty cycle to 0 just to disable the pwm channel right afterwards does not immediately make sense.
Given that, I would expect to see a rationale here. Why is this patch needed ? Does it fix a bug ? If yes, pelase describe the bug. If not, what is the purpose of this patch ?
Maybe that is all explained in patch 0/6, which I was not copied on. Even if so, the reationale will be needed in the changelog to explain to future developers why this change was made.
Thanks,
GuenterQuoted 14 lines
Quoted 14 lines
Tested on OdroidXU3 board.
Signed-off-by Anand Moon <[email protected]>--- drivers/hwmon/pwm-fan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/hwmon/pwm-fan.c +0
-0@@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm) int ret = 0;Quoted 2 lines
drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 47
Quoted 2 lines
drivers/hwmon/pwm-fan.c +1
-0mutex_lock (&ctx->lock); +[ please refrain from unnecessary whitespace changes ]
Quoted 34 lines
Quoted 16 lines
drivers/hwmon/pwm-fan.c +3
-5if (ctx->pwm_value == pwm) goto exit_set_pwm_err; -if (pwm ==0 ) { -pwm_disable (ctx->pwm); - goto exit_set_pwm; - } - duty =DIV_ROUND_UP (pwm * (ctx->pwm->period -1 ),MAX_PWM ); ret =pwm_config (ctx->pwm, duty, ctx->pwm->period);if (ret) goto exit_set_pwm_err; +if (pwm ==0 ) +pwm_disable (ctx->pwm); +drivers/hwmon/pwm-fan.c static int __set_pwm(struct pwm_fan_ctx *ctx, · line 67
Quoted 10 lines
drivers/hwmon/pwm-fan.c +0
-1if (ctx->pwm_value ==0 ) { ret =pwm_enable (ctx->pwm);if (ret) goto exit_set_pwm_err; } -exit_set_pwm: ctx->pwm_value = pwm; exit_set_pwm_err:mutex_unlock (&ctx->lock);Reviewed-by Lukasz Majewski <[email protected]>BTW: I've added Guenter to CC.
--
Best regards,
Quoted 9 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150410/d3cba63e/attachment-0001.sig>
Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Quoted 11 lines · Thierry Reding
Quoted 9 lines · Sjoerd Simons
Yes/no/maybe :). Imho this is something to clarify in the pwm API documentation. As currently all it says is:
"pwm_disable- stop a PWM output toggling",Which is what the exynos driver does.
Thierry, could you clearify what the intention is here? I'm happy to prepare a pwm driver patch if needed to solve this?
Quoted 7 lines
I think the safest thing to do is for users to do both. You call
pwm_config()with a zero duty cycle to make it clear what the status is that you want. Then you callpwm_disable()to state that you don't need the output signal anymore, so that any clocks needed by the PWM can be stopped. Doing so gives the driver the most information and should make the user more resilient against any possible quirks in drivers.
It would be great if the documentation were more clear on this matter regardless. This is something I can imagine having to spend substantial amounts of time Googling whereas a simple note in the documentation would have removed all ambiguity.
Cheers,
- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150410/698d67eb/attachment.sig>
Guenter Roeck
maintainerRe: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan
Quoted 20 lines · Ben Gamari
Quoted 11 lines · Thierry Reding
Quoted 9 lines · Sjoerd Simons
Yes/no/maybe :). Imho this is something to clarify in the pwm API documentation. As currently all it says is:
"pwm_disable- stop a PWM output toggling",Which is what the exynos driver does.
Thierry, could you clearify what the intention is here? I'm happy to prepare a pwm driver patch if needed to solve this?
Quoted 7 lines
I think the safest thing to do is for users to do both. You call
pwm_config()with a zero duty cycle to make it clear what the status is that you want. Then you callpwm_disable()to state that you don't need the output signal anymore, so that any clocks needed by the PWM can be stopped. Doing so gives the driver the most information and should make the user more resilient against any possible quirks in drivers.
Quoted 5 lines
It would be great if the documentation were more clear on this matter regardless. This is something I can imagine having to spend substantial amounts of time Googling whereas a simple note in the documentation would have removed all ambiguity.
Especially since, in this case, the output signal _is_ still needed. It appears that pwm_disable() is only expected to stop the clock, not the signal itself.
Guenter
Markus Reichl
Tested-byAm Freitag, 27. M?rz 2015, 03:09:09 schrieb Anand Moon:
Quoted 9 lines
This work depeds upon work done by Lukasz Majewski <[email protected]>
and Sjoerd Simons <[email protected]> regarding the pwm-fan.-Anand Moon
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Best Regards,
---
Markus Reichl
Am Freitag, 27. M?rz 2015, 03:09:09 schrieb Anand Moon:
Quoted 9 lines
This work depeds upon work done by Lukasz Majewski <[email protected]>
and Sjoerd Simons <[email protected]> regarding the pwm-fan.-Anand Moon
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Best Regards,
---
Markus Reichl