thermal: exynos: Thermal code rework to use device tree
Subsystems (5)
cover thermal: exynos: Thermal code rework to use device tree
1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.
Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
This work should NOT bring any functional changes to Exynos thermal subsystem.
2. Patch-set structure
This series starts with extending current of-thermal.c implementation with exporting information about trip points and support for setting emulated temperature. Those changes were necessary to reuse this code in Exynos.
Then the cpu_cooling functionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.
Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
Patch series end with removing exynos5250/exynos3250 TMU compatibles. Both SoCs have thermal management unit (TMU) compatible with the one first introduced at Exynos4412.
3. Dead code removal
Thermal support for some SoCs, previously available in the exynos_tmu_data.c file, was removed since, as of 3.17-rc6, they didn't have TMU bindings.
Moreover, support for cpu_cooling devices was preserved only on those SoCs which had available and working cpufreq driver.
4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone + cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone + cpu_cooling)
- Exynos5250 - Arndale (TMU zone + cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)
Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. Prerequisites:
This work requires following patches developed by Bartlomiej Zolnierkiewicz:
5.1. [PATCH v3] ARM: dts: add CPU nodes for Exynos4 SoCs
http://article.gmane.org/gmane.linux.kernel.samsung-soc/37946/match=patch+v3+arm+dts+add+cpu+nodes+exynos4+socs
5.2. First thermal clean up patch set (from patch 1 to 33):
[PATCH 00/33] thermal: exynos: convert the driver to use per-SoC type operations
http://article.gmane.org/gmane.linux.kernel.samsung-soc/37642/match=patch+00+33+thermal+exynos+convert+driver+use+per+soc+type+operations
Lukasz Majewski (21):
thermal: of: Extend of-thermal.c to provide number of trip points
thermal: of: Extend of-thermal.c to provide check if trip point is
enabled
thermal: of: Extend of-thermal.c to provide number of non critical
trip points
thermal: of: Extend current of-thermal.c code to allow setting
emulated temp
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Provide thermal_exynos.h file to be included in
device tree files
thermal: dts: trats: Enable TMU on the Exynos4210 trats device
thermal: dts: exynos: Adding LD010 regulator node necessary for TMU on
Odroid U3 board
thermal: dts: Provide bindings and enable TMU at Exynos4x12 devices
thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu
cooling functionality
thermal: cpu_cooling: Modify exynos thermal code to use device tree
for cpu cooling configuration
thermal: exynos: dts: Add default definition for the TMU sensor
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data for
Exynos5440
thermal: exynos: dts: Provide device tree bindings identical to one in
exynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Remove exynos_tmu_data.c file
thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412
arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 5 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 28 +- arch/arm/boot/dts/exynos4212.dtsi | 5 +- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412.dtsi | 5 +- arch/arm/boot/dts/exynos4x12.dtsi | 13 + arch/arm/boot/dts/exynos5250.dtsi | 29 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 33 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 23 +- drivers/thermal/of-thermal.c | 52 ++- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 430 ---------------------- drivers/thermal/samsung/exynos_thermal_common.h | 106 ------ drivers/thermal/samsung/exynos_tmu.c | 283 +++++++------- drivers/thermal/samsung/exynos_tmu.h | 79 +--- drivers/thermal/samsung/exynos_tmu_data.c | 264 ------------- drivers/thermal/thermal_core.h | 15 + include/dt-bindings/thermal/thermal_exynos.h | 40 ++ include/linux/thermal.h | 6 +- 26 files changed, 623 insertions(+), 1020 deletions(-) create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5420-trip-points.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-trip-points.dtsi delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c create mode 100644 include/dt-bindings/thermal/thermal_exynos.h
Signature · 1 line
2.0.0.rc2
PATCH 1/21 thermal: of: Extend of-thermal.c to provide number of trip points
This patch extends the of-thermal.c to provide information about number of available trip points.
--- drivers/thermal/of-thermal.c | 6 ++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 11 insertions(+)
drivers/thermal/of-thermal.c +6 -0
@@ -113,6 +113,12 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz,return data->get_temp (data->sensor_data, temp); } +int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +return data->ntrips; +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +5 -0
@@ -81,9 +81,14 @@ static inline void thermal_gov_user_space_unregister(void) {}#ifdef CONFIG_THERMAL_OF int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void ); +int of_thermal_get_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips (struct thermal_zone_device *) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
PATCH 1/21 thermal: of: Extend of-thermal.c to provide number of trip points
Hello Lukasz,
Quoted 14 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide information about number of available trip points.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 6 ++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 11 insertions(+)drivers/thermal/of-thermal.c +0
-0
drivers/thermal/of-thermal.c static int of_thermal_get_temp(struct thermal_zone_device *tz, · line 120
Quoted 8 lines
drivers/thermal/of-thermal.c +5
-0@@ -113,6 +113,12 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz,return data->get_temp (data->sensor_data, temp); } +int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +return data->ntrips; +}
I am not against this addition. I just request you to document it accordingly.
Quoted 26 lines
drivers/thermal/of-thermal.c +1
-0+static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {drivers/thermal/thermal_core.h +5
-0@@ -81,9 +81,14 @@ static inline void thermal_gov_user_space_unregister(void) {}#ifdef CONFIG_THERMAL_OF int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void ); +int of_thermal_get_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips (struct thermal_zone_device *) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141106/41acfa02/attachment.sig>
PATCH 1/21 thermal: of: Extend of-thermal.c to provide number of trip points
Hi Eduardo,
Quoted 20 lines
Hello Lukasz,
Quoted 17 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide information about number of available trip points.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 6 ++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 11 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex f8eb625..b2390d9 100644drivers/thermal/of-thermal.c +0
-0@@ -113,6 +113,12 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz, return data->get_temp(data->sensor_data,temp ); }
Quoted 8 lines
drivers/thermal/of-thermal.c static int of_thermal_get_temp(struct thermal_zone_device *tz, · line 120
Quoted 5 lines
drivers/thermal/of-thermal.c +5
-0+int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +return data->ntrips; +}I am not against this addition. I just request you to document it accordingly.
OK, no problem.
Quoted 27 lines
Quoted 27 lines
drivers/thermal/of-thermal.c +1
-0+static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 3db339f..587ca5c 100644drivers/thermal/thermal_core.h +0
-0@@ -81,9 +81,14 @@ static inline void
thermal_gov_user_space_unregister(void){} #ifdefCONFIG_THERMAL_OF
intof_parse_thermal_zones(void);
voidof_thermal_destroy_zones(void);drivers/thermal/thermal_core.h +2
-0+int of_thermal_get_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips(struct thermal_zone_device*) +{
drivers/thermal/thermal_core.h +2
-0+return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 2/21 thermal: of: Extend of-thermal.c to provide check if trip point is enabled
In reply to Lukasz MajewskiThis patch extends the of-thermal.c to provide check if trip point is enabled.
--- drivers/thermal/of-thermal.c | 9 +++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 14 insertions(+)
drivers/thermal/of-thermal.c +9 -0
@@ -119,6 +119,15 @@ int of_thermal_get_ntrips(struct thermal_zone_device *tz)return data->ntrips; } +int of_thermal_is_trip_en (struct thermal_zone_device *tz,int trip) +{ +struct __thermal_zone *data = tz->devdata; + +if (trip >= data->ntrips || trip <0 ) +return 0 ; +return 1 ; +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +5 -0
@@ -82,6 +82,7 @@ static inline void thermal_gov_user_space_unregister(void) {}int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *); +int of_thermal_is_trip_en (struct thermal_zone_device *,int );#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
@@ -89,6 +90,10 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *) {return 0 ; } +int of_thermal_is_trip_en (struct thermal_zone_device *,int ) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
PATCH 2/21 thermal: of: Extend of-thermal.c to provide check if trip point is enabled
Hello Lukasz,
Quoted 14 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide check if trip point is enabled.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 9 +++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 14 insertions(+)drivers/thermal/of-thermal.c +0
-0
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 128
Quoted 10 lines
drivers/thermal/of-thermal.c +7
-0@@ -119,6 +119,15 @@ int of_thermal_get_ntrips(struct thermal_zone_device *tz)return data->ntrips; } +int of_thermal_is_trip_en (struct thermal_zone_device *tz,int trip) +{ +struct __thermal_zone *data = tz->devdata; + +if (trip >= data->ntrips || trip <0 ) +return 0 ; +return 1 ;
might be worth using 'true' and 'false', just for the sake of code readability.
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 130
Quoted 2 lines
drivers/thermal/of-thermal.c +2
-0+} +
I am not against this addition. I just request you to document it accordingly.
Quoted 16 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {drivers/thermal/thermal_core.h +1
-0@@ -82,6 +82,7 @@ static inline void thermal_gov_user_space_unregister(void) {}int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *); +int of_thermal_is_trip_en (struct thermal_zone_device *,int );#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
drivers/thermal/thermal_core.h static inline int of_thermal_get_ntrips(struct thermal_zone_device *) · line 93
Quoted 4 lines
drivers/thermal/thermal_core.h +1
-0@@ -89,6 +90,10 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *) {return 0 ; } +int of_thermal_is_trip_en (struct thermal_zone_device *,int )
this is supposed to be static inline.
Quoted 9 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141106/fcbfbbba/attachment-0001.sig>
PATCH 2/21 thermal: of: Extend of-thermal.c to provide check if trip point is enabled
Hi Eduardo,
Quoted 66 lines
Hello Lukasz,
Quoted 14 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide check if trip point is enabled.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 9 +++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 14 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex b2390d9..23c8d6c 100644drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct · line 128
Quoted 10 lines
drivers/thermal/of-thermal.c +7
-0@@ -119,6 +119,15 @@ int of_thermal_get_ntrips(struct thermal_zone_device *tz) return data->ntrips; } +int of_thermal_is_trip_en (struct thermal_zone_device *tz,int trip) +{ +struct __thermal_zone *data = tz->devdata; + +if (trip >= data->ntrips || trip <0 ) +return 0 ; +return 1 ;might be worth using 'true' and 'false', just for the sake of code readability.
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 130
Quoted 2 lines
drivers/thermal/of-thermal.c +2
-0+} +I am not against this addition. I just request you to document it accordingly.
Quoted 16 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 587ca5c..ed8ff05 100644drivers/thermal/thermal_core.h +0
-0@@ -82,6 +82,7 @@ static inline void
thermal_gov_user_space_unregister(void){} intof_parse_thermal_zones(void); voidof_thermal_destroy_zones(void);
intof_thermal_get_ntrips(struct thermal_zone_device *);drivers/thermal/thermal_core.h +1
-0+int of_thermal_is_trip_en (struct thermal_zone_device *,int );#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }drivers/thermal/thermal_core.h static inline int of_thermal_get_ntrips(struct · line 93
Quoted 4 lines
drivers/thermal/thermal_core.h +1
-0@@ -89,6 +90,10 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *) {return 0 ; } +int of_thermal_is_trip_en (struct thermal_zone_device *,int )this is supposed to be static inline.
Quoted 5 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif
Quoted 4 lines
Quoted 4 lines
drivers/thermal/thermal_core.h +0
-0#endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
I will prepare proper description for the code.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
In reply to Lukasz MajewskiThis patch extends the of-thermal.c to provide information about number of available non critical (i.e. non HW) trip points in the system.
--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)
drivers/thermal/of-thermal.c +12 -0
@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip)return 1 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; + +return --i; +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +5 -0
@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);int of_thermal_is_trip_en (struct thermal_zone_device *,int ); +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
Quoted 19 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)drivers/thermal/of-thermal.c +2
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip)return 1 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 10 lines
drivers/thermal/of-thermal.c +10
-0+struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; + +return --i; +} +
I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers. Maybe having a single API to provide a read-only copy the list / array of trips might be a better approach. I will think of a better way.
I also request you to document it accordingly.
Quoted 16 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {drivers/thermal/thermal_core.h +1
-0@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);int of_thermal_is_trip_en (struct thermal_zone_device *,int ); +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
drivers/thermal/thermal_core.h int of_thermal_is_trip_en(struct thermal_zone_device *, int) · line 98
Quoted 4 lines
drivers/thermal/thermal_core.h +1
-0@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *)
here, it is supposed to be static inline.
Quoted 9 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141106/34013c3e/attachment.sig>
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
Hi Eduardo,
Quoted 28 lines · Lukasz Majewski
Quoted 27 lines
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 23c8d6c..cd74e64 100644drivers/thermal/of-thermal.c +9
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; +
Quoted 8 lines
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 3 lines
drivers/thermal/of-thermal.c +3
-0+return --i; +} +I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers.
Why do you think that this is a specific API? In the thermal OF we can define trip point as "active", "passive", "hot" and "critical".
With the first three we can handle them and properly react. For the last one SoC's PMU will power down the board.
Do you know if any board (e.g. from TI) is NOT supposed to shut down when "critical" temperature is passed?
The real problem here is the accessibility to __thermal_trip and __thermal_bind arrays.
Use case:
In the Exynos driver we do need to initialize TMU registers with threshold temperatures.
The temperature is read via tz->ops->get_trip_temp() [1] (from of-thermal.c).
Unfortunately, the current API is not exporting the number of non-critical trip points to know how many times call [1]. Of course we could by hand instantiate [1] n times, but this looks for me a bit clumsy.
Additionally, we now have implicit assumption about the order of defined temperatures for trip points, but I think this is not a big issue.
Quoted 3 lines
Maybe having a
single API to provide a read-only copy the list / array of trips might be a better approach. I will think of a better way.
Definitely. Exporting available trip points is crucial.
Quoted 2 lines
I also request you to document it accordingly.
Ok, I will do that.
Quoted 33 lines
Quoted 18 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex ed8ff05..334a7be 100644drivers/thermal/thermal_core.h +1
-0@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);int of_thermal_is_trip_en (struct thermal_zone_device *,int ); +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }drivers/thermal/thermal_core.h int of_thermal_is_trip_en(struct · line 98
Quoted 4 lines
drivers/thermal/thermal_core.h +1
-0@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *)here, it is supposed to be static inline.
Quoted 9 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
Hello Lukasz,
Quoted 39 lines · Lukasz Majewski
Hi Eduardo,
Quoted 28 lines · Lukasz Majewski
Quoted 27 lines
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 23c8d6c..cd74e64 100644drivers/thermal/of-thermal.c +9
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; +Quoted 8 lines
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 3 lines
drivers/thermal/of-thermal.c +3
-0+return --i; +} +I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers.
Quoted 9 lines
Why do you think that this is a specific API? In the thermal OF we can define trip point as "active", "passive", "hot" and "critical".
With the first three we can handle them and properly react. For the last one SoC's PMU will power down the board.
Do you know if any board (e.g. from TI) is NOT supposed to shut down when "critical" temperature is passed?
So, my point is not really about the usage of trip points. It is just that the of-thermal API will grow with in a wide way with specific functions to check some property on the trip point array. And not all drivers may be using these function, e.g. the above proposal.
Quoted 12 lines
The real problem here is the accessibility to
__thermal_tripand__thermal_bindarrays.Use case:
In the Exynos driver we do need to initialize TMU registers with threshold temperatures.
The temperature is read viatz->ops->get_trip_temp()[1] (fromof-thermal.c).
Unfortunately, the current API is not exporting the number of non-critical trip points to know how many times call [1]. Of course we could by hand instantiate [1] n times, but this looks for me a bit clumsy.
I understand your use case. My point was simply that this use case may be specific to your driver (or few drivers).
Quoted 10 lines
Additionally, we now have implicit assumption about the order of defined temperatures for trip points, but I think this is not a big issue.
Quoted 3 lines
Maybe having a
single API to provide a read-only copy the list / array of trips might be a better approach. I will think of a better way.Definitely. Exporting available trip points is crucial.
Yeah, I think it is the best thing to do. Share a read-only array / copy of the needed data, and then drivers would check what ever property they need from the array. Just make sure you document that this is a read-only array (i.e. any possible change they do, won't affect the original array).
Quoted 4 lines
Quoted 2 lines
I also request you to document it accordingly.
Ok, I will do that.
Cool!
Quoted 30 lines
Quoted 30 lines
Quoted 19 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex ed8ff05..334a7be 100644drivers/thermal/thermal_core.h +1
-0@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);int of_thermal_is_trip_en (struct thermal_zone_device *,int ); +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }drivers/thermal/thermal_core.h int of_thermal_is_trip_en(struct · line 98
Quoted 4 lines
drivers/thermal/thermal_core.h +1
-0@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *)here, it is supposed to be static inline.
Quoted 5 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/thermal/thermal_core.h +0
-0#endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141107/eeb5475a/attachment-0001.sig>
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
Hi Eduardo,
Quoted 84 lines
Hello Lukasz,
Quoted 40 lines · Lukasz Majewski
Hi Eduardo,
Quoted 29 lines · Lukasz Majewski
Quoted 28 lines
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 23c8d6c..cd74e64 100644drivers/thermal/of-thermal.c +8
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; +Quoted 8 lines
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 3 lines
drivers/thermal/of-thermal.c +3
-0+return --i; +} +I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers.
Quoted 9 lines
Why do you think that this is a specific API? In the thermal OF we can define trip point as "active", "passive", "hot" and "critical".
With the first three we can handle them and properly react. For the last one SoC's PMU will power down the board.
Do you know if any board (e.g. from TI) is NOT supposed to shut down when "critical" temperature is passed?
So, my point is not really about the usage of trip points. It is just that the of-thermal API will grow with in a wide way with specific functions to check some property on the trip point array. And not all drivers may be using these function, e.g. the above proposal.
Quoted 12 lines
The real problem here is the accessibility to
__thermal_tripand__thermal_bindarrays.Use case:
In the Exynos driver we do need to initialize TMU registers with threshold temperatures.
The temperature is read viatz->ops->get_trip_temp()[1] (fromof-thermal.c).
Unfortunately, the current API is not exporting the number of non-critical trip points to know how many times call [1]. Of course we could by hand instantiate [1] n times, but this looks for me a bit clumsy.I understand your use case. My point was simply that this use case may be specific to your driver (or few drivers).
Quoted 9 lines
Additionally, we now have implicit assumption about the order of defined temperatures for trip points, but I think this is not a big issue.
Quoted 3 lines
Maybe having a
single API to provide a read-only copy the list / array of trips might be a better approach. I will think of a better way.
Quoted 8 lines
Quoted 2 lines
Definitely. Exporting available trip points is crucial.
Yeah, I think it is the best thing to do. Share a read-only array / copy of the needed data, and then drivers would check what ever property they need from the array. Just make sure you document that this is a read-only array (i.e. any possible change they do, won't affect the original array).
I agree on that.
Quoted 54 lines
Quoted 5 lines
Quoted 3 lines
I also request you to document it accordingly.
Ok, I will do that.
Cool!
Quoted 44 lines
Quoted 35 lines
Quoted 19 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend(struct thermal_zone_device *tz,int trip, enum
thermal_trend*trend)
{(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex ed8ff05..334a7be 100644drivers/thermal/thermal_core.h +1
-0@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);int of_thermal_is_trip_en (struct thermal_zone_device *,int ); +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }drivers/thermal/thermal_core.h int of_thermal_is_trip_en(struct · line 99
Quoted 5 lines
drivers/thermal/thermal_core.h +1
-0@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *)here, it is supposed to be static inline.
Quoted 9 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /*
__THERMAL_CORE_H__*/Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
In reply to Eduardo ValentinHi Eduardo,
Quoted 84 lines
Hello Lukasz,
Quoted 40 lines · Lukasz Majewski
Hi Eduardo,
Quoted 29 lines · Lukasz Majewski
Quoted 28 lines
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 23c8d6c..cd74e64 100644drivers/thermal/of-thermal.c +8
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; +Quoted 8 lines
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 3 lines
drivers/thermal/of-thermal.c +3
-0+return --i; +} +I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers.
Quoted 9 lines
Why do you think that this is a specific API? In the thermal OF we can define trip point as "active", "passive", "hot" and "critical".
With the first three we can handle them and properly react. For the last one SoC's PMU will power down the board.
Do you know if any board (e.g. from TI) is NOT supposed to shut down when "critical" temperature is passed?
So, my point is not really about the usage of trip points. It is just that the of-thermal API will grow with in a wide way with specific functions to check some property on the trip point array. And not all drivers may be using these function, e.g. the above proposal.
Quoted 12 lines
The real problem here is the accessibility to
__thermal_tripand__thermal_bindarrays.Use case:
In the Exynos driver we do need to initialize TMU registers with threshold temperatures.
The temperature is read viatz->ops->get_trip_temp()[1] (fromof-thermal.c).
Unfortunately, the current API is not exporting the number of non-critical trip points to know how many times call [1]. Of course we could by hand instantiate [1] n times, but this looks for me a bit clumsy.I understand your use case. My point was simply that this use case may be specific to your driver (or few drivers).
Quoted 9 lines
Additionally, we now have implicit assumption about the order of defined temperatures for trip points, but I think this is not a big issue.
Quoted 3 lines
Maybe having a
single API to provide a read-only copy the list / array of trips might be a better approach. I will think of a better way.
Quoted 8 lines
Quoted 2 lines
Definitely. Exporting available trip points is crucial.
Yeah, I think it is the best thing to do. Share a read-only array / copy of the needed data, and then drivers would check what ever property they need from the array. Just make sure you document that this is a read-only array (i.e. any possible change they do, won't affect the original array).
So I assume that you don't mind that I will prepare such of-thermal.c modification?
Quoted 54 lines
Quoted 5 lines
Quoted 3 lines
I also request you to document it accordingly.
Ok, I will do that.
Cool!
Quoted 44 lines
Quoted 35 lines
Quoted 19 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend(struct thermal_zone_device *tz,int trip, enum
thermal_trend*trend)
{(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex ed8ff05..334a7be 100644drivers/thermal/thermal_core.h +1
-0@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);int of_thermal_is_trip_en (struct thermal_zone_device *,int ); +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }drivers/thermal/thermal_core.h int of_thermal_is_trip_en(struct · line 99
Quoted 5 lines
drivers/thermal/thermal_core.h +1
-0@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *)here, it is supposed to be static inline.
Quoted 9 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /*
__THERMAL_CORE_H__*/Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
Hello Lukasz,
Quoted 89 lines · Lukasz Majewski
Hi Eduardo,
Quoted 87 lines
Hello Lukasz,
Quoted 40 lines · Lukasz Majewski
Hi Eduardo,
Quoted 29 lines · Lukasz Majewski
Quoted 28 lines
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 23c8d6c..cd74e64 100644drivers/thermal/of-thermal.c +8
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; +Quoted 8 lines
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 3 lines
drivers/thermal/of-thermal.c +3
-0+return --i; +} +I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers.
Quoted 9 lines
Why do you think that this is a specific API? In the thermal OF we can define trip point as "active", "passive", "hot" and "critical".
With the first three we can handle them and properly react. For the last one SoC's PMU will power down the board.
Do you know if any board (e.g. from TI) is NOT supposed to shut down when "critical" temperature is passed?
So, my point is not really about the usage of trip points. It is just that the of-thermal API will grow with in a wide way with specific functions to check some property on the trip point array. And not all drivers may be using these function, e.g. the above proposal.
Quoted 12 lines
The real problem here is the accessibility to
__thermal_tripand__thermal_bindarrays.Use case:
In the Exynos driver we do need to initialize TMU registers with threshold temperatures.
The temperature is read viatz->ops->get_trip_temp()[1] (fromof-thermal.c).
Unfortunately, the current API is not exporting the number of non-critical trip points to know how many times call [1]. Of course we could by hand instantiate [1] n times, but this looks for me a bit clumsy.I understand your use case. My point was simply that this use case may be specific to your driver (or few drivers).
Quoted 11 lines
Additionally, we now have implicit assumption about the order of defined temperatures for trip points, but I think this is not a big issue.
Quoted 3 lines
Maybe having a
single API to provide a read-only copy the list / array of trips might be a better approach. I will think of a better way.Definitely. Exporting available trip points is crucial.
Quoted 8 lines
Quoted 5 lines
Yeah, I think it is the best thing to do. Share a read-only array / copy of the needed data, and then drivers would check what ever property they need from the array. Just make sure you document that this is a read-only array (i.e. any possible change they do, won't affect the original array).
So I assume that you don't mind that I will prepare such
of-thermal.cmodification?
No, please, feel free to send the proposal along with your patchset. To me, it makes sense you do it, because you will also present a real use case of this required change.
Quoted 52 lines
Quoted 52 lines
Quoted 6 lines
Quoted 4 lines
I also request you to document it accordingly.
Ok, I will do that.
Cool!
Quoted 41 lines
Quoted 35 lines
Quoted 19 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend(struct thermal_zone_device *tz,int trip, enum
thermal_trend*trend)
{(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex ed8ff05..334a7be 100644drivers/thermal/thermal_core.h +1
-0@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);int of_thermal_is_trip_en (struct thermal_zone_device *,int ); +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }drivers/thermal/thermal_core.h int of_thermal_is_trip_en(struct · line 99
Quoted 5 lines
drivers/thermal/thermal_core.h +1
-0@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *)here, it is supposed to be static inline.
Quoted 9 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /*
__THERMAL_CORE_H__*/Signature · 1 line
2.0.0.rc2Signature · 1 line
Best regards,
Quoted 12 lines
Quoted 3 lines
Quoted 3 lines
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141118/767cfb83/attachment-0001.sig>
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
Quoted 103 lines · On Tue, 18 Nov 2014 11:20:26 -0400 Eduardo Valentin <[email protected]> wrote:
Hello Lukasz,
Quoted 100 lines · Lukasz Majewski
Hi Eduardo,
Quoted 97 lines
Hello Lukasz,
Quoted 46 lines · Lukasz Majewski
Hi Eduardo,
Quoted 31 lines
Quoted 29 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 23c8d6c..cd74e64 100644drivers/thermal/of-thermal.c +9
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; + +return --i;Quoted 8 lines
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 2 lines
drivers/thermal/of-thermal.c +2
-0+} +I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers.
Why do you think that this is a specific API? In the thermal OF we can define trip point as "active", "passive", "hot" and "critical".
Quoted 6 lines
With the first three we can handle them and properly react. For the last one SoC's PMU will power down the board.
Do you know if any board (e.g. from TI) is NOT supposed to shut down when "critical" temperature is passed?
So, my point is not really about the usage of trip points. It is just that the of-thermal API will grow with in a wide way with specific functions to check some property on the trip point array. And not all drivers may be using these function, e.g. the above proposal.
Quoted 12 lines
The real problem here is the accessibility to
__thermal_tripand__thermal_bindarrays.Use case:
In the Exynos driver we do need to initialize TMU registers with threshold temperatures.
The temperature is read viatz->ops->get_trip_temp()[1] (fromof-thermal.c).
Unfortunately, the current API is not exporting the number of non-critical trip points to know how many times call [1]. Of course we could by hand instantiate [1] n times, but this looks for me a bit clumsy.I understand your use case. My point was simply that this use case may be specific to your driver (or few drivers).
Quoted 5 lines
Additionally, we now have implicit assumption about the order of defined temperatures for trip points, but I think this is not a big issue.
Quoted 7 lines
Quoted 4 lines
Maybe having a
single API to provide a read-only copy the list / array of trips might be a better approach. I will think of a better way.Definitely. Exporting available trip points is crucial.
Yeah, I think it is the best thing to do. Share a read-only array / copy of the needed data, and then drivers would check what ever property they need from the array. Just make sure you document that this is a read-only array (i.e. any possible change they do, won't affect the original array).
Quoted 6 lines
Quoted 2 lines
So I assume that you don't mind that I will prepare such
of-thermal.cmodification?No, please, feel free to send the proposal along with your patchset. To me, it makes sense you do it, because you will also present a real use case of this required change.
Ok. I will rebase on top of your today's work.
Quoted 59 lines
Quoted 59 lines
Quoted 56 lines
Quoted 7 lines
Quoted 5 lines
I also request you to document it accordingly.
Ok, I will do that.
Cool!
Quoted 44 lines
Quoted 35 lines
Quoted 19 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend(struct thermal_zone_device*tz, int trip, enum
thermal_trend*trend)
{(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex ed8ff05..334a7be 100644 ---a/drivers/thermal/thermal_core.h+++b/drivers/thermal/thermal_core.hdrivers/thermal/of-thermal.c +0
-0@@ -83,6 +83,7 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *); int of_thermal_is_trip_en(struct thermal_zone_device *,int); +int
of_thermal_get_non_crit_ntrips(struct thermal_zone_device *); #else
static inline intof_parse_thermal_zones(void){ return
0; } static inline voidof_thermal_destroy_zones(void){ }drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct · line 99
Quoted 5 lines
drivers/thermal/of-thermal.c +1
-0@@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *)here, it is supposed to be static inline.
Quoted 9 lines
drivers/thermal/of-thermal.c +3
-0+{ +return 0 ; +}#endif #endif /*
__THERMAL_CORE_H__*/Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Quoted 6 lines
Quoted 6 lines
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Best regards,
Lukasz Majewski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141118/bfb70aa8/attachment.sig>
PATCH 3/21 thermal: of: Extend of-thermal.c to provide number of non critical trip points
In reply to Lukasz MajewskiHi Lukasz,
Quoted 48 lines · Lukasz Majewski
Hi Eduardo,
Quoted 28 lines · Lukasz Majewski
Quoted 27 lines
This patch extends the
of-thermal.cto provide information about number of available non critical (i.e. non HW) trip points in the system.Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 23c8d6c..cd74e64 100644drivers/thermal/of-thermal.c +9
-0@@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +int i; + +for (i =0 ; i < data->ntrips; i++) +if (data->trips[i].type !=THERMAL_TRIP_CRITICAL ) +continue ; +Quoted 8 lines
drivers/thermal/of-thermal.c int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 142
Quoted 3 lines
drivers/thermal/of-thermal.c +3
-0+return --i; +} +I am not against this addition. But looks like we start to spread some specific APIs that may not be used to other drivers.
Why do you think that this is a specific API? In the thermal OF we can define trip point as "active", "passive", "hot" and "critical".
With the first three we can handle them and properly react. For the last one SoC's PMU will power down the board.
Do you know if any board (e.g. from TI) is NOT supposed to shut down when "critical" temperature is passed?
Quoted 6 lines
The real problem here is the accessibility to
__thermal_tripand__thermal_bindarrays.Use case:
In the Exynos driver we do need to initialize TMU registers with threshold temperatures.
Is this indeed plural or you want to program the next trip point as your alarm temperature? If so, there was another patch floating around adding set_trips() callback that would get passed in the low and high trip points for the current temperature reading and you can use that data to program alarms. Rockchip thermal driver uses it.
https://lkml.org/lkml/2014/6/27/76
Thanks.
Signature · 1 line
Dmitry
PATCH 4/21 thermal: of: Extend current of-thermal.c code to allow setting emulated temp
In reply to Lukasz MajewskiBefore this change it was only possible to set get_temp() and get_trend() methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.
Now it is possible to also set emulated value of temperature for debug purposes.
--- drivers/thermal/of-thermal.c | 25 ++++++++++++++++++++++--- include/linux/thermal.h | 6 ++++-- 2 files changed, 26 insertions(+), 5 deletions(-)
drivers/thermal/of-thermal.c +22 -3
@@ -98,10 +98,22 @@ struct __thermal_zone {void *sensor_data;int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long ); };/*** DT thermal zone device callbacks ***/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->set_emul_temp) +return -EINVAL ; + +return data->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_temp (struct thermal_zone_device *tz,unsigned long *temp) {
@@ -352,7 +364,8 @@ static struct thermal_zone_device * thermal_zone_of_add_sensor(struct device_node *zone, struct device_node *sensor, void *data, int (*get_temp)(void *, long *), - int (*get_trend)(void *, long *)) + int (*get_trend)(void *, long *), + int (*set_emul_temp)(void *, unsigned long)) { struct thermal_zone_device *tzd;struct __thermal_zone *tz;
@@ -366,10 +379,12 @@ thermal_zone_of_add_sensor(struct device_node *zone,mutex_lock (&tzd->lock); tz->get_temp = get_temp; tz->get_trend = get_trend; + tz->set_emul_temp = set_emul_temp; tz->sensor_data = data; tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;
@@ -411,7 +426,8 @@ thermal_zone_of_add_sensor(struct device_node *zone,struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int sensor_id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)) +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long )) {struct device_node *np, *child, *sensor_np;
@@ -453,7 +469,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,return thermal_zone_of_add_sensor (child, sensor_np, data, get_temp, - get_trend); + get_trend, + set_emul_temp); } }of_node_put (np);
@@ -494,9 +511,11 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->get_temp =NULL ; tz->get_trend =NULL ; + tz->set_emul_temp =NULL ; tz->sensor_data =NULL ;mutex_unlock (&tzd->lock); }
include/linux/thermal.h +4 -2
@@ -290,14 +290,16 @@ struct thermal_genl_event {struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)); +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long ));void thermal_zone_of_sensor_unregister (struct device *dev,struct thermal_zone_device *tz);#else static inline struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)) +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long )) {return NULL ; }
Signature · 1 line
2.0.0.rc2
PATCH 4/21 thermal: of: Extend current of-thermal.c code to allow setting emulated temp
Hello,
Quoted 41 lines · Lukasz Majewski
Before this change it was only possible to set
get_temp()andget_trend()methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.Now it is possible to also set emulated value of temperature for debug purposes.
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 25 ++++++++++++++++++++++--- include/linux/thermal.h | 6 ++++-- 2 files changed, 26 insertions(+), 5 deletions(-)drivers/thermal/of-thermal.c +12
-0@@ -98,10 +98,22 @@ struct __thermal_zone {void *sensor_data;int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long ); };/*** DT thermal zone device callbacks ***/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->set_emul_temp) +return -EINVAL ; + +return data->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_temp (struct thermal_zone_device *tz,unsigned long *temp) {
drivers/thermal/of-thermal.c static struct thermal_zone_device * · line 368
Quoted 6 lines
drivers/thermal/of-thermal.c +2
-1@@ -352,7 +364,8 @@ static struct thermal_zone_device * thermal_zone_of_add_sensor(struct device_node *zone, struct device_node *sensor, void *data, int (*get_temp)(void *, long *), - int (*get_trend)(void *, long *)) + int (*get_trend)(void *, long *), + int (*set_emul_temp)(void *, unsigned long))
Thanks for improving the API. However, looking at what is above, it starts to be pretty ugly. And for sure, this is not the last callback to be added. I believe it is time to add a .ops in the of-thermal. While in here, do you mind adding the .ops in a separated patch, then add the .set_emul_temp in the .ops field?
Quoted 74 lines
drivers/thermal/of-thermal.c +8
-2{struct thermal_zone_device *tzd;struct __thermal_zone *tz;@@ -366,10 +379,12 @@ thermal_zone_of_add_sensor(struct device_node *zone,mutex_lock (&tzd->lock); tz->get_temp = get_temp; tz->get_trend = get_trend; + tz->set_emul_temp = set_emul_temp; tz->sensor_data = data; tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;@@ -411,7 +426,8 @@ thermal_zone_of_add_sensor(struct device_node *zone,struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int sensor_id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)) +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long )) {struct device_node *np, *child, *sensor_np;@@ -453,7 +469,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,return thermal_zone_of_add_sensor (child, sensor_np, data, get_temp, - get_trend); + get_trend, + set_emul_temp); } }of_node_put (np);@@ -494,9 +511,11 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->get_temp =NULL ; tz->get_trend =NULL ; + tz->set_emul_temp =NULL ; tz->sensor_data =NULL ;mutex_unlock (&tzd->lock); }include/linux/thermal.h +4
-2@@ -290,14 +290,16 @@ struct thermal_genl_event {struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)); +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long ));void thermal_zone_of_sensor_unregister (struct device *dev,struct thermal_zone_device *tz);#else static inline struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)) +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long )) {return NULL ; }Signature · 1 line
2.0.0.rc2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141106/f8997fc6/attachment.sig>
PATCH 4/21 thermal: of: Extend current of-thermal.c code to allow setting emulated temp
Hi Eduardo,
Quoted 47 lines
Hello,
Quoted 44 lines · Lukasz Majewski
Before this change it was only possible to set
get_temp()andget_trend()methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.Now it is possible to also set emulated value of temperature for debug purposes.
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 25 ++++++++++++++++++++++--- include/linux/thermal.h | 6 ++++-- 2 files changed, 26 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex cd74e64..f206375 100644drivers/thermal/of-thermal.c +12
-0@@ -98,10 +98,22 @@ struct __thermal_zone {void *sensor_data;int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long ); };/*** DT thermal zone device callbacks ***/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->set_emul_temp) +return -EINVAL ; + +return data->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_temp (struct thermal_zone_device *tz,unsigned long *temp) {@@ -352,7 +364,8 @@ static struct thermal_zone_device * thermal_zone_of_add_sensor(struct device_node *zone, struct device_node *sensor, void *data, int (*get_temp)(void *, long *),
Quoted 8 lines
drivers/thermal/of-thermal.c static struct thermal_zone_device *
Quoted 4 lines
drivers/thermal/of-thermal.c +2
-1- int (*get_trend)(void *, long *)) +int (*get_trend)(void *,long *), + int (*set_emul_temp)(void *, unsigned long))Thanks for improving the API. However, looking at what is above, it starts to be pretty ugly. And for sure, this is not the last callback to be added.
Presumably there would be some more callbacks.
Quoted 3 lines
I believe it is time to add a .ops in the of-thermal. While in here, do you mind adding the .ops in a separated patch, then add the .set_emul_temp in the .ops field?
I will add an option to pass .ops with thermal_zone_of_add_sensor().
I'm only concerned a bit about testing other users of of-thermal. I have only beaglebone black (BBB) for testing, which on-soc bandgap thermal sensor is very inaccurate and hence not supported even at BBB github linux kernel repository (v3.14).
Because of above I would need your support for testing.
Quoted 80 lines
Quoted 80 lines
drivers/thermal/of-thermal.c +0
-0{struct thermal_zone_device *tzd;drivers/thermal/of-thermal.c +6
-2struct __thermal_zone *tz;@@ -366,10 +379,12 @@ thermal_zone_of_add_sensor(struct device_node *zone,mutex_lock (&tzd->lock); tz->get_temp = get_temp; tz->get_trend = get_trend; + tz->set_emul_temp = set_emul_temp; tz->sensor_data = data; tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;@@ -411,7 +426,8 @@ thermal_zone_of_add_sensor(struct device_node *zone, struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int sensor_id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)) +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long )) {struct device_node *np, *child, *sensor_np;@@ -453,7 +469,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, return thermal_zone_of_add_sensor(child, sensor_np, data, get_temp, - get_trend); + get_trend, + set_emul_temp); }drivers/thermal/of-thermal.c +2
-0}of_node_put (np);@@ -494,9 +511,11 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->get_temp =NULL ; tz->get_trend =NULL ; + tz->set_emul_temp =NULL ; tz->sensor_data =NULL ;mutex_unlock (&tzd->lock); }include/linux/thermal.h +2
-1@@ -290,14 +290,16 @@ struct thermal_genl_event {struct thermal_zone_device * thermal_zone_of_sensor_register(struct device *dev, int id, void *data, int (*get_temp)(void *, long *), -int (*get_trend)(void *,long *)); + int (*get_trend)(void *, long *), + int (*set_emul_temp)(void *,unsigned long)); void
thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz);
#else
static inline structthermal_zone_device* thermal_zone_of_sensor_register(struct device *dev, int id,
void *data, int (*get_temp)(void
*, long *),include/linux/thermal.h +2
-1- int (*get_trend)(void *, long *)) + int (*get_trend)(void *, long *), + int (*set_emul_temp)(void *,unsigned long)) {
return NULL;
}Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 4/21 thermal: of: Extend current of-thermal.c code to allow setting emulated temp
Lukasz,
Quoted 64 lines · Lukasz Majewski
Hi Eduardo,
Quoted 47 lines
Hello,
Quoted 44 lines · Lukasz Majewski
Before this change it was only possible to set
get_temp()andget_trend()methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.Now it is possible to also set emulated value of temperature for debug purposes.
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 25 ++++++++++++++++++++++--- include/linux/thermal.h | 6 ++++-- 2 files changed, 26 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex cd74e64..f206375 100644drivers/thermal/of-thermal.c +12
-0@@ -98,10 +98,22 @@ struct __thermal_zone {void *sensor_data;int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long ); };/*** DT thermal zone device callbacks ***/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->set_emul_temp) +return -EINVAL ; + +return data->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_temp (struct thermal_zone_device *tz,unsigned long *temp) {@@ -352,7 +364,8 @@ static struct thermal_zone_device * thermal_zone_of_add_sensor(struct device_node *zone, struct device_node *sensor, void *data, int (*get_temp)(void *, long *),Quoted 8 lines
drivers/thermal/of-thermal.c static struct thermal_zone_device *
Quoted 4 lines
drivers/thermal/of-thermal.c +2
-1- int (*get_trend)(void *, long *)) +int (*get_trend)(void *,long *), + int (*set_emul_temp)(void *, unsigned long))Thanks for improving the API. However, looking at what is above, it starts to be pretty ugly. And for sure, this is not the last callback to be added.
Presumably there would be some more callbacks.
Quoted 3 lines
I believe it is time to add a .ops in the of-thermal. While in here, do you mind adding the .ops in a separated patch, then add the .set_emul_temp in the .ops field?
Quoted 9 lines
I will add an option to pass .ops with
thermal_zone_of_add_sensor().I'm only concerned a bit about testing other users of of-thermal. I have only beaglebone black (BBB) for testing, which on-soc bandgap thermal sensor is very inaccurate and hence not supported even at BBB github linux kernel repository (v3.14).
Because of above I would need your support for testing.
I did the .ops part that is required for your patch:
https://patchwork.kernel.org/patch/5329801/
As you already reviewed it. Do you mind refreshing your series on top of it?
Cheers,
Quoted 72 lines
Quoted 72 lines
Quoted 72 lines
drivers/thermal/of-thermal.c +0
-0{struct thermal_zone_device *tzd;drivers/thermal/of-thermal.c +6
-2struct __thermal_zone *tz;@@ -366,10 +379,12 @@ thermal_zone_of_add_sensor(struct device_node *zone,mutex_lock (&tzd->lock); tz->get_temp = get_temp; tz->get_trend = get_trend; + tz->set_emul_temp = set_emul_temp; tz->sensor_data = data; tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;@@ -411,7 +426,8 @@ thermal_zone_of_add_sensor(struct device_node *zone, struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int sensor_id,void *data,int (*get_temp)(void *,long *), -int (*get_trend)(void *,long *)) +int (*get_trend)(void *,long *), +int (*set_emul_temp)(void *,unsigned long )) {struct device_node *np, *child, *sensor_np;@@ -453,7 +469,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, return thermal_zone_of_add_sensor(child, sensor_np, data, get_temp, - get_trend); + get_trend, + set_emul_temp); }drivers/thermal/of-thermal.c +2
-0}of_node_put (np);@@ -494,9 +511,11 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->get_temp =NULL ; tz->get_trend =NULL ; + tz->set_emul_temp =NULL ; tz->sensor_data =NULL ;mutex_unlock (&tzd->lock); }include/linux/thermal.h +2
-1@@ -290,14 +290,16 @@ struct thermal_genl_event {struct thermal_zone_device * thermal_zone_of_sensor_register(struct device *dev, int id, void *data, int (*get_temp)(void *, long *), -int (*get_trend)(void *,long *)); + int (*get_trend)(void *, long *), + int (*set_emul_temp)(void *,unsigned long)); void
thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz);
#else
static inline structthermal_zone_device* thermal_zone_of_sensor_register(struct device *dev, int id,
void *data, int (*get_temp)(void
*, long *),include/linux/thermal.h +0
-1- int (*get_trend)(void *, long *))
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
include/linux/thermal.h +2
-0+ int (*get_trend)(void *, long *), + int (*set_emul_temp)(void *,unsigned long)) {
return NULL;
}Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141118/79194856/attachment.sig>
PATCH 4/21 thermal: of: Extend current of-thermal.c code to allow setting emulated temp
Quoted 77 lines · On Tue, 18 Nov 2014 11:23:29 -0400 Eduardo Valentin <[email protected]> wrote:
Lukasz,
Quoted 73 lines · Lukasz Majewski
Hi Eduardo,
Quoted 49 lines
Hello,
Quoted 46 lines · Lukasz Majewski
Before this change it was only possible to set
get_temp()andget_trend()methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.Now it is possible to also set emulated value of temperature for debug purposes.
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/of-thermal.c | 25 ++++++++++++++++++++++--- include/linux/thermal.h | 6 ++++-- 2 files changed, 26 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex cd74e64..f206375 100644drivers/thermal/of-thermal.c +12
-0@@ -98,10 +98,22 @@ struct __thermal_zone {void *sensor_data;int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long ); };/*** DT thermal zone device callbacks ***/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->set_emul_temp) +return -EINVAL ; + +return data->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_temp (struct thermal_zone_device *tz,unsigned long *temp){
drivers/thermal/of-thermal.c +0
-0@@ -352,7 +364,8 @@ static struct thermal_zone_device * thermal_zone_of_add_sensor(struct device_node *zone, struct device_node *sensor, void *data, int (*get_temp)(void *, long *),Quoted 8 lines
drivers/thermal/of-thermal.c static struct thermal_zone_device *
Quoted 4 lines
drivers/thermal/of-thermal.c +2
-1- int (*get_trend)(void *, long *)) +int (*get_trend)(void *,long *), + int (*set_emul_temp)(void *, unsigned long))Thanks for improving the API. However, looking at what is above, it starts to be pretty ugly. And for sure, this is not the last callback to be added.
Presumably there would be some more callbacks.
Quoted 3 lines
I believe it is time to add a .ops in the of-thermal. While in here, do you mind adding the .ops in a separated patch, then add the .set_emul_temp in the .ops field?
I will add an option to pass .ops with
thermal_zone_of_add_sensor().I'm only concerned a bit about testing other users of of-thermal. I have only beaglebone black (BBB) for testing, which on-soc bandgap thermal sensor is very inaccurate and hence not supported even at BBB github linux kernel repository (v3.14).
Quoted 8 lines
Quoted 2 lines
Because of above I would need your support for testing.
I did the .ops part that is required for your patch:
https://patchwork.kernel.org/patch/5329801/As you already reviewed it. Do you mind refreshing your series on top of it?
Yours patches were almost identical to mine. I will wait maybe two more days, and if nobody opposed to your concept, I send my work on top of your patch.
Best regards,
Lukasz Majewski
Quoted 99 lines
Cheers,
Quoted 95 lines
Quoted 86 lines
Quoted 86 lines
drivers/thermal/of-thermal.c +0
-0{struct thermal_zone_device *tzd;drivers/thermal/of-thermal.c +2
-0struct __thermal_zone *tz;@@ -366,10 +379,12 @@ thermal_zone_of_add_sensor(struct device_node *zone,mutex_lock (&tzd->lock); tz->get_temp = get_temp; tz->get_trend = get_trend; + tz->set_emul_temp = set_emul_temp; tz->sensor_data = data; tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;@@ -411,7 +426,8 @@ thermal_zone_of_add_sensor(struct
device_node*zone, structthermal_zone_device*
thermal_zone_of_sensor_register(struct device *dev, intsensor_id, void *data, int (*get_temp)(void
*, long *),drivers/thermal/of-thermal.c +0
-1- int (*get_trend)(void *, long*))
drivers/thermal/of-thermal.c +1
-0+ int (*get_trend)(void *, long*),
drivers/thermal/of-thermal.c +1
-0+ int (*set_emul_temp)(void *,unsigned long)) {
drivers/thermal/of-thermal.c +0
-0struct device_node *np, *child, *sensor_np;@@ -453,7 +469,8 @@ thermal_zone_of_sensor_register(structdevice *dev, int
sensor_id, return thermal_zone_of_add_sensor(child,sensor_np, data,drivers/thermal/of-thermal.c +0
-1get_temp, -
get_trend);
+get_trend,
+set_emul_temp); }drivers/thermal/of-thermal.c +2
-0}of_node_put (np);@@ -494,9 +511,11 @@ void thermal_zone_of_sensor_unregister(struct device *dev, mutex_lock(&tzd->lock); tzd->ops->get_temp = NULL; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->get_temp =NULL ; tz->get_trend =NULL ; + tz->set_emul_temp =NULL ; tz->sensor_data =NULL ;mutex_unlock (&tzd->lock); }include/linux/thermal.h +2
-1@@ -290,14 +290,16 @@ struct thermal_genl_event {struct thermal_zone_device *thermal_zone_of_sensor_register (struct device *dev,int id,void *data,int (*get_temp)(void *, long *), -int (*get_trend)(void *,long *)); +int (*get_trend)(void *,long *), + int (*set_emul_temp)(void *,unsigned long)); void
thermal_zone_of_sensor_unregister(struct device *dev, struct thermal_zone_device *tz);
#else
static inline structthermal_zone_device* thermal_zone_of_sensor_register(struct device *dev, int id,
void *data, int
(*get_temp)(void *, long *),include/linux/thermal.h +0
-1- int (*get_trend)(void *, long*))
include/linux/thermal.h +1
-0+ int (*get_trend)(void *, long*),
include/linux/thermal.h +1
-0+ int (*set_emul_temp)(void *,unsigned long)) {
return NULL;
}Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141118/ffe33b35/attachment.sig>
PATCH 5/21 thermal: exynos: cosmetic: Correct comment format
In reply to Lukasz Majewski--- drivers/thermal/samsung/exynos_tmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/samsung/exynos_tmu.c +1 -1
@@ -606,7 +606,7 @@ out:#define exynos5440_tmu_set_emulation NULLstatic int exynos_tmu_set_emulation (void *drv_data,unsigned long temp) {return -EINVAL ; } -#endif /*CONFIG_THERMAL_EMULATION*/ +#endif /* CONFIG_THERMAL_EMULATION */ static int exynos4210_tmu_read (struct exynos_tmu_data *data) {
Signature · 1 line
2.0.0.rc2
PATCH 6/21 thermal: exynos: Provide thermal_exynos.h file to be included in device tree files
In reply to Lukasz MajewskiThis patch is a preparatory patch for being able to read Exynos thermal configuration from the device tree.
The DTC is not able to interpret enums properly and hence it is necessary to #define those values explicitly.
--- drivers/thermal/samsung/exynos_tmu.c | 2 +- drivers/thermal/samsung/exynos_tmu.h | 23 +++------------- include/dt-bindings/thermal/thermal_exynos.h | 40 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 include/dt-bindings/thermal/thermal_exynos.h
drivers/thermal/samsung/exynos_tmu.c +1 -1
@@ -159,7 +159,7 @@ struct exynos_tmu_data {void __iomem *base;void __iomem *base_second;int irq; -enum soc_type soc; +int soc;struct work_struct irq_work;struct mutex lock;struct clk *clk, *clk_sec;
drivers/thermal/samsung/exynos_tmu.h +3 -20
@@ -26,24 +26,7 @@#include "exynos_thermal_common.h" -enum calibration_type { -TYPE_ONE_POINT_TRIMMING , -TYPE_ONE_POINT_TRIMMING_25 , -TYPE_ONE_POINT_TRIMMING_85 , -TYPE_TWO_POINT_TRIMMING , -TYPE_NONE , -}; - -enum soc_type { -SOC_ARCH_EXYNOS3250 =1 , -SOC_ARCH_EXYNOS4210 , -SOC_ARCH_EXYNOS4412 , -SOC_ARCH_EXYNOS5250 , -SOC_ARCH_EXYNOS5260 , -SOC_ARCH_EXYNOS5420 , -SOC_ARCH_EXYNOS5420_TRIMINFO , -SOC_ARCH_EXYNOS5440 , -}; +#include <dt-bindings/thermal/thermal_exynos.h> /** * struct exynos_tmu_platform_data
@@ -115,8 +98,8 @@ struct exynos_tmu_platform_data {u8 second_point_trim;u8 default_temp_offset; -enum calibration_type cal_type; -enum soc_type type; +u32 cal_type; +u32 type;struct freq_clip_table freq_tab[4 ];unsigned int freq_tab_count; };
include/dt-bindings/thermal/thermal_exynos.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* thermal_exynos.h - Samsung EXYNOS TMU device tree definitions +* +* Copyright (C) 2014 Samsung Electronics +* 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 as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _EXYNOS_THERMAL_TMU_DT_H +#define _EXYNOS_THERMAL_TMU_DT_H + +#define TYPE_ONE_POINT_TRIMMING 0 +#define TYPE_ONE_POINT_TRIMMING_25 1 +#define TYPE_ONE_POINT_TRIMMING_85 2 +#define TYPE_TWO_POINT_TRIMMING 3 +#define TYPE_NONE 4 + +#define SOC_ARCH_EXYNOS3250 1 +#define SOC_ARCH_EXYNOS4210 2 +#define SOC_ARCH_EXYNOS4412 3 +#define SOC_ARCH_EXYNOS5250 4 +#define SOC_ARCH_EXYNOS5260 5 +#define SOC_ARCH_EXYNOS5420_TRIMINFO 6 +#define SOC_ARCH_EXYNOS5420 7 +#define SOC_ARCH_EXYNOS5440 8 + +#endif /* _EXYNOS_THERMAL_TMU_DT_H */
Signature · 1 line
2.0.0.rc2
PATCH 7/21 thermal: dts: trats: Enable TMU on the Exynos4210 trats device
In reply to Lukasz MajewskiThe thermal IP block (Thermal Management Unit) called TMU has been enabled in this device.
--- arch/arm/boot/dts/exynos4210-trats.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/exynos4210-trats.dts +4 -0
@@ -424,6 +424,10 @@ status = "okay"; }; + tmu at 100C0000 { + status = "okay"; + }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;
Signature · 1 line
2.0.0.rc2
PATCH 8/21 thermal: dts: exynos: Adding LD010 regulator node necessary for TMU on Odroid U3 board
In reply to Lukasz Majewski--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +7 -0
@@ -209,6 +209,13 @@ regulator-always-on; }; + ldo10_reg: LDO10 { + regulator-name = "VDD18_MIPIHSI_1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + ldo11_reg: LDO11 { regulator-name = "VDD18_ABB1_1.8V"; regulator-min-microvolt = <1800000>;
Signature · 1 line
2.0.0.rc2
PATCH 9/21 thermal: dts: Provide bindings and enable TMU at Exynos4x12 devices
In reply to Lukasz MajewskiThis commit adds necessary bindings for enabling TMU IP block on the Exynos4412 Odroid U3 device.
--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 5 +++++ arch/arm/boot/dts/exynos4x12.dtsi | 10 ++++++++++ 2 files changed, 15 insertions(+)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +5 -0
@@ -374,6 +374,11 @@ ehci: ehci at 12580000 { status = "okay"; }; + + tmu at 100C0000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; }; &pinctrl_1 {
arch/arm/boot/dts/exynos4x12.dtsi +10 -0
@@ -271,4 +271,14 @@ compatible = "samsung,exynos4x12-usb2-phy"; samsung,sysreg-phandle = <&sys_reg>; }; + + tmu at 100C0000 { + compatible = "samsung,exynos4412-tmu"; + interrupt-parent = <&combiner>; + reg = <0x100C0000 0x100>; + interrupts = <2 4>; + clocks = <&clock 383>; + clock-names = "tmu_apbif"; + status = "disabled"; + }; };
Signature · 1 line
2.0.0.rc2
PATCH 10/21 thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu cooling functionality
In reply to Lukasz MajewskiPresented patch aims to move data necessary for correct CPU cooling device configuration from exynos_tmu_data.c to device tree.
--- arch/arm/boot/dts/exynos4210-trats.dts | 15 +++++++++++++++ arch/arm/boot/dts/exynos4210.dtsi | 5 ++++- arch/arm/boot/dts/exynos4212.dtsi | 5 ++++- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 15 +++++++++++++++ arch/arm/boot/dts/exynos4412.dtsi | 5 ++++- arch/arm/boot/dts/exynos5250.dtsi | 20 +++++++++++++++++++- 6 files changed, 61 insertions(+), 4 deletions(-)
arch/arm/boot/dts/exynos4210-trats.dts +15 -0
@@ -428,6 +428,21 @@ status = "okay"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 2 2>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 4 4>; + }; + }; + }; + }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;
arch/arm/boot/dts/exynos4210.dtsi +4 -1
@@ -45,10 +45,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu at 0 { + cpu0: cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0x900>; + cooling-min-level = <4>; + cooling-max-level = <2>; + #cooling-cells = <2>; /* min followed by max */ }; cpu at 1 {
arch/arm/boot/dts/exynos4212.dtsi +4 -1
@@ -26,10 +26,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu at 0 { + cpu0: cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu at 1 {
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +15 -0
@@ -379,6 +379,21 @@ vtmu-supply = <&ldo10_reg>; status = "okay"; }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; }; &pinctrl_1 {
arch/arm/boot/dts/exynos4412.dtsi +4 -1
@@ -26,10 +26,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu at 0 { + cpu0: cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu at 1 {
arch/arm/boot/dts/exynos5250.dtsi +19 -1
@@ -58,11 +58,14 @@ #address-cells = <1>; #size-cells = <0>; - cpu at 0 { + cpu0: cpu at 0 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0>; clock-frequency = <1700000000>; + cooling-min-level = <15>; + cooling-max-level = <9>; + #cooling-cells = <2>; /* min followed by max */ }; cpu at 1 { device_type = "cpu";
@@ -241,6 +244,21 @@ clock-names = "tmu_apbif"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 9 9>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 15 15>; + }; + }; + }; + }; + serial at 12C00000 { clocks = <&clock CLK_UART0>, <&clock CLK_SCLK_UART0>; clock-names = "uart", "clk_uart_baud0";
Signature · 1 line
2.0.0.rc2
PATCH 11/21 thermal: cpu_cooling: Modify exynos thermal code to use device tree for cpu cooling configuration
In reply to Lukasz MajewskiUp till now exynos_tmu_data.c was used for storing CPU cooling configuration data. Now the Exynos thermal core code uses device tree to get this data. For this purpose generic thermal code for configuring CPU cooling was used.
--- drivers/cpufreq/exynos-cpufreq.c | 23 ++++- drivers/thermal/samsung/exynos_thermal_common.c | 122 ++++++++++++++---------- drivers/thermal/samsung/exynos_tmu.c | 7 -- drivers/thermal/samsung/exynos_tmu.h | 5 - drivers/thermal/samsung/exynos_tmu_data.c | 42 +------- 5 files changed, 94 insertions(+), 105 deletions(-)
drivers/cpufreq/exynos-cpufreq.c +21 -2
@@ -18,10 +18,13 @@#include <linux/cpufreq.h> #include <linux/platform_device.h> #include <linux/of.h> +#include <linux/cpu_cooling.h> +#include <linux/cpu.h> #include "exynos-cpufreq.h" static struct exynos_dvfs_info *exynos_info; +static struct thermal_cooling_device *cdev;static struct regulator *arm_regulator;static unsigned int locking_frequency;
@@ -156,6 +159,7 @@ static struct cpufreq_driver exynos_driver = {static int exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *np;int ret = -EINVAL ; exynos_info =kzalloc (sizeof (*exynos_info),GFP_KERNEL );
@@ -198,9 +202,24 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)/* Done here as we want to capture boot frequency */ locking_frequency =clk_get_rate (exynos_info->cpu_clk) /1000 ; -if (!cpufreq_register_driver (&exynos_driver)) -return 0 ; +if (cpufreq_register_driver (&exynos_driver)) + goto err; + np =of_find_node_by_path ("/cpus/cpu at 0" ); +if (!np) { +pr_err ("failed to find cpu0 node\n" ); +return -ENOENT ; + } +if (of_find_property (np,"#cooling-cells" ,NULL )) { + cdev =of_cpufreq_cooling_register (np, cpu_present_mask); +if (IS_ERR (cdev)) +pr_err ("running cpufreq without cooling device: %ld\n" , +PTR_ERR (cdev)); + } +of_node_put (np); + +return 0 ; + err:dev_err (&pdev->dev,"failed to register cpufreq driver\n" );regulator_put (arm_regulator); err_vdd_arm:
drivers/thermal/samsung/exynos_thermal_common.c +70 -52
156 lines not on this page · raw message
drivers/thermal/samsung/exynos_tmu.c +0 -7
@@ -937,13 +937,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) sensor_conf->trip_data.trigger_falling = pdata->threshold_falling; - sensor_conf->cooling_data.freq_clip_count = pdata->freq_tab_count; -for (i =0 ; i < pdata->freq_tab_count; i++) { - sensor_conf->cooling_data.freq_data[i].freq_clip_max = - pdata->freq_tab[i].freq_clip_max; - sensor_conf->cooling_data.freq_data[i].temp_level = - pdata->freq_tab[i].temp_level; - } sensor_conf->dev = &pdev->dev;/* Register the sensor with thermal management interface */ ret =exynos_register_thermal (sensor_conf);
drivers/thermal/samsung/exynos_tmu.h +0 -5
@@ -73,9 +73,6 @@* @second_point_trim: temp value of the second point trimming * @default_temp_offset: default temperature offset in case of no trimming * @cal_type: calibration type for temperature -* @freq_clip_table: Table representing frequency reduction percentage. -* @freq_tab_count: Count of the above table as frequency reduction may -* applicable to only some of the trigger levels. * * This structure is required for configuration of exynos_tmu driver. */
@@ -100,8 +97,6 @@ struct exynos_tmu_platform_data {u32 cal_type;u32 type; -struct freq_clip_table freq_tab[4 ]; -unsigned int freq_tab_count; };/**
drivers/thermal/samsung/exynos_tmu_data.c +3 -39
66 lines not on this page · raw message
Signature · 1 line
2.0.0.rc2
PATCH 12/21 thermal: exynos: dts: Add default definition for the TMU sensor
In reply to Lukasz MajewskiExynos 4 and 5 family of SoCs uses almost identical TMU sensor to measure the on chip temperature. Hence it is possible to group TMU configuration parameters in one dts include file.
--- arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +24 -0
@@ -0,0 +1,24 @@ +/* + * Device tree sources for Exynos4412 TMU sensor configuration + * + * 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_exynos.h> + +#thermal-sensor-cells = <0>; +gain = <8>; +reference_voltage = <16>; +noise_cancel_mode = <4>; +efuse_value = <55>; +min_efuse_value = <40>; +max_efuse_value = <100>; +first_point_trim = <25>; +second_point_trim = <85>; +default_temp_offset = <50>; +cal_type = <TYPE_ONE_POINT_TRIMMING>;
Signature · 1 line
2.0.0.rc2
PATCH 13/21 thermal: dts: Default trip points definition for Exynos5420 SoCs
In reply to Lukasz MajewskiThis code groups in one place default settings of trip points. It is used in SoCs with multiple instances of TMU sensor.
Separate device tree file prevents from multiple copying of the same data.
--- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 arch/arm/boot/dts/exynos5420-trip-points.dtsi
arch/arm/boot/dts/exynos5420-trip-points.dtsi new file +35 -0
@@ -0,0 +1,35 @@ +/* + * Device tree sources for default Exynos 5420 thermal zone definition + * + * 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. + * + */ + +polling-delay-passive = <0>; +polling-delay = <0>; +trips { + cpu-alert-0 { + temperature = <85000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu-alert-1 { + temperature = <103000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu-alert-2 { + temperature = <110000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu-crit-0 { + temperature = <1200000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "critical"; + }; +};
Signature · 1 line
2.0.0.rc2
PATCH 14/21 thermal: exynos: dts: Define default thermal-zones for Exynos4
In reply to Lukasz MajewskiTrip points corresponding to the one defined in the exynos_tmu_data.c for Exynos4 have been included.
This thermal-zones attribute is afterwards reused for Exynos4210, Exynos4412 and Exynos5250.
--- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi
arch/arm/boot/dts/exynos4-cpu-thermal.dtsi new file +52 -0
@@ -0,0 +1,52 @@ +/* + * Device tree sources for Exynos4 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 { + cpu_thermal: cpu-thermal { + thermal-sensors = <&tmu 0>; + polling-delay-passive = <0>; + polling-delay = <0>; + trips { + cpu_alert0: cpu-alert-0 { + temperature = <70000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu_alert1: cpu-alert-1 { + temperature = <95000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu_alert2: cpu-alert-2 { + temperature = <110000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu_crit0: cpu-crit-0 { + temperature = <120000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&cpu_alert0>; + }; + map1 { + trip = <&cpu_alert1>; + }; + }; + }; + }; +};
Signature · 1 line
2.0.0.rc2
PATCH 15/21 thermal: dts: exynos: Trip points and sensor configuration data for Exynos5440
In reply to Lukasz MajewskiThis commit provides information about Exynos5440 device configuration. Previously this information was available in exynos_tmu_data.c file. Now it is available in the device tree.
Such approach allows reusing some common code for thermal.
--- arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 +++++++++++++++++++++++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-trip-points.dtsi
arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Device tree sources for Exynos5440 TMU sensor configuration + * + * 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_exynos.h> + +#thermal-sensor-cells = <0>; +gain = <5>; +reference_voltage = <16>; +noise_cancel_mode = <4>; +efuse_value = <0x5d2d>; +min_efuse_value = <16>; +max_efuse_value = <76>; +first_point_trim = <25>; +second_point_trim = <70>; +default_temp_offset = <25>; +cal_type = <TYPE_ONE_POINT_TRIMMING>; +type = <SOC_ARCH_EXYNOS5440>;
arch/arm/boot/dts/exynos5440-trip-points.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Device tree sources for default Exynos5440 thermal zone definition + * + * 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. + * + */ + +polling-delay-passive = <0>; +polling-delay = <0>; +trips { + cpu-alert-0 { + temperature = <100000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "active"; + }; + cpu-crit-0 { + temperature = <1050000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "critical"; + }; +};
Signature · 1 line
2.0.0.rc2
PATCH 16/21 thermal: exynos: dts: Provide device tree bindings identical to one in exynos_tmu_data.c
In reply to Lukasz MajewskiPresented device tree bindings provide data already hardcoded in the exynos_tmu_data.c file.
After this commit, it should be possible to reuse common thermal core framework in Exynos SoCs.
--- arch/arm/boot/dts/exynos4.dtsi | 5 +++++ arch/arm/boot/dts/exynos4210.dtsi | 23 ++++++++++++++++++++++- arch/arm/boot/dts/exynos4x12.dtsi | 3 +++ arch/arm/boot/dts/exynos5250.dtsi | 7 +++++-- arch/arm/boot/dts/exynos5420.dtsi | 33 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5440.dtsi | 18 ++++++++++++++++++ 6 files changed, 86 insertions(+), 3 deletions(-)
arch/arm/boot/dts/exynos4.dtsi +5 -0
@@ -21,6 +21,7 @@ #include <dt-bindings/clock/exynos4.h> #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> #include "skeleton.dtsi" / {
@@ -645,4 +646,8 @@ samsung,sysreg = <&sys_reg>; status = "disabled"; }; + + tmu: tmu at 100C0000 { + #include "exynos4412-tmu-sensor-conf.dtsi" + }; };
arch/arm/boot/dts/exynos4210.dtsi +22 -1
@@ -21,6 +21,8 @@ #include "exynos4.dtsi" #include "exynos4210-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos4210", "samsung,exynos4";
@@ -146,16 +148,35 @@ reg = <0x03860000 0x1000>; }; - tmu at 100C0000 { + tmu: tmu at 100C0000 { compatible = "samsung,exynos4210-tmu"; interrupt-parent = <&combiner>; reg = <0x100C0000 0x100>; interrupts = <2 4>; clocks = <&clock CLK_TMU_APBIF>; clock-names = "tmu_apbif"; + gain = <15>; + reference_voltage = <7>; + type = <SOC_ARCH_EXYNOS4210>; status = "disabled"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + trips { + cpu_alert0: cpu-alert-0 { + temperature = <85000>; /* millicelsius */ + }; + cpu_alert1: cpu-alert-1 { + temperature = <100000>; /* millicelsius */ + }; + cpu_alert2: cpu-alert-2 { + temperature = <110000>; /* millicelsius */ + }; + }; + }; + }; + g2d at 12800000 { compatible = "samsung,s5pv210-g2d"; reg = <0x12800000 0x1000>;
arch/arm/boot/dts/exynos4x12.dtsi +3 -0
@@ -19,6 +19,8 @@ #include "exynos4.dtsi" #include "exynos4x12-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { aliases {
@@ -279,6 +281,7 @@ interrupts = <2 4>; clocks = <&clock 383>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS4412>; status = "disabled"; }; };
arch/arm/boot/dts/exynos5250.dtsi +5 -2
@@ -20,8 +20,9 @@ #include <dt-bindings/clock/exynos5250.h> #include "exynos5.dtsi" #include "exynos5250-pinctrl.dtsi" - +#include "exynos4-cpu-thermal.dtsi" #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos5250", "samsung,exynos5";
@@ -236,12 +237,14 @@ status = "disabled"; }; - tmu at 10060000 { + tmu: tmu at 10060000 { compatible = "samsung,exynos5250-tmu"; reg = <0x10060000 0x100>; interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS5250>; + #include "exynos4412-tmu-sensor-conf.dtsi" }; thermal-zones {
arch/arm/boot/dts/exynos5420.dtsi +33 -0
@@ -756,6 +756,8 @@ interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu1: tmu at 10064000 {
@@ -764,6 +766,8 @@ interrupts = <0 183 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu2: tmu at 10068000 {
@@ -772,6 +776,8 @@ interrupts = <0 184 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_cpu3: tmu at 1006c000 {
@@ -780,6 +786,8 @@ interrupts = <0 185 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU_GPU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_gpu: tmu at 100a0000 {
@@ -788,6 +796,31 @@ interrupts = <0 215 0>; clocks = <&clock CLK_TMU_GPU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; + }; + + 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" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmu_cpu2>; + #include "exynos5420-trip-points.dtsi" + }; + cpu3_thermal: cpu3-thermal { + thermal-sensors = <&tmu_cpu3>; + #include "exynos5420-trip-points.dtsi" + }; + gpu_thermal: gpu-thermal { + thermal-sensors = <&tmu_gpu>; + #include "exynos5420-trip-points.dtsi" + }; }; watchdog: watchdog at 101D0000 {
arch/arm/boot/dts/exynos5440.dtsi +18 -0
@@ -219,6 +219,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_1: tmuctrl at 16011C {
@@ -227,6 +228,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_2: tmuctrl at 160120 {
@@ -235,6 +237,22 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" + }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmuctrl_0>; + #include "exynos5440-trip-points.dtsi" + }; + cpu1_thermal: cpu1-thermal { + thermal-sensors = <&tmuctrl_1>; + #include "exynos5440-trip-points.dtsi" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmuctrl_2>; + #include "exynos5440-trip-points.dtsi" + }; }; sata at 210000 {
Signature · 1 line
2.0.0.rc2
PATCH 17/21 thermal: samsung: core: Exynos TMU rework to use device tree for configuration
In reply to Lukasz MajewskiThis patch brings support for providing configuration via device tree. Previously, data hardcoded in the exynos_tmu_data.c file was used, which is not scalable and error prone.
--- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_tmu.c | 266 ++++++++++++++++++++--------------- drivers/thermal/samsung/exynos_tmu.h | 51 ------- 3 files changed, 154 insertions(+), 165 deletions(-)
drivers/thermal/samsung/Makefile +0 -2
@@ -3,5 +3,3 @@ # obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o exynos_thermal-y := exynos_tmu.o -exynos_thermal-y += exynos_tmu_data.o -exynos_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o
drivers/thermal/samsung/exynos_tmu.c +154 -112
489 lines not on this page · raw message
drivers/thermal/samsung/exynos_tmu.h +0 -51
79 lines not on this page · raw message
Signature · 1 line
2.0.0.rc2
PATCH 18/21 thermal: exynos: Remove exynos_thermal_common.[c|h] files
In reply to Lukasz MajewskiAfter defining all necessary Exynos data in the device tree those files can be removed.
--- drivers/thermal/samsung/exynos_thermal_common.c | 448 ------------------------ drivers/thermal/samsung/exynos_thermal_common.h | 106 ------ 2 files changed, 554 deletions(-) delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h
drivers/thermal/samsung/exynos_thermal_common.c deleted +0 -448
@@ -1,448 +0,0 @@ -/* -* exynos_thermal_common.c - Samsung EXYNOS common thermal file -* -* Copyright (C) 2013 Samsung Electronics -* Amit Daniel Kachhap <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ - -#include <linux/cpu_cooling.h> -#include <linux/err.h> -#include <linux/slab.h> -#include <linux/thermal.h> - -#include "exynos_thermal_common.h" - -struct exynos_thermal_zone { -enum thermal_device_mode mode; -struct thermal_zone_device *therm_dev; -struct thermal_cooling_device *cool_dev[MAX_COOLING_DEVICE ]; -unsigned int cool_dev_size; -struct platform_device *exynos4_dev; -struct thermal_sensor_conf *sensor_conf; -bool bind; -}; - -/* Get mode callback functions for thermal zone */ -static int exynos_get_mode (struct thermal_zone_device *thermal, -enum thermal_device_mode *mode) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -if (th_zone) - *mode = th_zone->mode; -return 0 ; -} - -/* Set mode callback functions for thermal zone */ -static int exynos_set_mode (struct thermal_zone_device *thermal, -enum thermal_device_mode mode) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -if (!th_zone) { -dev_err (&thermal->device, -"thermal zone not registered\n" ); -return 0 ; - } - -mutex_lock (&thermal->lock); - -if (mode ==THERMAL_DEVICE_ENABLED && - !th_zone->sensor_conf->trip_data.trigger_falling) - thermal->polling_delay =IDLE_INTERVAL ; -else - thermal->polling_delay =0 ; - -mutex_unlock (&thermal->lock); - - th_zone->mode = mode; -thermal_zone_device_update (thermal); -dev_dbg (th_zone->sensor_conf->dev, -"thermal polling set for duration=%d msec\n" , - thermal->polling_delay); -return 0 ; -} - - -/* Get trip type callback functions for thermal zone */ -static int exynos_get_trip_type (struct thermal_zone_device *thermal,int trip, -enum thermal_trip_type *type) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -int max_trip = th_zone->sensor_conf->trip_data.trip_count; -int trip_type; - -if (trip <0 || trip >= max_trip) -return -EINVAL ; - - trip_type = th_zone->sensor_conf->trip_data.trip_type[trip]; - -if (trip_type ==SW_TRIP ) - *type =THERMAL_TRIP_CRITICAL ; -else if (trip_type ==THROTTLE_ACTIVE ) - *type =THERMAL_TRIP_ACTIVE ; -else if (trip_type ==THROTTLE_PASSIVE ) - *type =THERMAL_TRIP_PASSIVE ; -else -return -EINVAL ; - -return 0 ; -} - -/* Get trip temperature callback functions for thermal zone */ -static int exynos_get_trip_temp (struct thermal_zone_device *thermal,int trip, -unsigned long *temp) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -int max_trip = th_zone->sensor_conf->trip_data.trip_count; - -if (trip <0 || trip >= max_trip) -return -EINVAL ; - - *temp = th_zone->sensor_conf->trip_data.trip_val[trip]; -/* convert the temperature into millicelsius */ - *temp = *temp *MCELSIUS ; - -return 0 ; -} - -/* Get critical temperature callback functions for thermal zone */ -static int exynos_get_crit_temp (struct thermal_zone_device *thermal, -unsigned long *temp) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -int max_trip = th_zone->sensor_conf->trip_data.trip_count; -/* Get the temp of highest trip*/ -return exynos_get_trip_temp (thermal, max_trip -1 , temp); -} - -/* Bind callback functions for thermal zone */ -static int exynos_bind (struct thermal_zone_device *thermal, -struct thermal_cooling_device *cdev) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -struct thermal_sensor_conf *data = th_zone->sensor_conf; -struct device_node *child, *gchild, *np; -struct of_phandle_args cooling_spec; -unsigned long max, state =0 ; -int ret =0 , i =0 ; - -/* -* Below code is necessary to skip binding when cpufreq's -* frequency table is not yet initialized. -*/ - cdev->ops->get_max_state (cdev, &state); -if (!state && !th_zone->cool_dev_size) { - th_zone->cool_dev_size =1 ; - th_zone->cool_dev[0 ] = cdev; - th_zone->bind = false; -return 0 ; - } - - np =of_find_node_by_path ("/thermal-zones/cpu-thermal" ); -if (!np) { -pr_err ("failed to find thmerla-zones/cpu-thermal node\n" ); -return -ENOENT ; - } - - child =of_get_child_by_name (np,"cooling-maps" ); - -for_each_child_of_node (child, gchild) { - ret =of_parse_phandle_with_args (gchild,"cooling-device" , -"#cooling-cells" , -0 , &cooling_spec); -if (ret <0 ) { -pr_err ("missing cooling_device property\n" ); - goto end; - } - -if (cooling_spec.args_count <2 ) { - ret = -EINVAL ; - goto end; - } - - max = cooling_spec.args[0 ]; -if (thermal_zone_bind_cooling_device (thermal, i, cdev, - max,0 )) { -dev_err (data->dev, -"thermal error unbinding cdev inst=%d\n" , i); - - ret = -EINVAL ; - goto end; - } - i++; - } - th_zone->bind = true; -end: -of_node_put (child); -of_node_put (np); - -return ret; -} - -/* Unbind callback functions for thermal zone */ -static int exynos_unbind (struct thermal_zone_device *thermal, -struct thermal_cooling_device *cdev) -{ -int ret =0 , i; -struct exynos_thermal_zone *th_zone = thermal->devdata; -struct thermal_sensor_conf *data = th_zone->sensor_conf; -struct device_node *child, *gchild, *np; - -if (th_zone->bind == false || !th_zone->cool_dev_size) -return 0 ; - -/* find the cooling device registered*/ -for (i =0 ; i < th_zone->cool_dev_size; i++) -if (cdev == th_zone->cool_dev[i]) -break ; - -/* No matching cooling device */ -if (i == th_zone->cool_dev_size) -return 0 ; - - np =of_find_node_by_path ("/thermal-zones/cpu-thermal" ); -if (!np) { -pr_err ("failed to find thmerla-zones/cpu-thermal node\n" ); -return -ENOENT ; - } - - child =of_get_child_by_name (np,"cooling-maps" ); - - i =0 ; -for_each_child_of_node (child, gchild) { -if (thermal_zone_unbind_cooling_device (thermal, i, - cdev)) { -dev_err (data->dev, -"error unbinding cdev inst=%d\n" , i); - ret = -EINVAL ; - goto end; - } - i++; - } - th_zone->bind = false; -end: -of_node_put (child); -of_node_put (np); - -return ret; -} - -/* Get temperature callback functions for thermal zone */ -static int exynos_get_temp (struct thermal_zone_device *thermal, -unsigned long *temp) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -void *data; - -if (!th_zone->sensor_conf) { -dev_err (&thermal->device, -"Temperature sensor not initialised\n" ); -return -EINVAL ; - } - data = th_zone->sensor_conf->driver_data; - *temp = th_zone->sensor_conf->read_temperature (data); -/* convert the temperature into millicelsius */ - *temp = *temp *MCELSIUS ; -return 0 ; -} - -/* Get temperature callback functions for thermal zone */ -static int exynos_set_emul_temp (struct thermal_zone_device *thermal, -unsigned long temp) -{ -void *data; -int ret = -EINVAL ; -struct exynos_thermal_zone *th_zone = thermal->devdata; - -if (!th_zone->sensor_conf) { -dev_err (&thermal->device, -"Temperature sensor not initialised\n" ); -return -EINVAL ; - } - data = th_zone->sensor_conf->driver_data; -if (th_zone->sensor_conf->write_emul_temp) - ret = th_zone->sensor_conf->write_emul_temp (data, temp); -return ret; -} - -/* Get the temperature trend */ -static int exynos_get_trend (struct thermal_zone_device *thermal, -int trip,enum thermal_trend *trend) -{ -int ret; -unsigned long trip_temp; - - ret =exynos_get_trip_temp (thermal, trip, &trip_temp); -if (ret <0 ) -return ret; - -if (thermal->temperature >= trip_temp) - *trend =THERMAL_TREND_RAISE_FULL ; -else - *trend =THERMAL_TREND_DROP_FULL ; - -return 0 ; -} -/* Operation callback functions for thermal zone */ -static struct thermal_zone_device_ops exynos_dev_ops = { - .bind = exynos_bind, - .unbind = exynos_unbind, - .get_temp = exynos_get_temp, - .set_emul_temp = exynos_set_emul_temp, - .get_trend = exynos_get_trend, - .get_mode = exynos_get_mode, - .set_mode = exynos_set_mode, - .get_trip_type = exynos_get_trip_type, - .get_trip_temp = exynos_get_trip_temp, - .get_crit_temp = exynos_get_crit_temp, -}; - -/* -* This function may be called from interrupt based temperature sensor -* when threshold is changed. -*/ -void exynos_report_trigger (struct thermal_sensor_conf *conf) -{ -unsigned int i; -char data[10 ]; -char *envp[] = { data,NULL }; -struct exynos_thermal_zone *th_zone; - -if (!conf || !conf->pzone_data) { -pr_err ("Invalid temperature sensor configuration data\n" ); -return ; - } - - th_zone = conf->pzone_data; - -if (th_zone->bind == false) { -for (i =0 ; i < th_zone->cool_dev_size; i++) { -if (!th_zone->cool_dev[i]) -continue ; -exynos_bind (th_zone->therm_dev, - th_zone->cool_dev[i]); - } - } - -thermal_zone_device_update (th_zone->therm_dev); - -mutex_lock (&th_zone->therm_dev->lock); -/* Find the level for which trip happened */ -for (i =0 ; i < th_zone->sensor_conf->trip_data.trip_count; i++) { -if (th_zone->therm_dev->last_temperature < - th_zone->sensor_conf->trip_data.trip_val[i] *MCELSIUS ) -break ; - } - -if (th_zone->mode ==THERMAL_DEVICE_ENABLED && - !th_zone->sensor_conf->trip_data.trigger_falling) { -if (i >0 ) - th_zone->therm_dev->polling_delay =ACTIVE_INTERVAL ; -else - th_zone->therm_dev->polling_delay =IDLE_INTERVAL ; - } - -snprintf (data,sizeof (data),"%u" , i); -kobject_uevent_env (&th_zone->therm_dev->device.kobj,KOBJ_CHANGE , envp); -mutex_unlock (&th_zone->therm_dev->lock); -} - -/* Register with the in-kernel thermal management */ -int exynos_register_thermal (struct thermal_sensor_conf *sensor_conf) -{ -int ret; -struct cpumask mask_val; -struct exynos_thermal_zone *th_zone; - -if (!sensor_conf || !sensor_conf->read_temperature) { -pr_err ("Temperature sensor not initialised\n" ); -return -EINVAL ; - } - - th_zone =devm_kzalloc (sensor_conf->dev, -sizeof (struct exynos_thermal_zone ),GFP_KERNEL ); -if (!th_zone) -return -ENOMEM ; - - th_zone->sensor_conf = sensor_conf; -/* -* TODO: 1) Handle multiple cooling devices in a thermal zone -* 2) Add a flag/name in cooling info to map to specific -* sensor -*/ -if (sensor_conf->cooling_data.freq_clip_count >0 ) { -cpumask_set_cpu (0 , &mask_val); - th_zone->cool_dev[th_zone->cool_dev_size] = -cpufreq_cooling_register (&mask_val); -if (IS_ERR (th_zone->cool_dev[th_zone->cool_dev_size])) { -dev_err (sensor_conf->dev, -"Failed to register cpufreq cooling device\n" ); - ret = -EINVAL ; - goto err_unregister; - } - th_zone->cool_dev_size++; - } - - th_zone->therm_dev =thermal_zone_device_register ( - sensor_conf->name, sensor_conf->trip_data.trip_count, -0 , th_zone, &exynos_dev_ops,NULL ,0 , - sensor_conf->trip_data.trigger_falling ?0 : -IDLE_INTERVAL ); - -if (IS_ERR (th_zone->therm_dev)) { -dev_err (sensor_conf->dev, -"Failed to register thermal zone device\n" ); - ret =PTR_ERR (th_zone->therm_dev); - goto err_unregister; - } - th_zone->mode =THERMAL_DEVICE_ENABLED ; - sensor_conf->pzone_data = th_zone; - -dev_info (sensor_conf->dev, -"Exynos: Thermal zone(%s) registered\n" , sensor_conf->name); - -return 0 ; - -err_unregister: -exynos_unregister_thermal (sensor_conf); -return ret; -} - -/* Un-Register with the in-kernel thermal management */ -void exynos_unregister_thermal (struct thermal_sensor_conf *sensor_conf) -{ -int i; -struct exynos_thermal_zone *th_zone; - -if (!sensor_conf || !sensor_conf->pzone_data) { -pr_err ("Invalid temperature sensor configuration data\n" ); -return ; - } - - th_zone = sensor_conf->pzone_data; - -if (th_zone->therm_dev) -thermal_zone_device_unregister (th_zone->therm_dev); - -for (i =0 ; i < th_zone->cool_dev_size; i++) { -if (th_zone->cool_dev[i]) -cpufreq_cooling_unregister (th_zone->cool_dev[i]); - } - -dev_info (sensor_conf->dev, -"Exynos: Kernel Thermal management unregistered\n" ); -}
drivers/thermal/samsung/exynos_thermal_common.h deleted +0 -106
106 lines not on this page · raw message
Signature · 1 line
2.0.0.rc2
PATCH 19/21 thermal: exynos: Remove exynos_tmu_data.c file
In reply to Lukasz MajewskiData already present in the exynos_tmu_data.c file has been moved to the appropriate device tree files.
--- drivers/thermal/samsung/exynos_tmu_data.c | 228 ------------------------------ 1 file changed, 228 deletions(-) delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c
drivers/thermal/samsung/exynos_tmu_data.c deleted +0 -228
@@ -1,228 +0,0 @@ -/* -* exynos_tmu_data.c - Samsung EXYNOS tmu data file -* -* Copyright (C) 2013 Samsung Electronics -* Amit Daniel Kachhap <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ - -#include "exynos_thermal_common.h" -#include "exynos_tmu.h" - -struct exynos_tmu_init_data const exynos4210_default_tmu_data = { - .tmu_data = { - { - .threshold =80 , - .trigger_levels[0 ] =5 , - .trigger_levels[1 ] =20 , - .trigger_levels[2 ] =30 , - .trigger_enable[0 ] = true, - .trigger_enable[1 ] = true, - .trigger_enable[2 ] = true, - .trigger_enable[3 ] = false, - .trigger_type[0 ] =THROTTLE_ACTIVE , - .trigger_type[1 ] =THROTTLE_ACTIVE , - .trigger_type[2 ] =SW_TRIP , - .max_trigger_level =4 , - .non_hw_trigger_levels =3 , - .gain =15 , - .reference_voltage =7 , - .cal_type =TYPE_ONE_POINT_TRIMMING , - .min_efuse_value =40 , - .max_efuse_value =100 , - .first_point_trim =25 , - .second_point_trim =85 , - .default_temp_offset =50 , - .type =SOC_ARCH_EXYNOS4210 , - }, - }, - .tmu_count =1 , -}; - -#define EXYNOS3250_TMU_DATA \ - .threshold_falling = 10, \ - .trigger_levels[0] = 70, \ - .trigger_levels[1] = 95, \ - .trigger_levels[2] = 110, \ - .trigger_levels[3] = 120, \ - .trigger_enable[0] = true, \ - .trigger_enable[1] = true, \ - .trigger_enable[2] = true, \ - .trigger_enable[3] = false, \ - .trigger_type[0] = THROTTLE_ACTIVE, \ - .trigger_type[1] = THROTTLE_ACTIVE, \ - .trigger_type[2] = SW_TRIP, \ - .trigger_type[3] = HW_TRIP, \ - .max_trigger_level = 4, \ - .non_hw_trigger_levels = 3, \ - .gain = 8, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_TWO_POINT_TRIMMING, \ - .efuse_value = 55, \ - .min_efuse_value = 40, \ - .max_efuse_value = 100, \ - .first_point_trim = 25, \ - .second_point_trim = 85, \ - .default_temp_offset = 50 - -struct exynos_tmu_init_data const exynos3250_default_tmu_data = { - .tmu_data = { - { -EXYNOS3250_TMU_DATA , - .type =SOC_ARCH_EXYNOS3250 , - }, - }, - .tmu_count =1 , -}; - -#define EXYNOS4412_TMU_DATA \ - .threshold_falling = 10, \ - .trigger_levels[0] = 70, \ - .trigger_levels[1] = 95, \ - .trigger_levels[2] = 110, \ - .trigger_levels[3] = 120, \ - .trigger_enable[0] = true, \ - .trigger_enable[1] = true, \ - .trigger_enable[2] = true, \ - .trigger_enable[3] = false, \ - .trigger_type[0] = THROTTLE_ACTIVE, \ - .trigger_type[1] = THROTTLE_ACTIVE, \ - .trigger_type[2] = SW_TRIP, \ - .trigger_type[3] = HW_TRIP, \ - .max_trigger_level = 4, \ - .non_hw_trigger_levels = 3, \ - .gain = 8, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_ONE_POINT_TRIMMING, \ - .efuse_value = 55, \ - .min_efuse_value = 40, \ - .max_efuse_value = 100, \ - .first_point_trim = 25, \ - .second_point_trim = 85, \ - .default_temp_offset = 50 - -struct exynos_tmu_init_data const exynos4412_default_tmu_data = { - .tmu_data = { - { -EXYNOS4412_TMU_DATA , - .type =SOC_ARCH_EXYNOS4412 , - }, - }, - .tmu_count =1 , -}; - -struct exynos_tmu_init_data const exynos5250_default_tmu_data = { - .tmu_data = { - { -EXYNOS4412_TMU_DATA , - .type =SOC_ARCH_EXYNOS5250 , - }, - }, - .tmu_count =1 , -}; - -#define __EXYNOS5260_TMU_DATA \ - .threshold_falling = 10, \ - .trigger_levels[0] = 85, \ - .trigger_levels[1] = 103, \ - .trigger_levels[2] = 110, \ - .trigger_levels[3] = 120, \ - .trigger_enable[0] = true, \ - .trigger_enable[1] = true, \ - .trigger_enable[2] = true, \ - .trigger_enable[3] = false, \ - .trigger_type[0] = THROTTLE_ACTIVE, \ - .trigger_type[1] = THROTTLE_ACTIVE, \ - .trigger_type[2] = SW_TRIP, \ - .trigger_type[3] = HW_TRIP, \ - .max_trigger_level = 4, \ - .non_hw_trigger_levels = 3, \ - .gain = 8, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_ONE_POINT_TRIMMING, \ - .efuse_value = 55, \ - .min_efuse_value = 40, \ - .max_efuse_value = 100, \ - .first_point_trim = 25, \ - .second_point_trim = 85, \ - .default_temp_offset = 50, - -#define EXYNOS5260_TMU_DATA \ - __EXYNOS5260_TMU_DATA \ - .type = SOC_ARCH_EXYNOS5260 - -struct exynos_tmu_init_data const exynos5260_default_tmu_data = { - .tmu_data = { - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - }, - .tmu_count =5 , -}; - -#define EXYNOS5420_TMU_DATA \ - __EXYNOS5260_TMU_DATA \ - .type = SOC_ARCH_EXYNOS5420 - -#define EXYNOS5420_TMU_DATA_SHARED \ - __EXYNOS5260_TMU_DATA \ - .type = SOC_ARCH_EXYNOS5420_TRIMINFO - -struct exynos_tmu_init_data const exynos5420_default_tmu_data = { - .tmu_data = { - {EXYNOS5420_TMU_DATA }, - {EXYNOS5420_TMU_DATA }, - {EXYNOS5420_TMU_DATA_SHARED }, - {EXYNOS5420_TMU_DATA_SHARED }, - {EXYNOS5420_TMU_DATA_SHARED }, - }, - .tmu_count =5 , -}; - -#define EXYNOS5440_TMU_DATA \ - .trigger_levels[0] = 100, \ - .trigger_levels[4] = 105, \ - .trigger_enable[0] = 1, \ - .trigger_type[0] = SW_TRIP, \ - .trigger_type[4] = HW_TRIP, \ - .max_trigger_level = 5, \ - .non_hw_trigger_levels = 1, \ - .gain = 5, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_ONE_POINT_TRIMMING, \ - .efuse_value = 0x5b2d, \ - .min_efuse_value = 16, \ - .max_efuse_value = 76, \ - .first_point_trim = 25, \ - .second_point_trim = 70, \ - .default_temp_offset = 25, \ - .type = SOC_ARCH_EXYNOS5440 - -struct exynos_tmu_init_data const exynos5440_default_tmu_data = { - .tmu_data = { - {EXYNOS5440_TMU_DATA } , - {EXYNOS5440_TMU_DATA } , - {EXYNOS5440_TMU_DATA } , - }, - .tmu_count =3 , -};
Signature · 1 line
2.0.0.rc2
PATCH 20/21 thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
In reply to Lukasz MajewskiSince both SoCs have the same TMU IP block embedded on them, it is not necessary to maintain separate compatible entry.
--- arch/arm/boot/dts/exynos5250.dtsi | 2 +- drivers/thermal/samsung/exynos_tmu.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
arch/arm/boot/dts/exynos5250.dtsi +1 -1
@@ -238,7 +238,7 @@ }; tmu: tmu at 10060000 { - compatible = "samsung,exynos5250-tmu"; + compatible = "samsung,exynos4412-tmu"; reg = <0x10060000 0x100>; interrupts = <0 65 0>; clocks = <&clock CLK_TMU>;
drivers/thermal/samsung/exynos_tmu.c +0 -3
@@ -753,9 +753,6 @@ static const struct of_device_id exynos_tmu_match[] = { .compatible = "samsung,exynos4412-tmu", }, { - .compatible = "samsung,exynos5250-tmu", - }, - { .compatible = "samsung,exynos5260-tmu", }, {
Signature · 1 line
2.0.0.rc2
PATCH 21/21 thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412
In reply to Lukasz MajewskiSince both SoCs have the same TMU IP block embedded on them, it is not necessary to maintain separate compatible entry.
--- drivers/thermal/samsung/exynos_tmu.c | 3 --- 1 file changed, 3 deletions(-)
drivers/thermal/samsung/exynos_tmu.c +0 -3
@@ -744,9 +744,6 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id)static const struct of_device_id exynos_tmu_match[] = { { - .compatible ="samsung,exynos3250-tmu" , - }, - { .compatible ="samsung,exynos4210-tmu" , }, {
Signature · 1 line
2.0.0.rc2
PATCH 21/21 thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412
Quoted 13 lines · Lukasz Majewski
Since both SoCs have the same TMU IP block embedded on them, it is not necessary to maintain separate compatible entry.
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/samsung/exynos_tmu.c | 3 --- 1 file changed, 3 deletions(-)drivers/thermal/samsung/exynos_tmu.c +0
-0
drivers/thermal/samsung/exynos_tmu.c static irqreturn_t exynos_tmu_irq(int irq, void *id) · line 749
Quoted 6 lines
drivers/thermal/samsung/exynos_tmu.c +0
-3@@ -744,9 +744,6 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id)static const struct of_device_id exynos_tmu_match[] = { { - .compatible ="samsung,exynos3250-tmu" , - }, - {
If you want to remove compatible string for Exynos3250, you have to modify it on exynos3250.dtsi.
Thanks,
Chanwoo Choi
PATCH 21/21 thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412
Hi Chanwoo,
Quoted 9 lines · Lukasz Majewski
Quoted 8 lines
Since both SoCs have the same TMU IP block embedded on them, it is not necessary to maintain separate compatible entry.
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/thermal/samsung/exynos_tmu.c | 3 --- 1 file changed, 3 deletions(-)
Quoted 15 lines
drivers/thermal/samsung/exynos_tmu.c static irqreturn_t exynos_tmu_irq(int irq, void · line 749
Quoted 11 lines
(quoted diff) +0
-0
b/drivers/thermal/samsung/exynos_tmu.cindex f1e8c9b..7818e2f 100644drivers/thermal/samsung/exynos_tmu.c +0
-3@@ -744,9 +744,6 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id)static const struct of_device_id exynos_tmu_match[] = { { - .compatible ="samsung,exynos3250-tmu" , - }, - {If you want to remove compatible string for Exynos3250, you have to modify it on
exynos3250.dtsi.
Thanks for pointing this out. I've overlooked this dtsi file.
Quoted 2 lines
Thanks,
Chanwoo Choi
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
cover thermal: exynos: Thermal code rework to use device tree
In reply to Lukasz MajewskiHi Lukasz,
Quoted 60 lines
1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (
of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
This work should NOT bring any functional changes to Exynos thermal subsystem.
2. Patch-set structure
This series starts with extending current
of-thermal.cimplementation with exporting information about trip points and support for setting emulated temperature. Those changes were necessary to reuse this code in Exynos.Then the
cpu_coolingfunctionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
Patch series end with removing exynos5250/exynos3250 TMU compatibles. Both SoCs have thermal management unit (TMU) compatible with the one first introduced at Exynos4412.
3. Dead code removal
Thermal support for some SoCs, previously available in the
exynos_tmu_data.cfile, was removed since, as of 3.17-rc6, they didn't have TMU bindings.Moreover, support for
cpu_coolingdevices was preserved only on those SoCs which had available and working cpufreq driver.4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone +cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone +cpu_cooling)
- Exynos5250 - Arndale (TMU zone +cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. Prerequisites:
This work requires following patches developed by Bartlomiej Zolnierkiewicz:
Quoted 9 lines
5.1. [PATCH v3] ARM: dts: add CPU nodes for Exynos4 SoCs
http://article.gmane.org/gmane.linux.kernel.samsung-soc/37946/match=patch+v3+arm+dts+add+cpu+nodes+exynos4+socs5.2. First thermal clean up patch set (from patch 1 to 33):
[PATCH 00/33] thermal: exynos: convert the driver to use per-SoC type operations
http://article.gmane.org/gmane.linux.kernel.samsung-soc/37642/match=patch+00+33+thermal+exynos+convert+driver+use+per+soc+type+operations
Any comments on this patch set (despite the ones from Chanwoo)?
I'm especially wondering if changes introduced to of-thermal.c file are appropriate for mainline.
Quoted 72 lines
Lukasz Majewski (21):
thermal: of: Extendof-thermal.cto provide number of trip points
thermal: of: Extendof-thermal.cto provide check if trip point is
enabled
thermal: of: Extendof-thermal.cto provide number of non critical
trip points
thermal: of: Extend currentof-thermal.ccode to allow setting
emulated temp
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Providethermal_exynos.hfile to be included in
device tree files
thermal: dts: trats: Enable TMU on the Exynos4210 trats device
thermal: dts: exynos: Adding LD010 regulator node necessary for TMU
on Odroid U3 board
thermal: dts: Provide bindings and enable TMU at Exynos4x12 devices
thermal:cpu_cooling: dts: Define device tree bindings for Exynos
cpu cooling functionality
thermal:cpu_cooling: Modify exynos thermal code to use device tree
for cpu cooling configuration
thermal: exynos: dts: Add default definition for the TMU sensor
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data forExynos5440thermal: exynos: dts: Provide device tree bindings identical to one
inexynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Removeexynos_tmu_data.cfile
thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 5 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 28 +- arch/arm/boot/dts/exynos4212.dtsi | 5 +- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412.dtsi | 5 +- arch/arm/boot/dts/exynos4x12.dtsi | 13 + arch/arm/boot/dts/exynos5250.dtsi | 29 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 33 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 23 +- drivers/thermal/of-thermal.c | 52 ++- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 430----------------------
drivers/thermal/samsung/exynos_thermal_common.h| 106 ------drivers/thermal/samsung/exynos_tmu.c| 283
+++++++-------drivers/thermal/samsung/exynos_tmu.h|
79 +---drivers/thermal/samsung/exynos_tmu_data.c| 264
-------------drivers/thermal/thermal_core.h| 15
+include/dt-bindings/thermal/thermal_exynos.h| 40 ++include/linux/thermal.h| 6 +- 26 files
changed, 623 insertions(+), 1020 deletions(-) create mode 100644arch/arm/boot/dts/exynos4-cpu-thermal.dtsicreate mode 100644arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsicreate mode 100644arch/arm/boot/dts/exynos5420-trip-points.dtsicreate mode 100644arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsicreate mode 100644arch/arm/boot/dts/exynos5440-trip-points.dtsidelete mode 100644drivers/thermal/samsung/exynos_thermal_common.cdelete mode 100644drivers/thermal/samsung/exynos_thermal_common.hdelete mode 100644drivers/thermal/samsung/exynos_tmu_data.ccreate mode 100644include/dt-bindings/thermal/thermal_exynos.h
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
v2 cover thermal: of: of-thermal.c API extensions
In reply to Lukasz MajewskiProvided patch series extend of-thermal.c file API. It is necessary for ongoing Exynos TMU rework.
First version of this code can be found at:
http://www.spinics.net/lists/linux-samsung-soc/msg37719.html
This code provides some methods to access some of-thermal local data. Moreover it provides a read only copy of trip points.
Lukasz Majewski (4):
thermal: of: Extend of-thermal.c to provide number of trip points
thermal: of: Extend of-thermal.c to provide check if trip point is
enabled
thermal: of: Extend of-thermal to export table of trip points
thermal: of: Extend current of-thermal.c code to allow setting
emulated temp
drivers/thermal/of-thermal.c | 97 ++++++++++++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 17 ++++++++ include/linux/thermal.h | 15 +++++++ 3 files changed, 129 insertions(+)
Signature · 1 line
2.0.0.rc2
PATCH v2 1/4 thermal: of: Extend of-thermal.c to provide number of trip points
This patch extends the of-thermal.c to provide information about number of available trip points.
---
Changes for v2:
- Provide detailed (doxygen like) description of the of_thermal_get_ntrips() method
- Check for data pointer not being NULL
--- drivers/thermal/of-thermal.c | 20 ++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 25 insertions(+)
drivers/thermal/of-thermal.c +20 -0
@@ -112,6 +112,26 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz,return data->ops->get_temp (data->sensor_data, temp); } +/** +* of_thermal_get_ntrips - function to export number of available trip +* points. +* @tz: pointer to a thermal zone +* +* This function is a globally visible wrapper to get number of trip points +* stored in the local struct __thermal_zone +* +* Return: number of available trip points, -ENODEV when data not available +*/ +int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data ||IS_ERR (data)) +return -ENODEV ; + +return data->ntrips; +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +5 -0
@@ -89,9 +89,14 @@ static inline void thermal_gov_user_space_unregister(void) {}#ifdef CONFIG_THERMAL_OF int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void ); +int of_thermal_get_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips (struct thermal_zone_device *) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 1/4] thermal: of: Extend of-thermal.c to provide number of trip points
Lukasz,
Quoted 32 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide information about number of available trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Provide detailed (doxygen like) description of theof_thermal_get_ntrips()method
- Check for data pointer not being NULL--- drivers/thermal/of-thermal.c | 20 ++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 25 insertions(+)drivers/thermal/of-thermal.c +10
-0@@ -112,6 +112,26 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz,return data->ops->get_temp (data->sensor_data, temp); } +/** +* of_thermal_get_ntrips - function to export number of available trip +* points. +* @tz: pointer to a thermal zone +* +* This function is a globally visible wrapper to get number of trip points +* stored in the local struct __thermal_zone +* +* Return: number of available trip points, -ENODEV when data not available +*/
drivers/thermal/of-thermal.c static int of_thermal_get_temp(struct thermal_zone_device *tz, · line 134
Quoted 10 lines
drivers/thermal/of-thermal.c +10
-0+int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data ||IS_ERR (data)) +return -ENODEV ; + +return data->ntrips; +} +
MissingEXPORT_SYMBOL_GPL(of_thermal_get_ntrips);
Quoted 8 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {drivers/thermal/thermal_core.h +0
-0
drivers/thermal/thermal_core.h static inline void thermal_gov_user_space_unregister(void) {} · line 96
Quoted 8 lines
drivers/thermal/thermal_core.h +2
-0@@ -89,9 +89,14 @@ static inline void thermal_gov_user_space_unregister(void) {}#ifdef CONFIG_THERMAL_OF int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void ); +int of_thermal_get_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips (struct thermal_zone_device *)
You need to declare the parameter name with a name ---------------^ .
drivers/thermal/thermal_core.h static inline void thermal_gov_user_space_unregister(void) {} · line 97
Quoted 1 line
drivers/thermal/thermal_core.h +1
-0+{
This produces a compilation error if CONFIG_THERMAL_OF is not set:
In file included from drivers/thermal/step_wise.c:28:0:drivers/thermal/thermal_core.h: In function ‘of_thermal_get_ntrips’:drivers/thermal/thermal_core.h:96:48: error: parameter name omitted
static inline int of_thermal_get_ntrips(struct thermal_zone_device *)
Quoted 8 lines
drivers/thermal/thermal_core.h +2
-0+return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 1/4] thermal: of: Extend of-thermal.c to provide number of trip points
Hi Eduardo,
Quoted 44 lines
Lukasz,
Quoted 40 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide information about number of available trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Provide detailed (doxygen like) description of theof_thermal_get_ntrips()method
- Check for data pointer not being NULL--- drivers/thermal/of-thermal.c | 20 ++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 25 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex b7982f0..7170822 100644drivers/thermal/of-thermal.c +0
-0@@ -112,6 +112,26 @@ static int of_thermal_get_temp(struct
thermal_zone_device*tz, returndata->ops->get_temp(data->sensor_data, temp); }+/**
+ *of_thermal_get_ntrips- function to export number of available trip
+ * points.
+ * @tz: pointer to a thermal zone
+ *
+ * This function is a globally visible wrapper to get number of trip points
+ * stored in the local struct__thermal_zone
+ *
+ * Return: number of available trip points,-ENODEVwhen data not available
+ */drivers/thermal/of-thermal.c +5
-0+int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data ||IS_ERR (data))
Quoted 8 lines
drivers/thermal/of-thermal.c static int of_thermal_get_temp(struct thermal_zone_device *tz, · line 134
Quoted 5 lines
drivers/thermal/of-thermal.c +5
-0+return -ENODEV ; + +return data->ntrips; +} +Missing
EXPORT_SYMBOL_GPL(of_thermal_get_ntrips);
OK
Quoted 22 lines
Quoted 17 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex d15d243..c3c7b82 100644drivers/thermal/thermal_core.h +0
-0@@ -89,9 +89,14 @@ static inline void
thermal_gov_user_space_unregister(void){} #ifdefCONFIG_THERMAL_OF
intof_parse_thermal_zones(void);
voidof_thermal_destroy_zones(void);drivers/thermal/thermal_core.h +2
-0+int of_thermal_get_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips(struct thermal_zone_deviceQuoted 1 line
*)
You need to declare the parameter name with a name ---------------^ .
Quoted 8 lines
Quoted 1 line
+{
This produces a compilation error if
CONFIG_THERMAL_OFis not set:
In file included fromdrivers/thermal/step_wise.c:28:0:drivers/thermal/thermal_core.h: In function ‘of_thermal_get_ntrips’:drivers/thermal/thermal_core.h:96:48: error: parameter name omitted
static inline intof_thermal_get_ntrips(struct thermal_zone_device *)
Good point. Thanks for check.
Quoted 10 lines
Quoted 10 lines
drivers/thermal/thermal_core.h +2
-0+return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 2/4 thermal: of: Extend of-thermal.c to provide check if trip point is enabled
In reply to Lukasz MajewskiThis patch extends the of-thermal.c to provide check if trip point is enabled.
---
Changes for v2:
- Replace int with bool
- Replace 1/0 with true/false
- Add check if data pointer is not NULL
- Add missing doxygen style comment for the function
--- drivers/thermal/of-thermal.c | 20 ++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 25 insertions(+)
drivers/thermal/of-thermal.c +20 -0
@@ -132,6 +132,26 @@ int of_thermal_get_ntrips(struct thermal_zone_device *tz)return data->ntrips; } +/** +* of_thermal_is_trip_en - function to check if trip point is enabled +* +* @tz: pointer to a thermal zone +* @trip: trip point to evaluate +* +* This function is responsible for checking if passed trip point is enabled +* +* Return: true if trip point is enabled, false otherwise +*/ +bool of_thermal_is_trip_en (struct thermal_zone_device *tz,int trip) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data || trip >= data->ntrips || trip <0 ) +return false; + +return true; +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +5 -0
@@ -90,6 +90,7 @@ static inline void thermal_gov_user_space_unregister(void) {}int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *); +bool of_thermal_is_trip_en (struct thermal_zone_device *,int );#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
@@ -97,6 +98,10 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *) {return 0 ; } +static inline bool of_thermal_is_trip_en (struct thermal_zone_device *,int ) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 2/4] thermal: of: Extend of-thermal.c to provide check if trip point is enabled
Lukasz,
Same stuff here.
Quoted 24 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide check if trip point is enabled.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Replace int with bool
- Replace 1/0 with true/false
- Add check if data pointer is not NULL
- Add missing doxygen style comment for the function--- drivers/thermal/of-thermal.c | 20 ++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 25 insertions(+)drivers/thermal/of-thermal.c +1
-0@@ -132,6 +132,26 @@ int of_thermal_get_ntrips(struct thermal_zone_device *tz)return data->ntrips; } +/**
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 145
Quoted 10 lines
drivers/thermal/of-thermal.c +10
-0+* of_thermal_is_trip_en - function to check if trip point is enabled +* +* @tz: pointer to a thermal zone +* @trip: trip point to evaluate +* +* This function is responsible for checking if passed trip point is enabled +* +* Return: true if trip point is enabled, false otherwise +*/ +bool of_thermal_is_trip_en (struct thermal_zone_device *tz,int trip)
This one looks more like "is this trip point valid?" than "is this trip point enabled?", isn't it?
By having such a function to check if a trip is enabled, one would expect to have functions to enable / disable trips points.
What do you think of naming it:of_thermal_is_trip_valid()
?
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 149
Quoted 4 lines
drivers/thermal/of-thermal.c +4
-0+{ +struct __thermal_zone *data = tz->devdata; + +if (!data || trip >= data->ntrips || trip <0 )
Even your check is about looking if the trip value is within a range, telling the caller if the trip is valid or not, right?
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 154
Quoted 5 lines
drivers/thermal/of-thermal.c +5
-0+return false; + +return true; +} +
Missing:EXPORT_SYMBOL_GPL(of_thermal_is_trip_en);
or
EXPORT_SYMBOL_GPL(of_thermal_is_trip_valid);
Quoted 16 lines
drivers/thermal/of-thermal.c +0
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {drivers/thermal/thermal_core.h +1
-0@@ -90,6 +90,7 @@ static inline void thermal_gov_user_space_unregister(void) {}int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *); +bool of_thermal_is_trip_en (struct thermal_zone_device *,int );#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
drivers/thermal/thermal_core.h static inline int of_thermal_get_ntrips(struct thermal_zone_device *) · line 101
Quoted 4 lines
drivers/thermal/thermal_core.h +1
-0@@ -97,6 +98,10 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *) {return 0 ; } +static inline bool of_thermal_is_trip_en (struct thermal_zone_device *,int )
Same as in patch 01, this produces compilation error. Please, name your parameters.
Quoted 9 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 2/4] thermal: of: Extend of-thermal.c to provide check if trip point is enabled
Hi Eduardo,
Quoted 47 lines
Lukasz,
Same stuff here.
Quoted 29 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide check if trip point is enabled.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Replace int with bool
- Replace 1/0 with true/false
- Add check if data pointer is not NULL
- Add missing doxygen style comment for the function--- drivers/thermal/of-thermal.c | 20 ++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 25 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 7170822..336af7f 100644drivers/thermal/of-thermal.c +2
-0@@ -132,6 +132,26 @@ int of_thermal_get_ntrips(struct thermal_zone_device *tz) return data->ntrips; } +/** +* of_thermal_is_trip_en - function to check if trip point is enabled
+ *
+ * @tz: pointer to a thermal zone
+ * @trip: trip point to evaluateQuoted 8 lines
+ *
+ * This function is responsible for checking if passed trip point is enabled
+ *
+ * Return: true if trip point is enabled, false otherwise
+ */
+boolof_thermal_is_trip_en(struct thermal_zone_device *tz, int trip)This one looks more like "is this trip point valid?" than "is this trip point enabled?", isn't it?
Quoted 7 lines
By having such a function to check if a trip is enabled, one would expect to have functions to enable / disable trips points.
What do you think of naming it:
of_thermal_is_trip_valid()
?
Good point. I think that of_thermal_is_trip_valid() is a better name.
Quoted 7 lines
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 149
Quoted 4 lines
drivers/thermal/of-thermal.c +4
-0+{ +struct __thermal_zone *data = tz->devdata; + +if (!data || trip >= data->ntrips || trip <0 )Even your check is about looking if the trip value is within a range, telling the caller if the trip is valid or not, right?
Yes. Correct. it justifies function rename to of_thermal_is_trip_valid()
Quoted 10 lines
drivers/thermal/of-thermal.c int of_thermal_get_ntrips(struct thermal_zone_device *tz) · line 154
Quoted 6 lines
drivers/thermal/of-thermal.c +5
-0+return false; + +return true; +} +Missing:
EXPORT_SYMBOL_GPL(of_thermal_is_trip_en);
Quoted 3 lines
or
EXPORT_SYMBOL_GPL(of_thermal_is_trip_valid);
I will add that, no problem.
Quoted 17 lines
Quoted 17 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex c3c7b82..466208c 100644drivers/thermal/thermal_core.h +0
-0@@ -90,6 +90,7 @@ static inline void
thermal_gov_user_space_unregister(void){} intof_parse_thermal_zones(void); voidof_thermal_destroy_zones(void);
intof_thermal_get_ntrips(struct thermal_zone_device *);drivers/thermal/thermal_core.h +1
-0+bool of_thermal_is_trip_en (struct thermal_zone_device *,int );#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -97,6 +98,10 @@ static inline int of_thermal_get_ntrips(struct
Quoted 8 lines
drivers/thermal/thermal_core.h static inline int of_thermal_get_ntrips(struct · line 102
Quoted 5 lines
drivers/thermal/thermal_core.h +1
-0thermal_zone_device *) {return 0 ; } +static inline bool of_thermal_is_trip_en (struct thermal_zone_device *,int )Same as in patch 01, this produces compilation error. Please, name your parameters.
Ok.
Quoted 10 lines
Quoted 10 lines
drivers/thermal/thermal_core.h +3
-0+{ +return 0 ; +}#endif #endif /*
__THERMAL_CORE_H__*/Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 3/4 thermal: of: Extend of-thermal to export table of trip points
In reply to Lukasz MajewskiThis patch extends the of-thermal.c to export copy of trip points for a given thermal zone.
Thermal drivers should use of_thermal_get_trip_points() method to get pointer to table of thermal trip points.
---
Changes for v2:
- New patch - as suggested by Eduardo Valentin
--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)
drivers/thermal/of-thermal.c +33 -0
@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;/* cooling binding data */ int num_tbps;
@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip)return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported +* trip points +* +* @tz: pointer to a thermal zone +* +* This function provides a pointer to the copy of trip points table +* +* Return: pointer to trip points table, NULL otherwise +*/ +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data) +return NULL ; + +return data->gtrips; +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;
@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i; +kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);
drivers/thermal/thermal_core.h +7 -0
@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */
include/linux/thermal.h +14 -0
@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); }; +/** +* struct thermal_trip - Structure representing themal trip points exported from +* of-thermal +* +* @temperature: trip point temperature +* @hysteresis: trip point hysteresis +* @type: trip point type +*/ +struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Hello Lukasz,
Quoted 43 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)drivers/thermal/of-thermal.c +12
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip)return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported +* trip points +* +* @tz: pointer to a thermal zone +* +* This function provides a pointer to the copy of trip points table +* +* Return: pointer to trip points table, NULL otherwise +*/ +const struct thermal_trip * const
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 10 lines
drivers/thermal/of-thermal.c +10
-0+of_thermal_get_trip_points(struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);
Quoted 42 lines
drivers/thermal/of-thermal.c +11
-0static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i; +kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
drivers/thermal/thermal_core.h static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) · line 104
Quoted 1 line
drivers/thermal/thermal_core.h +0
-0@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {
This produces compilation error when CONFIG_THERMAL_OF is not set. Name the parameters to fix.
Quoted 15 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0
include/linux/thermal.h struct thermal_zone_of_device_ops { · line 309
Quoted 7 lines
include/linux/thermal.h +4
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); }; +/** +* struct thermal_trip - Structure representing themal trip points exported from +* of-thermal +*
The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
Quoted 16 lines
include/linux/thermal.h +10
-0+* @temperature: trip point temperature +* @hysteresis: trip point hysteresis +* @type: trip point type +*/ +struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Hi Eduardo,
Quoted 52 lines
Hello Lukasz,
Quoted 49 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +3
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */drivers/thermal/of-thermal.c +5
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +
Quoted 8 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 6 lines
drivers/thermal/of-thermal.c +6
-0+if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);
Ok.
Quoted 41 lines
Quoted 41 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:drivers/thermal/of-thermal.c +1
-0of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i; +kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);
Quoted 8 lines
drivers/thermal/thermal_core.h static inline bool · line 104
Quoted 5 lines
drivers/thermal/thermal_core.h +0
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {This produces compilation error when
CONFIG_THERMAL_OFis not set. Name the parameters to fix.
As all the other cases, I will fix that.
Quoted 19 lines
Quoted 19 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); };
Quoted 9 lines
Quoted 5 lines
include/linux/thermal.h +2
-0+/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
It can stay to be struct thermal_trip or we can rename it to struct of_thermal_trip.
I'm fine with both names.
Quoted 17 lines
Quoted 17 lines
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-0+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Hello,
Quoted 146 lines · Lukasz Majewski
Hi Eduardo,
Quoted 52 lines
Hello Lukasz,
Quoted 49 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +3
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */drivers/thermal/of-thermal.c +5
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +Quoted 8 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 6 lines
drivers/thermal/of-thermal.c +6
-0+if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);Ok.
Quoted 41 lines
Quoted 41 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:drivers/thermal/of-thermal.c +1
-0of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i; +kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);Quoted 8 lines
drivers/thermal/thermal_core.h static inline bool · line 104
Quoted 5 lines
drivers/thermal/thermal_core.h +0
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {This produces compilation error when
CONFIG_THERMAL_OFis not set. Name the parameters to fix.As all the other cases, I will fix that.
Quoted 19 lines
Quoted 19 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); };Quoted 9 lines
Quoted 5 lines
include/linux/thermal.h +2
-0+/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
Quoted 4 lines
It can stay to be struct
thermal_tripor we can rename it to structof_thermal_trip.I'm fine with both names.
Leave it as 'thermal_trip'.
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-0+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Hi Eduardo, Lukasz,
[Combining my concerns as a single text blob here]
I. Firstly, with the current patch
1. is it really needed to duplicate the struct thermal_trip? Why don’t we get rid of the __thermal_trip and stay with the 'thermal_trip' ? it is not a big change.
2. gtrips is not updated on "set_trip_temp" etc. actions via sysfs. (am I missing something?).
II. The other concern is more of a design question
1. Do we intend to keep the of-thermal as a middle layer between the thermal_core and the sensor device? OR, is the role of of-thermal just to parse the DT and opt out ? currently of-thermal is somewhat a hybrid of these as, in addition to parsing the dt, it holds on to the data related to trip points etc. etc.
2. assuming latter is true (OF is just a dt parser helper): we should not be adding more intelligence and dependencies linked to the OF.
3. assuming former is true (OF is a well-defined middle layer): All is good till the point OF maintains the trip points (which is a good thing since, OF caches on to the data); BUT, if we expose this information to the sensor device too (as this patch is doing),
3a. we violate the layering principle :-)
3b. more importantly, this is all just excessive logic that we put in which *could be useful* only if we intend to extend the role of OF as a trip point management layer that does more than just holding on to the data. This may include -
-> The sensor devices to know nothing about the trip_points, instead the sensor devices would work on "temperature thresholds" and OF would map sensor thresholds to the actual trip points as needed (configured from DT); while the sensor devices stick to using "thresholds".
-> Queuing from above, sensors, most of the time, only need to know a high and a low temp threshold; which essentially is a subset of the active/passive etc. trip points. Calculation of that based on the current temp, as of today is replicated across all the sensor drivers and can be hoisted up to the of-thermal.
Seems like this is the opportune time to make a call about the role of of-thermal?
Quoted 26 lines · Eduardo Valentin
* PGP Signed by an unknown key
Hello,
Quoted 21 lines · Lukasz Majewski
Hi Eduardo,
Quoted 19 lines
Hello Lukasz,
Quoted 16 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/thermal/of-thermal.c struct __thermal_zone { · line 92
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +1
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;
Do we really need this duplication ?
Quoted 62 lines
Quoted 62 lines
Quoted 24 lines
Quoted 24 lines
drivers/thermal/of-thermal.c +2
-0/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */drivers/thermal/of-thermal.c +5
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +Quoted 8 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 6 lines
drivers/thermal/of-thermal.c +6
-0+if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);Ok.
Quoted 27 lines
Quoted 27 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:drivers/thermal/of-thermal.c +0
-0of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i;
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/thermal/of-thermal.c static inline void of_thermal_free_zone(struct __thermal_zone *tz) · line 831
Quoted 4 lines
drivers/thermal/of-thermal.c +1
-0+kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);
Couldn't find the code that updates *gtrips as a result of set_trip_temp via sysfs.
Quoted 88 lines
Quoted 50 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);Quoted 8 lines
drivers/thermal/thermal_core.h static inline bool · line 104
Quoted 5 lines
drivers/thermal/thermal_core.h +0
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {This produces compilation error when
CONFIG_THERMAL_OFis not set. Name the parameters to fix.As all the other cases, I will fix that.
Quoted 19 lines
Quoted 19 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); };Quoted 9 lines
Quoted 5 lines
include/linux/thermal.h +2
-0+/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
Quoted 4 lines
It can stay to be struct
thermal_tripor we can rename it to structof_thermal_trip.I'm fine with both names.
Leave it as '
thermal_trip'.Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-0+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group* Unknown Key
*0x7DA4E256
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Quoted 42 lines · navneet kumar
Hi Eduardo, Lukasz,
[Combining my concerns as a single text blob here]
I. Firstly, with the current patch
1. is it really needed to duplicate the structthermal_trip? Why don’t we get rid of the__thermal_tripand stay with the 'thermal_trip' ? it is not a big change.2. gtrips is not updated on "
set_trip_temp" etc. actions via sysfs. (am I missing something?).II. The other concern is more of a design question
1. Do we intend to keep the of-thermal as a middle layer between thethermal_coreand the sensor device? OR, is the role of of-thermal just to parse the DT and opt out ? currently of-thermal is somewhat a hybrid of these as, in addition to parsing the dt, it holds on to the data related to trip points etc. etc.2. assuming latter is true (OF is just a dt parser helper): we should not be adding more intelligence and dependencies linked to the OF.
3. assuming former is true (OF is a well-defined middle layer): All is good till the point OF maintains the trip points (which is a good thing since, OF caches on to the data); BUT, if we expose this information to the sensor device too (as this patch is doing),
3a. we violate the layering principle :-)
3b. more importantly, this is all just excessive logic that we put in which *could be useful* only if we intend to extend the role of OF as a trip point management layer that does more than just holding on to the data. This may include -
-> The sensor devices to know nothing about the
trip_points, instead the sensor devices would work on "temperature thresholds" and OF would map sensor thresholds to the actual trip points as needed (configured from DT); while the sensor devices stick to using "thresholds".
Quoted 7 lines
-> Queuing from above, sensors, most of the time, only need to know a high and a low temp threshold; which essentially is a subset of the active/passive etc. trip points. Calculation of that based on the current temp, as of today is replicated across all the sensor drivers and can be hoisted up to the of-thermal.
Sorry, lost you here. What replicated calculation do you refer to ?
Thanks,
Guenter
Quoted 197 lines
Seems like this is the opportune time to make a call about the role of of-thermal?
Quoted 26 lines · Eduardo Valentin
* PGP Signed by an unknown key
Hello,
Quoted 21 lines · Lukasz Majewski
Hi Eduardo,
Quoted 19 lines
Hello Lukasz,
Quoted 16 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/thermal/of-thermal.c struct __thermal_zone { · line 92
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +1
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;Do we really need this duplication ?
Quoted 62 lines
Quoted 62 lines
Quoted 24 lines
Quoted 24 lines
drivers/thermal/of-thermal.c +2
-0/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */drivers/thermal/of-thermal.c +5
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +Quoted 8 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 6 lines
drivers/thermal/of-thermal.c +6
-0+if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);Ok.
Quoted 27 lines
Quoted 27 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:of_node_put(child); tz->mode = THERMAL_DEVICE_DISABLED;drivers/thermal/of-thermal.c +0
-0@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i;Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/thermal/of-thermal.c static inline void of_thermal_free_zone(struct __thermal_zone *tz) · line 831
Quoted 4 lines
drivers/thermal/of-thermal.c +1
-0+kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);Couldn't find the code that updates *gtrips as a result of
set_trip_tempvia sysfs.Quoted 88 lines
Quoted 50 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);Quoted 8 lines
drivers/thermal/thermal_core.h static inline bool · line 104
Quoted 5 lines
drivers/thermal/thermal_core.h +0
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {This produces compilation error when
CONFIG_THERMAL_OFis not set. Name the parameters to fix.As all the other cases, I will fix that.
Quoted 19 lines
Quoted 19 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); };Quoted 9 lines
Quoted 5 lines
include/linux/thermal.h +2
-0+/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
Quoted 4 lines
It can stay to be struct
thermal_tripor we can rename it to structof_thermal_trip.I'm fine with both names.
Leave it as '
thermal_trip'.Quoted 24 lines
Quoted 18 lines
Quoted 16 lines
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-1+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device * --Quoted 2 lines
2.0.0.rc2
--
Best regards,Quoted 3 lines
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
* Unknown Key
*0x7DA4E256
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Quoted 59 lines · Guenter Roeck
Quoted 50 lines · navneet kumar
Hi Eduardo, Lukasz,
[Combining my concerns as a single text blob here]
I. Firstly, with the current patch
1. is it really needed to duplicate the structthermal_trip? Why
don’t
we get rid of the__thermal_tripand stay with the 'thermal_trip'
? it
is not a big change.2. gtrips is not updated on "
set_trip_temp" etc. actions via
sysfs. (am
I missing something?).II. The other concern is more of a design question
1. Do we intend to keep the of-thermal as a middle layer between thethermal_coreand the sensor device? OR, is the role of of-thermal
just
to parse the DT and opt out ? currently of-thermal is somewhat a
hybrid
of these as, in addition to parsing the dt, it holds on to the data related to trip points etc. etc.2. assuming latter is true (OF is just a dt parser helper): we should not be adding more intelligence and dependencies linked to the OF.
3. assuming former is true (OF is a well-defined middle layer):
All is
good till the point OF maintains the trip points (which is a good
thing
since, OF caches on to the data); BUT, if we expose this
information to
the sensor device too (as this patch is doing),3a. we violate the layering principle :-)
3b. more importantly, this is all just excessive logic that we put in which *could be useful* only if we intend to extend the role of OF as a trip point management layer that does more than just holding on to the data. This may include -
-> The sensor devices to know nothing about the
trip_points, instead the sensor devices would work on "temperature thresholds" and OF would map sensor thresholds to the actual trip points as needed (configured from DT); while the sensor devices stick to using "thresholds".Quoted 7 lines
-> Queuing from above, sensors, most of the time, only need to know a high and a low temp threshold; which essentially is a subset of the active/passive etc. trip points. Calculation of that based on the current temp, as of today is replicated across all the sensor drivers and can be hoisted up to the of-thermal.
Quoted 5 lines
Sorry, lost you here. What replicated calculation do you refer to ?
Thanks,
Guenter
Some sensors have an ability to generate interrupts based upon a configured high and low temp thresholds/values. Once any of these limits is crossed, the sensor hardware has to be reconfigured with a new set of such values.
I'll try to explain with an example -
consider trip points TP1, TP2, TP3, TP4 sorted as low to high; and the current temp T1 such that -
TP2<T1<TP3
With the conditions as is, and assuming the interrupts have been configured, an interrupt will trigger if T1 goes below TP2 or exceeds TP3.
Now, say, T1 crosses TP3, the sensor hardware generates an interrupt (avoids polling on the zone temp). Furthermore, we require that the new limits for the interrupts be TP3 and TP4 for 'low' and 'high' thresholds interrupts respectively, such that an interrupt will be fired when temp goes below TP3 or exceeds TP4.
Above case is when the temp crosses a set of High-low. The same situation may occur when a trip point temp is changed from sysfs, in which case, the thresholds for configuring the interrupts may have to be reconfigured.
Today, the sensors find the high-low thresholds by -
1. querying the temp from the thermal_zone
2. traversing the trip points (which may have been cached locally by the sensor), and figuring out the high/low temperature thresholds.
These above steps aka 'replicated calculation'.
Whatever the case may be, the real question is the role and scope of of-thermal.
Quoted 205 lines
Quoted 199 lines
Seems like this is the opportune time to make a call about the role of of-thermal?
Quoted 26 lines · Eduardo Valentin
* PGP Signed by an unknown key
Hello,
Quoted 21 lines · Lukasz Majewski
Hi Eduardo,
Quoted 19 lines
Hello Lukasz,
Quoted 16 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/thermal/of-thermal.c struct __thermal_zone { · line 92
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +1
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;Do we really need this duplication ?
Quoted 62 lines
Quoted 62 lines
Quoted 24 lines
Quoted 24 lines
drivers/thermal/of-thermal.c +2
-0/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */drivers/thermal/of-thermal.c +5
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +Quoted 8 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 6 lines
drivers/thermal/of-thermal.c +6
-0+if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);Ok.
Quoted 27 lines
Quoted 27 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:of_node_put(child); tz->mode = THERMAL_DEVICE_DISABLED;drivers/thermal/of-thermal.c +0
-0@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i;Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/thermal/of-thermal.c static inline void of_thermal_free_zone(struct __thermal_zone *tz) · line 831
Quoted 4 lines
drivers/thermal/of-thermal.c +1
-0+kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);Couldn't find the code that updates *gtrips as a result of
set_trip_tempvia
sysfs.Quoted 88 lines
Quoted 50 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);Quoted 8 lines
drivers/thermal/thermal_core.h static inline bool · line 104
Quoted 5 lines
drivers/thermal/thermal_core.h +0
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {This produces compilation error when
CONFIG_THERMAL_OFis not set. Name the parameters to fix.As all the other cases, I will fix that.
Quoted 19 lines
Quoted 19 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); };Quoted 9 lines
Quoted 5 lines
include/linux/thermal.h +2
-0+/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
Quoted 4 lines
It can stay to be struct
thermal_tripor we can rename it to structof_thermal_trip.I'm fine with both names.
Leave it as '
thermal_trip'.Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-0+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group* Unknown Key
*0x7DA4E256Signature · 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
In reply to navneet kumarHello Navneet,
Quoted 5 lines · navneet kumar
Hi Eduardo, Lukasz,
[Combining my concerns as a single text blob here]
Quoted 8 lines
I. Firstly, with the current patch
1. is it really needed to duplicate the structthermal_trip? Why don’t we get rid of the__thermal_tripand stay with the 'thermal_trip' ? it is not a big change.2. gtrips is not updated on "
set_trip_temp" etc. actions via sysfs. (am I missing something?).
Good! Comments are always welcome, that's how we make patches :-).
Both above make sense to me.
Quoted 7 lines
II. The other concern is more of a design question
1. Do we intend to keep the of-thermal as a middle layer between thethermal_coreand the sensor device? OR, is the role of of-thermal just to parse the DT and opt out ? currently of-thermal is somewhat a hybrid of these as, in addition to parsing the dt, it holds on to the data related to trip points etc. etc.
of-thermal has always been as your latter statement, and I intend to keep it as it should be, just a of parser for thermal data.
Quoted 3 lines
2. assuming latter is true (OF is just a dt parser helper): we should not be adding more intelligence and dependencies linked to the OF.
Yes this is right. We should never be adding intelligence to it, except for parsing the thermal data out of device tree and adding the proper structures inside the kernel.
Quoted 5 lines
3. assuming former is true (OF is a well-defined middle layer): All is good till the point OF maintains the trip points (which is a good thing since, OF caches on to the data); BUT, if we expose this information to the sensor device too (as this patch is doing),
the former is not true.
Quoted 2 lines
3a. we violate the layering principle :-)
well, even if it was, I disagree here. :-) The split between data coming from DT and the driver is still in place. Besides, there is other layers that expose some of their data, and that doesn't violate their layering principles. CPUfreq, for one closer example, exposes its freq table.
It would be different if by exposing this data, the users would be affecting the behavior of the layer. And that is not the intention of cpufreq table. In the same way, that is not the intention of this patch.
Quoted 12 lines
3b. more importantly, this is all just excessive logic that we put in which *could be useful* only if we intend to extend the role of OF as a trip point management layer that does more than just holding on to the data. This may include -
-> The sensor devices to know nothing about the
trip_points, instead the sensor devices would work on "temperature thresholds" and OF would map sensor thresholds to the actual trip points as needed (configured from DT); while the sensor devices stick to using "thresholds".
Quoted 7 lines
-> Queuing from above, sensors, most of the time, only need to know a high and a low temp threshold; which essentially is a subset of the active/passive etc. trip points. Calculation of that based on the current temp, as of today is replicated across all the sensor drivers and can be hoisted up to the of-thermal.
There is no intention to add such logic to of thermal. The main reason is of-thermal should never be competing with thermal core. Any extension in of-thermal needs to be supported by thermal core.
I believe all the above is left currently to thermal zone device drivers. The problem with of-thermal is that it had to be born as a thermal zone device driver. And that is because..
Quoted 2 lines
Seems like this is the opportune time to make a call about the role of of-thermal?
.. the point one may be missing here is the fact that with current thermal subsystem implementation, handling thermal devices is somewhat different from other devices within the kernel.
The real design issue (or not an issue) we have is the fact that thermal drivers adds both the driver and the device. Changing that is somewhat disruptive. Not impossible, but requires considering the existing driver's code.
If we had a better split from who adds the device and who provides the driver, then of-thermal would never be a "glue layer" or born as thermal zone device driver. It would simply, parse DT, add the devices, done.
Then, drivers would register themselves as handlers for specific thermal devices. That is the correct design, based on common design found in other parts of the kernel. Another little missing end would be the "compatible" string for thermal zone devices in DT. But as I said, it should not be a blocker.
So, given the current situation, we have essentially two options: (a) stick to the same design we have for now, having of-thermal as dummy as possible, and grow in small steps towards the correct design; or (b) redesign thermal core to have a better split between devices and drivers, then adjust of-thermal.
For now, the path we are taking is (a). In fact, to fit the needs of coming drivers, specially considering they are based on DT booting platforms, it is always tempting to add intelligence to of-thermal. But, as I mentioned, I want to avoid growing intelligence in it, for obvious reasons.
Quoted 194 lines · Eduardo Valentin
Quoted 26 lines
* PGP Signed by an unknown key
Hello,
Quoted 21 lines · Lukasz Majewski
Hi Eduardo,
Quoted 19 lines
Hello Lukasz,
Quoted 16 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/thermal/of-thermal.c struct __thermal_zone { · line 92
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +1
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;Do we really need this duplication ?
Quoted 62 lines
Quoted 62 lines
Quoted 24 lines
Quoted 24 lines
drivers/thermal/of-thermal.c +2
-0/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */drivers/thermal/of-thermal.c +5
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +Quoted 8 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 6 lines
drivers/thermal/of-thermal.c +6
-0+if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);Ok.
Quoted 27 lines
Quoted 27 lines
static int of_thermal_get_trend(struct
thermal_zone_device*tz,
int trip, enumthermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:drivers/thermal/of-thermal.c +0
-0of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i;Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/thermal/of-thermal.c static inline void of_thermal_free_zone(struct __thermal_zone *tz) · line 831
Quoted 4 lines
drivers/thermal/of-thermal.c +1
-0+kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);Couldn't find the code that updates *gtrips as a result of
set_trip_tempvia sysfs.Quoted 88 lines
Quoted 50 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);Quoted 8 lines
drivers/thermal/thermal_core.h static inline bool · line 104
Quoted 5 lines
drivers/thermal/thermal_core.h +0
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {This produces compilation error when
CONFIG_THERMAL_OFis not set. Name the parameters to fix.As all the other cases, I will fix that.
Quoted 19 lines
Quoted 19 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); };Quoted 9 lines
Quoted 5 lines
include/linux/thermal.h +2
-0+/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
Quoted 4 lines
It can stay to be struct
thermal_tripor we can rename it to structof_thermal_trip.I'm fine with both names.
Leave it as '
thermal_trip'.Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-0+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group* Unknown Key
*0x7DA4E256
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Hi Eduardo,
Quoted 13 lines
Hello Navneet,
Quoted 9 lines · navneet kumar
Hi Eduardo, Lukasz,
[Combining my concerns as a single text blob here]
I. Firstly, with the current patch
1. is it really needed to duplicate the structthermal_trip? Why don’t we get rid of the__thermal_tripand stay with the 'thermal_trip' ? it is not a big change.
The __thermal_trip seems to be somehow "private" structure (to of-thermal) which holds not only data which could be exposed to sensors.
Quoted 3 lines
Quoted 3 lines
2. gtrips is not updated on "
set_trip_temp" etc. actions
via sysfs. (am I missing something?).
True. This is a bug. Thanks for spotting.
Quoted 14 lines
Quoted 1 line
Good! Comments are always welcome, that's how we make patches :-).
Both above make sense to me.
Quoted 7 lines
II. The other concern is more of a design question
1. Do we intend to keep the of-thermal as a middle layer
between thethermal_coreand the sensor device? OR, is the role of of-thermal just to parse the DT and opt out ? currently of-thermal is somewhat a hybrid of these as, in addition to parsing the dt, it holds on to the data related to trip points etc. etc.
Quoted 2 lines
of-thermal has always been as your latter statement, and I intend to keep it as it should be, just a of parser for thermal data.
It seems to me that now of-thermal is doing more than parsing thermal data.
For example it is an abstraction layer for
calling .get_temp(), .get_trend().
It has its own set of "private" trip points which aren't exposed to sensors.
Also, it registers thermal_zone_device.
A lot of stuff is done by the of-thermal. Frankly, I don't mind, since this is a common code for many sensors.
For example with of-thermal.c usage, we are able to cut down LOC number by half for Exynos TMU when moving to OF.
Quoted 7 lines
Quoted 5 lines
2. assuming latter is true (OF is just a dt parser helper):
we should not be adding more intelligence and dependencies linked to the OF.Yes this is right. We should never be adding intelligence to it,
But a lot of stuff is already added and to be worse it is well adopted API by sensors.
Quoted 2 lines
except for parsing the thermal data out of device tree and adding the proper structures inside the kernel.
In my understanding the of-thermal code to expose the above features need to:
- parse device tree
- export trip points in a table to sensors
- export cpu frequencies (OPPs?) with information about corresponding temperature
And that is all. The sensor is then responsible for initializing HW and register the thermal zone with thermal_core.
Quoted 12 lines
Quoted 7 lines
3. assuming former is true (OF is a well-defined middle
layer): All is good till the point OF maintains the trip points (which is a good thing since, OF caches on to the data); BUT, if we expose this information to the sensor device too (as this patch is doing),the former is not true.
Quoted 2 lines
3a. we violate the layering principle :-)
Are we? of-thermal.c is parsing DT and it exposes read only information about trip points. Also it gives you information about e.g. number of available trip points.
Quoted 71 lines
well, even if it was, I disagree here. :-) The split between data coming from DT and the driver is still in place. Besides, there is other layers that expose some of their data, and that doesn't violate their layering principles. CPUfreq, for one closer example, exposes its freq table.
It would be different if by exposing this data, the users would be affecting the behavior of the layer. And that is not the intention of cpufreq table. In the same way, that is not the intention of this patch.
Quoted 12 lines
3b. more importantly, this is all just excessive
logic that we put in which *could be useful* only if we intend to extend the role of OF as a trip point management layer that does more than just holding on to the data. This may include --> The sensor devices to know nothing aboutthe
trip_points, instead the sensor devices would work on
"temperature thresholds" and OF would map
sensor thresholds to the actual trip points as needed
(configured from DT); while the sensor
devices stick to using "thresholds".Quoted 7 lines
-> Queuing from above, sensors, most of thetime, only need to know a high and a low temp threshold; which
essentially is a subset of the
active/passive etc. trip points. Calculation of that based on the current temp, as of today is replicated across all the sensor drivers and can be hoisted up to the of-thermal.There is no intention to add such logic to of thermal. The main reason is of-thermal should never be competing with thermal core. Any extension in of-thermal needs to be supported by thermal core.
I believe all the above is left currently to thermal zone device drivers. The problem with of-thermal is that it had to be born as a thermal zone device driver. And that is because..
Quoted 3 lines
Seems like this is the opportune time to make a call about the role of of-thermal?
.. the point one may be missing here is the fact that with current thermal subsystem implementation, handling thermal devices is somewhat different from other devices within the kernel.
The real design issue (or not an issue) we have is the fact that thermal drivers adds both the driver and the device. Changing that is somewhat disruptive. Not impossible, but requires considering the existing driver's code.
If we had a better split from who adds the device and who provides the driver, then of-thermal would never be a "glue layer" or born as thermal zone device driver. It would simply, parse DT, add the devices, done.
Then, drivers would register themselves as handlers for specific thermal devices. That is the correct design, based on common design found in other parts of the kernel. Another little missing end would be the "compatible" string for thermal zone devices in DT. But as I said, it should not be a blocker.
So, given the current situation, we have essentially two options: (a) stick to the same design we have for now, having of-thermal as dummy as possible, and grow in small steps towards the correct design; or
(b) redesign thermal core to have a better split between devices and drivers, then adjust of-thermal.
Quoted 5 lines
For now, the path we are taking is (a). In fact, to fit the needs of coming drivers, specially considering they are based on DT booting platforms, it is always tempting to add intelligence to of-thermal. But, as I mentioned, I want to avoid growing intelligence in it, for obvious reasons.
Eventually, it is your call if we make __thermal_trip [1] exported to sensors (with or without struct device_node *np)
or if we have new structure (e.g. struct thermal_trip) which is a read
only reference to relevant fields of [1]?
Quoted 197 lines
Quoted 197 lines · Eduardo Valentin
Quoted 27 lines
* PGP Signed by an unknown key
Hello,
Quoted 22 lines · Lukasz Majewski
Hi Eduardo,
Quoted 20 lines
Hello Lukasz,
Quoted 17 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33+++++++++++++++++++++++++++++++++
drivers/thermal/thermal_core.h| 7 +++++++include/linux/thermal.h| 14 ++++++++++++++ 3 files
changed, 54 insertions(+)Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/thermal/of-thermal.c struct __thermal_zone { · line 92
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +1
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;Do we really need this duplication ?
Quoted 62 lines
Quoted 62 lines
Quoted 24 lines
Quoted 24 lines
drivers/thermal/of-thermal.c +2
-0/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */drivers/thermal/of-thermal.c +5
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; +Quoted 8 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 176
Quoted 6 lines
drivers/thermal/of-thermal.c +6
-0+if (!data) +return NULL ; + +return data->gtrips; +} +
EXPORT_SYMBOL_GPL(of_thermal_get_trip_points);Ok.
Quoted 27 lines
Quoted 27 lines
static int of_thermal_get_trend(struct
thermal_zone_device
*tz, int trip, enumthermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:drivers/thermal/of-thermal.c +0
-0of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i;Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/thermal/of-thermal.c static inline void of_thermal_free_zone(struct __thermal_zone *tz) · line 831
Quoted 4 lines
drivers/thermal/of-thermal.c +1
-0+kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);Couldn't find the code that updates *gtrips as a result of
set_trip_tempvia sysfs.Quoted 89 lines
Quoted 51 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +2
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);Quoted 8 lines
drivers/thermal/thermal_core.h static inline bool · line 104
Quoted 5 lines
drivers/thermal/thermal_core.h +0
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {This produces compilation error when
CONFIG_THERMAL_OFis not set. Name the parameters to fix.As all the other cases, I will fix that.
Quoted 19 lines
Quoted 19 lines
drivers/thermal/thermal_core.h +5
-0return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +0
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); };Quoted 10 lines
Quoted 5 lines
include/linux/thermal.h +2
-0+/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *The only problem I have with this name is that would look like it is in use in all thermal framework, which is not really the case. But I do think having a type here is a good thing. So, not sure :-)
Quoted 4 lines
It can stay to be struct
thermal_tripor we can rename it to structof_thermal_trip.I'm fine with both names.
Leave it as '
thermal_trip'.Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-0+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group* Unknown Key
*0x7DA4E256
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
In reply to Lukasz MajewskiQuoted 34 lines · Lukasz Majewski
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)drivers/thermal/of-thermal.c +3
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip)return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 167
Quoted 10 lines
drivers/thermal/of-thermal.c +10
-0+* trip points +* +* @tz: pointer to a thermal zone +* +* This function provides a pointer to the copy of trip points table +* +* Return: pointer to trip points table, NULL otherwise +*/ +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz)
Another thing, can you please check why scripts/kernel-doc does not like this prototype? It throws an warn:
Warning(drivers/thermal/of-thermal.c:168): cannot understand function
prototype: 'const struct thermal_trip * const of_thermal_get_trip_points(struct thermal_zone_device *tz) '
Quoted 90 lines
drivers/thermal/of-thermal.c +20
-0+{ +struct __thermal_zone *data = tz->devdata; + +if (!data) +return NULL ; + +return data->gtrips; +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i; +kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);drivers/thermal/thermal_core.h +7
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +14
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); }; +/** +* struct thermal_trip - Structure representing themal trip points exported from +* of-thermal +* +* @temperature: trip point temperature +* @hysteresis: trip point hysteresis +* @type: trip point type +*/ +struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 3/4] thermal: of: Extend of-thermal to export table of trip points
Hi Eduardo,
Quoted 45 lines · Lukasz Majewski
Quoted 44 lines
This patch extends the
of-thermal.cto export copy of trip points for a given thermal zone.Thermal drivers should use
of_thermal_get_trip_points()method to get pointer to table of thermal trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- New patch - as suggested by Eduardo Valentin--- drivers/thermal/of-thermal.c | 33 +++++++++++++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ include/linux/thermal.h | 14 ++++++++++++++ 3 files changed, 54 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 336af7f..33921c5 100644drivers/thermal/of-thermal.c +3
-0@@ -89,6 +89,7 @@ struct __thermal_zone {/* trip data */ int ntrips;struct __thermal_trip *trips; +struct thermal_trip *gtrips;/* cooling binding data */ int num_tbps;@@ -152,6 +153,27 @@ bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return true; } +/** +* of_thermal_get_trip_points - function to get access to a globally exported
+ * trip points
+ *
+ * @tz: pointer to a thermal zone
+ *
+ * This function provides a pointer to the copy of trip points table
+ *
+ * Return: pointer to trip points table, NULL otherwise
+ */
Quoted 9 lines
drivers/thermal/of-thermal.c bool of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) · line 167
Quoted 2 lines
drivers/thermal/of-thermal.c +2
-0+const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz)Another thing, can you please check why
scripts/kernel-docdoes not like this prototype? It throws an warn:
Warning(drivers/thermal/of-thermal.c:168): cannot understand function
prototype: 'const structthermal_trip* constof_thermal_get_trip_points(struct thermal_zone_device *tz)'
I will check that. However the warning looks a bit strange.
Quoted 94 lines
Quoted 94 lines
drivers/thermal/of-thermal.c +9
-0+{ +struct __thermal_zone *data = tz->devdata; + +if (!data) +return NULL ; + +return data->gtrips; +} + static int of_thermal_get_trend(struct thermal_zone_device *tz,int trip, enum
thermal_trend*trend)
{drivers/thermal/of-thermal.c +10
-0@@ -767,6 +789,16 @@ thermal_of_build_thermal_zone(struct device_node *np) goto free_tbps; } + tz->gtrips =kcalloc (tz->ntrips,sizeof (*tz->gtrips),GFP_KERNEL ); +if (!tz->gtrips) { + ret = -ENOMEM ; + goto free_tbps; + } + +for (i =0 ; i < tz->ntrips; i++) +memcpy (&(tz->gtrips[i]), &(tz->trips[i].temperature), +sizeof (*tz->gtrips)); + finish:drivers/thermal/of-thermal.c +1
-0of_node_put (child); tz->mode =THERMAL_DEVICE_DISABLED ;@@ -793,6 +825,7 @@ static inline void of_thermal_free_zone(struct __thermal_zone *tz) {int i; +kfree (tz->gtrips);for (i =0 ; i < tz->num_tbps; i++)of_node_put (tz->tbps[i].cooling_device);kfree (tz->tbps);(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex 466208c..a9580ca 100644drivers/thermal/thermal_core.h +7
-0@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_en (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }@@ -102,6 +104,11 @@ static inline bool of_thermal_is_trip_en(struct thermal_zone_device *, int) {return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */ include/linux/thermal.h +2
-0@@ -303,6 +303,20 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); }; +/** +* struct thermal_trip - Structure representing themal trip points exported from
+ * of-thermal
+ *
+ * @temperature: trip point temperature
+ * @hysteresis: trip point hysteresis
+ * @type: trip point type
+ */include/linux/thermal.h +6
-0+struct thermal_trip { +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 4/4 thermal: of: Extend current of-thermal.c code to allow setting emulated temp
In reply to Lukasz MajewskiBefore this change it was only possible to set get_temp() and get_trend() methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.
Now it is possible to also set emulated value of temperature for debug purposes.
---
Changes for v2:
- Rework the emulated temperature setting code to use of_thermal_sensor_ops structure
--- drivers/thermal/of-thermal.c | 24 ++++++++++++++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 25 insertions(+)
drivers/thermal/of-thermal.c +24 -0
@@ -174,6 +174,28 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz)return data->gtrips; } +/** +* of_thermal_set_emul_temp - function to set emulated temperature +* +* @tz: pointer to a thermal zone +* @temp: temperature to set +* +* This function gives the ability to set emulated value of temperature, +* which is handy for debugging +* +* Return: zero on success, error code otherwise +*/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->ops || !data->ops->set_emul_temp) +return -EINVAL ; + +return data->ops->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
@@ -405,6 +427,7 @@ thermal_zone_of_add_sensor(struct device_node *zone, tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;
@@ -533,6 +556,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->ops =NULL ; tz->sensor_data =NULL ;
include/linux/thermal.h +1 -0
@@ -301,6 +301,7 @@ struct thermal_genl_event {struct thermal_zone_of_device_ops {int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long ); };/**
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 4/4] thermal: of: Extend current of-thermal.c code to allow setting emulated temp
Quoted 71 lines · Lukasz Majewski
Before this change it was only possible to set
get_temp()andget_trend()methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.Now it is possible to also set emulated value of temperature for debug purposes.
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Rework the emulated temperature setting code to useof_thermal_sensor_opsstructure--- drivers/thermal/of-thermal.c | 24 ++++++++++++++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 25 insertions(+)drivers/thermal/of-thermal.c +24
-0@@ -174,6 +174,28 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz)return data->gtrips; } +/** +* of_thermal_set_emul_temp - function to set emulated temperature +* +* @tz: pointer to a thermal zone +* @temp: temperature to set +* +* This function gives the ability to set emulated value of temperature, +* which is handy for debugging +* +* Return: zero on success, error code otherwise +*/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->ops || !data->ops->set_emul_temp) +return -EINVAL ; + +return data->ops->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {@@ -405,6 +427,7 @@ thermal_zone_of_add_sensor(struct device_node *zone, tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;@@ -533,6 +556,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->ops =NULL ; tz->sensor_data =NULL ;include/linux/thermal.h +0
-0
include/linux/thermal.h struct thermal_genl_event { · line 304
Quoted 4 lines
include/linux/thermal.h +1
-0@@ -301,6 +301,7 @@ struct thermal_genl_event {struct thermal_zone_of_device_ops {int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long );
Please add it in the list of Optional functions in the comment above this struct.
Apart from that:
Quoted 6 lines
include/linux/thermal.h +0
-0};/** Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 4/4] thermal: of: Extend current of-thermal.c code to allow setting emulated temp
Hi Eduardo,
Quoted 66 lines · Lukasz Majewski
Quoted 65 lines
Before this change it was only possible to set
get_temp()andget_trend()methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.Now it is possible to also set emulated value of temperature for debug purposes.
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Rework the emulated temperature setting code to useof_thermal_sensor_opsstructure--- drivers/thermal/of-thermal.c | 24 ++++++++++++++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 25 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex 33921c5..ad7dc2b 100644drivers/thermal/of-thermal.c +22
-0@@ -174,6 +174,28 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz) return data->gtrips; } +/** +* of_thermal_set_emul_temp - function to set emulated temperature +* +* @tz: pointer to a thermal zone +* @temp: temperature to set +* +* This function gives the ability to set emulated value of temperature, +* which is handy for debugging +* +* Return: zero on success, error code otherwise +*/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->ops || !data->ops->set_emul_temp) +return -EINVAL ; + +return data->ops->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend){
drivers/thermal/of-thermal.c +2
-0@@ -405,6 +427,7 @@ thermal_zone_of_add_sensor(struct device_node *zone, tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;@@ -533,6 +556,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ;
Quoted 14 lines
include/linux/thermal.h struct thermal_genl_event { · line 304
Quoted 11 lines
drivers/thermal/of-thermal.c +0
-0tz->ops =NULL ; tz->sensor_data =NULL ;include/linux/thermal.h +1
-0@@ -301,6 +301,7 @@ struct thermal_genl_event {struct thermal_zone_of_device_ops {int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long );Please add it in the list of Optional functions in the comment above this struct.
I will add proper comment to struct thermal_zone_of_device_ops comment.
Quoted 13 lines
Apart from that:
Acked-by Eduardo Valentin <[email protected]>Quoted 6 lines
include/linux/thermal.h +0
-0};/** Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
v3 cover thermal: of: of-thermal.c API extensions
In reply to Lukasz MajewskiProvided patch series extend of-thermal.c file API. It is necessary for ongoing Exynos TMU rework.
First version of this code can be found at:
http://www.spinics.net/lists/linux-samsung-soc/msg37719.html
Second version:
http://www.spinics.net/lists/kernel/msg1872274.html
This code provides methods to access some of-thermal local data. Moreover it provides a read only access to of-thermal trip points.
Lukasz Majewski (5):
thermal: of: Extend of-thermal.c to provide number of trip points
thermal: of: Extend of-thermal.c to provide check if trip point is
valid
thermal: of: Rename struct __thermal_trip to struct thermal_trip
thermal: of: Extend of-thermal to export table of trip points
thermal: of: Extend current of-thermal.c code to allow setting
emulated temp
drivers/thermal/of-thermal.c | 109 ++++++++++++++++++++++++++++++++++------- drivers/thermal/thermal_core.h | 18 +++++++ include/linux/thermal.h | 18 +++++++ 3 files changed, 127 insertions(+), 18 deletions(-)
Signature · 1 line
2.0.0.rc2
PATCH v3 1/5 thermal: of: Extend of-thermal.c to provide number of trip points
This patch extends the of-thermal.c to provide information about number of available trip points.
---
Changes for v3:
- Exporting of_thermal_get_ntrips symbol as a GPL
- Fix build error when CONFIG_THERMAL_OF is disabled
Changes for v2:
- Provide detailed (doxygen like) description of the of_thermal_get_ntrips() method
- Check for data pointer not being NULL
--- drivers/thermal/of-thermal.c | 21 +++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 26 insertions(+)
drivers/thermal/of-thermal.c +21 -0
@@ -112,6 +112,27 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz,return data->ops->get_temp (data->sensor_data, temp); } +/** +* of_thermal_get_ntrips - function to export number of available trip +* points. +* @tz: pointer to a thermal zone +* +* This function is a globally visible wrapper to get number of trip points +* stored in the local struct __thermal_zone +* +* Return: number of available trip points, -ENODEV when data not available +*/ +int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data ||IS_ERR (data)) +return -ENODEV ; + +return data->ntrips; +} +EXPORT_SYMBOL_GPL (of_thermal_get_ntrips); +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +5 -0
@@ -89,9 +89,14 @@ static inline void thermal_gov_user_space_unregister(void) {}#ifdef CONFIG_THERMAL_OF int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void ); +int of_thermal_get_ntrips (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
Re: [PATCH v3 1/5] thermal: of: Extend of-thermal.c to provide number of trip points
Quoted 55 lines · Lukasz Majewski
This patch extends the
of-thermal.cto provide information about number of available trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v3:
- Exportingof_thermal_get_ntripssymbol as a GPL
- Fix build error whenCONFIG_THERMAL_OFis disabledChanges for v2:
- Provide detailed (doxygen like) description of theof_thermal_get_ntrips()method
- Check for data pointer not being NULL--- drivers/thermal/of-thermal.c | 21 +++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 26 insertions(+)drivers/thermal/of-thermal.c +21
-0@@ -112,6 +112,27 @@ static int of_thermal_get_temp(struct thermal_zone_device *tz,return data->ops->get_temp (data->sensor_data, temp); } +/** +* of_thermal_get_ntrips - function to export number of available trip +* points. +* @tz: pointer to a thermal zone +* +* This function is a globally visible wrapper to get number of trip points +* stored in the local struct __thermal_zone +* +* Return: number of available trip points, -ENODEV when data not available +*/ +int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data ||IS_ERR (data)) +return -ENODEV ; + +return data->ntrips; +} +EXPORT_SYMBOL_GPL (of_thermal_get_ntrips); +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {drivers/thermal/thermal_core.h +0
-0
drivers/thermal/thermal_core.h static inline void thermal_gov_user_space_unregister(void) {} · line 92
Quoted 4 lines
drivers/thermal/thermal_core.h +1
-0@@ -89,9 +89,14 @@ static inline void thermal_gov_user_space_unregister(void) {}#ifdef CONFIG_THERMAL_OF int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void ); +int of_thermal_get_ntrips (struct thermal_zone_device *);
Lukasz,
Here is a question that applies to all patches in this series adding functions in this header.
i suppose you intend to use these new functions in driver code, right? Add them here, will limit their usage to code inside drivers/thermal.
Shouldn't these new APIs be declared under include/linux/thermal.h?
This way, they can be be available to other parts of the kernel too.
Quoted 13 lines
drivers/thermal/thermal_core.h +4
-0#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { } +static inline int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */ Signature · 1 line
2.0.0.rc2
Re: [PATCH v3 1/5] thermal: of: Extend of-thermal.c to provide number of trip points
On Mon, 8 Dec 2014 15:52:49 -0400
Eduardo Valentin <[email protected]> wrote:
Hi Eduardo,
Quoted 66 lines · Lukasz Majewski
Quoted 58 lines
This patch extends the
of-thermal.cto provide information about number of available trip points.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v3:
- Exportingof_thermal_get_ntripssymbol as a GPL
- Fix build error whenCONFIG_THERMAL_OFis disabledChanges for v2:
- Provide detailed (doxygen like) description of theof_thermal_get_ntrips()method
- Check for data pointer not being NULL--- drivers/thermal/of-thermal.c | 21 +++++++++++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 26 insertions(+)(quoted diff) +0
-0
b/drivers/thermal/of-thermal.cindex b7982f0..7facd23 100644drivers/thermal/of-thermal.c +0
-0@@ -112,6 +112,27 @@ static int of_thermal_get_temp(struct
thermal_zone_device*tz, returndata->ops->get_temp(data->sensor_data, temp); }+/**
+ *of_thermal_get_ntrips- function to export number of available trip
+ * points.
+ * @tz: pointer to a thermal zone
+ *
+ * This function is a globally visible wrapper to get number of trip points
+ * stored in the local struct__thermal_zone
+ *
+ * Return: number of available trip points,-ENODEVwhen data not available
+ */drivers/thermal/of-thermal.c +11
-0+int of_thermal_get_ntrips (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data ||IS_ERR (data)) +return -ENODEV ; + +return data->ntrips; +} +EXPORT_SYMBOL_GPL (of_thermal_get_ntrips); + static int of_thermal_get_trend(struct thermal_zone_device *tz,int trip, enum
thermal_trend*trend)
{(quoted diff) +0
-0
b/drivers/thermal/thermal_core.hindex d15d243..1cc5041 100644drivers/thermal/thermal_core.h +0
-0@@ -89,9 +89,14 @@ static inline voidQuoted 4 lines
thermal_gov_user_space_unregister(void){} #ifdefCONFIG_THERMAL_OF
intof_parse_thermal_zones(void);
voidof_thermal_destroy_zones(void);
+intof_thermal_get_ntrips(struct thermal_zone_device *);Lukasz,
Quoted 4 lines
Here is a question that applies to all patches in this series adding functions in this header.
i suppose you intend to use these new functions in driver code, right?
Yes, right.
Quoted 1 line
Add them here, will limit their usage to code inside
drivers/thermal.
This is my intention - at least for now the use case is to configure the thermal driver (i.e. Exynos TMU). Other drivers (e.g. TI) can benefit from this code too.
Quoted 2 lines
Shouldn't these new APIs be declared under
include/linux/thermal.h?
I'd prefer to leave this API in ./drivers/thermal and move them to ./include/linux/thermal.h only when other parts of the kernel require it.
Quoted 13 lines
This way, they can be be available to other parts of the kernel too.
Quoted 9 lines
#else
static inline intof_parse_thermal_zones(void){ return 0; } static inline voidof_thermal_destroy_zones(void){ }
+static inline intof_thermal_get_ntrips(struct thermal_zone_device *tz)+{drivers/thermal/thermal_core.h +2
-0+ return 0; +}#endif
Quoted 4 lines
Quoted 4 lines
#endif /*
__THERMAL_CORE_H__*/Signature · 1 line
2.0.0.rc2
Best Regards,
Lukasz Majewski
PATCH v3 2/5 thermal: of: Extend of-thermal.c to provide check if trip point is valid
In reply to Lukasz MajewskiThis patch extends the of-thermal.c to provide check if trip point is valid.
---
Changes for v3:
- Rename of_thermal_is_trip_en() to of_thermal_is_trip_valid()
- Export of_thermal_is_trip_valid symbol as GPL
- Fix the build error when CONFIG_THERMAL_OF is not defined
Changes for v2:
- Replace int with bool
- Replace 1/0 with true/false
- Add check if data pointer is not NULL
- Add missing doxygen style comment for the function
--- drivers/thermal/of-thermal.c | 21 +++++++++++++++++++++ drivers/thermal/thermal_core.h | 6 ++++++ 2 files changed, 27 insertions(+)
drivers/thermal/of-thermal.c +21 -0
@@ -133,6 +133,27 @@ int of_thermal_get_ntrips(struct thermal_zone_device *tz) }EXPORT_SYMBOL_GPL (of_thermal_get_ntrips); +/** +* of_thermal_is_trip_valid - function to check if trip point is valid +* +* @tz: pointer to a thermal zone +* @trip: trip point to evaluate +* +* This function is responsible for checking if passed trip point is valid +* +* Return: true if trip point is valid, false otherwise +*/ +bool of_thermal_is_trip_valid (struct thermal_zone_device *tz,int trip) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data || trip >= data->ntrips || trip <0 ) +return false; + +return true; +} +EXPORT_SYMBOL_GPL (of_thermal_is_trip_valid); +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +6 -0
@@ -90,6 +90,7 @@ static inline void thermal_gov_user_space_unregister(void) {}int of_parse_thermal_zones (void );void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *); +bool of_thermal_is_trip_valid (struct thermal_zone_device *,int );#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
@@ -97,6 +98,11 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz) {return 0 ; } +static inline bool of_thermal_is_trip_valid (struct thermal_zone_device *tz, +int trip) +{ +return 0 ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
PATCH v3 3/5 thermal: of: Rename struct __thermal_trip to struct thermal_trip
In reply to Lukasz MajewskiThis patch changes name of struct __thermal_trip to thermal_trip and moves declaration of the latter to ./include/linux/thermal.h for better visibility.
---
Changes for v3:
- New patch - as suggested by Navneet Kumar
--- drivers/thermal/of-thermal.c | 21 +++------------------ include/linux/thermal.h | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/thermal/of-thermal.c +3 -18
@@ -37,21 +37,6 @@/*** Private data structures to represent thermal device tree data ***/ /** -* struct __thermal_trip - representation of a point in temperature domain -* @np: pointer to struct device_node that this trip point was created from -* @temperature: temperature value in miliCelsius -* @hysteresis: relative hysteresis in miliCelsius -* @type: trip point type -*/ - -struct __thermal_trip { -struct device_node *np; -unsigned long int temperature; -unsigned long int hysteresis; -enum thermal_trip_type type; -}; - -/** * struct __thermal_bind_param - a match between trip and cooling device * @cooling_device: a pointer to identify the referred cooling device * @trip_id: the trip point index
@@ -88,7 +73,7 @@ struct __thermal_zone {/* trip data */ int ntrips; -struct __thermal_trip *trips; +struct thermal_trip *trips;/* cooling binding data */ int num_tbps;
@@ -538,7 +523,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_unregister);*/ static int thermal_of_populate_bind_params (struct device_node *np,struct __thermal_bind_params *__tbp, -struct __thermal_trip *trips, +struct thermal_trip *trips,int ntrips) {struct of_phandle_args cooling_spec;
@@ -641,7 +626,7 @@ static int thermal_of_get_trip_type(struct device_node *np,* Return: 0 on success, proper error code otherwise */ static int thermal_of_populate_trip (struct device_node *np, -struct __thermal_trip *trip) +struct thermal_trip *trip) {int prop;int ret;
include/linux/thermal.h +15 -0
@@ -303,6 +303,21 @@ struct thermal_zone_of_device_ops {int (*get_trend)(void *,long *); }; +/** +* struct thermal_trip - representation of a point in temperature domain +* @np: pointer to struct device_node that this trip point was created from +* @temperature: temperature value in miliCelsius +* @hysteresis: relative hysteresis in miliCelsius +* @type: trip point type +*/ + +struct thermal_trip { +struct device_node *np; +unsigned long int temperature; +unsigned long int hysteresis; +enum thermal_trip_type type; +}; +/* Function declarations */ #ifdef CONFIG_THERMAL_OF struct thermal_zone_device *
Signature · 1 line
2.0.0.rc2
PATCH v3 4/5 thermal: of: Extend of-thermal to export table of trip points
In reply to Lukasz MajewskiThis patch extends the of-thermal.c to export trip points for a given thermal zone.
Thermal drivers should use of_thermal_get_trip_points() method to get pointer to table of thermal trip points.
---
Changes for v3:
- Export of_thermal_get_trip_points symbol as GPL
- Fix the build error when CONFIG_THERMAL_OF is not defined
Changes for v2:
- New patch - as suggested by Eduardo Valentin
--- drivers/thermal/of-thermal.c | 22 ++++++++++++++++++++++ drivers/thermal/thermal_core.h | 7 +++++++ 2 files changed, 29 insertions(+)
drivers/thermal/of-thermal.c +22 -0
@@ -139,6 +139,28 @@ bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, int trip) }EXPORT_SYMBOL_GPL (of_thermal_is_trip_valid); +/** +* of_thermal_get_trip_points - function to get access to a globally exported +* trip points +* +* @tz: pointer to a thermal zone +* +* This function provides a pointer to trip points table +* +* Return: pointer to trip points table, NULL otherwise +*/ +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data) +return NULL ; + +return data->trips; +} +EXPORT_SYMBOL_GPL (of_thermal_get_trip_points); +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
drivers/thermal/thermal_core.h +7 -0
@@ -91,6 +91,8 @@ int of_parse_thermal_zones(void);void of_thermal_destroy_zones (void );int of_thermal_get_ntrips (struct thermal_zone_device *);bool of_thermal_is_trip_valid (struct thermal_zone_device *,int ); +const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *);#else static inline int of_parse_thermal_zones (void ) {return 0 ; }static inline void of_thermal_destroy_zones (void ) { }
@@ -103,6 +105,11 @@ static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, {return 0 ; } +static inline const struct thermal_trip *const +of_thermal_get_trip_points (struct thermal_zone_device *tz) +{ +return NULL ; +}#endif #endif /* __THERMAL_CORE_H__ */
Signature · 1 line
2.0.0.rc2
PATCH v3 5/5 thermal: of: Extend current of-thermal.c code to allow setting emulated temp
In reply to Lukasz MajewskiBefore this change it was only possible to set get_temp() and get_trend() methods to be used in the common code handling passing parameters via device tree to "cpu-thermal" CPU thermal zone device.
Now it is possible to also set emulated value of temperature for debug purposes.
---
Changes for v3:
- Update comment for .set_emul_temp method to indicate that it is optional
Changes for v2:
- Rework the emulated temperature setting code to use of_thermal_sensor_ops structure
--- drivers/thermal/of-thermal.c | 24 ++++++++++++++++++++++++ include/linux/thermal.h | 3 +++ 2 files changed, 27 insertions(+)
drivers/thermal/of-thermal.c +24 -0
@@ -161,6 +161,28 @@ of_thermal_get_trip_points(struct thermal_zone_device *tz) }EXPORT_SYMBOL_GPL (of_thermal_get_trip_points); +/** +* of_thermal_set_emul_temp - function to set emulated temperature +* +* @tz: pointer to a thermal zone +* @temp: temperature to set +* +* This function gives the ability to set emulated value of temperature, +* which is handy for debugging +* +* Return: zero on success, error code otherwise +*/ +static int of_thermal_set_emul_temp (struct thermal_zone_device *tz, +unsigned long temp) +{ +struct __thermal_zone *data = tz->devdata; + +if (!data->ops || !data->ops->set_emul_temp) +return -EINVAL ; + +return data->ops->set_emul_temp (data->sensor_data, temp); +} +static int of_thermal_get_trend (struct thermal_zone_device *tz,int trip,enum thermal_trend *trend) {
@@ -392,6 +414,7 @@ thermal_zone_of_add_sensor(struct device_node *zone, tzd->ops->get_temp = of_thermal_get_temp; tzd->ops->get_trend = of_thermal_get_trend; + tzd->ops->set_emul_temp = of_thermal_set_emul_temp;mutex_unlock (&tzd->lock);return tzd;
@@ -520,6 +543,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev,mutex_lock (&tzd->lock); tzd->ops->get_temp =NULL ; tzd->ops->get_trend =NULL ; + tzd->ops->set_emul_temp =NULL ; tz->ops =NULL ; tz->sensor_data =NULL ;
include/linux/thermal.h +3 -0
@@ -297,10 +297,13 @@ struct thermal_genl_event {* * Optional: * @get_trend: a pointer to a function that reads the sensor temperature trend. +* @set_emul_temp: a pointer to a function that sets sensor emulated +* temperature. */ struct thermal_zone_of_device_ops {int (*get_temp)(void *,long *);int (*get_trend)(void *,long *); +int (*set_emul_temp)(void *,unsigned long ); };/**
Signature · 1 line
2.0.0.rc2
Eduardo Valentin
AppliedRe: [PATCH v3 0/5] thermal: of: of-thermal.c API extensions
In reply to Lukasz MajewskiQuoted 12 lines · Lukasz Majewski
Provided patch series extend
of-thermal.cfile API. It is necessary for ongoing Exynos TMU rework.First version of this code can be found at:
http://www.spinics.net/lists/linux-samsung-soc/msg37719.htmlSecond version:
http://www.spinics.net/lists/kernel/msg1872274.htmlThis code provides methods to access some of-thermal local data. Moreover it provides a read only access to of-thermal trip points.
Quoted 8 lines
Lukasz Majewski (5):
thermal: of: Extendof-thermal.cto provide number of trip points
thermal: of: Extendof-thermal.cto provide check if trip point is
valid
thermal: of: Rename struct__thermal_tripto structthermal_trip
thermal: of: Extend of-thermal to export table of trip points
thermal: of: Extend currentof-thermal.ccode to allow setting
emulated temp
Applied the series in my -linus branch.
Cheers
Quoted 9 lines
drivers/thermal/of-thermal.c | 109 ++++++++++++++++++++++++++++++++++------- drivers/thermal/thermal_core.h | 18 +++++++ include/linux/thermal.h | 18 +++++++ 3 files changed, 127 insertions(+), 18 deletions(-)Signature · 1 line
2.0.0.rc2
v2 cover thermal: exynos: Thermal code rework to use device tree
In reply to Lukasz Majewski1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.
Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
This work should NOT bring any functional changes to Exynos thermal subsystem.
2. Patch-set structure
Then the cpu_cooling functionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.
Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
Patch series end with removing exynos5250/exynos3250 TMU compatibles. Both SoCs have thermal management unit (TMU) compatible with the one first introduced at Exynos4412.
3. Dead code removal
Thermal support for some SoCs, previously available in the exynos_tmu_data.c file, was removed since, as of (almost) 3.19-rc1, they didn't have TMU bindings.
Moreover, support for cpu_cooling devices was preserved only on those SoCs which had available and working cpufreq driver.
4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone + cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone + cpu_cooling)
- Exynos5250 - Arndale (TMU zone + cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)
Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. This work apply on the following tree:
kernel.org: 'linux-soc-thermal/next' - Eduardo Velentin's tree
SHA1: c42c7a44c7a543dcb388c1ee1a798e6ed76ad8cf
Lukasz Majewski (17):
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Provide thermal_exynos.h file to be included in
device tree files
thermal: dts: trats: Enable TMU on the Exynos4210 trats device
thermal: dts: exynos: Add LD010 regulator node necessary for TMU on
Odroid
thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu
cooling functionality
thermal: cpu_cooling: Modify exynos thermal code to use device tree
for cpu cooling configuration
thermal: exynos: dts: Add default definition of the TMU sensor
parameter
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data for
Exynos5440
thermal: exynos: dts: Provide device tree bindings identical to one in
exynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Remove exynos_tmu_data.c file
thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412
arch/arm/boot/dts/exynos3250.dtsi | 6 +- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 5 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 43 ++- arch/arm/boot/dts/exynos4212.dtsi | 20 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 + arch/arm/boot/dts/exynos4412.dtsi | 32 ++ arch/arm/boot/dts/exynos4x12.dtsi | 3 + arch/arm/boot/dts/exynos5250.dtsi | 29 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 33 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 23 +- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 427 ---------------------- drivers/thermal/samsung/exynos_thermal_common.h | 106 ------ drivers/thermal/samsung/exynos_tmu.c | 337 ++++++++++------- drivers/thermal/samsung/exynos_tmu.h | 80 +--- drivers/thermal/samsung/exynos_tmu_data.c | 264 ------------- include/dt-bindings/thermal/thermal_exynos.h | 37 ++ 25 files changed, 669 insertions(+), 1018 deletions(-) create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5420-trip-points.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-trip-points.dtsi delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c create mode 100644 include/dt-bindings/thermal/thermal_exynos.h
Signature · 1 line
2.0.0.rc2
Quoted 9 lines · Lukasz Majewski
1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (
of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.
Very good! Thanks for cleaning the code.
Given the decision to be DT only, my only question now is if you need to support non-DT booting systems. Do you (Exynos platforms in general) care about booting without DT?
If not, then removing makes completely sense to me.
Quoted 3 lines
Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
Great!
Quoted 3 lines
This work should NOT bring any functional changes to Exynos thermal subsystem.
OK.
Quoted 6 lines
2. Patch-set structure
Then the
cpu_coolingfunctionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.
uhh.. OK. but, by supporting of-thermal that means drivers should never care about loading cpu cooling. That is done via cpufreq-dt. That is why we had the cycle with cpufreq folks, remember?
(I will have a look in your patches)
Quoted 3 lines
Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
This is very good. Do you care sending feedback if you need extra configuration or does of-thermal cover your scenarios (a part from the amendments you already did)?
I know people (tegra and rockchip) are interested in hw trip points, which I believe should be of your interest too. Of course, that is maybe an off-topic for this series.
Quoted 4 lines
Patch series end with removing exynos5250/exynos3250 TMU compatibles. Both SoCs have thermal management unit (TMU) compatible with the one first introduced at Exynos4412.
OK. I will have a look in DT changes you did. But in general, removing support needs to be done carefully for backward compatibility :-(.
Quoted 8 lines
3. Dead code removal
Thermal support for some SoCs, previously available in the
exynos_tmu_data.cfile, was removed since, as of (almost) 3.19-rc1, they didn't have TMU bindings.Moreover, support for
cpu_coolingdevices was preserved only on those SoCs which had available and working cpufreq driver.
Have you tried your series with cpufreq-dt?
Quoted 64 lines
4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone +cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone +cpu_cooling)
- Exynos5250 - Arndale (TMU zone +cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. This work apply on the following tree:
kernel.org: 'linux-soc-thermal/next' - Eduardo Velentin's tree
SHA1:c42c7a44c7a543dcb388c1ee1a798e6ed76ad8cfLukasz Majewski (17):
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Providethermal_exynos.hfile to be included in
device tree files
thermal: dts: trats: Enable TMU on the Exynos4210 trats device
thermal: dts: exynos: Add LD010 regulator node necessary for TMU on
Odroid
thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
thermal:cpu_cooling: dts: Define device tree bindings for Exynos cpu
cooling functionality
thermal:cpu_cooling: Modify exynos thermal code to use device tree
for cpu cooling configuration
thermal: exynos: dts: Add default definition of the TMU sensor
parameter
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data forExynos5440thermal: exynos: dts: Provide device tree bindings identical to one in
exynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Removeexynos_tmu_data.cfile
thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412arch/arm/boot/dts/exynos3250.dtsi | 6 +- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 5 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 43 ++- arch/arm/boot/dts/exynos4212.dtsi | 20 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 + arch/arm/boot/dts/exynos4412.dtsi | 32 ++ arch/arm/boot/dts/exynos4x12.dtsi | 3 + arch/arm/boot/dts/exynos5250.dtsi | 29 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 33 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 23 +-
Quoted 8 lines
drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 427 ---------------------- drivers/thermal/samsung/exynos_thermal_common.h | 106 ------ drivers/thermal/samsung/exynos_tmu.c | 337 ++++++++++------- drivers/thermal/samsung/exynos_tmu.h | 80 +--- drivers/thermal/samsung/exynos_tmu_data.c | 264 ------------- include/dt-bindings/thermal/thermal_exynos.h | 37 ++ 25 files changed, 669 insertions(+), 1018 deletions(-)
Good!
Quoted 13 lines
create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5420-trip-points.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-trip-points.dtsi delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c create mode 100644 include/dt-bindings/thermal/thermal_exynos.hSignature · 1 line
2.0.0.rc2
Hi Eduardo,
Quoted 11 lines · Lukasz Majewski
Quoted 9 lines
1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (
of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.
Quoted 5 lines
Very good! Thanks for cleaning the code.
Given the decision to be DT only, my only question now is if you need to support non-DT booting systems. Do you (Exynos platforms in general) care about booting without DT?
As fair as I know all Exynos systems have been ported to DT. Support for new Exynos based devices is only accepted if configuration is DT based.
Quoted 18 lines
If not, then removing makes completely sense to me.
Quoted 3 lines
Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
Great!
Quoted 3 lines
This work should NOT bring any functional changes to Exynos thermal subsystem.
OK.
Quoted 2 lines
2. Patch-set structure
Quoted 7 lines
Quoted 4 lines
Then the
cpu_coolingfunctionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.uhh.. OK. but, by supporting of-thermal that means drivers should never care about loading cpu cooling. That is done via cpufreq-dt.
Up till now exynos has a Kbuild option to enable cpu_cooling for its thermal subsystem.
cpufreq for Exynos also undergo major rework (done by Tomas Abraham):
"cpufreq: use generic cpufreq drivers for exynos platforms" [1]
It converts some Exynos 4 and 5 platform to use cpufreq-dt/cpufreq-bL and is pretty close to be added in this merge window.
Unfortunately not all devices were converted (e.g. Exynos 4412) and old legacy cpufreq code is used (I simply wait with porting Exynos4412 for "base" patches landing in the kernel).
Although, this shouldn't be a problem.
Quoted 3 lines
That is why we had the cycle with cpufreq folks, remember?
(I will have a look in your patches)
It would be great if those patches could find their way to therma -next. Then also Abhilash could benefit from them.
Quoted 8 lines
Quoted 4 lines
Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
This is very good. Do you care sending feedback if you need extra configuration or does of-thermal cover your scenarios (a part from the amendments you already did)?
Changes, which I did recently to of-thermal.c are enough.
Quoted 4 lines
I know people (tegra and rockchip) are interested in hw trip points, which I believe should be of your interest too. Of course, that is maybe an off-topic for this series.
With this patch series I've tried to preserve previous functionality. I've got some ideas for improvements, but those are for other discussion.
Quoted 9 lines
Quoted 6 lines
Patch series end with removing exynos5250/exynos3250 TMU compatibles. Both SoCs have thermal management unit (TMU) compatible with the one first introduced at Exynos4412.
OK. I will have a look in DT changes you did. But in general, removing support needs to be done carefully for backward compatibility :-(.
Essentially this is a clean up, not removing support. The trick here is that Exynos4412 (which was added first to mainline), Exynos5250 and Exynos3250 use the same TMU IP block.
Quoted 8 lines
Quoted 8 lines
3. Dead code removal
Thermal support for some SoCs, previously available in the
exynos_tmu_data.cfile, was removed since, as of (almost) 3.19-rc1, they didn't have TMU bindings.
Quoted 5 lines
Quoted 2 lines
Moreover, support for
cpu_coolingdevices was preserved only on those SoCs which had available and working cpufreq driver.Have you tried your series with cpufreq-dt?
Since I don't know if [1] will be finally accepted - I've used already available cpufreq code (with exynos_defconfig + cpu_cooling enabled).
I don't think that there should be any problem with using cpufreq-dt. Moreover, we would have enough time for potential fixes before next kernel (3.19) is released.
Quoted 91 lines
Quoted 67 lines
4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone +cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone +cpu_cooling)
- Exynos5250 - Arndale (TMU zone +cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. This work apply on the following tree:
kernel.org: 'linux-soc-thermal/next' - Eduardo Velentin's tree
SHA1:c42c7a44c7a543dcb388c1ee1a798e6ed76ad8cfLukasz Majewski (17):
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Providethermal_exynos.hfile to be included in
device tree files
thermal: dts: trats: Enable TMU on the Exynos4210 trats device
thermal: dts: exynos: Add LD010 regulator node necessary for TMU
on Odroid
thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
thermal:cpu_cooling: dts: Define device tree bindings for Exynos
cpu cooling functionality
thermal:cpu_cooling: Modify exynos thermal code to use device
tree for cpu cooling configuration
thermal: exynos: dts: Add default definition of the TMU sensor
parameter
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data
for Exynos5440
thermal: exynos: dts: Provide device tree bindings identical to
one inexynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Removeexynos_tmu_data.cfile
thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412arch/arm/boot/dts/exynos3250.dtsi | 6 +- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 5 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 43 ++- arch/arm/boot/dts/exynos4212.dtsi | 20 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 + arch/arm/boot/dts/exynos4412.dtsi | 32 ++ arch/arm/boot/dts/exynos4x12.dtsi | 3 + arch/arm/boot/dts/exynos5250.dtsi | 29 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 33 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 23 +- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 427Quoted 7 lines
----------------------
drivers/thermal/samsung/exynos_thermal_common.h| 106 ------drivers/thermal/samsung/exynos_tmu.c| 337
++++++++++-------drivers/thermal/samsung/exynos_tmu.h| 80 +--- drivers/thermal/samsung/exynos_tmu_data.c | 264 ------------- include/dt-bindings/thermal/thermal_exynos.h |37 ++ 25 files changed, 669 insertions(+), 1018 deletions(-)
Good!
Quoted 14 lines
create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi create mode 100644
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsicreate mode 100644arch/arm/boot/dts/exynos5420-trip-points.dtsicreate mode 100644arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsicreate mode 100644arch/arm/boot/dts/exynos5440-trip-points.dtsidelete mode 100644drivers/thermal/samsung/exynos_thermal_common.cdelete mode 100644drivers/thermal/samsung/exynos_thermal_common.hdelete mode 100644drivers/thermal/samsung/exynos_tmu_data.ccreate mode 100644include/dt-bindings/thermal/thermal_exynos.hSignature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Hi Lukasz and Eduardo,
[...]
Quoted 9 lines
Although, this shouldn't be a problem.
Quoted 3 lines
That is why we had the cycle with cpufreq folks, remember?
(I will have a look in your patches)
It would be great if those patches could find their way to therma -next. Then also Abhilash could benefit from them.
I have a couple of 5420/5800 based chromebooks that I will test this series on. Is it OK for me to start basing my Exynos7 TMU support on this series ? Please let me know if I can help in any other way with this.
Regards,
Abhilash
Hi Abhilash,
Quoted 10 lines
Hi Lukasz and Eduardo,
[...]
Quoted 7 lines
Although, this shouldn't be a problem.
Quoted 3 lines
That is why we had the cycle with cpufreq folks, remember?
(I will have a look in your patches)
Quoted 7 lines
Quoted 2 lines
It would be great if those patches could find their way to therma -next. Then also Abhilash could benefit from them.
I have a couple of 5420/5800 based chromebooks that I will test this series on. Is it OK for me to start basing my Exynos7 TMU support on this series ? Please let me know if I can help in any other way with this.
I'm fine if you rebase on top of my patches.
However, it is up to Eduardo when he decides to pull them to -next branch.
I hope that it will happen soon.
Quoted 3 lines
Regards,
Abhilash
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Hi Lukasz,
Quoted 20 lines · Lukasz Majewski
Hi Abhilash,
Quoted 10 lines
Hi Lukasz and Eduardo,
[...]
Quoted 7 lines
Although, this shouldn't be a problem.
Quoted 3 lines
That is why we had the cycle with cpufreq folks, remember?
(I will have a look in your patches)
Quoted 7 lines
Quoted 2 lines
It would be great if those patches could find their way to therma -next. Then also Abhilash could benefit from them.
I have a couple of 5420/5800 based chromebooks that I will test this series on. Is it OK for me to start basing my Exynos7 TMU support on this series ? Please let me know if I can help in any other way with this.
Quoted 6 lines
I'm fine if you rebase on top of my patches.
However, it is up to Eduardo when he decides to pull them to -next branch.
I hope that it will happen soon.
I tested a Peach Pit (5420 based chromebook) with your patches and they work well (temperatures and software tripping). However, my earlier comments with regards to duplicate exynos_tmu_initialize() and the thermal zone showing as disabled in sysfs .
Also, I think the documentation for the dt properties are missing ?
I will post my exynos7 work based on your patches soon. Please take a look.
Regards,
Abhilash
Quoted 13 lines
Quoted 4 lines
Regards,
Abhilash--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 1/17 thermal: exynos: cosmetic: Correct comment format
In reply to Lukasz Majewski---
Changes for v2:
- None
--- drivers/thermal/samsung/exynos_tmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/samsung/exynos_tmu.c +1 -1
@@ -576,7 +576,7 @@ out:#define exynos5440_tmu_set_emulation NULLstatic int exynos_tmu_set_emulation (void *drv_data,unsigned long temp) {return -EINVAL ; } -#endif /*CONFIG_THERMAL_EMULATION*/ +#endif /* CONFIG_THERMAL_EMULATION */ static int exynos4210_tmu_read (struct exynos_tmu_data *data) {
Signature · 1 line
2.0.0.rc2
PATCH v2 2/17 thermal: exynos: Provide thermal_exynos.h file to be included in device tree files
In reply to Lukasz MajewskiThis patch is a preparatory patch to be able to read Exynos thermal configuration from the device tree.
It turned out that DTC is not able to interpret enums properly and hence it is necessary to #define those values explicitly.
For this reason the ./include/dt-bindings/thermal/thermal_exynos.h file has been introduced.
---
Changes for v2:
- None
--- drivers/thermal/samsung/exynos_tmu.c | 2 +- drivers/thermal/samsung/exynos_tmu.h | 24 +++--------------- include/dt-bindings/thermal/thermal_exynos.h | 37 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 include/dt-bindings/thermal/thermal_exynos.h
drivers/thermal/samsung/exynos_tmu.c +1 -1
@@ -144,7 +144,7 @@ struct exynos_tmu_data {void __iomem *base;void __iomem *base_second;int irq; -enum soc_type soc; +int soc;struct work_struct irq_work;struct mutex lock;struct clk *clk, *clk_sec;
drivers/thermal/samsung/exynos_tmu.h +4 -20
@@ -26,24 +26,7 @@#include "exynos_thermal_common.h" -enum calibration_type { -TYPE_ONE_POINT_TRIMMING , -TYPE_ONE_POINT_TRIMMING_25 , -TYPE_ONE_POINT_TRIMMING_85 , -TYPE_TWO_POINT_TRIMMING , -TYPE_NONE , -}; - -enum soc_type { -SOC_ARCH_EXYNOS3250 =1 , -SOC_ARCH_EXYNOS4210 , -SOC_ARCH_EXYNOS4412 , -SOC_ARCH_EXYNOS5250 , -SOC_ARCH_EXYNOS5260 , -SOC_ARCH_EXYNOS5420 , -SOC_ARCH_EXYNOS5420_TRIMINFO , -SOC_ARCH_EXYNOS5440 , -}; +#include <dt-bindings/thermal/thermal_exynos.h> /** * struct exynos_tmu_platform_data
@@ -115,8 +98,9 @@ struct exynos_tmu_platform_data {u8 second_point_trim;u8 default_temp_offset; -enum calibration_type cal_type; -enum soc_type type; +u32 cal_type; +u32 cal_mode; +u32 type;struct freq_clip_table freq_tab[4 ];unsigned int freq_tab_count; };
include/dt-bindings/thermal/thermal_exynos.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* thermal_exynos.h - Samsung EXYNOS TMU device tree definitions +* +* Copyright (C) 2014 Samsung Electronics +* 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 as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#ifndef _EXYNOS_THERMAL_TMU_DT_H +#define _EXYNOS_THERMAL_TMU_DT_H + +#define TYPE_ONE_POINT_TRIMMING 0 +#define TYPE_ONE_POINT_TRIMMING_25 1 +#define TYPE_ONE_POINT_TRIMMING_85 2 +#define TYPE_TWO_POINT_TRIMMING 3 +#define TYPE_NONE 4 + +#define SOC_ARCH_EXYNOS3250 1 +#define SOC_ARCH_EXYNOS4210 2 +#define SOC_ARCH_EXYNOS4412 3 +#define SOC_ARCH_EXYNOS5250 4 +#define SOC_ARCH_EXYNOS5260 5 +#define SOC_ARCH_EXYNOS5420_TRIMINFO 6 +#define SOC_ARCH_EXYNOS5420 7 +#define SOC_ARCH_EXYNOS5440 8 + +#endif /* _EXYNOS_THERMAL_TMU_DT_H */
Signature · 1 line
2.0.0.rc2
PATCH v2 3/17 thermal: dts: trats: Enable TMU on the Exynos4210 trats device
In reply to Lukasz MajewskiThe thermal IP block (Thermal Management Unit) called TMU has been enabled in this device.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos4210-trats.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/exynos4210-trats.dts +4 -0
@@ -424,6 +424,10 @@ status = "okay"; }; + tmu@100C0000 { + status = "okay"; + }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;
Signature · 1 line
2.0.0.rc2
PATCH v2 4/17 thermal: dts: exynos: Add LD010 regulator node necessary for TMU on Odroid
In reply to Lukasz Majewski---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +7 -0
@@ -205,6 +205,13 @@ regulator-always-on; }; + ldo10_reg: LDO10 { + regulator-name = "VDD18_MIPIHSI_1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + ldo11_reg: LDO11 { regulator-name = "VDD18_ABB1_1.8V"; regulator-min-microvolt = <1800000>;
Signature · 1 line
2.0.0.rc2
PATCH v2 5/17 thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
In reply to Lukasz MajewskiThis commit enables TMU IP block on the Exynos4412 Odroid U3 device.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +5 -0
@@ -370,6 +370,11 @@ ehci: ehci@12580000 { status = "okay"; }; + + tmu@100C0000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; }; &pinctrl_1 {
Signature · 1 line
2.0.0.rc2
PATCH v2 6/17 thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu cooling functionality
In reply to Lukasz MajewskiPresented patch aims to move data necessary for correct CPU cooling device configuration from exynos_tmu_data.c to device tree.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos4210-trats.dts | 15 ++++++++++++ arch/arm/boot/dts/exynos4210.dtsi | 20 ++++++++++++++++ arch/arm/boot/dts/exynos4212.dtsi | 20 ++++++++++++++++ arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 15 ++++++++++++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 ++++++++++++ arch/arm/boot/dts/exynos4412.dtsi | 32 +++++++++++++++++++++++++ arch/arm/boot/dts/exynos5250.dtsi | 20 +++++++++++++++- 7 files changed, 136 insertions(+), 1 deletion(-)
arch/arm/boot/dts/exynos4210-trats.dts +15 -0
@@ -428,6 +428,21 @@ status = "okay"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 2 2>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 4 4>; + }; + }; + }; + }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;
arch/arm/boot/dts/exynos4210.dtsi +20 -0
@@ -41,6 +41,26 @@ #clock-cells = <1>; }; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x900>; + cooling-min-level = <4>; + cooling-max-level = <2>; + #cooling-cells = <2>; /* min followed by max */ + }; + + cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x901>; + }; + }; + sysram@02020000 { compatible = "mmio-sram"; reg = <0x02020000 0x20000>;
arch/arm/boot/dts/exynos4212.dtsi +20 -0
@@ -22,6 +22,26 @@ / { compatible = "samsung,exynos4212", "samsung,exynos4"; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ + }; + + cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA01>; + }; + }; + combiner: interrupt-controller@10440000 { samsung,combiner-nr = <18>; };
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +15 -0
@@ -375,6 +375,21 @@ vtmu-supply = <&ldo10_reg>; status = "okay"; }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; }; &pinctrl_1 {
arch/arm/boot/dts/exynos4412-trats2.dts +15 -0
@@ -786,4 +786,19 @@ pulldown-ohm = <100000>; /* 100K */ io-channels = <&adc 2>; /* Battery temperature */ }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; };
arch/arm/boot/dts/exynos4412.dtsi +32 -0
@@ -22,6 +22,38 @@ / { compatible = "samsung,exynos4412", "samsung,exynos4"; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ + }; + + cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA01>; + }; + + cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA02>; + }; + + cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA03>; + }; + }; + combiner: interrupt-controller@10440000 { samsung,combiner-nr = <20>; };
arch/arm/boot/dts/exynos5250.dtsi +19 -1
@@ -58,11 +58,14 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0>; clock-frequency = <1700000000>; + cooling-min-level = <15>; + cooling-max-level = <9>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@1 { device_type = "cpu";
@@ -241,6 +244,21 @@ clock-names = "tmu_apbif"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 9 9>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 15 15>; + }; + }; + }; + }; + serial@12C00000 { clocks = <&clock CLK_UART0>, <&clock CLK_SCLK_UART0>; clock-names = "uart", "clk_uart_baud0";
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 06/17] thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu cooling functionality
Quoted 2 lines · Lukasz Majewski
Presented patch aims to move data necessary for correct CPU cooling device configuration from
exynos_tmu_data.cto device tree.
I believe the patch title is misleading. Looks like you are changing something at cpu cooling, but in fact, you are changing DTS files. I would suggest you to use a prefix like 'arm: dts: ....'
Quoted 241 lines
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None--- arch/arm/boot/dts/exynos4210-trats.dts | 15 ++++++++++++ arch/arm/boot/dts/exynos4210.dtsi | 20 ++++++++++++++++ arch/arm/boot/dts/exynos4212.dtsi | 20 ++++++++++++++++ arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 15 ++++++++++++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 ++++++++++++ arch/arm/boot/dts/exynos4412.dtsi | 32 +++++++++++++++++++++++++ arch/arm/boot/dts/exynos5250.dtsi | 20 +++++++++++++++- 7 files changed, 136 insertions(+), 1 deletion(-)arch/arm/boot/dts/exynos4210-trats.dts +15
-0@@ -428,6 +428,21 @@ status = "okay"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 2 2>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 4 4>; + }; + }; + }; + }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;arch/arm/boot/dts/exynos4210.dtsi +20
-0@@ -41,6 +41,26 @@ #clock-cells = <1>; }; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x900>; + cooling-min-level = <4>; + cooling-max-level = <2>; + #cooling-cells = <2>; /* min followed by max */ + }; + + cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x901>; + }; + }; + sysram@02020000 { compatible = "mmio-sram"; reg = <0x02020000 0x20000>;arch/arm/boot/dts/exynos4212.dtsi +20
-0@@ -22,6 +22,26 @@ / { compatible = "samsung,exynos4212", "samsung,exynos4"; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ + }; + + cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA01>; + }; + }; + combiner: interrupt-controller@10440000 { samsung,combiner-nr = <18>; };arch/arm/boot/dts/exynos4412-odroid-common.dtsi +15
-0@@ -375,6 +375,21 @@ vtmu-supply = <&ldo10_reg>; status = "okay"; }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; }; &pinctrl_1 {arch/arm/boot/dts/exynos4412-trats2.dts +15
-0@@ -786,4 +786,19 @@ pulldown-ohm = <100000>; /* 100K */ io-channels = <&adc 2>; /* Battery temperature */ }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; };arch/arm/boot/dts/exynos4412.dtsi +32
-0@@ -22,6 +22,38 @@ / { compatible = "samsung,exynos4412", "samsung,exynos4"; + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ + }; + + cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA01>; + }; + + cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA02>; + }; + + cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0xA03>; + }; + }; + combiner: interrupt-controller@10440000 { samsung,combiner-nr = <20>; };arch/arm/boot/dts/exynos5250.dtsi +19
-1@@ -58,11 +58,14 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0>; clock-frequency = <1700000000>; + cooling-min-level = <15>; + cooling-max-level = <9>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@1 { device_type = "cpu";@@ -241,6 +244,21 @@ clock-names = "tmu_apbif"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 9 9>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 15 15>; + }; + }; + }; + }; + serial@12C00000 { clocks = <&clock CLK_UART0>, <&clock CLK_SCLK_UART0>; clock-names = "uart", "clk_uart_baud0";Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 06/17] thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu cooling functionality
Hi Eduardo,
Quoted 6 lines
Quoted 2 lines
Presented patch aims to move data necessary for correct CPU cooling device configuration from
exynos_tmu_data.cto device tree.I believe the patch title is misleading. Looks like you are changing something at cpu cooling, but in fact, you are changing DTS files. I would suggest you to use a prefix like 'arm: dts: ....'
Now this patch name is:
thermal: cpu_cooling: dts: ......
All the code in this patch adds bindings for 'thermal-zone' to map cooling device to proper trip points.
In fact this is solely related to cpu_cooling...
Quoted 1 line
From the above, I think that the already provided convention is more
suitable and "arm: dts: cpu_cooling: thermal" seems a bit awkward for me.
If you don't regard my justification as valid, then I will fix this.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v2 06/17] thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu cooling functionality
Quoted 16 lines · Lukasz Majewski
Hi Eduardo,
Quoted 6 lines
Quoted 2 lines
Presented patch aims to move data necessary for correct CPU cooling device configuration from
exynos_tmu_data.cto device tree.I believe the patch title is misleading. Looks like you are changing something at cpu cooling, but in fact, you are changing DTS files. I would suggest you to use a prefix like 'arm: dts: ....'
Now this patch name is:
thermal:cpu_cooling: dts: ......All the code in this patch adds bindings for 'thermal-zone' to map cooling device to proper trip points.
In fact this is solely related tocpu_cooling...
Quoted 5 lines
From the above, I think that the already provided convention is more suitable and "arm: dts:
cpu_cooling: thermal" seems a bit awkward for me.If you don't regard my justification as valid, then I will fix this.
Still, the naming is confusing. With that prefix you are saying this patch is something generic about cpu cooling and thermal dts. And that is not what this patch is about.
Saying "arm: dts: add cpu cooling bindings for Exynos" is a short and direct subject. Besides, you have the plus to call the attention of the ARM and device tree maintainers. It will be also in my radar.
The original subject also makes me think you are dealing with C code, while the former says already upfront that you are talking about arm dts bindings.
Cheers,
Quoted 7 lines
Signature · 6 lines
-- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Re: [PATCH v2 06/17] thermal: cpu_cooling: dts: Define device tree bindings for Exynos cpu cooling functionality
Hi Eduardo,
Quoted 26 lines · Lukasz Majewski
Quoted 18 lines
Hi Eduardo,
Quoted 8 lines
Quoted 3 lines
Presented patch aims to move data necessary for correct CPU cooling device configuration from
exynos_tmu_data.cto device tree.I believe the patch title is misleading. Looks like you are changing something at cpu cooling, but in fact, you are changing DTS files. I would suggest you to use a prefix like 'arm:
dts: ....'Now this patch name is:
thermal:cpu_cooling: dts: ......All the code in this patch adds bindings for 'thermal-zone' to map cooling device to proper trip points.
In fact this is solely related tocpu_cooling...Quoted 5 lines
From the above, I think that the already provided convention is more suitable and "arm: dts:
cpu_cooling: thermal" seems a bit awkward for me.If you don't regard my justification as valid, then I will fix this.
Quoted 7 lines
Still, the naming is confusing. With that prefix you are saying this patch is something generic about cpu cooling and thermal dts. And that is not what this patch is about.
Saying "arm: dts: add cpu cooling bindings for Exynos" is a short and direct subject. Besides, you have the plus to call the attention of the ARM and device tree maintainers. It will be also in my radar.
Fair enough. Thanks for clarification.
Quoted 14 lines
The original subject also makes me think you are dealing with C code, while the former says already upfront that you are talking about arm dts bindings.
Cheers,
Quoted 7 lines
Signature · 6 lines
-- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 7/17 thermal: cpu_cooling: Modify exynos thermal code to use device tree for cpu cooling configuration
In reply to Lukasz MajewskiUp till now exynos_tmu_data.c was used for storing CPU cooling configuration data. Now the Exynos thermal core code uses device tree to get this data. For this purpose generic thermal code for configuring CPU cooling was used.
---
Changes for v2:
- None
--- drivers/cpufreq/exynos-cpufreq.c | 23 ++++- drivers/thermal/samsung/exynos_thermal_common.c | 122 ++++++++++++++---------- drivers/thermal/samsung/exynos_tmu.c | 7 -- drivers/thermal/samsung/exynos_tmu.h | 5 - drivers/thermal/samsung/exynos_tmu_data.c | 42 +------- 5 files changed, 94 insertions(+), 105 deletions(-)
drivers/cpufreq/exynos-cpufreq.c +21 -2
@@ -18,10 +18,13 @@#include <linux/cpufreq.h> #include <linux/platform_device.h> #include <linux/of.h> +#include <linux/cpu_cooling.h> +#include <linux/cpu.h> #include "exynos-cpufreq.h" static struct exynos_dvfs_info *exynos_info; +static struct thermal_cooling_device *cdev;static struct regulator *arm_regulator;static unsigned int locking_frequency;
@@ -156,6 +159,7 @@ static struct cpufreq_driver exynos_driver = {static int exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *np;int ret = -EINVAL ; exynos_info =kzalloc (sizeof (*exynos_info),GFP_KERNEL );
@@ -198,9 +202,24 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)/* Done here as we want to capture boot frequency */ locking_frequency =clk_get_rate (exynos_info->cpu_clk) /1000 ; -if (!cpufreq_register_driver (&exynos_driver)) -return 0 ; +if (cpufreq_register_driver (&exynos_driver)) + goto err; + np =of_find_node_by_path ("/cpus/cpu@0" ); +if (!np) { +pr_err ("failed to find cpu0 node\n" ); +return -ENOENT ; + } +if (of_find_property (np,"#cooling-cells" ,NULL )) { + cdev =of_cpufreq_cooling_register (np, cpu_present_mask); +if (IS_ERR (cdev)) +pr_err ("running cpufreq without cooling device: %ld\n" , +PTR_ERR (cdev)); + } +of_node_put (np); + +return 0 ; + err:dev_err (&pdev->dev,"failed to register cpufreq driver\n" );regulator_put (arm_regulator); err_vdd_arm:
drivers/thermal/samsung/exynos_thermal_common.c +70 -52
156 lines not on this page · raw message
drivers/thermal/samsung/exynos_tmu.c +0 -7
@@ -916,13 +916,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) sensor_conf->trip_data.trigger_falling = pdata->threshold_falling; - sensor_conf->cooling_data.freq_clip_count = pdata->freq_tab_count; -for (i =0 ; i < pdata->freq_tab_count; i++) { - sensor_conf->cooling_data.freq_data[i].freq_clip_max = - pdata->freq_tab[i].freq_clip_max; - sensor_conf->cooling_data.freq_data[i].temp_level = - pdata->freq_tab[i].temp_level; - } sensor_conf->dev = &pdev->dev;/* Register the sensor with thermal management interface */ ret =exynos_register_thermal (sensor_conf);
drivers/thermal/samsung/exynos_tmu.h +0 -5
@@ -73,9 +73,6 @@* @second_point_trim: temp value of the second point trimming * @default_temp_offset: default temperature offset in case of no trimming * @cal_type: calibration type for temperature -* @freq_clip_table: Table representing frequency reduction percentage. -* @freq_tab_count: Count of the above table as frequency reduction may -* applicable to only some of the trigger levels. * * This structure is required for configuration of exynos_tmu driver. */
@@ -101,8 +98,6 @@ struct exynos_tmu_platform_data {u32 cal_type;u32 cal_mode;u32 type; -struct freq_clip_table freq_tab[4 ]; -unsigned int freq_tab_count; };/**
drivers/thermal/samsung/exynos_tmu_data.c +3 -39
66 lines not on this page · raw message
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 07/17] thermal: cpu_cooling: Modify exynos thermal code to use device tree for cpu cooling configuration
Quoted 4 lines · Lukasz Majewski
Up till now
exynos_tmu_data.cwas used for storing CPU cooling configuration data. Now the Exynos thermal core code uses device tree to get this data. For this purpose generic thermal code for configuring CPU cooling was used.
Title prefix also does not help here, I would use 'thermal: exynos: ....'
Quoted 126 lines
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None--- drivers/cpufreq/exynos-cpufreq.c | 23 ++++- drivers/thermal/samsung/exynos_thermal_common.c | 122 ++++++++++++++---------- drivers/thermal/samsung/exynos_tmu.c | 7 -- drivers/thermal/samsung/exynos_tmu.h | 5 - drivers/thermal/samsung/exynos_tmu_data.c | 42 +------- 5 files changed, 94 insertions(+), 105 deletions(-)drivers/cpufreq/exynos-cpufreq.c +21
-2@@ -18,10 +18,13 @@#include <linux/cpufreq.h> #include <linux/platform_device.h> #include <linux/of.h> +#include <linux/cpu_cooling.h> +#include <linux/cpu.h> #include "exynos-cpufreq.h" static struct exynos_dvfs_info *exynos_info; +static struct thermal_cooling_device *cdev;static struct regulator *arm_regulator;static unsigned int locking_frequency;@@ -156,6 +159,7 @@ static struct cpufreq_driver exynos_driver = {static int exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *np;int ret = -EINVAL ; exynos_info =kzalloc (sizeof (*exynos_info),GFP_KERNEL );@@ -198,9 +202,24 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)/* Done here as we want to capture boot frequency */ locking_frequency =clk_get_rate (exynos_info->cpu_clk) /1000 ; -if (!cpufreq_register_driver (&exynos_driver)) -return 0 ; +if (cpufreq_register_driver (&exynos_driver)) + goto err; + np =of_find_node_by_path ("/cpus/cpu@0" ); +if (!np) { +pr_err ("failed to find cpu0 node\n" ); +return -ENOENT ; + } +if (of_find_property (np,"#cooling-cells" ,NULL )) { + cdev =of_cpufreq_cooling_register (np, cpu_present_mask); +if (IS_ERR (cdev)) +pr_err ("running cpufreq without cooling device: %ld\n" , +PTR_ERR (cdev)); + } +of_node_put (np); + +return 0 ; + err:dev_err (&pdev->dev,"failed to register cpufreq driver\n" );regulator_put (arm_regulator); err_vdd_arm:drivers/thermal/samsung/exynos_thermal_common.c +20
-25@@ -133,47 +133,62 @@ static int exynos_get_crit_temp(struct thermal_zone_device *thermal,static int exynos_bind (struct thermal_zone_device *thermal,struct thermal_cooling_device *cdev) { -int ret =0 , i, tab_size, level; -struct freq_clip_table *tab_ptr, *clip_data;struct exynos_thermal_zone *th_zone = thermal->devdata;struct thermal_sensor_conf *data = th_zone->sensor_conf; +struct device_node *child, *gchild, *np; +struct of_phandle_args cooling_spec; +unsigned long max, state =0 ; +int ret =0 , i =0 ; - tab_ptr = (struct freq_clip_table *)data->cooling_data.freq_data; - tab_size = data->cooling_data.freq_clip_count; - -if (tab_ptr ==NULL || tab_size ==0 ) +/* +* Below code is necessary to skip binding when cpufreq's +* frequency table is not yet initialized. +*/ + cdev->ops->get_max_state (cdev, &state); +if (!state && !th_zone->cool_dev_size) { + th_zone->cool_dev_size =1 ; + th_zone->cool_dev[0 ] = cdev; + th_zone->bind = false;return 0 ; + } -/* find the cooling device registered*/ -for (i =0 ; i < th_zone->cool_dev_size; i++) -if (cdev == th_zone->cool_dev[i]) -break ; + np =of_find_node_by_path ("/thermal-zones/cpu-thermal" ); +if (!np) { +pr_err ("failed to find thmerla-zones/cpu-thermal node\n" ); +return -ENOENT ; + } -/* No matching cooling device */ -if (i == th_zone->cool_dev_size) -return 0 ; + child =of_get_child_by_name (np,"cooling-maps" ); -/* Bind the thermal zone to the cpufreq cooling device */ -for (i =0 ; i < tab_size; i++) { - clip_data = (struct freq_clip_table *)&(tab_ptr[i]); - level =cpufreq_cooling_get_level (0 , clip_data->freq_clip_max); -if (level ==THERMAL_CSTATE_INVALID ) -return 0 ; -switch (GET_ZONE (i)) { -case MONITOR_ZONE : -case WARN_ZONE : -if (thermal_zone_bind_cooling_device (thermal, i, cdev, - level,0 )) { - dev_err(data->dev,
drivers/thermal/samsung/exynos_thermal_common.c static int exynos_get_crit_temp(struct thermal_zone_device *thermal, · line 166
Quoted 10 lines
drivers/thermal/samsung/exynos_thermal_common.c +4
-6- "error unbinding cdev inst=%d\n", i); - ret = -EINVAL ; - } - th_zone->bind = true; -break ; -default : +for_each_child_of_node (child, gchild) { + ret =of_parse_phandle_with_args (gchild,"cooling-device" , +"#cooling-cells" , +0 , &cooling_spec);
hmm.. Why do we need to duplicate the same parsing found at of-thermal? Can you please help me understand the reasoning?
Quoted 211 lines
drivers/thermal/samsung/exynos_thermal_common.c +46
-21+if (ret <0 ) { +pr_err ("missing cooling_device property\n" ); + goto end; + } + +if (cooling_spec.args_count <2 ) { ret = -EINVAL ; + goto end; } + + max = cooling_spec.args[0 ]; +if (thermal_zone_bind_cooling_device (thermal, i, cdev, + max,0 )) { +dev_err (data->dev, +"thermal error unbinding cdev inst=%d\n" , i); + + ret = -EINVAL ; + goto end; + } + i++; } + th_zone->bind = true; +end: +of_node_put (child); +of_node_put (np);return ret; }@@ -182,16 +197,12 @@ static int exynos_bind(struct thermal_zone_device *thermal,static int exynos_unbind (struct thermal_zone_device *thermal,struct thermal_cooling_device *cdev) { -int ret =0 , i, tab_size; +int ret =0 , i;struct exynos_thermal_zone *th_zone = thermal->devdata;struct thermal_sensor_conf *data = th_zone->sensor_conf; +struct device_node *child, *gchild, *np; -if (th_zone->bind == false) -return 0 ; - - tab_size = data->cooling_data.freq_clip_count; - -if (tab_size ==0 ) +if (th_zone->bind == false || !th_zone->cool_dev_size)return 0 ;/* find the cooling device registered*/ @@ -203,23 +214,30 @@ static int exynos_unbind(struct thermal_zone_device *thermal,if (i == th_zone->cool_dev_size)return 0 ; -/* Bind the thermal zone to the cpufreq cooling device */ -for (i =0 ; i < tab_size; i++) { -switch (GET_ZONE (i)) { -case MONITOR_ZONE : -case WARN_ZONE : -if (thermal_zone_unbind_cooling_device (thermal, i, - cdev)) { -dev_err (data->dev, -"error unbinding cdev inst=%d\n" , i); - ret = -EINVAL ; - } - th_zone->bind = false; -break ; -default : + np =of_find_node_by_path ("/thermal-zones/cpu-thermal" ); +if (!np) { +pr_err ("failed to find thmerla-zones/cpu-thermal node\n" ); +return -ENOENT ; + } + + child =of_get_child_by_name (np,"cooling-maps" ); + + i =0 ; +for_each_child_of_node (child, gchild) { +if (thermal_zone_unbind_cooling_device (thermal, i, + cdev)) { +dev_err (data->dev, +"error unbinding cdev inst=%d\n" , i); ret = -EINVAL ; + goto end; } + i++; } + th_zone->bind = false; +end: +of_node_put (child); +of_node_put (np); +return ret; }drivers/thermal/samsung/exynos_tmu.c +0
-7@@ -916,13 +916,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) sensor_conf->trip_data.trigger_falling = pdata->threshold_falling; - sensor_conf->cooling_data.freq_clip_count = pdata->freq_tab_count; -for (i =0 ; i < pdata->freq_tab_count; i++) { - sensor_conf->cooling_data.freq_data[i].freq_clip_max = - pdata->freq_tab[i].freq_clip_max; - sensor_conf->cooling_data.freq_data[i].temp_level = - pdata->freq_tab[i].temp_level; - } sensor_conf->dev = &pdev->dev;/* Register the sensor with thermal management interface */ ret =exynos_register_thermal (sensor_conf);drivers/thermal/samsung/exynos_tmu.h +0
-5@@ -73,9 +73,6 @@* @second_point_trim: temp value of the second point trimming * @default_temp_offset: default temperature offset in case of no trimming * @cal_type: calibration type for temperature -* @freq_clip_table: Table representing frequency reduction percentage. -* @freq_tab_count: Count of the above table as frequency reduction may -* applicable to only some of the trigger levels. * * This structure is required for configuration of exynos_tmu driver. */ @@ -101,8 +98,6 @@ struct exynos_tmu_platform_data {u32 cal_type;u32 cal_mode;u32 type; -struct freq_clip_table freq_tab[4 ]; -unsigned int freq_tab_count; };/** drivers/thermal/samsung/exynos_tmu_data.c +3
-39@@ -47,15 +47,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = { .first_point_trim = 25, .second_point_trim = 85, .default_temp_offset = 50, - .freq_tab[0] = { - .freq_clip_max = 800 * 1000, - .temp_level = 85, - }, - .freq_tab[1] = { - .freq_clip_max = 200 * 1000, - .temp_level = 100, - }, - .freq_tab_count = 2, .type = SOC_ARCH_EXYNOS4210, }, },@@ -87,16 +78,7 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = { .max_efuse_value = 100, \ .first_point_trim = 25, \ .second_point_trim = 85, \ - .default_temp_offset = 50, \ - .freq_tab[0] = { \ - .freq_clip_max = 800 * 1000, \ - .temp_level = 70, \ - }, \ - .freq_tab[1] = { \ - .freq_clip_max = 400 * 1000, \ - .temp_level = 95, \ - }, \ - .freq_tab_count = 2 + .default_temp_offset = 50struct exynos_tmu_init_data const exynos3250_default_tmu_data = { .tmu_data = {@@ -133,16 +115,7 @@ struct exynos_tmu_init_data const exynos3250_default_tmu_data = { .max_efuse_value = 100, \ .first_point_trim = 25, \ .second_point_trim = 85, \ - .default_temp_offset = 50, \ - .freq_tab[0] = { \ - .freq_clip_max = 1400 * 1000, \ - .temp_level = 70, \ - }, \ - .freq_tab[1] = { \ - .freq_clip_max = 400 * 1000, \ - .temp_level = 95, \ - }, \ - .freq_tab_count = 2 + .default_temp_offset = 50struct exynos_tmu_init_data const exynos4412_default_tmu_data = { .tmu_data = {@@ -189,16 +162,7 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = { .max_efuse_value = 100, \ .first_point_trim = 25, \ .second_point_trim = 85, \ - .default_temp_offset = 50, \ - .freq_tab[0] = { \ - .freq_clip_max = 800 * 1000, \ - .temp_level = 85, \ - }, \ - .freq_tab[1] = { \ - .freq_clip_max = 200 * 1000, \ - .temp_level = 103, \ - }, \ - .freq_tab_count = 2, \ + .default_temp_offset = 50,#define EXYNOS5260_TMU_DATA \ __EXYNOS5260_TMU_DATA \Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 07/17] thermal: cpu_cooling: Modify exynos thermal code to use device tree for cpu cooling configuration
Hi Eduardo,
Quoted 8 lines · Lukasz Majewski
Quoted 4 lines
Up till now
exynos_tmu_data.cwas used for storing CPU cooling configuration data. Now the Exynos thermal core code uses device tree to get this data. For this purpose generic thermal code for configuring CPU cooling was used.Title prefix also does not help here, I would use 'thermal:
exynos: ....'
Ok.
Quoted 144 lines
Quoted 144 lines
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None--- drivers/cpufreq/exynos-cpufreq.c | 23 ++++- drivers/thermal/samsung/exynos_thermal_common.c | 122 ++++++++++++++---------- drivers/thermal/samsung/exynos_tmu.c | 7 -- drivers/thermal/samsung/exynos_tmu.h | 5 - drivers/thermal/samsung/exynos_tmu_data.c | 42 +------- 5files changed, 94 insertions(+), 105 deletions(-)
(quoted diff) +0
-0
b/drivers/cpufreq/exynos-cpufreq.cindex 1e0ec57..fdedb8d 100644drivers/cpufreq/exynos-cpufreq.c +4
-0@@ -18,10 +18,13 @@#include <linux/cpufreq.h> #include <linux/platform_device.h> #include <linux/of.h> +#include <linux/cpu_cooling.h> +#include <linux/cpu.h> #include "exynos-cpufreq.h" static struct exynos_dvfs_info *exynos_info; +static struct thermal_cooling_device *cdev;static struct regulator *arm_regulator;static unsigned int locking_frequency;@@ -156,6 +159,7 @@ static struct cpufreq_driver exynos_driver = {static int exynos_cpufreq_probe (struct platform_device *pdev) { +struct device_node *np;int ret = -EINVAL ; exynos_info =kzalloc (sizeof (*exynos_info),GFP_KERNEL );@@ -198,9 +202,24 @@ static int exynos_cpufreq_probe(struct
platform_device*pdev) /* Done here as we want to capture boot frequency */locking_frequency=clk_get_rate(exynos_info->cpu_clk)/ 1000;drivers/cpufreq/exynos-cpufreq.c +9
-2-if (!cpufreq_register_driver (&exynos_driver)) -return 0 ; +if (cpufreq_register_driver (&exynos_driver)) + goto err; + np =of_find_node_by_path ("/cpus/cpu@0" ); +if (!np) { +pr_err ("failed to find cpu0 node\n" ); +return -ENOENT ; + } +if (of_find_property (np,"#cooling-cells" ,NULL )) { + cdev = of_cpufreq_cooling_register(np,
cpu_present_mask);drivers/cpufreq/exynos-cpufreq.c +2
-0+if (IS_ERR (cdev)) + pr_err("running cpufreq without coolingdevice: %ld\n",
drivers/cpufreq/exynos-cpufreq.c +6
-0+ PTR_ERR(cdev)); + } +of_node_put (np); + +return 0 ; + err:dev_err (&pdev->dev,"failed to register cpufreq driver\n" );regulator_put (arm_regulator); err_vdd_arm:(quoted diff) +0
-0
b/drivers/thermal/samsung/exynos_thermal_common.cindex 6dc3815..00aa688 100644 ---a/drivers/thermal/samsung/exynos_thermal_common.c+++b/drivers/thermal/samsung/exynos_thermal_common.c@@ -133,47 +133,62 @@ static int exynos_get_crit_temp(structthermal_zone_device*thermal, static intexynos_bind(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev){drivers/thermal/samsung/exynos_thermal_common.c +4
-3-int ret =0 , i, tab_size, level; -struct freq_clip_table *tab_ptr, *clip_data;struct exynos_thermal_zone *th_zone = thermal->devdata;struct thermal_sensor_conf *data = th_zone->sensor_conf; +struct device_node *child, *gchild, *np; +struct of_phandle_args cooling_spec; +unsigned long max, state =0 ; +int ret =0 , i =0 ; - tab_ptr = (struct freq_clip_table*)data->cooling_data.freq_data;
drivers/thermal/samsung/exynos_thermal_common.c +13
-7- tab_size = data->cooling_data.freq_clip_count; - -if (tab_ptr ==NULL || tab_size ==0 ) +/* +* Below code is necessary to skip binding when cpufreq's +* frequency table is not yet initialized. +*/ + cdev->ops->get_max_state (cdev, &state); +if (!state && !th_zone->cool_dev_size) { + th_zone->cool_dev_size =1 ; + th_zone->cool_dev[0 ] = cdev; + th_zone->bind = false;return 0 ; + } -/* find the cooling device registered*/ -for (i =0 ; i < th_zone->cool_dev_size; i++) -if (cdev == th_zone->cool_dev[i]) -break ; + np =of_find_node_by_path ("/thermal-zones/cpu-thermal" ); +if (!np) { + pr_err("failed to find thmerla-zones/cpu-thermalnode\n");
drivers/thermal/samsung/exynos_thermal_common.c +3
-6+return -ENOENT ; + } -/* No matching cooling device */ -if (i == th_zone->cool_dev_size) -return 0 ; + child =of_get_child_by_name (np,"cooling-maps" ); -/* Bind the thermal zone to the cpufreq cooling device */ -for (i =0 ; i < tab_size; i++) { - clip_data = (struct freq_clip_table*)&(tab_ptr[i]);
(quoted diff) +0
-1- level = cpufreq_cooling_get_level(0,
clip_data->freq_clip_max);drivers/thermal/samsung/exynos_thermal_common.c +0
-6-if (level ==THERMAL_CSTATE_INVALID ) -return 0 ; -switch (GET_ZONE (i)) { -case MONITOR_ZONE : -case WARN_ZONE : - if(thermal_zone_bind_cooling_device(thermal, i, cdev, -
level, 0)) {(quoted diff) +0
-2- dev_err(data->dev, - "error unbinding cdevinst=%d\n", i);
drivers/thermal/samsung/exynos_thermal_common.c +1
-5- ret = -EINVAL ; - } - th_zone->bind = true; -break ; -default : +for_each_child_of_node (child, gchild) {
Quoted 8 lines
drivers/thermal/samsung/exynos_thermal_common.c static int exynos_get_crit_temp(struct thermal_zone_device *thermal, · line 166
Quoted 4 lines
(quoted diff) +1
-0+ ret = of_parse_phandle_with_args(gchild,"cooling-device",
drivers/thermal/samsung/exynos_thermal_common.c +2
-0+"#cooling-cells" , + 0, &cooling_spec);hmm.. Why do we need to duplicate the same parsing found at of-thermal? Can you please help me understand the reasoning?
This hack is to provide thermal functionality between commits.
Please note that this file - exynos_thermal_common.c - is removed in [PATCH 14/17], so this code is not present after applying the whole series.
Quoted 225 lines
Quoted 225 lines
(quoted diff) +2
-0+ if (ret < 0) { + pr_err("missing cooling_deviceproperty\n");
drivers/thermal/samsung/exynos_thermal_common.c +8
-0+ goto end; + } + +if (cooling_spec.args_count <2 ) { ret = -EINVAL ; + goto end; } + + max = cooling_spec.args[0 ]; + if (thermal_zone_bind_cooling_device(thermal, i,cdev,
drivers/thermal/samsung/exynos_thermal_common.c +3
-0+ max, 0)) { + dev_err(data->dev, + "thermal error unbinding cdevinst=%d\n", i); +
drivers/thermal/samsung/exynos_thermal_common.c +8
-0+ ret = -EINVAL ; + goto end; + } + i++; } + th_zone->bind = true; +end: +of_node_put (child); +of_node_put (np);return ret; }@@ -182,16 +197,12 @@ static int exynos_bind(struct
thermal_zone_device*thermal, static intexynos_unbind(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev)
{drivers/thermal/samsung/exynos_thermal_common.c +24
-21-int ret =0 , i, tab_size; +int ret =0 , i;struct exynos_thermal_zone *th_zone = thermal->devdata;struct thermal_sensor_conf *data = th_zone->sensor_conf; +struct device_node *child, *gchild, *np; -if (th_zone->bind == false) -return 0 ; - - tab_size = data->cooling_data.freq_clip_count; - -if (tab_size ==0 ) +if (th_zone->bind == false || !th_zone->cool_dev_size)return 0 ;/* find the cooling device registered*/ @@ -203,23 +214,30 @@ static int exynos_unbind(struct thermal_zone_device *thermal, if (i == th_zone->cool_dev_size)return 0 ; -/* Bind the thermal zone to the cpufreq cooling device */ -for (i =0 ; i < tab_size; i++) { -switch (GET_ZONE (i)) { -case MONITOR_ZONE : -case WARN_ZONE : -if (thermal_zone_unbind_cooling_device (thermal ,i , -cdev )) { -dev_err (data->dev, -"error unbinding cdev inst=%d\n", i); - ret = -EINVAL ; - } - th_zone->bind = false; -break ; -default : + np = of_find_node_by_path("/thermal-zones/cpu-thermal"); +if (!np) { +pr_err ("failed to find thmerla-zones/cpu-thermal node\n"); +return -ENOENT ; + } + + child =of_get_child_by_name (np,"cooling-maps" ); + + i =0 ; +for_each_child_of_node (child, gchild) { +if (thermal_zone_unbind_cooling_device (thermal, i, + cdev)) { +dev_err (data->dev, +"error unbinding cdev inst=%d\n" , i); ret = -EINVAL ; + goto end; } + i++; } + th_zone->bind = false; +end: +of_node_put (child); +of_node_put (np); +return ret; }(quoted diff) +0
-0
b/drivers/thermal/samsung/exynos_tmu.cindex 936d16f..d2d6b53 100644drivers/thermal/samsung/exynos_tmu.c +0
-3@@ -916,13 +916,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) sensor_conf->trip_data.trigger_falling = pdata->threshold_falling; - sensor_conf->cooling_data.freq_clip_count = pdata->freq_tab_count; -for (i =0 ; i < pdata->freq_tab_count; i++) { -sensor_conf->cooling_data.freq_data[i].freq_clip_max = -
pdata->freq_tab[i].freq_clip_max;drivers/thermal/samsung/exynos_tmu.c +0
-2- sensor_conf->cooling_data.freq_data[i].temp_level = -pdata->freq_tab[i].temp_level;
drivers/thermal/samsung/exynos_tmu.c +0
-1- } sensor_conf->dev = &pdev->dev;/* Register the sensor with thermal management interface */ ret =exynos_register_thermal (sensor_conf);(quoted diff) +0
-0
b/drivers/thermal/samsung/exynos_tmu.hindex 03ebdd0..fcdb2fc 100644drivers/thermal/samsung/exynos_tmu.h +0
-0@@ -73,9 +73,6 @@* @second_point_trim: temp value of the second point trimming * @default_temp_offset: default temperature offset in case of no trimming
* @cal_type: calibration type for temperature
- * @freq_clip_table: Table representing frequency reduction percentage.
- * @freq_tab_count: Count of the above table as frequency reduction may
- * applicable to only some of the trigger levels.
*
* This structure is required for configuration ofexynos_tmu
driver. */drivers/thermal/samsung/exynos_tmu.h +0
-2@@ -101,8 +98,6 @@ struct exynos_tmu_platform_data {u32 cal_type;u32 cal_mode;u32 type; -struct freq_clip_table freq_tab[4 ]; -unsigned int freq_tab_count; };/** (quoted diff) +0
-0
b/drivers/thermal/samsung/exynos_tmu_data.cindex b239100..a993f3d 100644 ---a/drivers/thermal/samsung/exynos_tmu_data.c+++b/drivers/thermal/samsung/exynos_tmu_data.cdrivers/thermal/samsung/exynos_tmu_data.c +3
-39@@ -47,15 +47,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = { .first_point_trim = 25, .second_point_trim = 85, .default_temp_offset = 50, - .freq_tab[0] = { - .freq_clip_max = 800 * 1000, - .temp_level =85 , - }, - .freq_tab[1] = { - .freq_clip_max =200 *1000 , - .temp_level = 100, - }, - .freq_tab_count =2 , .type = SOC_ARCH_EXYNOS4210, }, },@@ -87,16 +78,7 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = { .max_efuse_value = 100, \ .first_point_trim = 25, \ .second_point_trim = 85, \ - .default_temp_offset = 50, \ - .freq_tab[0] = { \ - .freq_clip_max = 800 * 1000, \ - .temp_level = 70, \ - }, \ - .freq_tab[1] = { \ - .freq_clip_max = 400 * 1000, \ - .temp_level = 95, \ - }, \ - .freq_tab_count = 2 + .default_temp_offset = 50 struct exynos_tmu_init_data const exynos3250_default_tmu_data = { .tmu_data = {@@ -133,16 +115,7 @@ struct exynos_tmu_init_data const exynos3250_default_tmu_data = { .max_efuse_value = 100, \ .first_point_trim = 25, \ .second_point_trim = 85, \ - .default_temp_offset = 50, \ - .freq_tab[0] = { \ - .freq_clip_max = 1400 * 1000, \ - .temp_level = 70, \ - }, \ - .freq_tab[1] = { \ - .freq_clip_max = 400 * 1000, \ - .temp_level = 95, \ - }, \ - .freq_tab_count = 2 + .default_temp_offset = 50 struct exynos_tmu_init_data const exynos4412_default_tmu_data = { .tmu_data = {@@ -189,16 +162,7 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = { .max_efuse_value = 100, \ .first_point_trim = 25, \ .second_point_trim = 85, \ - .default_temp_offset = 50, \ - .freq_tab[0] = { \ - .freq_clip_max = 800 * 1000, \ - .temp_level = 85, \ - }, \ - .freq_tab[1] = { \ - .freq_clip_max = 200 * 1000, \ - .temp_level = 103, \ - }, \ - .freq_tab_count =2 , \ + .default_temp_offset = 50,#define EXYNOS5260_TMU_DATA \ __EXYNOS5260_TMU_DATA \Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 8/17 thermal: exynos: dts: Add default definition of the TMU sensor parameter
In reply to Lukasz MajewskiExynos 4 and 5 family of SoCs uses almost identical TMU sensor to measure the on chip temperature. For this reason it is possible to group TMU configuration parameters in one dts file.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +24 -0
@@ -0,0 +1,24 @@ +/* + * Device tree sources for Exynos4412 TMU sensor configuration + * + * 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_exynos.h> + +#thermal-sensor-cells = <0>; +gain = <8>; +reference_voltage = <16>; +noise_cancel_mode = <4>; +efuse_value = <55>; +min_efuse_value = <40>; +max_efuse_value = <100>; +first_point_trim = <25>; +second_point_trim = <85>; +default_temp_offset = <50>; +cal_type = <TYPE_ONE_POINT_TRIMMING>;
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 08/17] thermal: exynos: dts: Add default definition of the TMU sensor parameter
Lukasz,
Quoted 33 lines · Lukasz Majewski
Exynos 4 and 5 family of SoCs uses almost identical TMU sensor to measure the on chip temperature. For this reason it is possible to group TMU configuration parameters in one dts file.
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None--- arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsiarch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +14
-0@@ -0,0 +1,24 @@ +/* + * Device tree sources for Exynos4412 TMU sensor configuration + * + * 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_exynos.h> + +#thermal-sensor-cells = <0>;
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi line 24
Quoted 10 lines
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +10
-0+gain = <8>; +reference_voltage = <16>; +noise_cancel_mode = <4>; +efuse_value = <55>; +min_efuse_value = <40>; +max_efuse_value = <100>; +first_point_trim = <25>; +second_point_trim = <85>; +default_temp_offset = <50>; +cal_type = <TYPE_ONE_POINT_TRIMMING>;
Are the above properties specific to exynos? For specific DT entries, they need to be marked with a prefix. Please read the 'Device Specific Data' section of Device tree Documentation [1].
Quoted 3 lines
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 08/17] thermal: exynos: dts: Add default definition of the TMU sensor parameter
Quoted 51 lines · Eduardo Valentin
Lukasz,
Quoted 33 lines · Lukasz Majewski
Exynos 4 and 5 family of SoCs uses almost identical TMU sensor to measure the on chip temperature. For this reason it is possible to group TMU configuration parameters in one dts file.
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None--- arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsiarch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +14
-0@@ -0,0 +1,24 @@ +/* + * Device tree sources for Exynos4412 TMU sensor configuration + * + * 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_exynos.h> + +#thermal-sensor-cells = <0>;arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi line 24
Quoted 10 lines
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +10
-0+gain = <8>; +reference_voltage = <16>; +noise_cancel_mode = <4>; +efuse_value = <55>; +min_efuse_value = <40>; +max_efuse_value = <100>; +first_point_trim = <25>; +second_point_trim = <85>; +default_temp_offset = <50>; +cal_type = <TYPE_ONE_POINT_TRIMMING>;Are the above properties specific to exynos? For specific DT entries, they need to be marked with a prefix. Please read the 'Device Specific Data' section of Device tree Documentation [1].
Quoted 1 line
BTW, you have to update:Documentation/devicetree/bindings/thermal/exynos-thermal.txt
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 08/17] thermal: exynos: dts: Add default definition of the TMU sensor parameter
Hi Eduardo,
Quoted 44 lines · Eduardo Valentin
Quoted 43 lines
Lukasz,
Quoted 40 lines · Lukasz Majewski
Exynos 4 and 5 family of SoCs uses almost identical TMU sensor to measure the on chip temperature. For this reason it is possible to group TMU configuration parameters in one dts file.
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None--- arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsinew file mode 100644 index 0000000..ee6d8bbarch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +6
-0@@ -0,0 +1,24 @@ +/* + * Device tree sources for Exynos4412 TMU sensor configuration + * + * Copyright (c) 2014 Lukasz Majewski <[email protected]> + * + * 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/exynos4412-tmu-sensor-conf.dtsi new file +8
-0+ +#include <dt-bindings/thermal/thermal_exynos.h> + +#thermal-sensor-cells = <0>; +gain = <8>; +reference_voltage = <16>; +noise_cancel_mode = <4>; +efuse_value = <55>;
Quoted 8 lines
Quoted 8 lines
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi line 24
Quoted 6 lines
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi new file +6
-0+min_efuse_value = <40>; +max_efuse_value = <100>; +first_point_trim = <25>; +second_point_trim = <85>; +default_temp_offset = <50>; +cal_type = <TYPE_ONE_POINT_TRIMMING>;Are the above properties specific to exynos?
Yes, they are specific for Exynos.
Quoted 3 lines
Quoted 3 lines
For specific DT
entries, they need to be marked with a prefix. Please read the 'Device Specific Data' section of Device tree Documentation [1].
Ok, I will. Thanks for tip.
Quoted 6 lines
Quoted 2 lines
BTW, you have to update:
Documentation/devicetree/bindings/thermal/exynos-thermal.txt
I've forgotten to update this entry. Will be fixed at v3.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Signature · 2 lines
-- 2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 9/17 thermal: dts: Default trip points definition for Exynos5420 SoCs
In reply to Lukasz MajewskiThis code groups in one place default settings of trip points. It is used in SoCs with multiple instances of TMU sensor.
Separate device tree file prevents from multiple copying of the same data.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 arch/arm/boot/dts/exynos5420-trip-points.dtsi
arch/arm/boot/dts/exynos5420-trip-points.dtsi new file +35 -0
@@ -0,0 +1,35 @@ +/* + * Device tree sources for default Exynos 5420 thermal zone definition + * + * 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. + * + */ + +polling-delay-passive = <0>; +polling-delay = <0>; +trips { + cpu-alert-0 { + temperature = <85000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu-alert-1 { + temperature = <103000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu-alert-2 { + temperature = <110000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu-crit-0 { + temperature = <1200000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "critical"; + }; +};
Signature · 1 line
2.0.0.rc2
PATCH v2 10/17 thermal: exynos: dts: Define default thermal-zones for Exynos4
In reply to Lukasz MajewskiTrip points corresponding to the one defined in the exynos_tmu_data.c for Exynos4 have been included.
This thermal-zones attribute is afterwards reused for Exynos4210, Exynos4412 and Exynos5250.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi
arch/arm/boot/dts/exynos4-cpu-thermal.dtsi new file +52 -0
@@ -0,0 +1,52 @@ +/* + * Device tree sources for Exynos4 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 { + cpu_thermal: cpu-thermal { + thermal-sensors = <&tmu 0>; + polling-delay-passive = <0>; + polling-delay = <0>; + trips { + cpu_alert0: cpu-alert-0 { + temperature = <70000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu_alert1: cpu-alert-1 { + temperature = <95000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu_alert2: cpu-alert-2 { + temperature = <110000>; /* millicelsius */ + hysteresis = <10000>; /* millicelsius */ + type = "active"; + }; + cpu_crit0: cpu-crit-0 { + temperature = <120000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "critical"; + }; + }; + cooling-maps { + map0 { + trip = <&cpu_alert0>; + }; + map1 { + trip = <&cpu_alert1>; + }; + }; + }; + }; +};
Signature · 1 line
2.0.0.rc2
PATCH v2 11/17 thermal: dts: exynos: Trip points and sensor configuration data for Exynos5440
In reply to Lukasz MajewskiThis commit provides information about Exynos5440 device configuration. Previously this information was available in exynos_tmu_data.c file. Now it is available in the device tree.
Such approach allows reusing some common code for thermal.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 +++++++++++++++++++++++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-trip-points.dtsi
arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Device tree sources for Exynos5440 TMU sensor configuration + * + * 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_exynos.h> + +#thermal-sensor-cells = <0>; +gain = <5>; +reference_voltage = <16>; +noise_cancel_mode = <4>; +efuse_value = <0x5d2d>; +min_efuse_value = <16>; +max_efuse_value = <76>; +first_point_trim = <25>; +second_point_trim = <70>; +default_temp_offset = <25>; +cal_type = <TYPE_ONE_POINT_TRIMMING>; +type = <SOC_ARCH_EXYNOS5440>;
arch/arm/boot/dts/exynos5440-trip-points.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Device tree sources for default Exynos5440 thermal zone definition + * + * 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. + * + */ + +polling-delay-passive = <0>; +polling-delay = <0>; +trips { + cpu-alert-0 { + temperature = <100000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "active"; + }; + cpu-crit-0 { + temperature = <1050000>; /* millicelsius */ + hysteresis = <0>; /* millicelsius */ + type = "critical"; + }; +};
Signature · 1 line
2.0.0.rc2
PATCH v2 12/17 thermal: exynos: dts: Provide device tree bindings identical to one in exynos_tmu_data.c
In reply to Lukasz MajewskiPresented device tree bindings provide data already hardcoded in the exynos_tmu_data.c file.
After this commit, it should be possible to reuse common thermal core framework in Exynos SoCs.
---
Changes for v2:
- Add proper TMU entries for exynos3250.dtsi
--- arch/arm/boot/dts/exynos3250.dtsi | 4 ++++ arch/arm/boot/dts/exynos4.dtsi | 5 +++++ arch/arm/boot/dts/exynos4210.dtsi | 23 ++++++++++++++++++++++- arch/arm/boot/dts/exynos4x12.dtsi | 3 +++ arch/arm/boot/dts/exynos5250.dtsi | 7 +++++-- arch/arm/boot/dts/exynos5420.dtsi | 33 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5440.dtsi | 18 ++++++++++++++++++ 7 files changed, 90 insertions(+), 3 deletions(-)
arch/arm/boot/dts/exynos3250.dtsi +4 -0
@@ -18,7 +18,9 @@ */ #include "skeleton.dtsi" +#include "exynos4-cpu-thermal.dtsi" #include <dt-bindings/clock/exynos3250.h> +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos3250";
@@ -188,6 +190,8 @@ interrupts = <0 216 0>; clocks = <&cmu CLK_TMU_APBIF>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS3250>; + #include "exynos4412-tmu-sensor-conf.dtsi" status = "disabled"; };
arch/arm/boot/dts/exynos4.dtsi +5 -0
@@ -21,6 +21,7 @@ #include <dt-bindings/clock/exynos4.h> #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> #include "skeleton.dtsi" / {
@@ -645,4 +646,8 @@ samsung,sysreg = <&sys_reg>; status = "disabled"; }; + + tmu: tmu@100C0000 { + #include "exynos4412-tmu-sensor-conf.dtsi" + }; };
arch/arm/boot/dts/exynos4210.dtsi +22 -1
@@ -21,6 +21,8 @@ #include "exynos4.dtsi" #include "exynos4210-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos4210", "samsung,exynos4";
@@ -146,16 +148,35 @@ reg = <0x03860000 0x1000>; }; - tmu@100C0000 { + tmu: tmu@100C0000 { compatible = "samsung,exynos4210-tmu"; interrupt-parent = <&combiner>; reg = <0x100C0000 0x100>; interrupts = <2 4>; clocks = <&clock CLK_TMU_APBIF>; clock-names = "tmu_apbif"; + gain = <15>; + reference_voltage = <7>; + type = <SOC_ARCH_EXYNOS4210>; status = "disabled"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + trips { + cpu_alert0: cpu-alert-0 { + temperature = <85000>; /* millicelsius */ + }; + cpu_alert1: cpu-alert-1 { + temperature = <100000>; /* millicelsius */ + }; + cpu_alert2: cpu-alert-2 { + temperature = <110000>; /* millicelsius */ + }; + }; + }; + }; + g2d@12800000 { compatible = "samsung,s5pv210-g2d"; reg = <0x12800000 0x1000>;
arch/arm/boot/dts/exynos4x12.dtsi +3 -0
@@ -19,6 +19,8 @@ #include "exynos4.dtsi" #include "exynos4x12-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { aliases {
@@ -279,6 +281,7 @@ reg = <0x100C0000 0x100>; clocks = <&clock 383>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS4412>; status = "disabled"; }; };
arch/arm/boot/dts/exynos5250.dtsi +5 -2
@@ -20,8 +20,9 @@ #include <dt-bindings/clock/exynos5250.h> #include "exynos5.dtsi" #include "exynos5250-pinctrl.dtsi" - +#include "exynos4-cpu-thermal.dtsi" #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos5250", "samsung,exynos5";
@@ -236,12 +237,14 @@ status = "disabled"; }; - tmu@10060000 { + tmu: tmu@10060000 { compatible = "samsung,exynos5250-tmu"; reg = <0x10060000 0x100>; interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS5250>; + #include "exynos4412-tmu-sensor-conf.dtsi" }; thermal-zones {
arch/arm/boot/dts/exynos5420.dtsi +33 -0
@@ -756,6 +756,8 @@ interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu1: tmu@10064000 {
@@ -764,6 +766,8 @@ interrupts = <0 183 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu2: tmu@10068000 {
@@ -772,6 +776,8 @@ interrupts = <0 184 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_cpu3: tmu@1006c000 {
@@ -780,6 +786,8 @@ interrupts = <0 185 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU_GPU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_gpu: tmu@100a0000 {
@@ -788,6 +796,31 @@ interrupts = <0 215 0>; clocks = <&clock CLK_TMU_GPU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; + }; + + 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" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmu_cpu2>; + #include "exynos5420-trip-points.dtsi" + }; + cpu3_thermal: cpu3-thermal { + thermal-sensors = <&tmu_cpu3>; + #include "exynos5420-trip-points.dtsi" + }; + gpu_thermal: gpu-thermal { + thermal-sensors = <&tmu_gpu>; + #include "exynos5420-trip-points.dtsi" + }; }; watchdog: watchdog@101D0000 {
arch/arm/boot/dts/exynos5440.dtsi +18 -0
@@ -219,6 +219,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_1: tmuctrl@16011C {
@@ -227,6 +228,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_2: tmuctrl@160120 {
@@ -235,6 +237,22 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" + }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmuctrl_0>; + #include "exynos5440-trip-points.dtsi" + }; + cpu1_thermal: cpu1-thermal { + thermal-sensors = <&tmuctrl_1>; + #include "exynos5440-trip-points.dtsi" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmuctrl_2>; + #include "exynos5440-trip-points.dtsi" + }; }; sata@210000 {
Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 12/17] thermal: exynos: dts: Provide device tree bindings identical to one in exynos_tmu_data.c
Lukasz
Quoted 34 lines · Lukasz Majewski
Presented device tree bindings provide data already hardcoded in the
exynos_tmu_data.cfile.
After this commit, it should be possible to reuse common thermal core framework in Exynos SoCs.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Add proper TMU entries forexynos3250.dtsi--- arch/arm/boot/dts/exynos3250.dtsi | 4 ++++ arch/arm/boot/dts/exynos4.dtsi | 5 +++++ arch/arm/boot/dts/exynos4210.dtsi | 23 ++++++++++++++++++++++- arch/arm/boot/dts/exynos4x12.dtsi | 3 +++ arch/arm/boot/dts/exynos5250.dtsi | 7 +++++-- arch/arm/boot/dts/exynos5420.dtsi | 33 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/exynos5440.dtsi | 18 ++++++++++++++++++ 7 files changed, 90 insertions(+), 3 deletions(-)arch/arm/boot/dts/exynos3250.dtsi +2
-0@@ -18,7 +18,9 @@ */ #include "skeleton.dtsi" +#include "exynos4-cpu-thermal.dtsi" #include <dt-bindings/clock/exynos3250.h> +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos3250";
arch/arm/boot/dts/exynos3250.dtsi line 193
Quoted 4 lines
arch/arm/boot/dts/exynos3250.dtsi +1
-0@@ -188,6 +190,8 @@ interrupts = <0 216 0>; clocks = <&cmu CLK_TMU_APBIF>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS3250>;
Why do we need a 'type' property here? Can't we reuse compatible?
Quoted 245 lines
arch/arm/boot/dts/exynos3250.dtsi +1
-0+ #include "exynos4412-tmu-sensor-conf.dtsi" status = "disabled"; };arch/arm/boot/dts/exynos4.dtsi +5
-0@@ -21,6 +21,7 @@ #include <dt-bindings/clock/exynos4.h> #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> #include "skeleton.dtsi" / {@@ -645,4 +646,8 @@ samsung,sysreg = <&sys_reg>; status = "disabled"; }; + + tmu: tmu@100C0000 { + #include "exynos4412-tmu-sensor-conf.dtsi" + }; };arch/arm/boot/dts/exynos4210.dtsi +22
-1@@ -21,6 +21,8 @@ #include "exynos4.dtsi" #include "exynos4210-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos4210", "samsung,exynos4";@@ -146,16 +148,35 @@ reg = <0x03860000 0x1000>; }; - tmu@100C0000 { + tmu: tmu@100C0000 { compatible = "samsung,exynos4210-tmu"; interrupt-parent = <&combiner>; reg = <0x100C0000 0x100>; interrupts = <2 4>; clocks = <&clock CLK_TMU_APBIF>; clock-names = "tmu_apbif"; + gain = <15>; + reference_voltage = <7>; + type = <SOC_ARCH_EXYNOS4210>; status = "disabled"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + trips { + cpu_alert0: cpu-alert-0 { + temperature = <85000>; /* millicelsius */ + }; + cpu_alert1: cpu-alert-1 { + temperature = <100000>; /* millicelsius */ + }; + cpu_alert2: cpu-alert-2 { + temperature = <110000>; /* millicelsius */ + }; + }; + }; + }; + g2d@12800000 { compatible = "samsung,s5pv210-g2d"; reg = <0x12800000 0x1000>;arch/arm/boot/dts/exynos4x12.dtsi +3
-0@@ -19,6 +19,8 @@ #include "exynos4.dtsi" #include "exynos4x12-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { aliases {@@ -279,6 +281,7 @@ reg = <0x100C0000 0x100>; clocks = <&clock 383>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS4412>; status = "disabled"; }; };arch/arm/boot/dts/exynos5250.dtsi +5
-2@@ -20,8 +20,9 @@ #include <dt-bindings/clock/exynos5250.h> #include "exynos5.dtsi" #include "exynos5250-pinctrl.dtsi" - +#include "exynos4-cpu-thermal.dtsi" #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos5250", "samsung,exynos5";@@ -236,12 +237,14 @@ status = "disabled"; }; - tmu@10060000 { + tmu: tmu@10060000 { compatible = "samsung,exynos5250-tmu"; reg = <0x10060000 0x100>; interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS5250>; + #include "exynos4412-tmu-sensor-conf.dtsi" }; thermal-zones {arch/arm/boot/dts/exynos5420.dtsi +33
-0@@ -756,6 +756,8 @@ interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu1: tmu@10064000 {@@ -764,6 +766,8 @@ interrupts = <0 183 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu2: tmu@10068000 {@@ -772,6 +776,8 @@ interrupts = <0 184 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_cpu3: tmu@1006c000 {@@ -780,6 +786,8 @@ interrupts = <0 185 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU_GPU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_gpu: tmu@100a0000 {@@ -788,6 +796,31 @@ interrupts = <0 215 0>; clocks = <&clock CLK_TMU_GPU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; + }; + + 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" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmu_cpu2>; + #include "exynos5420-trip-points.dtsi" + }; + cpu3_thermal: cpu3-thermal { + thermal-sensors = <&tmu_cpu3>; + #include "exynos5420-trip-points.dtsi" + }; + gpu_thermal: gpu-thermal { + thermal-sensors = <&tmu_gpu>; + #include "exynos5420-trip-points.dtsi" + }; }; watchdog: watchdog@101D0000 {arch/arm/boot/dts/exynos5440.dtsi +18
-0@@ -219,6 +219,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_1: tmuctrl@16011C {@@ -227,6 +228,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_2: tmuctrl@160120 {@@ -235,6 +237,22 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" + }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmuctrl_0>; + #include "exynos5440-trip-points.dtsi" + }; + cpu1_thermal: cpu1-thermal { + thermal-sensors = <&tmuctrl_1>; + #include "exynos5440-trip-points.dtsi" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmuctrl_2>; + #include "exynos5440-trip-points.dtsi" + }; }; sata@210000 {Signature · 1 line
2.0.0.rc2
Re: [PATCH v2 12/17] thermal: exynos: dts: Provide device tree bindings identical to one in exynos_tmu_data.c
Hi Eduardo,
Quoted 35 lines
Lukasz
Quoted 32 lines · Lukasz Majewski
Presented device tree bindings provide data already hardcoded in the
exynos_tmu_data.cfile.
After this commit, it should be possible to reuse common thermal core framework in Exynos SoCs.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- Add proper TMU entries forexynos3250.dtsi--- arch/arm/boot/dts/exynos3250.dtsi | 4 ++++ arch/arm/boot/dts/exynos4.dtsi | 5 +++++ arch/arm/boot/dts/exynos4210.dtsi | 23 ++++++++++++++++++++++- arch/arm/boot/dts/exynos4x12.dtsi | 3 +++ arch/arm/boot/dts/exynos5250.dtsi | 7 +++++-- arch/arm/boot/dts/exynos5420.dtsi | 33+++++++++++++++++++++++++++++++++
arch/arm/boot/dts/exynos5440.dtsi| 18 ++++++++++++++++++ 7 files changed, 90 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos3250.dtsiindex 693a327..6edfa76 100644arch/arm/boot/dts/exynos3250.dtsi +2
-0@@ -18,7 +18,9 @@ */ #include "skeleton.dtsi" +#include "exynos4-cpu-thermal.dtsi" #include <dt-bindings/clock/exynos3250.h> +#include <dt-bindings/thermal/thermal_exynos.h>
Quoted 9 lines
arch/arm/boot/dts/exynos3250.dtsi line 193
Quoted 7 lines
arch/arm/boot/dts/exynos3250.dtsi +1
-0/ { compatible = "samsung,exynos3250";@@ -188,6 +190,8 @@ interrupts = <0 216 0>; clocks = <&cmu CLK_TMU_APBIF>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS3250>;Why do we need a 'type' property here? Can't we reuse compatible?
It is doable to reuse "compatibles" for this purpose. We can do away with "type" here.
I will do this for v3.
Quoted 249 lines
Quoted 249 lines
arch/arm/boot/dts/exynos3250.dtsi +1
-0+ #include "exynos4412-tmu-sensor-conf.dtsi" status = "disabled"; };(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos4.dtsiindex e0278ec..1735bb3 100644arch/arm/boot/dts/exynos4.dtsi +5
-0@@ -21,6 +21,7 @@ #include <dt-bindings/clock/exynos4.h> #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> #include "skeleton.dtsi" / {@@ -645,4 +646,8 @@ samsung,sysreg = <&sys_reg>; status = "disabled"; }; + + tmu: tmu@100C0000 { + #include "exynos4412-tmu-sensor-conf.dtsi" + }; };(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos4210.dtsiindex 10e8915..1c52681 100644arch/arm/boot/dts/exynos4210.dtsi +11
-1@@ -21,6 +21,8 @@ #include "exynos4.dtsi" #include "exynos4210-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos4210", "samsung,exynos4";@@ -146,16 +148,35 @@ reg = <0x03860000 0x1000>; }; - tmu@100C0000 { + tmu: tmu@100C0000 { compatible = "samsung,exynos4210-tmu"; interrupt-parent = <&combiner>; reg = <0x100C0000 0x100>; interrupts = <2 4>; clocks = <&clock CLK_TMU_APBIF>; clock-names = "tmu_apbif"; + gain = <15>; + reference_voltage = <7>; + type = <SOC_ARCH_EXYNOS4210>; status = "disabled"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + trips { + cpu_alert0: cpu-alert-0 { + temperature = <85000>; /*millicelsius */
arch/arm/boot/dts/exynos4210.dtsi +3
-0+ }; + cpu_alert1: cpu-alert-1 { + temperature = <100000>; /*millicelsius */
arch/arm/boot/dts/exynos4210.dtsi +3
-0+ }; + cpu_alert2: cpu-alert-2 { + temperature = <110000>; /*millicelsius */
arch/arm/boot/dts/exynos4210.dtsi +5
-0+ }; + }; + }; + }; + g2d@12800000 { compatible = "samsung,s5pv210-g2d"; reg = <0x12800000 0x1000>;(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos4x12.dtsiindex 2e9f1f7..ee24d83 100644arch/arm/boot/dts/exynos4x12.dtsi +3
-0@@ -19,6 +19,8 @@ #include "exynos4.dtsi" #include "exynos4x12-pinctrl.dtsi" +#include "exynos4-cpu-thermal.dtsi" +#include <dt-bindings/thermal/thermal_exynos.h> / { aliases {@@ -279,6 +281,7 @@ reg = <0x100C0000 0x100>; clocks = <&clock 383>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS4412>; status = "disabled"; }; };(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5250.dtsiindex a5bbc1a..2167394 100644arch/arm/boot/dts/exynos5250.dtsi +5
-2@@ -20,8 +20,9 @@ #include <dt-bindings/clock/exynos5250.h> #include "exynos5.dtsi" #include "exynos5250-pinctrl.dtsi" - +#include "exynos4-cpu-thermal.dtsi" #include <dt-bindings/clock/exynos-audss-clk.h> +#include <dt-bindings/thermal/thermal_exynos.h> / { compatible = "samsung,exynos5250", "samsung,exynos5";@@ -236,12 +237,14 @@ status = "disabled"; }; - tmu@10060000 { + tmu: tmu@10060000 { compatible = "samsung,exynos5250-tmu"; reg = <0x10060000 0x100>; interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + type = <SOC_ARCH_EXYNOS5250>; + #include "exynos4412-tmu-sensor-conf.dtsi" }; thermal-zones {(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5420.dtsiindex 8617a03..23d488b 100644arch/arm/boot/dts/exynos5420.dtsi +33
-0@@ -756,6 +756,8 @@ interrupts = <0 65 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu1: tmu@10064000 {@@ -764,6 +766,8 @@ interrupts = <0 183 0>; clocks = <&clock CLK_TMU>; clock-names = "tmu_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420>; }; tmu_cpu2: tmu@10068000 {@@ -772,6 +776,8 @@ interrupts = <0 184 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_cpu3: tmu@1006c000 {@@ -780,6 +786,8 @@ interrupts = <0 185 0>; clocks = <&clock CLK_TMU>, <&clock CLK_TMU_GPU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; }; tmu_gpu: tmu@100a0000 {@@ -788,6 +796,31 @@ interrupts = <0 215 0>; clocks = <&clock CLK_TMU_GPU>, <&clock CLK_TMU>; clock-names = "tmu_apbif", "tmu_triminfo_apbif"; + #include "exynos4412-tmu-sensor-conf.dtsi" + type = <SOC_ARCH_EXYNOS5420_TRIMINFO>; + }; + + 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" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmu_cpu2>; + #include "exynos5420-trip-points.dtsi" + }; + cpu3_thermal: cpu3-thermal { + thermal-sensors = <&tmu_cpu3>; + #include "exynos5420-trip-points.dtsi" + }; + gpu_thermal: gpu-thermal { + thermal-sensors = <&tmu_gpu>; + #include "exynos5420-trip-points.dtsi" + }; }; watchdog: watchdog@101D0000 {(quoted diff) +0
-0
b/arch/arm/boot/dts/exynos5440.dtsiindex 8f3373c..59d9416 100644arch/arm/boot/dts/exynos5440.dtsi +18
-0@@ -219,6 +219,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_1: tmuctrl@16011C {@@ -227,6 +228,7 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" }; tmuctrl_2: tmuctrl@160120 {@@ -235,6 +237,22 @@ interrupts = <0 58 0>; clocks = <&clock CLK_B_125>; clock-names = "tmu_apbif"; + #include "exynos5440-tmu-sensor-conf.dtsi" + }; + + thermal-zones { + cpu0_thermal: cpu0-thermal { + thermal-sensors = <&tmuctrl_0>; + #include "exynos5440-trip-points.dtsi" + }; + cpu1_thermal: cpu1-thermal { + thermal-sensors = <&tmuctrl_1>; + #include "exynos5440-trip-points.dtsi" + }; + cpu2_thermal: cpu2-thermal { + thermal-sensors = <&tmuctrl_2>; + #include "exynos5440-trip-points.dtsi" + }; }; sata@210000 {Signature · 1 line
2.0.0.rc2
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 13/17 thermal: samsung: core: Exynos TMU rework to use device tree for configuration
In reply to Lukasz MajewskiThis patch brings support for providing configuration via device tree. Previously this data has been hardcoded in the exynos_tmu_data.c file. Such approach was not scalable and very often required copying the whole data.
---
Changes for v2:
- Adjust exynos_tmu.c code to the newest ti-soc-thermal repository
- Usage of of-thermal.c exported trip points table
--- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_tmu.c | 320 ++++++++++++++++++++++------------- drivers/thermal/samsung/exynos_tmu.h | 51 ------ 3 files changed, 200 insertions(+), 173 deletions(-)
drivers/thermal/samsung/Makefile +0 -2
@@ -3,5 +3,3 @@ # obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o exynos_thermal-y := exynos_tmu.o -exynos_thermal-y += exynos_tmu_data.o -exynos_thermal-$(CONFIG_EXYNOS_THERMAL_CORE) += exynos_thermal_common.o
drivers/thermal/samsung/exynos_tmu.c +200 -120
547 lines not on this page · raw message
drivers/thermal/samsung/exynos_tmu.h +0 -51
79 lines not on this page · raw message
Signature · 1 line
2.0.0.rc2
PATCH v2 14/17 thermal: exynos: Remove exynos_thermal_common.[c|h] files
In reply to Lukasz MajewskiAfter defining all necessary Exynos data in the device tree and heavy reusage of the of-thermal.c those files can be removed.
---
Changes for v2:
- None
--- drivers/thermal/samsung/exynos_thermal_common.c | 445 ------------------------ drivers/thermal/samsung/exynos_thermal_common.h | 106 ------ 2 files changed, 551 deletions(-) delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h
drivers/thermal/samsung/exynos_thermal_common.c deleted +0 -445
@@ -1,445 +0,0 @@ -/* -* exynos_thermal_common.c - Samsung EXYNOS common thermal file -* -* Copyright (C) 2013 Samsung Electronics -* Amit Daniel Kachhap <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ - -#include <linux/cpu_cooling.h> -#include <linux/err.h> -#include <linux/slab.h> -#include <linux/thermal.h> - -#include "exynos_thermal_common.h" - -struct exynos_thermal_zone { -enum thermal_device_mode mode; -struct thermal_zone_device *therm_dev; -struct thermal_cooling_device *cool_dev[MAX_COOLING_DEVICE ]; -unsigned int cool_dev_size; -struct platform_device *exynos4_dev; -struct thermal_sensor_conf *sensor_conf; -bool bind; -}; - -/* Get mode callback functions for thermal zone */ -static int exynos_get_mode (struct thermal_zone_device *thermal, -enum thermal_device_mode *mode) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -if (th_zone) - *mode = th_zone->mode; -return 0 ; -} - -/* Set mode callback functions for thermal zone */ -static int exynos_set_mode (struct thermal_zone_device *thermal, -enum thermal_device_mode mode) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -if (!th_zone) { -dev_err (&thermal->device, -"thermal zone not registered\n" ); -return 0 ; - } - -mutex_lock (&thermal->lock); - -if (mode ==THERMAL_DEVICE_ENABLED && - !th_zone->sensor_conf->trip_data.trigger_falling) - thermal->polling_delay =IDLE_INTERVAL ; -else - thermal->polling_delay =0 ; - -mutex_unlock (&thermal->lock); - - th_zone->mode = mode; -thermal_zone_device_update (thermal); -dev_dbg (th_zone->sensor_conf->dev, -"thermal polling set for duration=%d msec\n" , - thermal->polling_delay); -return 0 ; -} - - -/* Get trip type callback functions for thermal zone */ -static int exynos_get_trip_type (struct thermal_zone_device *thermal,int trip, -enum thermal_trip_type *type) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -int max_trip = th_zone->sensor_conf->trip_data.trip_count; -int trip_type; - -if (trip <0 || trip >= max_trip) -return -EINVAL ; - - trip_type = th_zone->sensor_conf->trip_data.trip_type[trip]; - -if (trip_type ==SW_TRIP ) - *type =THERMAL_TRIP_CRITICAL ; -else if (trip_type ==THROTTLE_ACTIVE ) - *type =THERMAL_TRIP_ACTIVE ; -else if (trip_type ==THROTTLE_PASSIVE ) - *type =THERMAL_TRIP_PASSIVE ; -else -return -EINVAL ; - -return 0 ; -} - -/* Get trip temperature callback functions for thermal zone */ -static int exynos_get_trip_temp (struct thermal_zone_device *thermal,int trip, -unsigned long *temp) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -int max_trip = th_zone->sensor_conf->trip_data.trip_count; - -if (trip <0 || trip >= max_trip) -return -EINVAL ; - - *temp = th_zone->sensor_conf->trip_data.trip_val[trip]; -/* convert the temperature into millicelsius */ - *temp = *temp *MCELSIUS ; - -return 0 ; -} - -/* Get critical temperature callback functions for thermal zone */ -static int exynos_get_crit_temp (struct thermal_zone_device *thermal, -unsigned long *temp) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -int max_trip = th_zone->sensor_conf->trip_data.trip_count; -/* Get the temp of highest trip*/ -return exynos_get_trip_temp (thermal, max_trip -1 , temp); -} - -/* Bind callback functions for thermal zone */ -static int exynos_bind (struct thermal_zone_device *thermal, -struct thermal_cooling_device *cdev) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -struct thermal_sensor_conf *data = th_zone->sensor_conf; -struct device_node *child, *gchild, *np; -struct of_phandle_args cooling_spec; -unsigned long max, state =0 ; -int ret =0 , i =0 ; - -/* -* Below code is necessary to skip binding when cpufreq's -* frequency table is not yet initialized. -*/ - cdev->ops->get_max_state (cdev, &state); -if (!state && !th_zone->cool_dev_size) { - th_zone->cool_dev_size =1 ; - th_zone->cool_dev[0 ] = cdev; - th_zone->bind = false; -return 0 ; - } - - np =of_find_node_by_path ("/thermal-zones/cpu-thermal" ); -if (!np) { -pr_err ("failed to find thmerla-zones/cpu-thermal node\n" ); -return -ENOENT ; - } - - child =of_get_child_by_name (np,"cooling-maps" ); - -for_each_child_of_node (child, gchild) { - ret =of_parse_phandle_with_args (gchild,"cooling-device" , -"#cooling-cells" , -0 , &cooling_spec); -if (ret <0 ) { -pr_err ("missing cooling_device property\n" ); - goto end; - } - -if (cooling_spec.args_count <2 ) { - ret = -EINVAL ; - goto end; - } - - max = cooling_spec.args[0 ]; -if (thermal_zone_bind_cooling_device (thermal, i, cdev, - max,0 )) { -dev_err (data->dev, -"thermal error unbinding cdev inst=%d\n" , i); - - ret = -EINVAL ; - goto end; - } - i++; - } - th_zone->bind = true; -end: -of_node_put (child); -of_node_put (np); - -return ret; -} - -/* Unbind callback functions for thermal zone */ -static int exynos_unbind (struct thermal_zone_device *thermal, -struct thermal_cooling_device *cdev) -{ -int ret =0 , i; -struct exynos_thermal_zone *th_zone = thermal->devdata; -struct thermal_sensor_conf *data = th_zone->sensor_conf; -struct device_node *child, *gchild, *np; - -if (th_zone->bind == false || !th_zone->cool_dev_size) -return 0 ; - -/* find the cooling device registered*/ -for (i =0 ; i < th_zone->cool_dev_size; i++) -if (cdev == th_zone->cool_dev[i]) -break ; - -/* No matching cooling device */ -if (i == th_zone->cool_dev_size) -return 0 ; - - np =of_find_node_by_path ("/thermal-zones/cpu-thermal" ); -if (!np) { -pr_err ("failed to find thmerla-zones/cpu-thermal node\n" ); -return -ENOENT ; - } - - child =of_get_child_by_name (np,"cooling-maps" ); - - i =0 ; -for_each_child_of_node (child, gchild) { -if (thermal_zone_unbind_cooling_device (thermal, i, - cdev)) { -dev_err (data->dev, -"error unbinding cdev inst=%d\n" , i); - ret = -EINVAL ; - goto end; - } - i++; - } - th_zone->bind = false; -end: -of_node_put (child); -of_node_put (np); - -return ret; -} - -/* Get temperature callback functions for thermal zone */ -static int exynos_get_temp (struct thermal_zone_device *thermal, -unsigned long *temp) -{ -struct exynos_thermal_zone *th_zone = thermal->devdata; -void *data; - -if (!th_zone->sensor_conf) { -dev_err (&thermal->device, -"Temperature sensor not initialised\n" ); -return -EINVAL ; - } - data = th_zone->sensor_conf->driver_data; - *temp = th_zone->sensor_conf->read_temperature (data); -/* convert the temperature into millicelsius */ - *temp = *temp *MCELSIUS ; -return 0 ; -} - -/* Get temperature callback functions for thermal zone */ -static int exynos_set_emul_temp (struct thermal_zone_device *thermal, -unsigned long temp) -{ -void *data; -int ret = -EINVAL ; -struct exynos_thermal_zone *th_zone = thermal->devdata; - -if (!th_zone->sensor_conf) { -dev_err (&thermal->device, -"Temperature sensor not initialised\n" ); -return -EINVAL ; - } - data = th_zone->sensor_conf->driver_data; -if (th_zone->sensor_conf->write_emul_temp) - ret = th_zone->sensor_conf->write_emul_temp (data, temp); -return ret; -} - -/* Get the temperature trend */ -static int exynos_get_trend (struct thermal_zone_device *thermal, -int trip,enum thermal_trend *trend) -{ -int ret; -unsigned long trip_temp; - - ret =exynos_get_trip_temp (thermal, trip, &trip_temp); -if (ret <0 ) -return ret; - -if (thermal->temperature >= trip_temp) - *trend =THERMAL_TREND_RAISE_FULL ; -else - *trend =THERMAL_TREND_DROP_FULL ; - -return 0 ; -} -/* Operation callback functions for thermal zone */ -static struct thermal_zone_device_ops exynos_dev_ops = { - .bind = exynos_bind, - .unbind = exynos_unbind, - .get_temp = exynos_get_temp, - .set_emul_temp = exynos_set_emul_temp, - .get_trend = exynos_get_trend, - .get_mode = exynos_get_mode, - .set_mode = exynos_set_mode, - .get_trip_type = exynos_get_trip_type, - .get_trip_temp = exynos_get_trip_temp, - .get_crit_temp = exynos_get_crit_temp, -}; - -/* -* This function may be called from interrupt based temperature sensor -* when threshold is changed. -*/ -void exynos_report_trigger (struct thermal_sensor_conf *conf) -{ -unsigned int i; -char data[10 ]; -char *envp[] = { data,NULL }; -struct exynos_thermal_zone *th_zone; - -if (!conf || !conf->pzone_data) { -pr_err ("Invalid temperature sensor configuration data\n" ); -return ; - } - - th_zone = conf->pzone_data; - -if (th_zone->bind == false) { -for (i =0 ; i < th_zone->cool_dev_size; i++) { -if (!th_zone->cool_dev[i]) -continue ; -exynos_bind (th_zone->therm_dev, - th_zone->cool_dev[i]); - } - } - -thermal_zone_device_update (th_zone->therm_dev); - -mutex_lock (&th_zone->therm_dev->lock); -/* Find the level for which trip happened */ -for (i =0 ; i < th_zone->sensor_conf->trip_data.trip_count; i++) { -if (th_zone->therm_dev->last_temperature < - th_zone->sensor_conf->trip_data.trip_val[i] *MCELSIUS ) -break ; - } - -if (th_zone->mode ==THERMAL_DEVICE_ENABLED && - !th_zone->sensor_conf->trip_data.trigger_falling) { -if (i >0 ) - th_zone->therm_dev->polling_delay =ACTIVE_INTERVAL ; -else - th_zone->therm_dev->polling_delay =IDLE_INTERVAL ; - } - -snprintf (data,sizeof (data),"%u" , i); -kobject_uevent_env (&th_zone->therm_dev->device.kobj,KOBJ_CHANGE , envp); -mutex_unlock (&th_zone->therm_dev->lock); -} - -/* Register with the in-kernel thermal management */ -int exynos_register_thermal (struct thermal_sensor_conf *sensor_conf) -{ -int ret; -struct exynos_thermal_zone *th_zone; - -if (!sensor_conf || !sensor_conf->read_temperature) { -pr_err ("Temperature sensor not initialised\n" ); -return -EINVAL ; - } - - th_zone =devm_kzalloc (sensor_conf->dev, -sizeof (struct exynos_thermal_zone ),GFP_KERNEL ); -if (!th_zone) -return -ENOMEM ; - - th_zone->sensor_conf = sensor_conf; -/* -* TODO: 1) Handle multiple cooling devices in a thermal zone -* 2) Add a flag/name in cooling info to map to specific -* sensor -*/ -if (sensor_conf->cooling_data.freq_clip_count >0 ) { - th_zone->cool_dev[th_zone->cool_dev_size] = -cpufreq_cooling_register (cpu_present_mask); -if (IS_ERR (th_zone->cool_dev[th_zone->cool_dev_size])) { - ret =PTR_ERR (th_zone->cool_dev[th_zone->cool_dev_size]); -if (ret != -EPROBE_DEFER ) -dev_err (sensor_conf->dev, -"Failed to register cpufreq cooling device: %d\n" , - ret); - goto err_unregister; - } - th_zone->cool_dev_size++; - } - - th_zone->therm_dev =thermal_zone_device_register ( - sensor_conf->name, sensor_conf->trip_data.trip_count, -0 , th_zone, &exynos_dev_ops,NULL ,0 , - sensor_conf->trip_data.trigger_falling ?0 : -IDLE_INTERVAL ); - -if (IS_ERR (th_zone->therm_dev)) { -dev_err (sensor_conf->dev, -"Failed to register thermal zone device\n" ); - ret =PTR_ERR (th_zone->therm_dev); - goto err_unregister; - } - th_zone->mode =THERMAL_DEVICE_ENABLED ; - sensor_conf->pzone_data = th_zone; - -dev_info (sensor_conf->dev, -"Exynos: Thermal zone(%s) registered\n" , sensor_conf->name); - -return 0 ; - -err_unregister: -exynos_unregister_thermal (sensor_conf); -return ret; -} - -/* Un-Register with the in-kernel thermal management */ -void exynos_unregister_thermal (struct thermal_sensor_conf *sensor_conf) -{ -int i; -struct exynos_thermal_zone *th_zone; - -if (!sensor_conf || !sensor_conf->pzone_data) { -pr_err ("Invalid temperature sensor configuration data\n" ); -return ; - } - - th_zone = sensor_conf->pzone_data; - -thermal_zone_device_unregister (th_zone->therm_dev); - -for (i =0 ; i < th_zone->cool_dev_size; ++i) -cpufreq_cooling_unregister (th_zone->cool_dev[i]); - -dev_info (sensor_conf->dev, -"Exynos: Kernel Thermal management unregistered\n" ); -}
drivers/thermal/samsung/exynos_thermal_common.h deleted +0 -106
106 lines not on this page · raw message
Signature · 1 line
2.0.0.rc2
PATCH v2 15/17 thermal: exynos: Remove exynos_tmu_data.c file
In reply to Lukasz MajewskiData already present in the exynos_tmu_data.c file has been moved to the appropriate device tree files.
---
Changes for v2:
- None
--- drivers/thermal/samsung/exynos_tmu_data.c | 228 ------------------------------ 1 file changed, 228 deletions(-) delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c
drivers/thermal/samsung/exynos_tmu_data.c deleted +0 -228
@@ -1,228 +0,0 @@ -/* -* exynos_tmu_data.c - Samsung EXYNOS tmu data file -* -* Copyright (C) 2013 Samsung Electronics -* Amit Daniel Kachhap <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ - -#include "exynos_thermal_common.h" -#include "exynos_tmu.h" - -struct exynos_tmu_init_data const exynos4210_default_tmu_data = { - .tmu_data = { - { - .threshold =80 , - .trigger_levels[0 ] =5 , - .trigger_levels[1 ] =20 , - .trigger_levels[2 ] =30 , - .trigger_enable[0 ] = true, - .trigger_enable[1 ] = true, - .trigger_enable[2 ] = true, - .trigger_enable[3 ] = false, - .trigger_type[0 ] =THROTTLE_ACTIVE , - .trigger_type[1 ] =THROTTLE_ACTIVE , - .trigger_type[2 ] =SW_TRIP , - .max_trigger_level =4 , - .non_hw_trigger_levels =3 , - .gain =15 , - .reference_voltage =7 , - .cal_type =TYPE_ONE_POINT_TRIMMING , - .min_efuse_value =40 , - .max_efuse_value =100 , - .first_point_trim =25 , - .second_point_trim =85 , - .default_temp_offset =50 , - .type =SOC_ARCH_EXYNOS4210 , - }, - }, - .tmu_count =1 , -}; - -#define EXYNOS3250_TMU_DATA \ - .threshold_falling = 10, \ - .trigger_levels[0] = 70, \ - .trigger_levels[1] = 95, \ - .trigger_levels[2] = 110, \ - .trigger_levels[3] = 120, \ - .trigger_enable[0] = true, \ - .trigger_enable[1] = true, \ - .trigger_enable[2] = true, \ - .trigger_enable[3] = false, \ - .trigger_type[0] = THROTTLE_ACTIVE, \ - .trigger_type[1] = THROTTLE_ACTIVE, \ - .trigger_type[2] = SW_TRIP, \ - .trigger_type[3] = HW_TRIP, \ - .max_trigger_level = 4, \ - .non_hw_trigger_levels = 3, \ - .gain = 8, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_TWO_POINT_TRIMMING, \ - .efuse_value = 55, \ - .min_efuse_value = 40, \ - .max_efuse_value = 100, \ - .first_point_trim = 25, \ - .second_point_trim = 85, \ - .default_temp_offset = 50 - -struct exynos_tmu_init_data const exynos3250_default_tmu_data = { - .tmu_data = { - { -EXYNOS3250_TMU_DATA , - .type =SOC_ARCH_EXYNOS3250 , - }, - }, - .tmu_count =1 , -}; - -#define EXYNOS4412_TMU_DATA \ - .threshold_falling = 10, \ - .trigger_levels[0] = 70, \ - .trigger_levels[1] = 95, \ - .trigger_levels[2] = 110, \ - .trigger_levels[3] = 120, \ - .trigger_enable[0] = true, \ - .trigger_enable[1] = true, \ - .trigger_enable[2] = true, \ - .trigger_enable[3] = false, \ - .trigger_type[0] = THROTTLE_ACTIVE, \ - .trigger_type[1] = THROTTLE_ACTIVE, \ - .trigger_type[2] = SW_TRIP, \ - .trigger_type[3] = HW_TRIP, \ - .max_trigger_level = 4, \ - .non_hw_trigger_levels = 3, \ - .gain = 8, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_ONE_POINT_TRIMMING, \ - .efuse_value = 55, \ - .min_efuse_value = 40, \ - .max_efuse_value = 100, \ - .first_point_trim = 25, \ - .second_point_trim = 85, \ - .default_temp_offset = 50 - -struct exynos_tmu_init_data const exynos4412_default_tmu_data = { - .tmu_data = { - { -EXYNOS4412_TMU_DATA , - .type =SOC_ARCH_EXYNOS4412 , - }, - }, - .tmu_count =1 , -}; - -struct exynos_tmu_init_data const exynos5250_default_tmu_data = { - .tmu_data = { - { -EXYNOS4412_TMU_DATA , - .type =SOC_ARCH_EXYNOS5250 , - }, - }, - .tmu_count =1 , -}; - -#define __EXYNOS5260_TMU_DATA \ - .threshold_falling = 10, \ - .trigger_levels[0] = 85, \ - .trigger_levels[1] = 103, \ - .trigger_levels[2] = 110, \ - .trigger_levels[3] = 120, \ - .trigger_enable[0] = true, \ - .trigger_enable[1] = true, \ - .trigger_enable[2] = true, \ - .trigger_enable[3] = false, \ - .trigger_type[0] = THROTTLE_ACTIVE, \ - .trigger_type[1] = THROTTLE_ACTIVE, \ - .trigger_type[2] = SW_TRIP, \ - .trigger_type[3] = HW_TRIP, \ - .max_trigger_level = 4, \ - .non_hw_trigger_levels = 3, \ - .gain = 8, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_ONE_POINT_TRIMMING, \ - .efuse_value = 55, \ - .min_efuse_value = 40, \ - .max_efuse_value = 100, \ - .first_point_trim = 25, \ - .second_point_trim = 85, \ - .default_temp_offset = 50, - -#define EXYNOS5260_TMU_DATA \ - __EXYNOS5260_TMU_DATA \ - .type = SOC_ARCH_EXYNOS5260 - -struct exynos_tmu_init_data const exynos5260_default_tmu_data = { - .tmu_data = { - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - {EXYNOS5260_TMU_DATA }, - }, - .tmu_count =5 , -}; - -#define EXYNOS5420_TMU_DATA \ - __EXYNOS5260_TMU_DATA \ - .type = SOC_ARCH_EXYNOS5420 - -#define EXYNOS5420_TMU_DATA_SHARED \ - __EXYNOS5260_TMU_DATA \ - .type = SOC_ARCH_EXYNOS5420_TRIMINFO - -struct exynos_tmu_init_data const exynos5420_default_tmu_data = { - .tmu_data = { - {EXYNOS5420_TMU_DATA }, - {EXYNOS5420_TMU_DATA }, - {EXYNOS5420_TMU_DATA_SHARED }, - {EXYNOS5420_TMU_DATA_SHARED }, - {EXYNOS5420_TMU_DATA_SHARED }, - }, - .tmu_count =5 , -}; - -#define EXYNOS5440_TMU_DATA \ - .trigger_levels[0] = 100, \ - .trigger_levels[4] = 105, \ - .trigger_enable[0] = 1, \ - .trigger_type[0] = SW_TRIP, \ - .trigger_type[4] = HW_TRIP, \ - .max_trigger_level = 5, \ - .non_hw_trigger_levels = 1, \ - .gain = 5, \ - .reference_voltage = 16, \ - .noise_cancel_mode = 4, \ - .cal_type = TYPE_ONE_POINT_TRIMMING, \ - .efuse_value = 0x5b2d, \ - .min_efuse_value = 16, \ - .max_efuse_value = 76, \ - .first_point_trim = 25, \ - .second_point_trim = 70, \ - .default_temp_offset = 25, \ - .type = SOC_ARCH_EXYNOS5440 - -struct exynos_tmu_init_data const exynos5440_default_tmu_data = { - .tmu_data = { - {EXYNOS5440_TMU_DATA } , - {EXYNOS5440_TMU_DATA } , - {EXYNOS5440_TMU_DATA } , - }, - .tmu_count =3 , -};
Signature · 1 line
2.0.0.rc2
PATCH v2 16/17 thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
In reply to Lukasz MajewskiBoth SoCs have the same TMU IP block embedded on them. Necessary differences are specified via device tree.
Therefore there is no need to maintain a separate compatible entry.
---
Changes for v2:
- None
--- arch/arm/boot/dts/exynos5250.dtsi | 2 +- drivers/thermal/samsung/exynos_tmu.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
arch/arm/boot/dts/exynos5250.dtsi +1 -1
@@ -238,7 +238,7 @@ }; tmu: tmu@10060000 { - compatible = "samsung,exynos5250-tmu"; + compatible = "samsung,exynos4412-tmu"; reg = <0x10060000 0x100>; interrupts = <0 65 0>; clocks = <&clock CLK_TMU>;
drivers/thermal/samsung/exynos_tmu.c +0 -3
@@ -768,9 +768,6 @@ static const struct of_device_id exynos_tmu_match[] = { .compatible = "samsung,exynos4412-tmu", }, { - .compatible = "samsung,exynos5250-tmu", - }, - { .compatible = "samsung,exynos5260-tmu", }, {
Signature · 1 line
2.0.0.rc2
PATCH v2 17/17 thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412
In reply to Lukasz MajewskiBoth SoCs have the same TMU IP block embedded on them. Necessary differences are specified via device tree.
Therefore there is no need to maintain a separate compatible entry.
---
Changes for v2:
- Update DTS TMU entry for Exynos3250 to be compatible with Exynos4412
--- arch/arm/boot/dts/exynos3250.dtsi | 2 +- drivers/thermal/samsung/exynos_tmu.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
arch/arm/boot/dts/exynos3250.dtsi +1 -1
@@ -185,7 +185,7 @@ }; tmu: tmu@100C0000 { - compatible = "samsung,exynos3250-tmu"; + compatible = "samsung,exynos4412-tmu"; reg = <0x100C0000 0x100>; interrupts = <0 216 0>; clocks = <&cmu CLK_TMU_APBIF>;
drivers/thermal/samsung/exynos_tmu.c +0 -3
@@ -759,9 +759,6 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id)static const struct of_device_id exynos_tmu_match[] = { { - .compatible ="samsung,exynos3250-tmu" , - }, - { .compatible ="samsung,exynos4210-tmu" , }, {
Signature · 1 line
2.0.0.rc2
Lukasz,
Quoted 100 lines · Lukasz Majewski
1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (
of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
This work should NOT bring any functional changes to Exynos thermal subsystem.
2. Patch-set structure
Then the
cpu_coolingfunctionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
Patch series end with removing exynos5250/exynos3250 TMU compatibles. Both SoCs have thermal management unit (TMU) compatible with the one first introduced at Exynos4412.
3. Dead code removal
Thermal support for some SoCs, previously available in the
exynos_tmu_data.cfile, was removed since, as of (almost) 3.19-rc1, they didn't have TMU bindings.Moreover, support for
cpu_coolingdevices was preserved only on those SoCs which had available and working cpufreq driver.4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone +cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone +cpu_cooling)
- Exynos5250 - Arndale (TMU zone +cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. This work apply on the following tree:
kernel.org: 'linux-soc-thermal/next' - Eduardo Velentin's tree
SHA1:c42c7a44c7a543dcb388c1ee1a798e6ed76ad8cfLukasz Majewski (17):
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Providethermal_exynos.hfile to be included in
device tree files
thermal: dts: trats: Enable TMU on the Exynos4210 trats device
thermal: dts: exynos: Add LD010 regulator node necessary for TMU on
Odroid
thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
thermal:cpu_cooling: dts: Define device tree bindings for Exynos cpu
cooling functionality
thermal:cpu_cooling: Modify exynos thermal code to use device tree
for cpu cooling configuration
thermal: exynos: dts: Add default definition of the TMU sensor
parameter
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data forExynos5440thermal: exynos: dts: Provide device tree bindings identical to one in
exynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Removeexynos_tmu_data.cfile
thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412arch/arm/boot/dts/exynos3250.dtsi | 6 +- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 5 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 43 ++- arch/arm/boot/dts/exynos4212.dtsi | 20 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 + arch/arm/boot/dts/exynos4412.dtsi | 32 ++ arch/arm/boot/dts/exynos4x12.dtsi | 3 + arch/arm/boot/dts/exynos5250.dtsi | 29 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 33 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 23 +-
Quoted 8 lines
drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 427 ---------------------- drivers/thermal/samsung/exynos_thermal_common.h | 106 ------ drivers/thermal/samsung/exynos_tmu.c | 337 ++++++++++------- drivers/thermal/samsung/exynos_tmu.h | 80 +--- drivers/thermal/samsung/exynos_tmu_data.c | 264 ------------- include/dt-bindings/thermal/thermal_exynos.h | 37 ++ 25 files changed, 669 insertions(+), 1018 deletions(-)
Pretty good work moving data out of your driver. Impressed.
I sent out a couple of comments, most are minor. Major part is on duplication of of-thermal parser.
Quoted 5 lines
create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5420-trip-points.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-trip-points.dtsi
good stuff here too. Only concern is regarding 'type' property (possible to reuse compatible) and exynos specific data.
Quoted 8 lines
delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c create mode 100644 include/dt-bindings/thermal/thermal_exynos.hSignature · 1 line
2.0.0.rc2
Apologize for late answer.
Cheers,
Eduardo Valentin.
Quoted 115 lines · On Fri, 2 Jan 2015 14:25:26 -0400 Eduardo Valentin <[email protected]> wrote:
Lukasz,
Quoted 103 lines · Lukasz Majewski
1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (
of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
This work should NOT bring any functional changes to Exynos thermal subsystem.
2. Patch-set structure
Then the
cpu_coolingfunctionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
Patch series end with removing exynos5250/exynos3250 TMU compatibles. Both SoCs have thermal management unit (TMU) compatible with the one first introduced at Exynos4412.
3. Dead code removal
Thermal support for some SoCs, previously available in the
exynos_tmu_data.cfile, was removed since, as of (almost) 3.19-rc1, they didn't have TMU bindings.Moreover, support for
cpu_coolingdevices was preserved only on those SoCs which had available and working cpufreq driver.4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone +cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone +cpu_cooling)
- Exynos5250 - Arndale (TMU zone +cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. This work apply on the following tree:
kernel.org: 'linux-soc-thermal/next' - Eduardo Velentin's tree
SHA1:c42c7a44c7a543dcb388c1ee1a798e6ed76ad8cfLukasz Majewski (17):
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Providethermal_exynos.hfile to be included in
device tree files
thermal: dts: trats: Enable TMU on the Exynos4210 trats device
thermal: dts: exynos: Add LD010 regulator node necessary for TMU
on Odroid
thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
thermal:cpu_cooling: dts: Define device tree bindings for Exynos
cpu cooling functionality
thermal:cpu_cooling: Modify exynos thermal code to use device
tree for cpu cooling configuration
thermal: exynos: dts: Add default definition of the TMU sensor
parameter
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data
for Exynos5440
thermal: exynos: dts: Provide device tree bindings identical to
one inexynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Removeexynos_tmu_data.cfile
thermal: exynos: Make Exynos5250 TMU compatible with Exynos4412
thermal: exynos: Make Exynos3250 TMU compatible with Exynos4412arch/arm/boot/dts/exynos3250.dtsi | 6 +- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 5 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 43 ++- arch/arm/boot/dts/exynos4212.dtsi | 20 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 + arch/arm/boot/dts/exynos4412.dtsi | 32 ++ arch/arm/boot/dts/exynos4x12.dtsi | 3 + arch/arm/boot/dts/exynos5250.dtsi | 29 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 33 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 25 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 23 +- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 427Quoted 7 lines
----------------------
drivers/thermal/samsung/exynos_thermal_common.h| 106 ------drivers/thermal/samsung/exynos_tmu.c| 337
++++++++++-------drivers/thermal/samsung/exynos_tmu.h| 80 +--- drivers/thermal/samsung/exynos_tmu_data.c | 264 ------------- include/dt-bindings/thermal/thermal_exynos.h |37 ++ 25 files changed, 669 insertions(+), 1018 deletions(-)
Quoted 5 lines
Pretty good work moving data out of your driver. Impressed.
I sent out a couple of comments, most are minor. Major part is on duplication of of-thermal parser.
Thanks for your feedback.
Quoted 15 lines
Quoted 6 lines
create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi create mode 100644
arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsicreate mode 100644arch/arm/boot/dts/exynos5420-trip-points.dtsicreate mode 100644arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsicreate mode 100644arch/arm/boot/dts/exynos5440-trip-points.dtsigood stuff here too. Only concern is regarding 'type' property (possible to reuse compatible) and exynos specific data.
Quoted 5 lines
delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c create mode 100644 include/dt-bindings/thermal/thermal_exynos.h
Quoted 5 lines
Quoted 3 lines
Signature · 1 line
2.0.0.rc2Apologize for late answer.
I will be able to address your comments no sooner than next Monday. Moreover I still believe that we will manage to add this code to your -next branch :-)
Quoted 4 lines
Cheers,
Eduardo Valentin.
Best regards,
Lukasz Majewski
Hi,
On Sat, Jan 03, 2015 at 08:53:45PM +0100, Lukasz Majewski wrote:
<cut>
Quoted 7 lines
Quoted 3 lines
Apologize for late answer.
I will be able to address your comments no sooner than next Monday. Moreover I still believe that we will manage to add this code to your -next branch :-)
Good! Take your time.
Cheers,
Eduardo Valentin
Quoted 8 lines
Quoted 5 lines
Cheers,
Eduardo Valentin.
Best regards,
Lukasz Majewski
v3 cover thermal: exynos: Thermal code rework to use device tree
In reply to Lukasz Majewski1. Introduction
Following patches aim to clean up the current implementation of the thermal framework on Exynos devices.
The main goal was to use a generic code for reading thermal configuration (of-thermal.c). Due to that redundant exynos_thermal_common.[h|c] files were removed.
Around 400 lines of code (LOC) were removed directly by this patch, which is around 20% of the Exynos thermal code base.
This work should NOT bring any functional changes to Exynos thermal subsystem.
2. Patch-set structure
Then the cpu_cooling functionality has been preserved to allow cooling devices by reducing operating frequency. Definition of trip points and cpufreq's cooling properties were moved to device tree.
Then the rework of the way in which configuration data is provided to the Exynos thermal subsystem was performed. Now device tree is used for configuration.
3. Dead code removal
Thermal support for some SoCs, previously available in the exynos_tmu_data.c file, was removed since, as of (almost) 3.19-rc3, they didn't have TMU bindings.
Moreover, support for cpu_cooling devices was preserved only on those SoCs which had available and working cpufreq driver.
4. Testing
Test devices:
- Exynos4210 - Trats (TMU zone + cpu_cooling)
- Exynos4412 - Trats2/Odroid U3 (TMU zone + cpu_cooling)
- Exynos5250 - Arndale (TMU zone + cpu_cooling)
- Exynos5420 - Arndale-octa (only TMU zones)
Unfortunately, I don't posses Exynos5440 for testing. Its functionality has been preserved in the code, but not tested on the hardware. I would be grateful for help in testing.
5. This work apply on the following tree:
kernel.org: 'linux-soc-thermal/next' - Eduardo Velentin's tree
SHA1: 1813d80874699145f04af6b05ebab0a6419001fb
Lukasz Majewski (16):
thermal: exynos: cosmetic: Correct comment format
thermal: exynos: Provide thermal_exynos.h file to be included in
device tree files
arm: dts: trats: Enable TMU on the Exynos4210 trats device
arm: dts: odroid: Add LD010 regulator node necessary for TMU on Odroid
thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
arm: dts: Adding CPU cooling binding for Exynos SoCs
thermal: exynos: Modify exynos thermal code to use device tree for cpu
cooling configuration
thermal: exynos: dts: Add default definition of the TMU sensor
parameter
dts: Documentation: Extending documentation entry for exynos-thermal
thermal: dts: Default trip points definition for Exynos5420 SoCs
thermal: exynos: dts: Define default thermal-zones for Exynos4
thermal: dts: exynos: Trip points and sensor configuration data for
Exynos5440
thermal: exynos: dts: Provide device tree bindings identical to the
one in exynos_tmu_data.c
thermal: samsung: core: Exynos TMU rework to use device tree for
configuration
thermal: exynos: Remove exynos_thermal_common.[c|h] files
thermal: exynos: Remove exynos_tmu_data.c file
.../devicetree/bindings/thermal/exynos-thermal.txt | 17 + arch/arm/boot/dts/exynos3250.dtsi | 2 + arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 52 +++ arch/arm/boot/dts/exynos4.dtsi | 4 + arch/arm/boot/dts/exynos4210-trats.dts | 19 + arch/arm/boot/dts/exynos4210.dtsi | 26 +- arch/arm/boot/dts/exynos4212.dtsi | 5 +- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 27 ++ arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 + arch/arm/boot/dts/exynos4412.dtsi | 5 +- arch/arm/boot/dts/exynos4x12.dtsi | 1 + arch/arm/boot/dts/exynos5250.dtsi | 25 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 35 ++ arch/arm/boot/dts/exynos5420.dtsi | 28 ++ arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi | 24 ++ arch/arm/boot/dts/exynos5440-trip-points.dtsi | 25 ++ arch/arm/boot/dts/exynos5440.dtsi | 18 + drivers/cpufreq/exynos-cpufreq.c | 30 +- drivers/thermal/samsung/Makefile | 2 - drivers/thermal/samsung/exynos_thermal_common.c | 427 --------------------- drivers/thermal/samsung/exynos_thermal_common.h | 106 ----- drivers/thermal/samsung/exynos_tmu.c | 354 +++++++++++------ drivers/thermal/samsung/exynos_tmu.h | 68 +--- drivers/thermal/samsung/exynos_tmu_data.c | 264 ------------- include/dt-bindings/thermal/thermal_exynos.h | 28 ++ 26 files changed, 630 insertions(+), 1001 deletions(-) create mode 100644 arch/arm/boot/dts/exynos4-cpu-thermal.dtsi create mode 100644 arch/arm/boot/dts/exynos4412-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5420-trip-points.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-tmu-sensor-conf.dtsi create mode 100644 arch/arm/boot/dts/exynos5440-trip-points.dtsi delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.c delete mode 100644 drivers/thermal/samsung/exynos_thermal_common.h delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.c create mode 100644 include/dt-bindings/thermal/thermal_exynos.h
Signature · 1 line
2.0.0.rc2
PATCH v3 1/16 thermal: exynos: cosmetic: Correct comment format
---
Changes for v2:
- None
Changes for v3:
- None
--- drivers/thermal/samsung/exynos_tmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/samsung/exynos_tmu.c +1 -1
@@ -576,7 +576,7 @@ out:#define exynos5440_tmu_set_emulation NULLstatic int exynos_tmu_set_emulation (void *drv_data,unsigned long temp) {return -EINVAL ; } -#endif /*CONFIG_THERMAL_EMULATION*/ +#endif /* CONFIG_THERMAL_EMULATION */ static int exynos4210_tmu_read (struct exynos_tmu_data *data) {
Signature · 1 line
2.0.0.rc2
PATCH v3 2/16 thermal: exynos: Provide thermal_exynos.h file to be included in device tree files
In reply to Lukasz MajewskiThis patch is a preparatory patch to be able to read Exynos thermal configuration from the device tree.
It turned out that DTC is not able to interpret enums properly and hence it is necessary to #define those values explicitly.
For this reason the ./include/dt-bindings/thermal/thermal_exynos.h file has been introduced.
---
Changes for v2:
- None
Changes for v3:
- Restore 'enum soc_type type' since TMU sensor type will be extracted from device tree compatible
--- drivers/thermal/samsung/exynos_tmu.h | 12 +++--------- include/dt-bindings/thermal/thermal_exynos.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 include/dt-bindings/thermal/thermal_exynos.h
drivers/thermal/samsung/exynos_tmu.h +3 -9
@@ -26,14 +26,6 @@#include "exynos_thermal_common.h" -enum calibration_type { -TYPE_ONE_POINT_TRIMMING , -TYPE_ONE_POINT_TRIMMING_25 , -TYPE_ONE_POINT_TRIMMING_85 , -TYPE_TWO_POINT_TRIMMING , -TYPE_NONE , -}; -enum soc_type {SOC_ARCH_EXYNOS3250 =1 ,SOC_ARCH_EXYNOS4210 ,
@@ -44,6 +36,7 @@ enum soc_type {SOC_ARCH_EXYNOS5420_TRIMINFO , SOC_ARCH_EXYNOS5440, }; +#include <dt-bindings/thermal/thermal_exynos.h> /** * struct exynos_tmu_platform_data
@@ -115,8 +108,9 @@ struct exynos_tmu_platform_data {u8 second_point_trim;u8 default_temp_offset; -enum calibration_type cal_type;enum soc_type type; +u32 cal_type; +u32 cal_mode;struct freq_clip_table freq_tab[4 ];unsigned int freq_tab_count; };
include/dt-bindings/thermal/thermal_exynos.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* thermal_exynos.h - Samsung EXYNOS TMU device tree definitions +* +* Copyright (C) 2014 Samsung Electronics +* 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 as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#ifndef _EXYNOS_THERMAL_TMU_DT_H +#define _EXYNOS_THERMAL_TMU_DT_H + +#define TYPE_ONE_POINT_TRIMMING 0 +#define TYPE_ONE_POINT_TRIMMING_25 1 +#define TYPE_ONE_POINT_TRIMMING_85 2 +#define TYPE_TWO_POINT_TRIMMING 3 +#define TYPE_NONE 4 + +#endif /* _EXYNOS_THERMAL_TMU_DT_H */
Signature · 1 line
2.0.0.rc2
PATCH v3 3/16 arm: dts: trats: Enable TMU on the Exynos4210 trats device
In reply to Lukasz MajewskiThe thermal IP block (Thermal Management Unit) called TMU has been enabled in this device.
---
Changes for v2:
- None
Changes for v3:
- Patch title has been changed from thermal: dts: arm to arm: dts: trats
--- arch/arm/boot/dts/exynos4210-trats.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/exynos4210-trats.dts +4 -0
@@ -424,6 +424,10 @@ status = "okay"; }; + tmu@100C0000 { + status = "okay"; + }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;
Signature · 1 line
2.0.0.rc2
PATCH v3 4/16 arm: dts: odroid: Add LD010 regulator node necessary for TMU on Odroid
In reply to Lukasz Majewski---
Changes for v2:
- None
Changes for v3:
- Patch title has been changed from thermal: dts: exynos to arm: dts: Odroid
--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +7 -0
@@ -231,6 +231,13 @@ regulator-always-on; }; + ldo10_reg: LDO10 { + regulator-name = "VDD18_MIPIHSI_1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + ldo11_reg: LDO11 { regulator-name = "VDD18_ABB1_1.8V"; regulator-min-microvolt = <1800000>;
Signature · 1 line
2.0.0.rc2
PATCH v3 5/16 thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
In reply to Lukasz MajewskiThis commit enables TMU IP block on the Exynos4412 Odroid U3 device.
---
Changes for v2:
- None
Changes for v3:
- None
--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +5 -0
@@ -396,6 +396,11 @@ ehci: ehci@12580000 { status = "okay"; }; + + tmu@100C0000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; }; &pinctrl_1 {
Signature · 1 line
2.0.0.rc2
Re: [PATCH v3 05/16] thermal: dts: Enable TMU at Exynos4412 based Odroid U3 device
Quoted 3 lines · Lukasz Majewski
This commit enables TMU IP block on the Exynos4412 Odroid U3 device.
The comment about the patch subject applies here too. I would use "arm:
dts: ..." instead of "thermal: dts" ...".
Quoted 29 lines
Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None
Changes for v3:
- None--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/boot/dts/exynos4412-odroid-common.dtsi +5
-0@@ -396,6 +396,11 @@ ehci: ehci@12580000 { status = "okay"; }; + + tmu@100C0000 { + vtmu-supply = <&ldo10_reg>; + status = "okay"; + }; }; &pinctrl_1 {Signature · 1 line
2.0.0.rc2
PATCH v3 6/16 arm: dts: Adding CPU cooling binding for Exynos SoCs
In reply to Lukasz MajewskiPresented patch aims to move data necessary for correct CPU cooling device configuration from exynos_tmu_data.c to device tree.
---
Changes for v2:
- None
Changes for v3:
- Adjust CPU's DT nodes to work with newest ti-soc-thermal/next branch
- Patch title has been changed from "thermal: cpu_cooling: dts: ..."
--- arch/arm/boot/dts/exynos4210-trats.dts | 15 +++++++++++++++ arch/arm/boot/dts/exynos4210.dtsi | 5 ++++- arch/arm/boot/dts/exynos4212.dtsi | 5 ++++- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 15 +++++++++++++++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 +++++++++++++++ arch/arm/boot/dts/exynos4412.dtsi | 5 ++++- arch/arm/boot/dts/exynos5250.dtsi | 20 +++++++++++++++++++- 7 files changed, 76 insertions(+), 4 deletions(-)
arch/arm/boot/dts/exynos4210-trats.dts +15 -0
@@ -428,6 +428,21 @@ status = "okay"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 2 2>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 4 4>; + }; + }; + }; + }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;
arch/arm/boot/dts/exynos4210.dtsi +4 -1
@@ -35,10 +35,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu@900 { + cpu0: cpu@900 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0x900>; + cooling-min-level = <4>; + cooling-max-level = <2>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@901 {
arch/arm/boot/dts/exynos4212.dtsi +4 -1
@@ -26,10 +26,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu@A00 { + cpu0: cpu@A00 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@A01 {
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +15 -0
@@ -401,6 +401,21 @@ vtmu-supply = <&ldo10_reg>; status = "okay"; }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; }; &pinctrl_1 {
arch/arm/boot/dts/exynos4412-trats2.dts +15 -0
@@ -863,6 +863,21 @@ pulldown-ohm = <100000>; /* 100K */ io-channels = <&adc 2>; /* Battery temperature */ }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; }; &pinctrl_0 {
arch/arm/boot/dts/exynos4412.dtsi +4 -1
@@ -26,10 +26,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu@A00 { + cpu0: cpu@A00 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@A01 {
arch/arm/boot/dts/exynos5250.dtsi +19 -1
@@ -58,11 +58,14 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0>; clock-frequency = <1700000000>; + cooling-min-level = <15>; + cooling-max-level = <9>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@1 { device_type = "cpu";
@@ -241,6 +244,21 @@ clock-names = "tmu_apbif"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 9 9>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 15 15>; + }; + }; + }; + }; + serial@12C00000 { clocks = <&clock CLK_UART0>, <&clock CLK_SCLK_UART0>; clock-names = "uart", "clk_uart_baud0";
Signature · 1 line
2.0.0.rc2
Re: [PATCH v3 06/16] arm: dts: Adding CPU cooling binding for Exynos SoCs
Quoted 31 lines · Lukasz Majewski
Presented patch aims to move data necessary for correct CPU cooling device configuration from
exynos_tmu_data.cto device tree.Signed-off-by Lukasz Majewski <[email protected]>---
Changes for v2:
- None
Changes for v3:
- Adjust CPU's DT nodes to work with newest ti-soc-thermal/next branch
- Patch title has been changed from "thermal:cpu_cooling: dts: ..."--- arch/arm/boot/dts/exynos4210-trats.dts | 15 +++++++++++++++ arch/arm/boot/dts/exynos4210.dtsi | 5 ++++- arch/arm/boot/dts/exynos4212.dtsi | 5 ++++- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 15 +++++++++++++++ arch/arm/boot/dts/exynos4412-trats2.dts | 15 +++++++++++++++ arch/arm/boot/dts/exynos4412.dtsi | 5 ++++- arch/arm/boot/dts/exynos5250.dtsi | 20 +++++++++++++++++++- 7 files changed, 76 insertions(+), 4 deletions(-)arch/arm/boot/dts/exynos4210-trats.dts +3
-0@@ -428,6 +428,21 @@ status = "okay"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps {
arch/arm/boot/dts/exynos4210-trats.dts line 443
Quoted 10 lines
arch/arm/boot/dts/exynos4210-trats.dts +10
-0+ map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 2 2>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 4 4>; + }; + }; + };
The cpu_thermal zone above is incomplete. It is missing the following mandatory properties (according to Documentation/devicetree/bindings/thermal/thermal.txt):
- polling-delay:
- polling-delay-passive:
- thermal-sensors:
- trips:
Quoted 159 lines
arch/arm/boot/dts/exynos4210-trats.dts +2
-0+ }; + camera { pinctrl-names = "default"; pinctrl-0 = <>;arch/arm/boot/dts/exynos4210.dtsi +4
-1@@ -35,10 +35,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu@900 { + cpu0: cpu@900 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0x900>; + cooling-min-level = <4>; + cooling-max-level = <2>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@901 {arch/arm/boot/dts/exynos4212.dtsi +4
-1@@ -26,10 +26,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu@A00 { + cpu0: cpu@A00 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@A01 {arch/arm/boot/dts/exynos4412-odroid-common.dtsi +15
-0@@ -401,6 +401,21 @@ vtmu-supply = <&ldo10_reg>; status = "okay"; }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; }; &pinctrl_1 {arch/arm/boot/dts/exynos4412-trats2.dts +15
-0@@ -863,6 +863,21 @@ pulldown-ohm = <100000>; /* 100K */ io-channels = <&adc 2>; /* Battery temperature */ }; + + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 7 7>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 13 13>; + }; + }; + }; + }; }; &pinctrl_0 {arch/arm/boot/dts/exynos4412.dtsi +4
-1@@ -26,10 +26,13 @@ #address-cells = <1>; #size-cells = <0>; - cpu@A00 { + cpu0: cpu@A00 { device_type = "cpu"; compatible = "arm,cortex-a9"; reg = <0xA00>; + cooling-min-level = <13>; + cooling-max-level = <7>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@A01 {arch/arm/boot/dts/exynos5250.dtsi +19
-1@@ -58,11 +58,14 @@ #address-cells = <1>; #size-cells = <0>; - cpu@0 { + cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a15"; reg = <0>; clock-frequency = <1700000000>; + cooling-min-level = <15>; + cooling-max-level = <9>; + #cooling-cells = <2>; /* min followed by max */ }; cpu@1 { device_type = "cpu";@@ -241,6 +244,21 @@ clock-names = "tmu_apbif"; }; + thermal-zones { + cpu_thermal: cpu-thermal { + cooling-maps { + map0 { + /* Corresponds to 800MHz at freq_table */ + cooling-device = <&cpu0 9 9>; + }; + map1 { + /* Corresponds to 200MHz at freq_table */ + cooling-device = <&cpu0 15 15>; + }; + }; + }; + }; + serial@12C00000 { clocks = <&clock CLK_UART0>, <&clock CLK_SCLK_UART0>; clock-names = "uart", "clk_uart_baud0";Signature · 1 line
2.0.0.rc2