thermal: add new flag irq-mode for trip point
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): CGME20181107171019eucas1p1fcb1f44e00265434548d901479f2ea94@eucas1p1.samsung.com
v2 cover thermal: add new flag irq-mode for trip point
Hi all,
This patch set adds a new flag and mechanism in thermal trip points in DT. The old implementation in thermal zone in DT sets the same configuration for all internal trip points. It does not work for all HW. There are SoCs which support IRQs for some trip points (i.e. Exynos 4 has 4 trip points with IRQs). For additional one defined inside the thermal zone there is a need of 'polling'. When developer adds polling mode settings inside the thermal zone, all the trip points will be registered for polling, even those supporting IRQs, which does not make sense. Thus, developers create workarounds, which are confusing for some other developers. To workaround, people declare some trip points as 'active' (those with IRQ support). It allows to bypass polling mode in thermal framework applied for all thermal zone's trip points.
Thermal framework defines 4 types of trip points. The 'passive' means passive cooling using DVFS, 'active' is designed for fan and other devices actively changing the outside conditions. Therefore, a workaround mentioned earlier is confusing when someone does not know about the framework limitations.
This patch set tries to solve the issue by adding one flag inside the trip point: 'irq-mode;'. The trip point 'passive' declared in DT with explicit flag 'irq-mode;' will not register itself as polling mode. Thermal framework will skip it during scheduling next read out work. The old global-polling-mode-configuration-inside-thermal-zone is still valid. Patch set does not break existing design for trip points which do not have 'irq-mode' flag - they will use polling.
As an example please check patch #10 for Exynos4 SoC family, where there is 4 HW supported trip points and there is a need of 6. The rest 2 are declared as 'passive' without 'irq-mode;' flag, which means polling mode needed for them.
Patch #1 is a small cleanup in thermal framework.
Change log:
v2
- changed description in cover letter
- change commit messages according to Krzysztof comments
- rebase on top of current mainline (v4.20-rc1)
Regards,
Lukasz Luba
Lukasz Luba (11):
thermal: remove unused function parameter
thermal: add irq-mode configuration for trip point
thermal: add new sysfs file for irq-mode
Doc: thermal: new irq-mode for trip point
Doc: DT: thermal: new irq-mode for trip point
arm64: dts: exynos5433: add support for thermal trip irq-mode
arm64: dts: exynos7: add support for thermal trip irq-mode
arm: dts: exynos4: add support for thermal trip irq-mode
arm: dts: exynos5420: add support for thermal trip irq-mode
arm: dts: exynos5422: add support for thermal trip irq-mode
arm: dts: exynos5410: add support for thermal trip irq-mode
.../devicetree/bindings/thermal/thermal.txt | 7 ++ Documentation/thermal/sysfs-api.txt | 9 ++ arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 10 +- arch/arm/boot/dts/exynos5410-odroidxu.dts | 10 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 10 +- arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi | 40 +++++--- arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi | 105 ++++++++++++++------- .../arm64/boot/dts/exynos/exynos7-trip-points.dtsi | 8 ++ drivers/thermal/of-thermal.c | 17 ++++ drivers/thermal/thermal_core.c | 16 ++-- drivers/thermal/thermal_sysfs.c | 53 ++++++++++- include/linux/thermal.h | 5 + 12 files changed, 226 insertions(+), 64 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/11 thermal: remove unused function parameter
Clean unused parameter from internal framework function.
--- drivers/thermal/thermal_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/thermal/thermal_core.c +2 -4
@@ -315,9 +315,7 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz)mutex_unlock (&tz->lock); } -static void handle_non_critical_trips (struct thermal_zone_device *tz, -int trip, -enum thermal_trip_type trip_type) +static void handle_non_critical_trips (struct thermal_zone_device *tz,int trip) { tz->governor ? tz->governor->throttle (tz, trip) : def_governor->throttle (tz, trip);
@@ -418,7 +416,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)if (type ==THERMAL_TRIP_CRITICAL || type ==THERMAL_TRIP_HOT )handle_critical_trips (tz, trip, type);else -handle_non_critical_trips (tz, trip, type); +handle_non_critical_trips (tz, trip);/* * Alright, we handled this trip successfully. * So, start monitoring again.
Signature · 1 line
2.7.4
PATCH v2 2/11 thermal: add irq-mode configuration for trip point
In reply to Lukasz LubaThis patch adds support irq mode in trip point.
When that flag is set in DT, there is no need for polling in thermal framework. Crossing the trip point will rise an IRQ. The naming convention for tip point 'type' can be confussing and 'passive' (whic is passive cooling) might be interpretted wrongly.
This mechanism prevents from missue and adds explicit setting for hardware which support interrupts for pre-configured temperature threshold.
--- drivers/thermal/of-thermal.c | 17 +++++++++++++++++ drivers/thermal/thermal_core.c | 10 ++++++++-- include/linux/thermal.h | 5 +++++ 3 files changed, 30 insertions(+), 2 deletions(-)
drivers/thermal/of-thermal.c +17 -0
@@ -312,6 +312,20 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip,return 0 ; } +static int +of_thermal_get_trip_irq_mode (struct thermal_zone_device *tz,int trip, +bool *mode) +{ +struct __thermal_zone *data = tz->devdata; + +if (trip >= data->ntrips || trip <0 ) +return -EDOM ; + + *mode = data->trips[trip].irq_mode; + +return 0 ; +} +static int of_thermal_get_trip_temp (struct thermal_zone_device *tz,int trip,int *temp) {
@@ -394,6 +408,7 @@ static struct thermal_zone_device_ops of_thermal_ops = { .set_mode = of_thermal_set_mode, .get_trip_type = of_thermal_get_trip_type, + .get_trip_irq_mode = of_thermal_get_trip_irq_mode, .get_trip_temp = of_thermal_get_trip_temp, .set_trip_temp = of_thermal_set_trip_temp, .get_trip_hyst = of_thermal_get_trip_hyst,
@@ -827,6 +842,8 @@ static int thermal_of_populate_trip(struct device_node *np,return ret; } + trip->irq_mode =of_property_read_bool (np,"irq-mode" ); +/* Required for cooling map matching */ trip->np = np;of_node_get (np);
drivers/thermal/thermal_core.c +8 -2
@@ -406,6 +406,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz,static void handle_thermal_trip (struct thermal_zone_device *tz,int trip) {enum thermal_trip_type type; +bool irq_mode = false;/* Ignore disabled trip points */ if (test_bit (trip, &tz->trips_disabled))
@@ -419,9 +420,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)handle_non_critical_trips (tz, trip);/* * Alright, we handled this trip successfully. -* So, start monitoring again. +* So, start monitoring in polling mode if +* trip is not using irq HW support. */ -monitor_thermal_zone (tz); +if (tz->ops->get_trip_irq_mode) + tz->ops->get_trip_irq_mode (tz, trip, &irq_mode); + +if (!irq_mode) +monitor_thermal_zone (tz); }static void update_temperature (struct thermal_zone_device *tz)
include/linux/thermal.h +5 -0
@@ -103,6 +103,7 @@ struct thermal_zone_device_ops { enum thermal_device_mode);int (*get_trip_type) (struct thermal_zone_device *,int ,enum thermal_trip_type *); +int (*get_trip_irq_mode) (struct thermal_zone_device *,int ,bool *);int (*get_trip_temp) (struct thermal_zone_device *,int ,int *);int (*set_trip_temp) (struct thermal_zone_device *,int ,int );int (*get_trip_hyst) (struct thermal_zone_device *,int ,int *);
@@ -196,6 +197,7 @@ struct thermal_zone_device {struct thermal_attr *trip_temp_attrs;struct thermal_attr *trip_type_attrs;struct thermal_attr *trip_hyst_attrs; +struct thermal_attr *trip_irq_mode_attrs;void *devdata;int trips;unsigned long trips_disabled;/* bitmap for disabled trips */
@@ -364,6 +366,8 @@ struct thermal_zone_of_device_ops {* @temperature: temperature value in miliCelsius * @hysteresis: relative hysteresis in miliCelsius * @type: trip point type +* @irq_mode: to not use polling in framework set support of HW irq (which will +* be triggered when temperature reaches this level). */ struct thermal_trip {
@@ -371,6 +375,7 @@ struct thermal_trip {int temperature;int hysteresis;enum thermal_trip_type type; +bool irq_mode; };/* Function declarations */
Signature · 1 line
2.7.4
Zhang Rui
reviewerRe: [PATCH v2 02/11] thermal: add irq-mode configuration for trip point
Quoted 100 lines · Lukasz Luba
This patch adds support irq mode in trip point.
When that flag is set in DT, there is no need for polling in thermal framework. Crossing the trip point will rise an IRQ. The naming convention for tip point 'type' can be confussing and 'passive' (whic is passive cooling) might be interpretted wrongly.This mechanism prevents from missue and adds explicit setting for hardware which support interrupts for pre-configured temperature threshold.
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Signed-off-by Lukasz Luba <[email protected]>---
drivers/thermal/of-thermal.c | 17 +++++++++++++++++drivers/thermal/thermal_core.c| 10 ++++++++-- include/linux/thermal.h | 5 +++++3 files changed, 30 insertions(+), 2 deletions(-)drivers/thermal/of- renamed from drivers/thermal/of-thermal.c +0
-0
thermal.c
index 4bfdb4a..1a75946a 100644drivers/thermal/of-thermal.c +0
-0@@ -312,6 +312,20 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, return 0; }drivers/thermal/of-thermal.c +2
-0+static int +of_thermal_get_trip_irq_mode(struct thermal_zone_device *tz, inttrip,
drivers/thermal/of-thermal.c +12
-0+ bool *mode) +{ +struct __thermal_zone *data = tz->devdata; + +if (trip >= data->ntrips || trip <0 ) +return -EDOM ; + + *mode = data->trips[trip].irq_mode; + +return 0 ; +} +static int of_thermal_get_trip_temp(struct
thermal_zone_device*tz, int trip,
int *temp)
{drivers/thermal/of-thermal.c +0
-0@@ -394,6 +408,7 @@ static struct thermal_zone_device_ops of_thermal_ops = { .set_mode = of_thermal_set_mode,
.get_trip_type =of_thermal_get_trip_type,drivers/thermal/of-thermal.c +1
-0+ .get_trip_irq_mode = of_thermal_get_trip_irq_mode,.get_trip_temp =
of_thermal_get_trip_temp, .set_trip_temp =of_thermal_set_trip_temp, .get_trip_hyst =of_thermal_get_trip_hyst,drivers/thermal/of-thermal.c +0
-0@@ -827,6 +842,8 @@ static int thermal_of_populate_trip(structdevice_node *np, return ret; }drivers/thermal/of-thermal.c +2
-0+ trip->irq_mode =of_property_read_bool (np,"irq-mode" ); +/* Required for cooling map matching */
trip->np= np;
of_node_get(np);drivers/thermal/thermal_core.c +0
-0@@ -406,6 +406,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz,static void
handle_thermal_trip(struct thermal_zone_device *tz, int trip)
{
enumthermal_trip_typetype;drivers/thermal/thermal_core.c +1
-0+bool irq_mode = false;
/* Ignore disabled trip points */
if (test_bit(trip, &tz->trips_disabled))drivers/thermal/thermal_core.c +7
-2@@ -419,9 +420,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_non_critical_trips(tz, trip); /** Alright, we handled this trip successfully. -* So, start monitoring again. +* So, start monitoring in polling mode if +* trip is not using irq HW support. */ -monitor_thermal_zone (tz); +if (tz->ops->get_trip_irq_mode) + tz->ops->get_trip_irq_mode (tz, trip, &irq_mode); + +if (!irq_mode) +monitor_thermal_zone (tz); }
Quoted 1 line
handle_thermal_trip() is called from thermal_zone_device_update(), and it is invoked for every trip points.
say, you have a passive trip point 1 that supports irq_mode, and another passive trip point 2 that does not support irq_mode, monitor_thermal_zone() is still called in handle_thermal_trip(tz, 2), and the passive timer will be activated anyway, do I miss something?
thanks,
rui
Quoted 44 lines
static void
update_temperature(struct thermal_zone_device *tz)include/linux/thermal.h +1
-0@@ -103,6 +103,7 @@ struct thermal_zone_device_ops { enum thermal_device_mode); int (*get_trip_type) (struct thermal_zone_device *, int, enum thermal_trip_type *); +int (*get_trip_irq_mode) (struct thermal_zone_device *,int ,bool *);int (
*get_trip_temp) (structthermal_zone_device*, int, int *);
int (*set_trip_temp) (structthermal_zone_device*, int, int);
int (*get_trip_hyst) (structthermal_zone_device*, int, int *);include/linux/thermal.h +1
-0@@ -196,6 +197,7 @@ struct thermal_zone_device { struct thermal_attr *trip_temp_attrs; struct thermal_attr *trip_type_attrs; struct thermal_attr *trip_hyst_attrs; +struct thermal_attr *trip_irq_mode_attrs; void *devdata; int trips;unsigned long
trips_disabled; /* bitmap for disabled
trips */include/linux/thermal.h +1
-0@@ -364,6 +366,8 @@ struct thermal_zone_of_device_ops { * @temperature: temperature value in miliCelsius * @hysteresis: relative hysteresis in miliCelsius * @type: trip point type + * @irq_mode: to not use polling in framework set support of HW irq(which will
+ * be triggered when temperature reaches this level).
*/
structthermal_trip{include/linux/thermal.h +1
-0@@ -371,6 +375,7 @@ struct thermal_trip { int temperature; int hysteresis; enum thermal_trip_type type; +bool irq_mode; };
/* Function declarations */
Re: [PATCH v2 02/11] thermal: add irq-mode configuration for trip point
Hi Rui,
Quoted 100 lines · Zhang Rui
Quoted 99 lines · Lukasz Luba
This patch adds support irq mode in trip point.
When that flag is set in DT, there is no need for polling in thermal framework. Crossing the trip point will rise an IRQ. The naming convention for tip point 'type' can be confussing and 'passive' (whic is passive cooling) might be interpretted wrongly.This mechanism prevents from missue and adds explicit setting for hardware which support interrupts for pre-configured temperature threshold.
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Signed-off-by Lukasz Luba <[email protected]>--- drivers/thermal/of-thermal.c | 17 +++++++++++++++++ drivers/thermal/thermal_core.c | 10 ++++++++-- include/linux/thermal.h | 5 +++++ 3 files changed, 30 insertions(+), 2 deletions(-)drivers/thermal/of- renamed from drivers/thermal/of-thermal.c +0
-0
thermal.c
index 4bfdb4a..1a75946a 100644drivers/thermal/of-thermal.c +14
-0@@ -312,6 +312,20 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, return 0; } +static int +of_thermal_get_trip_irq_mode(struct thermal_zone_device *tz, int trip, + bool *mode) +{ + struct __thermal_zone *data = tz->devdata; + +if (trip >= data->ntrips || trip <0 ) +return -EDOM ; + + *mode = data->trips[trip].irq_mode; + +return 0 ; +} + static int of_thermal_get_trip_temp(struct thermal_zone_device *tz,int trip,
int *temp)
{drivers/thermal/of-thermal.c +1
-0@@ -394,6 +408,7 @@ static struct thermal_zone_device_ops of_thermal_ops = { .set_mode = of_thermal_set_mode, .get_trip_type = of_thermal_get_trip_type, + .get_trip_irq_mode = of_thermal_get_trip_irq_mode, .get_trip_temp = of_thermal_get_trip_temp, .set_trip_temp = of_thermal_set_trip_temp,.get_trip_hyst =
of_thermal_get_trip_hyst,drivers/thermal/of-thermal.c +2
-0@@ -827,6 +842,8 @@ static int thermal_of_populate_trip(structdevice_node *np, return ret; } + trip->irq_mode =of_property_read_bool (np,"irq-mode" ); + /* Required for cooling map matching */ trip->np = np;
of_node_get(np);drivers/thermal/thermal_core.c +1
-0@@ -406,6 +406,7 @@ static void handle_critical_trips(structthermal_zone_device *tz, static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) { enum thermal_trip_type type; + bool irq_mode = false;/* Ignore disabled trip points */
if (test_bit(trip, &tz->trips_disabled))drivers/thermal/thermal_core.c +7
-2@@ -419,9 +420,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_non_critical_trips(tz, trip); /** Alright, we handled this trip successfully. -* So, start monitoring again. +* So, start monitoring in polling mode if +* trip is not using irq HW support. */ -monitor_thermal_zone (tz); +if (tz->ops->get_trip_irq_mode) + tz->ops->get_trip_irq_mode (tz, trip, &irq_mode); + +if (!irq_mode) +monitor_thermal_zone (tz);
Quoted 8 lines
drivers/thermal/thermal_core.c static void handle_thermal_trip(struct · line 433
Quoted 2 lines
drivers/thermal/thermal_core.c +0
-0}
handle_thermal_trip()is called fromthermal_zone_device_update(), and it is invoked for every trip points.
say, you have a passive trip point 1 that supportsirq_mode, and another passive trip point 2 that does not supportirq_mode,monitor_thermal_zone()is still called inhandle_thermal_trip(tz, 2), and the passive timer will be activated anyway, do I miss something?
Yes, the passive timer will be activated in your example. It is correct behavior and does not break anything.
case 1: there is 'k' passive trip points which have irq_mode and 1 additional which does not have 'irq_mode', the framework will start polling but skip check for those 'k' trip points.
case 2: all of the passive trip points have irq_mode set, the framework will not register 'scheduled_work' because it will not call 'monitor_thermal_zone()'.
This is the case of most Exynos platforms, but there is one exception which has 'case 1' with 2 trip points not supporting irq_mode.
Regards,
Lukasz
Quoted 50 lines
thanks,
ruiQuoted 44 lines
static void
update_temperature(struct thermal_zone_device *tz)include/linux/thermal.h +1
-0@@ -103,6 +103,7 @@ struct thermal_zone_device_ops { enum thermal_device_mode); int (*get_trip_type) (struct thermal_zone_device *, int, enum thermal_trip_type *); +int (*get_trip_irq_mode) (struct thermal_zone_device *,int ,bool *); int (*get_trip_temp) (struct thermal_zone_device *, int, int *);int (
*set_trip_temp) (structthermal_zone_device*, int,
int);
int (*get_trip_hyst) (structthermal_zone_device*, int, int
*);include/linux/thermal.h +1
-0@@ -196,6 +197,7 @@ struct thermal_zone_device { struct thermal_attr *trip_temp_attrs; struct thermal_attr *trip_type_attrs; struct thermal_attr *trip_hyst_attrs; +struct thermal_attr *trip_irq_mode_attrs; void *devdata; int trips; unsigned long trips_disabled; /* bitmap for disabledtrips */
include/linux/thermal.h +1
-0@@ -364,6 +366,8 @@ struct thermal_zone_of_device_ops { * @temperature: temperature value in miliCelsius * @hysteresis: relative hysteresis in miliCelsius * @type: trip point type + * @irq_mode: to not use polling in framework set support of HW irq(which will
+ * be triggered when temperature reaches this level).
*/struct
thermal_trip{include/linux/thermal.h +1
-0@@ -371,6 +375,7 @@ struct thermal_trip { int temperature; int hysteresis; enum thermal_trip_type type; +bool irq_mode; }; /* Function declarations */
Re: [PATCH v2 02/11] thermal: add irq-mode configuration for trip point
Quoted 106 lines · Lukasz Luba
Hi Rui,
Quoted 95 lines · Zhang Rui
Quoted 94 lines · Lukasz Luba
This patch adds support irq mode in trip point.
When that flag is set in DT, there is no need for polling in thermal framework. Crossing the trip point will rise an IRQ. The naming convention for tip point 'type' can be confussing and 'passive' (whic is passive cooling) might be interpretted wrongly.This mechanism prevents from missue and adds explicit setting for hardware which support interrupts for pre-configured temperature threshold.
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Signed-off-by Lukasz Luba <[email protected]>---
drivers/thermal/of-thermal.c | 17 +++++++++++++++++drivers/thermal/thermal_core.c| 10 ++++++++-- include/linux/thermal.h | 5 +++++3 files changed, 30 insertions(+), 2 deletions(-)drivers/thermal/of- renamed from drivers/thermal/of-thermal.c +0
-0
thermal.c
index 4bfdb4a..1a75946a 100644drivers/thermal/of-thermal.c +14
-0@@ -312,6 +312,20 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, return 0; } +static int +of_thermal_get_trip_irq_mode(struct thermal_zone_device *tz, int trip, + bool *mode) +{ + struct __thermal_zone *data = tz->devdata; + + if (trip >= data->ntrips || trip < 0) + return -EDOM; + + *mode = data->trips[trip].irq_mode; + + return 0; +} + static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip,int *temp)
{drivers/thermal/of-thermal.c +3
-0@@ -394,6 +408,7 @@ static struct thermal_zone_device_ops of_thermal_ops = { .set_mode = of_thermal_set_mode, .get_trip_type = of_thermal_get_trip_type, + .get_trip_irq_mode = of_thermal_get_trip_irq_mode, .get_trip_temp = of_thermal_get_trip_temp, .set_trip_temp = of_thermal_set_trip_temp, .get_trip_hyst = of_thermal_get_trip_hyst,@@ -827,6 +842,8 @@ static int thermal_of_populate_trip(structdevice_node *np, return ret; } + trip->irq_mode = of_property_read_bool(np, "irq-mode"); + /* Required for cooling map matching */ trip->np = np; of_node_get(np);drivers/thermal/thermal_core.c +0
-0@@ -406,6 +406,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz,static void
handle_thermal_trip(struct thermal_zone_device *tz, int trip)
{
enumthermal_trip_typetype;
+ boolirq_mode= false;
/* Ignore disabled trip points */
if (test_bit(trip, &tz->trips_disabled))drivers/thermal/thermal_core.c +6
-2@@ -419,9 +420,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_non_critical_trips(tz, trip); /* * Alright, we handled this trip successfully. - * So, start monitoring again. + * So, start monitoring in polling mode if + * trip is not using irq HW support. */ - monitor_thermal_zone(tz); + if (tz->ops->get_trip_irq_mode) + tz->ops->get_trip_irq_mode(tz, trip, &irq_mode); + + if (!irq_mode)Quoted 8 lines
drivers/thermal/thermal_core.c static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) · line 431
Quoted 2 lines
drivers/thermal/thermal_core.c +1
-0+ monitor_thermal_zone(tz); }
handle_thermal_trip()is called fromthermal_zone_device_update(), and it is invoked for every trip points.
say, you have a passive trip point 1 that supportsirq_mode, and another passive trip point 2 that does not supportirq_mode,monitor_thermal_zone()is still called inhandle_thermal_trip(tz, 2), and the passive timer will be activated anyway, do I miss something?
Quoted 10 lines
Yes, the passive timer will be activated in your example. It is correct behavior and does not break anything.
case 1: there is 'k' passive trip points which haveirq_modeand 1 additional which does not have 'irq_mode', the framework will start polling but skip check for those 'k' trip points.
case 2: all of the passive trip points haveirq_modeset, the framework will not register 'scheduled_work' because it will not call 'monitor_thermal_zone()'.
This is the case of most Exynos platforms, but there is one exception which has 'case 1' with 2 trip points not supportingirq_mode.
Do you suggest to cover the 'case 1'?
It would be possible after adding a new enum THERMAL_FRAMEWORK_POLL, then function:thermal_zone_device_check() will call thermal_zone_device_update(tz, THERMAL_FRAMEWORK_POLL)
and in handle_thermal_trip() implement something like:
--------------8<----------------
static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
{
enum thermal_trip_type type;
bool irq_mode = false;
/* Ignore disabled trip points */
if (test_bit(trip, &tz->trips_disabled))
return;
if (tz->ops->get_trip_irq_mode)
tz->ops->get_trip_irq_mode(tz, trip, &irq_mode)
if (tz->notify_event == THERMAL_FRAMEWORK_POLL && irq_mode)
return;...
if (!irq_mode) monitor_thermal_zone(tz); }
---------->8-----------------------
I could implement it in v3 if you don't see that it add too much of mess and agree for this approach.
Regards,
Lukasz
Quoted 52 lines
Regards,
LukaszQuoted 48 lines
thanks,
ruiQuoted 42 lines
static void
update_temperature(struct thermal_zone_device *tz)include/linux/thermal.h +1
-0@@ -103,6 +103,7 @@ struct thermal_zone_device_ops { enum thermal_device_mode); int (*get_trip_type) (struct thermal_zone_device *, int, enum thermal_trip_type *); + int (*get_trip_irq_mode) (struct thermal_zone_device *, int,bool *);int (
*get_trip_temp) (structthermal_zone_device*, int, int *);
int (*set_trip_temp) (structthermal_zone_device*, int, int);
int (*get_trip_hyst) (structthermal_zone_device*, int, int *);include/linux/thermal.h +1
-0@@ -196,6 +197,7 @@ struct thermal_zone_device { struct thermal_attr *trip_temp_attrs; struct thermal_attr *trip_type_attrs; struct thermal_attr *trip_hyst_attrs; + struct thermal_attr *trip_irq_mode_attrs; void *devdata; int trips;unsigned long trips_disabled; /* bitmap for disabled trips */
include/linux/thermal.h +1
-0@@ -364,6 +366,8 @@ struct thermal_zone_of_device_ops { * @temperature: temperature value in miliCelsius * @hysteresis: relative hysteresis in miliCelsius * @type: trip point type + * @irq_mode: to not use polling in framework set support of HW irq(which will
+ * be triggered when temperature reaches this level). */
structthermal_trip{include/linux/thermal.h +1
-0@@ -371,6 +375,7 @@ struct thermal_trip { int temperature; int hysteresis; enum thermal_trip_type type; + bool irq_mode; }; /* Function declarations */
Zhang Rui
reviewerRe: [PATCH v2 02/11] thermal: add irq-mode configuration for trip point
Hi, Lukasz,
Quoted 110 lines · Lukasz Luba
Quoted 108 lines · Lukasz Luba
Hi Rui,
Quoted 104 lines · Zhang Rui
Quoted 91 lines · Lukasz Luba
This patch adds support irq mode in trip point.
When that flag is set in DT, there is no need for polling in thermal framework. Crossing the trip point will rise an IRQ. The naming convention for tip point 'type' can be confussing and 'passive' (whic is passive cooling) might be interpretted wrongly.This mechanism prevents from missue and adds explicit setting for hardware which support interrupts for pre-configured temperature
threshold.Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Signed-off-by Lukasz Luba <[email protected]>---
drivers/thermal/of-thermal.c | 17 +++++++++++++++++drivers/thermal/thermal_core.c| 10 ++++++++-- include/linux/thermal.h | 5 +++++3 files changed, 30 insertions(+), 2 deletions(-)drivers/thermal/of- renamed from drivers/thermal/of-thermal.c +0
-0
thermal.c
index 4bfdb4a..1a75946a 100644drivers/thermal/of-thermal.c +2
-0@@ -312,6 +312,20 @@ static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, return 0; } +static int +of_thermal_get_trip_irq_mode(struct thermal_zone_device *tz,int
trip,
+ bool *mode)drivers/thermal/of-thermal.c +11
-0+{ + struct __thermal_zone *data = tz->devdata; + + if (trip >= data->ntrips || trip < 0) + return -EDOM; + + *mode = data->trips[trip].irq_mode; + + return 0; +} +static int of_thermal_get_trip_temp(struct
thermal_zone_device*tz,
int trip,
int *temp)
{drivers/thermal/of-thermal.c +3
-0@@ -394,6 +408,7 @@ static struct thermal_zone_device_ops of_thermal_ops = { .set_mode = of_thermal_set_mode, .get_trip_type = of_thermal_get_trip_type, + .get_trip_irq_mode = of_thermal_get_trip_irq_mode, .get_trip_temp = of_thermal_get_trip_temp, .set_trip_temp = of_thermal_set_trip_temp, .get_trip_hyst = of_thermal_get_trip_hyst,@@ -827,6 +842,8 @@ static int thermal_of_populate_trip(structdevice_node *np, return ret; } + trip->irq_mode = of_property_read_bool(np, "irq-mode"); + /* Required for cooling map matching */ trip->np = np; of_node_get(np);drivers/thermal/thermal_core.c +0
-0@@ -406,6 +406,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz,static void handle_thermal_trip(struct
thermal_zone_device*tz, int
trip)
{
enumthermal_trip_typetype;
+ boolirq_mode= false;
/* Ignore disabled trip points */
if (test_bit(trip, &tz->trips_disabled))drivers/thermal/thermal_core.c +0
-1@@ -419,9 +420,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_non_critical_trips(tz, trip); /** Alright, we handled this trip successfully. -* So, start monitoring again. drivers/thermal/thermal_core.c static void handle_thermal_trip(struct · line 432
Quoted 10 lines
drivers/thermal/thermal_core.c +7
-1+* So, start monitoring in polling mode if +* trip is not using irq HW support. */ - monitor_thermal_zone(tz); + if (tz->ops->get_trip_irq_mode) + tz->ops->get_trip_irq_mode(tz, trip, &irq_mode); + + if (!irq_mode) + monitor_thermal_zone(tz); }
handle_thermal_trip()is called from
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
thermal_zone_device_update(), and
it is invoked for every trip points.
say, you have a passive trip point 1 that supportsirq_mode, and another passive trip point 2 that does not supportirq_mode,monitor_thermal_zone()is still called inhandle_thermal_trip(tz, 2),
and the passive timer will be activated anyway, do I miss something?
sorry that I missed this thread.
Quoted 13 lines
Quoted 5 lines
Yes, the passive timer will be activated in your example. It is correct
behavior and does not break anything.
case 1: there is 'k' passive trip points which haveirq_modeand 1 additional which does not have 'irq_mode', the framework will startQuoted 8 lines
polling but skip check for those 'k' trip points. case 2: all of the passive trip points have
irq_modeset, the framework
will not register 'scheduled_work' because it will not call 'monitor_thermal_zone()'.
This is the case of most Exynos platforms, but there is one exception
which has 'case 1' with 2 trip points not supportingirq_mode.
Quoted 1 line
Do you suggest to cover the 'case 1'?
So this solution does not cover case 1.
And for case 2, why not set passive_delay to 0? are they sharing the same DT file?
Quoted 2 lines
It would be possible after adding a new enum
THERMAL_FRAMEWORK_POLL, then function:
hmmm, I think we can
1. use tz->passive to count the passive trip points that need passive polling.
2. count tz->passive properly in the governors
3. always do passive polling when tz->passive > 0.
This will cover both cases, right?
some sample code to handle this in step_wise governor attached below,
what do you think?
thanks,
rui
drivers/thermal/step_wise.c +0 -0
@@ -121,8 +121,15 @@ static void update_passive_instance(struct
thermal_zone_device *tz,
* If value is +1, activate a passive instance.
* If value is -1, deactivate a passive instance.
*/
- if (type == THERMAL_TRIP_PASSIVE || type == THERMAL_TRIPS_NONE) - tz->passive += value;
+ if (type != THERMAL_TRIP_PASSIVE && type != THERMAL_TRIPS_NONE) + return;
+ if (tz->ops->get_trip_irq_mode) {
+ if (tz->ops->get_trip_irq_mode(tz, trip, &irq_mode)) + return;
+ if (irq_mode)
+ return;
+ }
+ tz->passive += value;
}
Quoted 93 lines
thermal_zone_device_check()will callthermal_zone_device_update(tz, THERMAL_FRAMEWORK_POLL)and inhandle_thermal_trip()implement something like:
--------------8<----------------
static voidhandle_thermal_trip(struct thermal_zone_device *tz, int trip){ enum thermal_trip_type type; bool irq_mode = false; /* Ignore disabled trip points */ if (test_bit(trip, &tz->trips_disabled)) return; if (tz->ops->get_trip_irq_mode) tz->ops->get_trip_irq_mode(tz, trip, &irq_mode) if (tz->notify_event == THERMAL_FRAMEWORK_POLL && irq_mode) return;...
if (!irq_mode) monitor_thermal_zone(tz); }---------->8-----------------------
I could implement it in v3 if you don't see that it add too much of mess
and agree for this approach.Regards,
LukaszQuoted 59 lines
Regards,
LukaszQuoted 54 lines
thanks,
ruiQuoted 48 lines
static void
update_temperature(struct thermal_zone_device *tz)include/linux/thermal.h +1
-0@@ -103,6 +103,7 @@ struct thermal_zone_device_ops { enum thermal_device_mode); int (*get_trip_type) (struct thermal_zone_device *, int, enum thermal_trip_type *); + int (*get_trip_irq_mode) (struct thermal_zone_device *,int ,bool *); int (*get_trip_temp) (struct thermal_zone_device *, int,int
*);
int (*set_trip_temp) (structthermal_zone_device*, int, int);
int (*get_trip_hyst) (structthermal_zone_device*, int, int
*);include/linux/thermal.h +1
-0@@ -196,6 +197,7 @@ struct thermal_zone_device { struct thermal_attr *trip_temp_attrs; struct thermal_attr *trip_type_attrs; struct thermal_attr *trip_hyst_attrs; + struct thermal_attr *trip_irq_mode_attrs; void *devdata; int trips;unsigned long trips_disabled; /* bitmap for disabled trips */
include/linux/thermal.h +1
-0@@ -364,6 +366,8 @@ struct thermal_zone_of_device_ops { * @temperature: temperature value in miliCelsius * @hysteresis: relative hysteresis in miliCelsius * @type: trip point type + * @irq_mode: to not use polling in framework set support ofHW irq
(which will
+ * be triggered when temperature reaches this level). */
structthermal_trip{include/linux/thermal.h +1
-0@@ -371,6 +375,7 @@ struct thermal_trip { int temperature; int hysteresis; enum thermal_trip_type type; + bool irq_mode; }; /* Function declarations */
PATCH v2 3/11 thermal: add new sysfs file for irq-mode
In reply to Lukasz LubaPatch adds show functions for irq-mode feature. It allocates new attributes and extends the old list.
--- drivers/thermal/thermal_sysfs.c | 53 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
drivers/thermal/thermal_sysfs.c +51 -2
@@ -21,6 +21,8 @@#include "thermal_core.h" +#define TRIP_ATTR_NUM 4 +/* sys I/F for thermal zone */ static ssize_t
@@ -167,6 +169,28 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr, }static ssize_t +trip_point_irq_mode_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct thermal_zone_device *tz =to_thermal_zone (dev); +int trip, ret; +bool mode; + +if (!tz->ops->get_trip_irq_mode) +return -EPERM ; + +if (sscanf (attr->attr.name,"trip_point_%d_irq" , &trip) !=1 ) +return -EINVAL ; + + ret = tz->ops->get_trip_irq_mode (tz, trip, &mode); + +if (ret) +return ret; + +return sprintf (buf,"%d\n" , mode); +} + +static ssize_t trip_point_hyst_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {
@@ -520,10 +544,19 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)if (!tz->trip_type_attrs)return -ENOMEM ; + tz->trip_irq_mode_attrs =kcalloc (tz->trips, +sizeof (*tz->trip_irq_mode_attrs), +GFP_KERNEL ); +if (!tz->trip_irq_mode_attrs) { +kfree (tz->trip_type_attrs); +return -ENOMEM ; + } + tz->trip_temp_attrs =kcalloc (tz->trips,sizeof (*tz->trip_temp_attrs),GFP_KERNEL );if (!tz->trip_temp_attrs) {kfree (tz->trip_type_attrs); +kfree (tz->trip_irq_mode_attrs);return -ENOMEM ; }
@@ -533,14 +566,17 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) GFP_KERNEL);if (!tz->trip_hyst_attrs) {kfree (tz->trip_type_attrs); +kfree (tz->trip_irq_mode_attrs);kfree (tz->trip_temp_attrs);return -ENOMEM ; } } - attrs =kcalloc (tz->trips *3 +1 ,sizeof (*attrs),GFP_KERNEL ); + attrs =kcalloc (tz->trips *TRIP_ATTR_NUM +1 ,sizeof (*attrs), +GFP_KERNEL );if (!attrs) {kfree (tz->trip_type_attrs); +kfree (tz->trip_irq_mode_attrs);kfree (tz->trip_temp_attrs);if (tz->ops->get_trip_hyst)kfree (tz->trip_hyst_attrs);
@@ -559,6 +595,19 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) tz->trip_type_attrs[indx].attr.show = trip_point_type_show; attrs[indx] = &tz->trip_type_attrs[indx].attr.attr; +/* create trip irq_mode attribute */ +snprintf (tz->trip_irq_mode_attrs[indx].name, +THERMAL_NAME_LENGTH ,"trip_point_%d_irq" , indx); + +sysfs_attr_init (&tz->trip_irq_mode_attrs[indx].attr.attr); + tz->trip_irq_mode_attrs[indx].attr.attr.name = + tz->trip_irq_mode_attrs[indx].name; + tz->trip_irq_mode_attrs[indx].attr.attr.mode =S_IRUGO ; + tz->trip_irq_mode_attrs[indx].attr.show = + trip_point_irq_mode_show; + attrs[indx + tz->trips *3 ] = + &tz->trip_irq_mode_attrs[indx].attr.attr; +/* create trip temp attribute */ snprintf (tz->trip_temp_attrs[indx].name,THERMAL_NAME_LENGTH ,"trip_point_%d_temp" , indx);
@@ -595,7 +644,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask) attrs[indx + tz->trips *2 ] = &tz->trip_hyst_attrs[indx].attr.attr; } - attrs[tz->trips *3 ] =NULL ; + attrs[tz->trips *TRIP_ATTR_NUM ] =NULL ; tz->trips_attribute_group.attrs = attrs;
Signature · 1 line
2.7.4
PATCH v2 4/11 Doc: thermal: new irq-mode for trip point
In reply to Lukasz LubaThermal trip point gets new flag in DT: irq-mode.
Trip point may have a new explicit flag which indicate IRQ support when the temperature is met (so the thermal framework deos not need to set polling for it).
It is useful for 'passive' cooling trip point,
which now will not be register for polling the temperature.
Update documentation about irq-mode for trip points. The new sysfs file shows 1 if the trip point supports IRQ.
--- Documentation/thermal/sysfs-api.txt | 9 +++++++++ 1 file changed, 9 insertions(+)
Documentation/thermal/sysfs-api.txt +9 -0
@@ -272,6 +272,7 @@ Thermal zone device sys I/F, created once it's registered: |---trip_point_[0-*]_temp: Trip point temperature |---trip_point_[0-*]_type: Trip point type |---trip_point_[0-*]_hyst: Hysteresis value for this trip point + |---trip_point_[0-*]_irq: Trip point supports triggering irq |---emul_temp: Emulated temperature set node |---sustainable_power: Sustainable dissipatable power |---k_po: Proportional term during temperature overshoot
@@ -365,6 +366,10 @@ trip_point_[0-*]_type thermal zone. RO, Optional +trip_point_[0-*]_irq + Boolean which indicate that the trip point triggers irq. + RO, Optional + trip_point_[0-*]_hyst The hysteresis value for a trip point, represented as an integer Unit: Celsius
@@ -544,12 +549,16 @@ method, the sys I/F structure will be built like this: |---available_policies: step_wise fair_share |---trip_point_0_temp: 100000 |---trip_point_0_type: critical + |---trip_point_0_irq: 1 |---trip_point_1_temp: 80000 |---trip_point_1_type: passive + |---trip_point_1_irq: 1 |---trip_point_2_temp: 70000 |---trip_point_2_type: active0 + |---trip_point_2_irq: 0 |---trip_point_3_temp: 60000 |---trip_point_3_type: active1 + |---trip_point_3_irq: 1 |---cdev0: --->/sys/class/thermal/cooling_device0 |---cdev0_trip_point: 1 /* cdev0 can be used for passive */ |---cdev0_weight: 1024
Signature · 1 line
2.7.4
PATCH v2 5/11 Doc: DT: thermal: new irq-mode for trip point
In reply to Lukasz LubaThermal trip point gets new flag in DT: irq-mode.
Trip point may have a new explicit flag which indicate IRQ support when the temperature is met (so the thermal framework deos not need to set polling for it).
It is useful for 'passive' cooling trip point,
which now will not register for polling the temperature.
Update documentation about irq-mode for trip points.
--- Documentation/devicetree/bindings/thermal/thermal.txt | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/thermal/thermal.txt +7 -0
@@ -90,6 +90,10 @@ Required properties: "critical": Hardware not reliable. Type: string +- irq-mode: A flag indicating that trip rises irq, so there is no + Type: bool need of polling in thermal framework. + Size: one cell + * Cooling device maps The cooling device maps node is a node to describe how cooling devices
@@ -256,16 +260,19 @@ thermal-zones { temperature = <90000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "active"; + irq-mode; }; cpu_alert1: cpu-alert1 { temperature = <100000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu_crit: cpu-crit { temperature = <125000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "critical"; + irq-mode; }; };
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerRe: [PATCH v2 05/11] Doc: DT: thermal: new irq-mode for trip point
Quoted 1 line · Lukasz Luba
Subject prefix:
dt-bindings: thermal:
Quoted 6 lines
Thermal trip point gets new flag in DT: irq-mode.
Trip point may have a new explicit flag which indicate IRQ support when the temperature is met (so the thermal framework deos not need to set polling for it).
It is useful for 'passive' cooling trip point,
which now will not register for polling the temperature.
You wrap lines in weird way making it more difficult to read. I already asked about this while reviewing v1. Please fix it.
https://elixir.bootlin.com/linux/latest/source/Documentation/process/submitting-patches.rst#L633
Quoted 19 lines
Update documentation about irq-mode for trip points.
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc devicetree at vger.kernel.orgSigned-off-by Lukasz Luba <[email protected]>--- Documentation/devicetree/bindings/thermal/thermal.txt | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/thermal/thermal.txt +0
-0
Documentation/devicetree/bindings/thermal/thermal.txt Required properties: · line 93
Quoted 4 lines
Documentation/devicetree/bindings/thermal/thermal.txt +1
-0@@ -90,6 +90,10 @@ Required properties: "critical": Hardware not reliable. Type: string +- irq-mode: A flag indicating that trip rises irq, so there is no
"rises IRQ" (it is an abbreviation).
Best regards,
Krzysztof
Quoted 29 lines
Documentation/devicetree/bindings/thermal/thermal.txt +6
-1+ Type: bool need of polling in thermal framework. + Size: one cell + * Cooling device maps The cooling device maps node is a node to describe how cooling devices@@ -256,16 +260,19 @@ thermal-zones { temperature = <90000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "active"; + irq-mode; }; cpu_alert1: cpu-alert1 { temperature = <100000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu_crit: cpu-crit { temperature = <125000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "critical"; + irq-mode; }; }; --2.7.4
Re: [PATCH v2 05/11] Doc: DT: thermal: new irq-mode for trip point
Hi Krzysztof,
Thanks for the comments.
Quoted 13 lines · Krzysztof Kozlowski
Quoted 1 line · Lukasz Luba
Subject prefix:
dt-bindings: thermal:Quoted 6 lines
Thermal trip point gets new flag in DT: irq-mode.
Trip point may have a new explicit flag which indicate IRQ support when the temperature is met (so the thermal framework deos not need to set polling for it).
It is useful for 'passive' cooling trip point,
which now will not register for polling the temperature.
Quoted 4 lines
You wrap lines in weird way making it more difficult to read. I already asked about this while reviewing v1. Please fix it.
https://elixir.bootlin.com/linux/latest/source/Documentation/process/submitting-patches.rst#L633
I will fix it in v3.
Quoted 22 lines
Quoted 22 lines
Update documentation about irq-mode for trip points.
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc devicetree at vger.kernel.orgSigned-off-by Lukasz Luba <[email protected]>--- Documentation/devicetree/bindings/thermal/thermal.txt | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/thermal/thermal.txt +0
-0@@ -90,6 +90,10 @@ Required properties: "critical": Hardware not reliable. Type: string
Quoted 3 lines
Documentation/devicetree/bindings/thermal/thermal.txt Required properties: · line 93
Quoted 1 line
Documentation/devicetree/bindings/thermal/thermal.txt +1
-0+- irq-mode: A flag indicating that trip rises irq, so there is no"rises IRQ" (it is an abbreviation).
ACK
Quoted 4 lines
Best regards,
Krzysztof
Regards,
Lukasz
Rob Herring
maintainerPATCH v2 5/11 Doc: DT: thermal: new irq-mode for trip point
In reply to Lukasz LubaQuoted 8 lines · Lukasz Luba
Thermal trip point gets new flag in DT: irq-mode.
Trip point may have a new explicit flag which indicate IRQ support when the temperature is met (so the thermal framework deos not need to set polling for it).
It is useful for 'passive' cooling trip point,
which now will not register for polling the temperature.Update documentation about irq-mode for trip points.
This patch should come before you use it.
Quoted 17 lines
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc devicetree at vger.kernel.orgSigned-off-by Lukasz Luba <[email protected]>--- Documentation/devicetree/bindings/thermal/thermal.txt | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/thermal/thermal.txt +0
-0
Documentation/devicetree/bindings/thermal/thermal.txt Required properties: · line 95
Quoted 6 lines
Documentation/devicetree/bindings/thermal/thermal.txt +3
-0@@ -90,6 +90,10 @@ Required properties: "critical": Hardware not reliable. Type: string +- irq-mode: A flag indicating that trip rises irq, so there is no + Type: bool need of polling in thermal framework. + Size: one cell
Should be optional, right?
Quoted 27 lines
Documentation/devicetree/bindings/thermal/thermal.txt +4
-0+ * Cooling device maps The cooling device maps node is a node to describe how cooling devices@@ -256,16 +260,19 @@ thermal-zones { temperature = <90000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "active"; + irq-mode; }; cpu_alert1: cpu-alert1 { temperature = <100000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu_crit: cpu-crit { temperature = <125000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "critical"; + irq-mode; }; };Signature · 1 line
2.7.4
Re: [PATCH v2 05/11] Doc: DT: thermal: new irq-mode for trip point
Hi Rob,
Quoted 11 lines · Rob Herring
Quoted 8 lines · Lukasz Luba
Thermal trip point gets new flag in DT: irq-mode.
Trip point may have a new explicit flag which indicate IRQ support when the temperature is met (so the thermal framework deos not need to set polling for it).
It is useful for 'passive' cooling trip point,
which now will not register for polling the temperature.Update documentation about irq-mode for trip points.
This patch should come before you use it.
OK, I will re-order the patch set in v3.
Quoted 21 lines
Quoted 21 lines
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc devicetree at vger.kernel.orgSigned-off-by Lukasz Luba <[email protected]>--- Documentation/devicetree/bindings/thermal/thermal.txt | 7 +++++++ 1 file changed, 7 insertions(+)Documentation/devicetree/bindings/thermal/thermal.txt +0
-0@@ -90,6 +90,10 @@ Required properties: "critical": Hardware not reliable. Type: string
Quoted 5 lines
Documentation/devicetree/bindings/thermal/thermal.txt Required properties: · line 95
Quoted 3 lines
Documentation/devicetree/bindings/thermal/thermal.txt +3
-0+- irq-mode: A flag indicating that trip rises irq, so there is no + Type: bool need of polling in thermal framework. + Size: one cellShould be optional, right?
Yes, it is optional. I will mention about it in change v3.
Thank you for the review.
Regards,
Lukasz
PATCH v2 6/11 arm64: dts: exynos5433: add support for thermal trip irq-mode
In reply to Lukasz LubaThis patch adds support for new flag which indicates that trip point triggers IRQ when temperature is met. Exynos5433 supports 8 trip point which will trigger IRQ. Above that number other trip points should be registered without 'irq-mode' flag.
--- arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi | 105 ++++++++++++++++--------- 1 file changed, 70 insertions(+), 35 deletions(-)
arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi +70 -35
@@ -17,37 +17,44 @@ thermal-zones { atlas0_alert_0: atlas0-alert-0 { temperature = <65000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas0_alert_1: atlas0-alert-1 { temperature = <70000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas0_alert_2: atlas0-alert-2 { temperature = <75000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas0_alert_3: atlas0-alert-3 { temperature = <80000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas0_alert_4: atlas0-alert-4 { temperature = <85000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas0_alert_5: atlas0-alert-5 { temperature = <90000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas0_alert_6: atlas0-alert-6 { temperature = <95000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; };
@@ -98,37 +105,44 @@ thermal-zones { atlas1_alert_0: atlas1-alert-0 { temperature = <65000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas1_alert_1: atlas1-alert-1 { temperature = <70000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas1_alert_2: atlas1-alert-2 { temperature = <75000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas1_alert_3: atlas1-alert-3 { temperature = <80000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas1_alert_4: atlas1-alert-4 { temperature = <85000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas1_alert_5: atlas1-alert-5 { temperature = <90000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; atlas1_alert_6: atlas1-alert-6 { temperature = <95000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; }; };
@@ -141,37 +155,44 @@ thermal-zones { g3d_alert_0: g3d-alert-0 { temperature = <70000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; g3d_alert_1: g3d-alert-1 { temperature = <75000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; g3d_alert_2: g3d-alert-2 { temperature = <80000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; g3d_alert_3: g3d-alert-3 { temperature = <85000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; g3d_alert_4: g3d-alert-4 { temperature = <90000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; g3d_alert_5: g3d-alert-5 { temperature = <95000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; g3d_alert_6: g3d-alert-6 { temperature = <100000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; }; };
@@ -184,37 +205,44 @@ thermal-zones { apollo_alert_0: apollo-alert-0 { temperature = <65000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; apollo_alert_1: apollo-alert-1 { temperature = <70000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; apollo_alert_2: apollo-alert-2 { temperature = <75000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; apollo_alert_3: apollo-alert-3 { temperature = <80000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; apollo_alert_4: apollo-alert-4 { temperature = <85000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; apollo_alert_5: apollo-alert-5 { temperature = <90000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; apollo_alert_6: apollo-alert-6 { temperature = <95000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; };
@@ -255,37 +283,44 @@ thermal-zones { isp_alert_0: isp-alert-0 { temperature = <80000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; isp_alert_1: isp-alert-1 { temperature = <85000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; isp_alert_2: isp-alert-2 { temperature = <90000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; isp_alert_3: isp-alert-3 { temperature = <95000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; isp_alert_4: isp-alert-4 { temperature = <100000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; isp_alert_5: isp-alert-5 { temperature = <105000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; isp_alert_6: isp-alert-6 { temperature = <110000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; }; };
Signature · 1 line
2.7.4
Krzysztof Kozlowski
maintainerRe: [PATCH v2 06/11] arm64: dts: exynos5433: add support for thermal trip irq-mode
Thanks Lukasz for patches. I like your work!
I have few more comments which will probably apply for all the DTS commits.
Quoted 2 lines · Lukasz Luba
This patch adds support for new flag which indicates
This patch does not add support. Support for flag was added in your first drivers/thermal patches in this set. This patch adds new flag. (and does something more, so read on)
Quoted 2 lines
that trip point triggers IRQ when temperature is met. Exynos5433 supports 8 trip point which will trigger IRQ.
/8 trip point/8 trip points/
Quoted 2 lines
Above that number other trip points should be registered without 'irq-mode' flag.
Please fix the line-wrap.
Quoted 16 lines
Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc devicetree at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-samsung-soc at vger.kernel.orgSigned-off-by Lukasz Luba <[email protected]>--- arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi | 105 ++++++++++++++++--------- 1 file changed, 70 insertions(+), 35 deletions(-)arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi +0
-0
arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi thermal-zones { · line 20
Quoted 5 lines
arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi +1
-1@@ -17,37 +17,44 @@ thermal-zones { atlas0_alert_0: atlas0-alert-0 { temperature = <65000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive";
This change is not explained in commit msg.
Basically you are doing here two things (related to each other). You clearly define which trip points are IRQ-type and you correct the type of trip point. Active is incorrect. This second thing is missing in your commit msg and I believe it is main reason behind this patch. You should focus then on this reason - start from it. Subject could be like "Use proper passive type for thermal trip points".
Without this explanation I don't see the strong reason behind that patch. IOW, everything was working fine before... so why adding this new flag? Or maybe something was not fine... and then it is real reason why you are sending the patch. Usually commit message should answer to the most important question "WHY". Now, it explains "WHAT"... but I can see it from the source code. However from the code it is not easy to guess WHY.
Best regards,
Krzysztof
Re: [PATCH v2 06/11] arm64: dts: exynos5433: add support for thermal trip irq-mode
Hi Krzysztof,
Quoted 11 lines · Krzysztof Kozlowski
Thanks Lukasz for patches. I like your work!
I have few more comments which will probably apply for all the DTS commits.
Quoted 2 lines · Lukasz Luba
This patch adds support for new flag which indicates
This patch does not add support. Support for flag was added in your first
drivers/thermalpatches in this set. This patch adds new flag. (and does something more, so read on)
Got it, will change the commit message.
Quoted 10 lines
Quoted 3 lines
that trip point triggers IRQ when temperature is met. Exynos5433 supports 8 trip point which will trigger IRQ.
/8 trip point/8 trip points/
Quoted 2 lines
Above that number other trip points should be registered without 'irq-mode' flag.
Please fix the line-wrap.
OK
Quoted 32 lines
Quoted 17 lines
Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc devicetree at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-samsung-soc at vger.kernel.orgSigned-off-by Lukasz Luba <[email protected]>--- arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi | 105 ++++++++++++++++--------- 1 file changed, 70 insertions(+), 35 deletions(-)arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi +0
-0arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi thermal-zones { · line 20
Quoted 5 lines
arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi +1
-1@@ -17,37 +17,44 @@ thermal-zones { atlas0_alert_0: atlas0-alert-0 { temperature = <65000>; /* millicelsius */ hysteresis = <1000>; /* millicelsius */ - type = "active"; + type = "passive";This change is not explained in commit msg.
Basically you are doing here two things (related to each other). You clearly define which trip points are IRQ-type and you correct the type of trip point. Active is incorrect. This second thing is missing in your commit msg and I believe it is main reason behind this patch. You should focus then on this reason - start from it. Subject could be like "Use proper passive type for thermal trip points".
Quoted 7 lines
Without this explanation I don't see the strong reason behind that patch. IOW, everything was working fine before... so why adding this new flag? Or maybe something was not fine... and then it is real reason why you are sending the patch. Usually commit message should answer to the most important question "WHY". Now, it explains "WHAT"... but I can see it from the source code. However from the code it is not easy to guess WHY.
OK, I will add the explanation 'why' similar to description from the cover-letter to all the patches which add this flag in DT files.
Quoted 5 lines
Best regards,
Krzysztof
Thank you for the review.
Regards,
Lukasz
PATCH v2 7/11 arm64: dts: exynos7: add support for thermal trip irq-mode
In reply to Lukasz LubaThis patch adds support for new flag which indicates
that trip point triggers IRQ when temperature is met. Change existing trip points to be expicitly marked with the new flag.
--- arch/arm64/boot/dts/exynos/exynos7-trip-points.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/exynos/exynos7-trip-points.dtsi +8 -0
@@ -11,40 +11,48 @@ trips { temperature = <75000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu-alert-1 { temperature = <80000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu-alert-2 { temperature = <85000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu-alert-3 { temperature = <90000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu-alert-4 { temperature = <95000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu-alert-5 { temperature = <100000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu-alert-6 { temperature = <110000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "passive"; + irq-mode; }; cpu-crit-0 { temperature = <115000>; /* millicelsius */ hysteresis = <0>; /* millicelsius */ type = "critical"; + irq-mode; }; };
Signature · 1 line
2.7.4
PATCH v2 8/11 arm: dts: exynos4: add support for thermal trip irq-mode
In reply to Lukasz LubaThis patch adds support for new flag which indicates
that trip point triggers IRQ when temperature is met. Change existing trip points to be expicitly marked with the new flag.
--- arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/boot/dts/exynos4-cpu-thermal.dtsi +7 -3
@@ -17,22 +17,26 @@ thermal-zones { cpu_alert0: cpu-alert-0 { temperature = <70000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu_alert1: cpu-alert-1 { temperature = <95000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu_alert2: cpu-alert-2 { temperature = <110000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu_crit0: cpu-crit-0 { temperature = <120000>; /* millicelsius */ hysteresis = <0>; /* millicelsius */ type = "critical"; + irq-mode; }; }; cooling-maps {
Signature · 1 line
2.7.4
PATCH v2 9/11 arm: dts: exynos5420: add support for thermal trip irq-mode
In reply to Lukasz LubaThis patch adds support for new flag which indicates
that trip point triggers IRQ when temperature is met. Change existing trip points to be expicitly marked with the new flag.
--- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/boot/dts/exynos5420-trip-points.dtsi +7 -3
@@ -11,21 +11,25 @@ trips { cpu-alert-0 { temperature = <85000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu-alert-1 { temperature = <103000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu-alert-2 { temperature = <110000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu-crit-0 { temperature = <120000>; /* millicelsius */ hysteresis = <0>; /* millicelsius */ type = "critical"; + irq-mode; }; };
Signature · 1 line
2.7.4
PATCH v2 10/11 arm: dts: exynos5422: add support for thermal trip irq-mode
In reply to Lukasz LubaThis patch adds support for new flag which indicates
that trip point triggers IRQ when temperature is met. Exynos5422 supports 4 trip points which will trigger IRQ. Additional trip points should be registered without 'irq-mode' flag.
--- arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi | 40 +++++++++++++++------- 1 file changed, 28 insertions(+), 12 deletions(-)
arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi +28 -12
@@ -59,22 +59,26 @@ cpu0_alert0: cpu-alert-0 { temperature = <50000>; /* millicelsius */ hysteresis = <5000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu0_alert1: cpu-alert-1 { temperature = <60000>; /* millicelsius */ hysteresis = <5000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu0_alert2: cpu-alert-2 { temperature = <70000>; /* millicelsius */ hysteresis = <5000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu0_crit0: cpu-crit-0 { temperature = <120000>; /* millicelsius */ hysteresis = <0>; /* millicelsius */ type = "critical"; + irq-mode; }; /* * Exynos542x supports only 4 trip-points
@@ -142,22 +146,26 @@ cpu1_alert0: cpu-alert-0 { temperature = <50000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu1_alert1: cpu-alert-1 { temperature = <60000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu1_alert2: cpu-alert-2 { temperature = <70000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu1_crit0: cpu-crit-0 { temperature = <120000>; hysteresis = <0>; type = "critical"; + irq-mode; }; cpu1_alert3: cpu-alert-3 { temperature = <70000>;
@@ -209,22 +217,26 @@ cpu2_alert0: cpu-alert-0 { temperature = <50000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu2_alert1: cpu-alert-1 { temperature = <60000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu2_alert2: cpu-alert-2 { temperature = <70000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu2_crit0: cpu-crit-0 { temperature = <120000>; hysteresis = <0>; type = "critical"; + irq-mode; }; cpu2_alert3: cpu-alert-3 { temperature = <70000>;
@@ -276,22 +288,26 @@ cpu3_alert0: cpu-alert-0 { temperature = <50000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu3_alert1: cpu-alert-1 { temperature = <60000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu3_alert2: cpu-alert-2 { temperature = <70000>; hysteresis = <5000>; - type = "active"; + type = "passive"; + irq-mode; }; cpu3_crit0: cpu-crit-0 { temperature = <120000>; hysteresis = <0>; type = "critical"; + irq-mode; }; cpu3_alert3: cpu-alert-3 { temperature = <70000>;
Signature · 1 line
2.7.4
PATCH v2 11/11 arm: dts: exynos5410: add support for thermal trip irq-mode
In reply to Lukasz LubaThis patch adds support for new flag which indicates
that trip point triggers IRQ when temperature is met. Change existing trip points to be expicitly marked with the new flag.
--- arch/arm/boot/dts/exynos5410-odroidxu.dts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/boot/dts/exynos5410-odroidxu.dts +7 -3
@@ -121,22 +121,26 @@ cpu_alert0: cpu-alert-0 { temperature = <50000>; /* millicelsius */ hysteresis = <5000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu_alert1: cpu-alert-1 { temperature = <60000>; /* millicelsius */ hysteresis = <5000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu_alert2: cpu-alert-2 { temperature = <70000>; /* millicelsius */ hysteresis = <5000>; /* millicelsius */ - type = "active"; + type = "passive"; + irq-mode; }; cpu_crit0: cpu-crit-0 { temperature = <120000>; /* millicelsius */ hysteresis = <0>; /* millicelsius */ type = "critical"; + irq-mode; }; };
Signature · 1 line
2.7.4
Zhang Rui
reviewerQuoted 12 lines · Lukasz Luba
Hi all,
This patch set adds a new flag and mechanism in thermal trip points in
DT. The old implementation in thermal zone in DT sets the same configuration for all internal trip points. It does not work for all HW. There are SoCs which support IRQs for some trip points (i.e. Exynos 4 has 4 trip points with IRQs). For additional one defined inside the thermal zone there is a need of 'polling'. When developer adds polling mode settings inside the thermal zone, all the trip points will be registered for polling, even those supporting IRQs, which does not make sense.
we have two timers, one for polling, and one for passive cooling. I think we are talking about passive cooling timer only, right? And the real problem is that we have multiple passive trip points and only part of them support irq_mode, and we don't want to start the passive polling timer for all of the passive trip points.
thanks,
rui
Quoted 70 lines
Thus, developers create workarounds, which
are confusing for some other developers. To workaround, people declare some trip points as 'active' (those with IRQ support). It allows to bypass polling mode in thermal framework applied for all thermal zone's trip points.Thermal framework defines 4 types of trip points. The 'passive' means passive cooling using DVFS, 'active' is designed for fan and other devices actively changing the outside conditions. Therefore, a workaround
mentioned earlier is confusing when someone does not know about the framework limitations.This patch set tries to solve the issue by adding one flag inside the trip point: 'irq-mode;'. The trip point 'passive' declared in DT with
explicit flag 'irq-mode;' will not register itself as polling mode. Thermal framework will skip it during scheduling next read out work. The old global-polling-mode-configuration-inside-thermal-zone is still
valid. Patch set does not break existing design for trip points which
do not have 'irq-mode' flag - they will use polling.As an example please check patch #10 for Exynos4 SoC family, where there
is 4 HW supported trip points and there is a need of 6. The rest 2 are
declared as 'passive' without 'irq-mode;' flag, which means polling mode needed for them.Patch #1 is a small cleanup in thermal framework.
Change log:
v2
- changed description in cover letter
- change commit messages according to Krzysztof comments
- rebase on top of current mainline (v4.20-rc1)Regards,
Lukasz LubaLukasz Luba (11):
thermal: remove unused function parameter
thermal: add irq-mode configuration for trip point
thermal: add new sysfs file for irq-mode
Doc: thermal: new irq-mode for trip point
Doc: DT: thermal: new irq-mode for trip point
arm64: dts: exynos5433: add support for thermal trip irq-mode
arm64: dts: exynos7: add support for thermal trip irq-mode
arm: dts: exynos4: add support for thermal trip irq-mode
arm: dts: exynos5420: add support for thermal trip irq-mode
arm: dts: exynos5422: add support for thermal trip irq-mode
arm: dts: exynos5410: add support for thermal trip irq-mode.../devicetree/bindings/thermal/thermal.txt | 7 ++ Documentation/thermal/sysfs-api.txt | 9 ++ arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 10 +- arch/arm/boot/dts/exynos5410-odroidxu.dts | 10 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 10 +-
arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi| 40 +++++--- arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi | 105
++++++++++++++-------
.../arm64/boot/dts/exynos/exynos7-trip-points.dtsi | 8 ++ drivers/thermal/of-thermal.c | 17 ++++ drivers/thermal/thermal_core.c | 16 ++-- drivers/thermal/thermal_sysfs.c | 53 ++++++++++- include/linux/thermal.h | 5 +12 files changed, 226 insertions(+), 64 deletions(-)
Hi Rui,
Quoted 14 lines · Zhang Rui
Quoted 12 lines · Lukasz Luba
Hi all,
This patch set adds a new flag and mechanism in thermal trip points in
DT. The old implementation in thermal zone in DT sets the same configuration for all internal trip points. It does not work for all HW. There are SoCs which support IRQs for some trip points (i.e. Exynos 4 has 4 trip points with IRQs). For additional one defined inside the thermal zone there is a need of 'polling'. When developer adds polling mode settings inside the thermal zone, all the trip points will be registered for polling, even those supporting IRQs, which does not make sense.
Quoted 5 lines
we have two timers, one for polling, and one for passive cooling. I think we are talking about passive cooling timer only, right? And the real problem is that we have multiple passive trip points and only part of them support
irq_mode, and we don't want to start the passive polling timer for all of the passive trip points.
Yes exactly, we don't want to poll all of them by starting 'passive polling timer'.
Regards,
Lukasz
Quoted 76 lines
thanks,
ruiQuoted 70 lines
Thus, developers create workarounds, which
are confusing for some other developers. To workaround, people declare some trip points as 'active' (those with IRQ support). It allows to bypass polling mode in thermal framework applied for all thermal zone's trip points.Thermal framework defines 4 types of trip points. The 'passive' means passive cooling using DVFS, 'active' is designed for fan and other devices actively changing the outside conditions. Therefore, a workaround
mentioned earlier is confusing when someone does not know about the framework limitations.This patch set tries to solve the issue by adding one flag inside the trip point: 'irq-mode;'. The trip point 'passive' declared in DT with
explicit flag 'irq-mode;' will not register itself as polling mode. Thermal framework will skip it during scheduling next read out work. The old global-polling-mode-configuration-inside-thermal-zone is still
valid. Patch set does not break existing design for trip points which
do not have 'irq-mode' flag - they will use polling.As an example please check patch #10 for Exynos4 SoC family, where there
is 4 HW supported trip points and there is a need of 6. The rest 2 are
declared as 'passive' without 'irq-mode;' flag, which means polling mode needed for them.Patch #1 is a small cleanup in thermal framework.
Change log:
v2
- changed description in cover letter
- change commit messages according to Krzysztof comments
- rebase on top of current mainline (v4.20-rc1)Regards,
Lukasz LubaLukasz Luba (11):
thermal: remove unused function parameter
thermal: add irq-mode configuration for trip point
thermal: add new sysfs file for irq-mode
Doc: thermal: new irq-mode for trip point
Doc: DT: thermal: new irq-mode for trip point
arm64: dts: exynos5433: add support for thermal trip irq-mode
arm64: dts: exynos7: add support for thermal trip irq-mode
arm: dts: exynos4: add support for thermal trip irq-mode
arm: dts: exynos5420: add support for thermal trip irq-mode
arm: dts: exynos5422: add support for thermal trip irq-mode
arm: dts: exynos5410: add support for thermal trip irq-mode.../devicetree/bindings/thermal/thermal.txt | 7 ++ Documentation/thermal/sysfs-api.txt | 9 ++ arch/arm/boot/dts/exynos4-cpu-thermal.dtsi | 10 +- arch/arm/boot/dts/exynos5410-odroidxu.dts | 10 +- arch/arm/boot/dts/exynos5420-trip-points.dtsi | 10 +- arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi | 40 +++++--- arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi | 105 ++++++++++++++------- .../arm64/boot/dts/exynos/exynos7-trip-points.dtsi | 8 ++ drivers/thermal/of-thermal.c | 17 ++++ drivers/thermal/thermal_core.c | 16 ++-- drivers/thermal/thermal_sysfs.c | 53 ++++++++++- include/linux/thermal.h | 5 + 12 files changed, 226 insertions(+), 64 deletions(-)