* [PATCH v7 0/3] Fixes for Tegra soctherm
@ 2019-01-03 10:12 Wei Ni
2019-01-03 10:12 ` [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Wei Ni @ 2019-01-03 10:12 UTC (permalink / raw)
To: daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel,
linux-pm, Wei Ni
This series fixed some issues for Tegra soctherm,
and add get_trend().
Main changes from v6:
1. Per Eduardo's comment, we can remove the change:
"thermal: tegra: parse sensor id before sensor register"
Main changes from v5:
1. Move the get_trend() patch https://lkml.org/lkml/2018/11/20/643
into this serial.
Main changes from v4:
1. fixed for the parsing sensor id.
2. keep warning for missing critical trips.
Main changes from v3:
1. updated codes for parsing sensor id, per Thierry's comments
Main changes from v2:
1. add codes to parse sensor id to avoid registration
failure.
Main changes from v1:
1. Acked by Thierry Reding <treding@nvidia.com> for the patch
"thermal: tegra: fix memory allocation".
2. Print out the sensor name when register failed.
2. Remove patch "thermal: tegra: fix coverity defect"
Wei Ni (3):
thermal: tegra: remove unnecessary warnings
thermal: tegra: fix memory allocation
thermal: tegra: add get_trend ops
drivers/thermal/tegra/soctherm.c | 40 +++++++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings
2019-01-03 10:12 [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
@ 2019-01-03 10:12 ` Wei Ni
2019-02-18 9:47 ` Daniel Lezcano
2019-01-03 10:12 ` [PATCH v7 2/3] thermal: tegra: fix memory allocation Wei Ni
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Wei Ni @ 2019-01-03 10:12 UTC (permalink / raw)
To: daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel,
linux-pm, Wei Ni
Convert warnings to info as not all platforms may
have all the thresholds and sensors enabled.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/thermal/tegra/soctherm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index ed28110a3535..f07de8258e93 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -569,7 +569,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
set_throttle:
ret = get_hot_temp(tz, &trip, &temperature);
if (ret) {
- dev_warn(dev, "throttrip: %s: missing hot temperature\n",
+ dev_info(dev, "throttrip: %s: missing hot temperature\n",
sg->name);
return 0;
}
@@ -600,7 +600,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
}
if (i == THROTTLE_SIZE)
- dev_warn(dev, "throttrip: %s: missing throttle cdev\n",
+ dev_info(dev, "throttrip: %s: missing throttle cdev\n",
sg->name);
return 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v7 2/3] thermal: tegra: fix memory allocation
2019-01-03 10:12 [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
2019-01-03 10:12 ` [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
@ 2019-01-03 10:12 ` Wei Ni
2019-02-18 10:24 ` Daniel Lezcano
2019-01-03 10:12 ` [PATCH v7 3/3] thermal: tegra: add get_trend ops Wei Ni
2019-01-11 2:20 ` [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
3 siblings, 1 reply; 15+ messages in thread
From: Wei Ni @ 2019-01-03 10:12 UTC (permalink / raw)
To: daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel,
linux-pm, Wei Ni
Fix memory allocation to store the pointers to
thermal_zone_device.
Signed-off-by: Wei Ni <wni@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
---
drivers/thermal/tegra/soctherm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index f07de8258e93..fd2703c0cfc5 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -1339,7 +1339,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
}
tegra->thermctl_tzs = devm_kcalloc(&pdev->dev,
- soc->num_ttgs, sizeof(*z),
+ soc->num_ttgs, sizeof(z),
GFP_KERNEL);
if (!tegra->thermctl_tzs)
return -ENOMEM;
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v7 3/3] thermal: tegra: add get_trend ops
2019-01-03 10:12 [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
2019-01-03 10:12 ` [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
2019-01-03 10:12 ` [PATCH v7 2/3] thermal: tegra: fix memory allocation Wei Ni
@ 2019-01-03 10:12 ` Wei Ni
2019-02-18 10:27 ` Daniel Lezcano
2019-01-11 2:20 ` [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
3 siblings, 1 reply; 15+ messages in thread
From: Wei Ni @ 2019-01-03 10:12 UTC (permalink / raw)
To: daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel,
linux-pm, Wei Ni
Add support for get_trend ops that allows soctherm
sensors to be used with the step-wise governor.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/thermal/tegra/soctherm.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index fd2703c0cfc5..864205af104b 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -488,9 +488,43 @@ static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp)
return 0;
}
+static int tegra_thermctl_get_trend(void *data, int trip,
+ enum thermal_trend *trend)
+{
+ struct tegra_thermctl_zone *zone = data;
+ struct thermal_zone_device *tz = zone->tz;
+ int trip_temp, temp, last_temp, ret;
+
+ if (!tz)
+ return -EINVAL;
+
+ ret = tz->ops->get_trip_temp(zone->tz, trip, &trip_temp);
+ if (ret)
+ return ret;
+
+ mutex_lock(&tz->lock);
+ temp = tz->temperature;
+ last_temp = tz->last_temperature;
+ mutex_unlock(&tz->lock);
+
+ if (temp > trip_temp) {
+ if (temp >= last_temp)
+ *trend = THERMAL_TREND_RAISING;
+ else
+ *trend = THERMAL_TREND_STABLE;
+ } else if (temp < trip_temp) {
+ *trend = THERMAL_TREND_DROPPING;
+ } else {
+ *trend = THERMAL_TREND_STABLE;
+ }
+
+ return 0;
+}
+
static const struct thermal_zone_of_device_ops tegra_of_thermal_ops = {
.get_temp = tegra_thermctl_get_temp,
.set_trip_temp = tegra_thermctl_set_trip_temp,
+ .get_trend = tegra_thermctl_get_trend,
};
static int get_hot_temp(struct thermal_zone_device *tz, int *trip, int *temp)
--
2.7.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v7 0/3] Fixes for Tegra soctherm
2019-01-03 10:12 [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
` (2 preceding siblings ...)
2019-01-03 10:12 ` [PATCH v7 3/3] thermal: tegra: add get_trend ops Wei Ni
@ 2019-01-11 2:20 ` Wei Ni
2019-01-21 9:17 ` Wei Ni
3 siblings, 1 reply; 15+ messages in thread
From: Wei Ni @ 2019-01-11 2:20 UTC (permalink / raw)
To: daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
Hi Eduardo,
Do you have any more comments, will you take this serial?
Thanks.
Wei.
On 3/1/2019 6:12 PM, Wei Ni wrote:
> This series fixed some issues for Tegra soctherm,
> and add get_trend().
>
> Main changes from v6:
> 1. Per Eduardo's comment, we can remove the change:
> "thermal: tegra: parse sensor id before sensor register"
>
> Main changes from v5:
> 1. Move the get_trend() patch https://lkml.org/lkml/2018/11/20/643
> into this serial.
>
> Main changes from v4:
> 1. fixed for the parsing sensor id.
> 2. keep warning for missing critical trips.
>
> Main changes from v3:
> 1. updated codes for parsing sensor id, per Thierry's comments
>
> Main changes from v2:
> 1. add codes to parse sensor id to avoid registration
> failure.
>
> Main changes from v1:
> 1. Acked by Thierry Reding <treding@nvidia.com> for the patch
> "thermal: tegra: fix memory allocation".
> 2. Print out the sensor name when register failed.
> 2. Remove patch "thermal: tegra: fix coverity defect"
>
> Wei Ni (3):
> thermal: tegra: remove unnecessary warnings
> thermal: tegra: fix memory allocation
> thermal: tegra: add get_trend ops
>
> drivers/thermal/tegra/soctherm.c | 40 +++++++++++++++++++++++++++++++++++++---
> 1 file changed, 37 insertions(+), 3 deletions(-)
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 0/3] Fixes for Tegra soctherm
2019-01-11 2:20 ` [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
@ 2019-01-21 9:17 ` Wei Ni
2019-02-18 7:59 ` Wei Ni
0 siblings, 1 reply; 15+ messages in thread
From: Wei Ni @ 2019-01-21 9:17 UTC (permalink / raw)
To: daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
Does there have any comments?
Thanks.
Wei.
On 11/1/2019 10:20 AM, Wei Ni wrote:
> Hi Eduardo,
> Do you have any more comments, will you take this serial?
>
> Thanks.
> Wei.
>
> On 3/1/2019 6:12 PM, Wei Ni wrote:
>> This series fixed some issues for Tegra soctherm,
>> and add get_trend().
>>
>> Main changes from v6:
>> 1. Per Eduardo's comment, we can remove the change:
>> "thermal: tegra: parse sensor id before sensor register"
>>
>> Main changes from v5:
>> 1. Move the get_trend() patch https://lkml.org/lkml/2018/11/20/643
>> into this serial.
>>
>> Main changes from v4:
>> 1. fixed for the parsing sensor id.
>> 2. keep warning for missing critical trips.
>>
>> Main changes from v3:
>> 1. updated codes for parsing sensor id, per Thierry's comments
>>
>> Main changes from v2:
>> 1. add codes to parse sensor id to avoid registration
>> failure.
>>
>> Main changes from v1:
>> 1. Acked by Thierry Reding <treding@nvidia.com> for the patch
>> "thermal: tegra: fix memory allocation".
>> 2. Print out the sensor name when register failed.
>> 2. Remove patch "thermal: tegra: fix coverity defect"
>>
>> Wei Ni (3):
>> thermal: tegra: remove unnecessary warnings
>> thermal: tegra: fix memory allocation
>> thermal: tegra: add get_trend ops
>>
>> drivers/thermal/tegra/soctherm.c | 40 +++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 37 insertions(+), 3 deletions(-)
>>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 0/3] Fixes for Tegra soctherm
2019-01-21 9:17 ` Wei Ni
@ 2019-02-18 7:59 ` Wei Ni
2019-02-20 2:14 ` Zhang Rui
0 siblings, 1 reply; 15+ messages in thread
From: Wei Ni @ 2019-02-18 7:59 UTC (permalink / raw)
To: daniel.lezcano, edubezval, rui.zhang
Cc: thierry.reding, linux-tegra, srikars, linux-kernel, linux-pm
Rui,
Will you take this serial?
Thanks.
Wei.
On 21/1/2019 5:17 PM, Wei Ni wrote:
> Does there have any comments?
>
> Thanks.
> Wei.
>
> On 11/1/2019 10:20 AM, Wei Ni wrote:
>> Hi Eduardo,
>> Do you have any more comments, will you take this serial?
>>
>> Thanks.
>> Wei.
>>
>> On 3/1/2019 6:12 PM, Wei Ni wrote:
>>> This series fixed some issues for Tegra soctherm,
>>> and add get_trend().
>>>
>>> Main changes from v6:
>>> 1. Per Eduardo's comment, we can remove the change:
>>> "thermal: tegra: parse sensor id before sensor register"
>>>
>>> Main changes from v5:
>>> 1. Move the get_trend() patch https://lkml.org/lkml/2018/11/20/643
>>> into this serial.
>>>
>>> Main changes from v4:
>>> 1. fixed for the parsing sensor id.
>>> 2. keep warning for missing critical trips.
>>>
>>> Main changes from v3:
>>> 1. updated codes for parsing sensor id, per Thierry's comments
>>>
>>> Main changes from v2:
>>> 1. add codes to parse sensor id to avoid registration
>>> failure.
>>>
>>> Main changes from v1:
>>> 1. Acked by Thierry Reding <treding@nvidia.com> for the patch
>>> "thermal: tegra: fix memory allocation".
>>> 2. Print out the sensor name when register failed.
>>> 2. Remove patch "thermal: tegra: fix coverity defect"
>>>
>>> Wei Ni (3):
>>> thermal: tegra: remove unnecessary warnings
>>> thermal: tegra: fix memory allocation
>>> thermal: tegra: add get_trend ops
>>>
>>> drivers/thermal/tegra/soctherm.c | 40 +++++++++++++++++++++++++++++++++++++---
>>> 1 file changed, 37 insertions(+), 3 deletions(-)
>>>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings
2019-01-03 10:12 ` [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
@ 2019-02-18 9:47 ` Daniel Lezcano
2019-02-19 2:14 ` Wei Ni
0 siblings, 1 reply; 15+ messages in thread
From: Daniel Lezcano @ 2019-02-18 9:47 UTC (permalink / raw)
To: Wei Ni, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
On 03/01/2019 11:12, Wei Ni wrote:
> Convert warnings to info as not all platforms may
> have all the thresholds and sensors enabled.
>
> Signed-off-by: Wei Ni <wni@nvidia.com>
> ---
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> drivers/thermal/tegra/soctherm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
> index ed28110a3535..f07de8258e93 100644
> --- a/drivers/thermal/tegra/soctherm.c
> +++ b/drivers/thermal/tegra/soctherm.c
> @@ -569,7 +569,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
> set_throttle:
> ret = get_hot_temp(tz, &trip, &temperature);
> if (ret) {
> - dev_warn(dev, "throttrip: %s: missing hot temperature\n",
> + dev_info(dev, "throttrip: %s: missing hot temperature\n",
> sg->name);
> return 0;
> }
> @@ -600,7 +600,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
> }
>
> if (i == THROTTLE_SIZE)
> - dev_warn(dev, "throttrip: %s: missing throttle cdev\n",
> + dev_info(dev, "throttrip: %s: missing throttle cdev\n",
> sg->name);
>
> return 0;
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 2/3] thermal: tegra: fix memory allocation
2019-01-03 10:12 ` [PATCH v7 2/3] thermal: tegra: fix memory allocation Wei Ni
@ 2019-02-18 10:24 ` Daniel Lezcano
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Lezcano @ 2019-02-18 10:24 UTC (permalink / raw)
To: Wei Ni, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
On 03/01/2019 11:12, Wei Ni wrote:
> Fix memory allocation to store the pointers to
> thermal_zone_device.
>
> Signed-off-by: Wei Ni <wni@nvidia.com>
> Acked-by: Thierry Reding <treding@nvidia.com>
> ---
Good catch
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> drivers/thermal/tegra/soctherm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
> index f07de8258e93..fd2703c0cfc5 100644
> --- a/drivers/thermal/tegra/soctherm.c
> +++ b/drivers/thermal/tegra/soctherm.c
> @@ -1339,7 +1339,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
> }
>
> tegra->thermctl_tzs = devm_kcalloc(&pdev->dev,
> - soc->num_ttgs, sizeof(*z),
> + soc->num_ttgs, sizeof(z),
> GFP_KERNEL);
> if (!tegra->thermctl_tzs)
> return -ENOMEM;
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 3/3] thermal: tegra: add get_trend ops
2019-01-03 10:12 ` [PATCH v7 3/3] thermal: tegra: add get_trend ops Wei Ni
@ 2019-02-18 10:27 ` Daniel Lezcano
2019-02-19 2:15 ` Wei Ni
0 siblings, 1 reply; 15+ messages in thread
From: Daniel Lezcano @ 2019-02-18 10:27 UTC (permalink / raw)
To: Wei Ni, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
On 03/01/2019 11:12, Wei Ni wrote:
> Add support for get_trend ops that allows soctherm
> sensors to be used with the step-wise governor.
>
> Signed-off-by: Wei Ni <wni@nvidia.com>
> ---
> drivers/thermal/tegra/soctherm.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
> index fd2703c0cfc5..864205af104b 100644
> --- a/drivers/thermal/tegra/soctherm.c
> +++ b/drivers/thermal/tegra/soctherm.c
> @@ -488,9 +488,43 @@ static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp)
> return 0;
> }
>
> +static int tegra_thermctl_get_trend(void *data, int trip,
> + enum thermal_trend *trend)
> +{
> + struct tegra_thermctl_zone *zone = data;
> + struct thermal_zone_device *tz = zone->tz;
> + int trip_temp, temp, last_temp, ret;
> +
> + if (!tz)
> + return -EINVAL;
> +
> + ret = tz->ops->get_trip_temp(zone->tz, trip, &trip_temp);
> + if (ret)
> + return ret;
> +
> + mutex_lock(&tz->lock);
No need to use the mutex here.
Why not ?
temp = READ_ONCE(tz->temperature);
last_temp = READ_ONCE(tz->last_temperature);
> + temp = tz->temperature;
> + last_temp = tz->last_temperature;
> + mutex_unlock(&tz->lock);
> +
> + if (temp > trip_temp) {
> + if (temp >= last_temp)
> + *trend = THERMAL_TREND_RAISING;
> + else
> + *trend = THERMAL_TREND_STABLE;
> + } else if (temp < trip_temp) {
> + *trend = THERMAL_TREND_DROPPING;
> + } else {
> + *trend = THERMAL_TREND_STABLE;
> + }
> +
> + return 0;
> +}
> +
> static const struct thermal_zone_of_device_ops tegra_of_thermal_ops = {
> .get_temp = tegra_thermctl_get_temp,
> .set_trip_temp = tegra_thermctl_set_trip_temp,
> + .get_trend = tegra_thermctl_get_trend,
> };
>
> static int get_hot_temp(struct thermal_zone_device *tz, int *trip, int *temp)
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings
2019-02-18 9:47 ` Daniel Lezcano
@ 2019-02-19 2:14 ` Wei Ni
0 siblings, 0 replies; 15+ messages in thread
From: Wei Ni @ 2019-02-19 2:14 UTC (permalink / raw)
To: Daniel Lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
On 18/2/2019 5:47 PM, Daniel Lezcano wrote:
> On 03/01/2019 11:12, Wei Ni wrote:
>> Convert warnings to info as not all platforms may
>> have all the thresholds and sensors enabled.
>>
>> Signed-off-by: Wei Ni <wni@nvidia.com>
>> ---
>
> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Daniel, thank you for your review.
>
>> drivers/thermal/tegra/soctherm.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
>> index ed28110a3535..f07de8258e93 100644
>> --- a/drivers/thermal/tegra/soctherm.c
>> +++ b/drivers/thermal/tegra/soctherm.c
>> @@ -569,7 +569,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
>> set_throttle:
>> ret = get_hot_temp(tz, &trip, &temperature);
>> if (ret) {
>> - dev_warn(dev, "throttrip: %s: missing hot temperature\n",
>> + dev_info(dev, "throttrip: %s: missing hot temperature\n",
>> sg->name);
>> return 0;
>> }
>> @@ -600,7 +600,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
>> }
>>
>> if (i == THROTTLE_SIZE)
>> - dev_warn(dev, "throttrip: %s: missing throttle cdev\n",
>> + dev_info(dev, "throttrip: %s: missing throttle cdev\n",
>> sg->name);
>>
>> return 0;
>>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 3/3] thermal: tegra: add get_trend ops
2019-02-18 10:27 ` Daniel Lezcano
@ 2019-02-19 2:15 ` Wei Ni
2020-03-30 17:23 ` Daniel Lezcano
0 siblings, 1 reply; 15+ messages in thread
From: Wei Ni @ 2019-02-19 2:15 UTC (permalink / raw)
To: Daniel Lezcano, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
On 18/2/2019 6:27 PM, Daniel Lezcano wrote:
> On 03/01/2019 11:12, Wei Ni wrote:
>> Add support for get_trend ops that allows soctherm
>> sensors to be used with the step-wise governor.
>>
>> Signed-off-by: Wei Ni <wni@nvidia.com>
>> ---
>> drivers/thermal/tegra/soctherm.c | 34 ++++++++++++++++++++++++++++++++++
>> 1 file changed, 34 insertions(+)
>>
>> diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
>> index fd2703c0cfc5..864205af104b 100644
>> --- a/drivers/thermal/tegra/soctherm.c
>> +++ b/drivers/thermal/tegra/soctherm.c
>> @@ -488,9 +488,43 @@ static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp)
>> return 0;
>> }
>>
>> +static int tegra_thermctl_get_trend(void *data, int trip,
>> + enum thermal_trend *trend)
>> +{
>> + struct tegra_thermctl_zone *zone = data;
>> + struct thermal_zone_device *tz = zone->tz;
>> + int trip_temp, temp, last_temp, ret;
>> +
>> + if (!tz)
>> + return -EINVAL;
>> +
>> + ret = tz->ops->get_trip_temp(zone->tz, trip, &trip_temp);
>> + if (ret)
>> + return ret;
>> +
>> + mutex_lock(&tz->lock);
>
> No need to use the mutex here.
>
> Why not ?
>
> temp = READ_ONCE(tz->temperature);
> last_temp = READ_ONCE(tz->last_temperature);
Yes, you are right, will change it in next version.
Wei.
>
>> + temp = tz->temperature;
>> + last_temp = tz->last_temperature;
>> + mutex_unlock(&tz->lock);
>> +
>> + if (temp > trip_temp) {
>> + if (temp >= last_temp)
>> + *trend = THERMAL_TREND_RAISING;
>> + else
>> + *trend = THERMAL_TREND_STABLE;
>> + } else if (temp < trip_temp) {
>> + *trend = THERMAL_TREND_DROPPING;
>> + } else {
>> + *trend = THERMAL_TREND_STABLE;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> static const struct thermal_zone_of_device_ops tegra_of_thermal_ops = {
>> .get_temp = tegra_thermctl_get_temp,
>> .set_trip_temp = tegra_thermctl_set_trip_temp,
>> + .get_trend = tegra_thermctl_get_trend,
>> };
>>
>> static int get_hot_temp(struct thermal_zone_device *tz, int *trip, int *temp)
>>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 0/3] Fixes for Tegra soctherm
2019-02-18 7:59 ` Wei Ni
@ 2019-02-20 2:14 ` Zhang Rui
2019-02-20 8:42 ` Wei Ni
0 siblings, 1 reply; 15+ messages in thread
From: Zhang Rui @ 2019-02-20 2:14 UTC (permalink / raw)
To: Wei Ni, daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, srikars, linux-kernel, linux-pm
On 一, 2019-02-18 at 15:59 +0800, Wei Ni wrote:
> Rui,
> Will you take this serial?
>
it is already in my tree.
I missed -rc6, thus I will queue them for 5.1-rc1.
thanks,
rui
> Thanks.
> Wei.
>
> On 21/1/2019 5:17 PM, Wei Ni wrote:
> >
> > Does there have any comments?
> >
> > Thanks.
> > Wei.
> >
> > On 11/1/2019 10:20 AM, Wei Ni wrote:
> > >
> > > Hi Eduardo,
> > > Do you have any more comments, will you take this serial?
> > >
> > > Thanks.
> > > Wei.
> > >
> > > On 3/1/2019 6:12 PM, Wei Ni wrote:
> > > >
> > > > This series fixed some issues for Tegra soctherm,
> > > > and add get_trend().
> > > >
> > > > Main changes from v6:
> > > > 1. Per Eduardo's comment, we can remove the change:
> > > > "thermal: tegra: parse sensor id before sensor register"
> > > >
> > > > Main changes from v5:
> > > > 1. Move the get_trend() patch https://lkml.org/lkml/2018/11/20/
> > > > 643
> > > > into this serial.
> > > >
> > > > Main changes from v4:
> > > > 1. fixed for the parsing sensor id.
> > > > 2. keep warning for missing critical trips.
> > > >
> > > > Main changes from v3:
> > > > 1. updated codes for parsing sensor id, per Thierry's comments
> > > >
> > > > Main changes from v2:
> > > > 1. add codes to parse sensor id to avoid registration
> > > > failure.
> > > >
> > > > Main changes from v1:
> > > > 1. Acked by Thierry Reding <treding@nvidia.com> for the patch
> > > > "thermal: tegra: fix memory allocation".
> > > > 2. Print out the sensor name when register failed.
> > > > 2. Remove patch "thermal: tegra: fix coverity defect"
> > > >
> > > > Wei Ni (3):
> > > > thermal: tegra: remove unnecessary warnings
> > > > thermal: tegra: fix memory allocation
> > > > thermal: tegra: add get_trend ops
> > > >
> > > > drivers/thermal/tegra/soctherm.c | 40
> > > > +++++++++++++++++++++++++++++++++++++---
> > > > 1 file changed, 37 insertions(+), 3 deletions(-)
> > > >
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 0/3] Fixes for Tegra soctherm
2019-02-20 2:14 ` Zhang Rui
@ 2019-02-20 8:42 ` Wei Ni
0 siblings, 0 replies; 15+ messages in thread
From: Wei Ni @ 2019-02-20 8:42 UTC (permalink / raw)
To: Zhang Rui, daniel.lezcano, edubezval
Cc: thierry.reding, linux-tegra, srikars, linux-kernel, linux-pm
On 20/2/2019 10:14 AM, Zhang Rui wrote:
> On 一, 2019-02-18 at 15:59 +0800, Wei Ni wrote:
>> Rui,
>> Will you take this serial?
>>
> it is already in my tree.
> I missed -rc6, thus I will queue them for 5.1-rc1.
Thanks.
I updated v8 patch per Daniel Lezcano's comment.
Please check it.
Wei.
>
> thanks,
> rui
>
>> Thanks.
>> Wei.
>>
>> On 21/1/2019 5:17 PM, Wei Ni wrote:
>>>
>>> Does there have any comments?
>>>
>>> Thanks.
>>> Wei.
>>>
>>> On 11/1/2019 10:20 AM, Wei Ni wrote:
>>>>
>>>> Hi Eduardo,
>>>> Do you have any more comments, will you take this serial?
>>>>
>>>> Thanks.
>>>> Wei.
>>>>
>>>> On 3/1/2019 6:12 PM, Wei Ni wrote:
>>>>>
>>>>> This series fixed some issues for Tegra soctherm,
>>>>> and add get_trend().
>>>>>
>>>>> Main changes from v6:
>>>>> 1. Per Eduardo's comment, we can remove the change:
>>>>> "thermal: tegra: parse sensor id before sensor register"
>>>>>
>>>>> Main changes from v5:
>>>>> 1. Move the get_trend() patch https://lkml.org/lkml/2018/11/20/
>>>>> 643
>>>>> into this serial.
>>>>>
>>>>> Main changes from v4:
>>>>> 1. fixed for the parsing sensor id.
>>>>> 2. keep warning for missing critical trips.
>>>>>
>>>>> Main changes from v3:
>>>>> 1. updated codes for parsing sensor id, per Thierry's comments
>>>>>
>>>>> Main changes from v2:
>>>>> 1. add codes to parse sensor id to avoid registration
>>>>> failure.
>>>>>
>>>>> Main changes from v1:
>>>>> 1. Acked by Thierry Reding <treding@nvidia.com> for the patch
>>>>> "thermal: tegra: fix memory allocation".
>>>>> 2. Print out the sensor name when register failed.
>>>>> 2. Remove patch "thermal: tegra: fix coverity defect"
>>>>>
>>>>> Wei Ni (3):
>>>>> thermal: tegra: remove unnecessary warnings
>>>>> thermal: tegra: fix memory allocation
>>>>> thermal: tegra: add get_trend ops
>>>>>
>>>>> drivers/thermal/tegra/soctherm.c | 40
>>>>> +++++++++++++++++++++++++++++++++++++---
>>>>> 1 file changed, 37 insertions(+), 3 deletions(-)
>>>>>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v7 3/3] thermal: tegra: add get_trend ops
2019-02-19 2:15 ` Wei Ni
@ 2020-03-30 17:23 ` Daniel Lezcano
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Lezcano @ 2020-03-30 17:23 UTC (permalink / raw)
To: Wei Ni, edubezval
Cc: thierry.reding, linux-tegra, rui.zhang, srikars, linux-kernel, linux-pm
Hi Wei,
On 19/02/2019 03:15, Wei Ni wrote:
>>> +static int tegra_thermctl_get_trend(void *data, int trip, +
>>> enum thermal_trend *trend)
[ ... ]
>>> + temp = tz->temperature; + last_temp = tz->last_temperature; +
>>> mutex_unlock(&tz->lock); + + if (temp > trip_temp) { + if
>>> (temp >= last_temp) + *trend = THERMAL_TREND_RAISING; +
>>> else + *trend = THERMAL_TREND_STABLE; + } else if (temp <
>>> trip_temp) { + *trend = THERMAL_TREND_DROPPING; + } else { +
>>> *trend = THERMAL_TREND_STABLE; + } + + return 0; +} + static
>>> const struct thermal_zone_of_device_ops tegra_of_thermal_ops =
>>> { .get_temp = tegra_thermctl_get_temp, .set_trip_temp =
>>> tegra_thermctl_set_trip_temp, + .get_trend =
>>> tegra_thermctl_get_trend, };
It has been awhile since this patch was submitted and merged by
Eduardo. I replace him to co-maintain the thermal framework with Rui.
While figuring out the internals for code cleanup, I ended up in this
function above.
Why do you have to use this routine instead of the generic one in
get_tz_trend()?
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-03-30 17:23 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03 10:12 [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
2019-01-03 10:12 ` [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
2019-02-18 9:47 ` Daniel Lezcano
2019-02-19 2:14 ` Wei Ni
2019-01-03 10:12 ` [PATCH v7 2/3] thermal: tegra: fix memory allocation Wei Ni
2019-02-18 10:24 ` Daniel Lezcano
2019-01-03 10:12 ` [PATCH v7 3/3] thermal: tegra: add get_trend ops Wei Ni
2019-02-18 10:27 ` Daniel Lezcano
2019-02-19 2:15 ` Wei Ni
2020-03-30 17:23 ` Daniel Lezcano
2019-01-11 2:20 ` [PATCH v7 0/3] Fixes for Tegra soctherm Wei Ni
2019-01-21 9:17 ` Wei Ni
2019-02-18 7:59 ` Wei Ni
2019-02-20 2:14 ` Zhang Rui
2019-02-20 8:42 ` Wei Ni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).