2019-01-03 14:17:43

by Wei Ni

[permalink] [raw]
Subject: [PATCH v7 0/3] Fixes for Tegra soctherm

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 <[email protected]> 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



2019-01-03 14:17:43

by Wei Ni

[permalink] [raw]
Subject: [PATCH v7 2/3] thermal: tegra: fix memory allocation

Fix memory allocation to store the pointers to
thermal_zone_device.

Signed-off-by: Wei Ni <[email protected]>
Acked-by: Thierry Reding <[email protected]>
---
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


2019-01-03 14:17:43

by Wei Ni

[permalink] [raw]
Subject: [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings

Convert warnings to info as not all platforms may
have all the thresholds and sensors enabled.

Signed-off-by: Wei Ni <[email protected]>
---
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


2019-01-03 14:17:43

by Wei Ni

[permalink] [raw]
Subject: [PATCH v7 3/3] thermal: tegra: add get_trend ops

Add support for get_trend ops that allows soctherm
sensors to be used with the step-wise governor.

Signed-off-by: Wei Ni <[email protected]>
---
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


2019-01-11 06:02:38

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH v7 0/3] Fixes for Tegra soctherm

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 <[email protected]> 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(-)
>

2019-01-21 09:19:31

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH v7 0/3] Fixes for Tegra soctherm

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 <[email protected]> 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(-)
>>

2019-02-18 08:09:07

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH v7 0/3] Fixes for Tegra soctherm

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 <[email protected]> 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(-)
>>>

2019-02-18 09:53:49

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings

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 <[email protected]>
> ---

Reviewed-by: Daniel Lezcano <[email protected]>

> 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


2019-02-18 10:30:24

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH v7 2/3] thermal: tegra: fix memory allocation

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 <[email protected]>
> Acked-by: Thierry Reding <[email protected]>
> ---

Good catch

Reviewed-by: Daniel Lezcano <[email protected]>


> 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


2019-02-18 10:31:56

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH v7 3/3] thermal: tegra: add get_trend ops

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 <[email protected]>
> ---
> 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


2019-02-19 02:50:29

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] thermal: tegra: remove unnecessary warnings



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 <[email protected]>
>> ---
>
> Reviewed-by: Daniel Lezcano <[email protected]>

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;
>>
>
>

2019-02-19 02:51:42

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH v7 3/3] thermal: tegra: add get_trend ops



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 <[email protected]>
>> ---
>> 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)
>>
>
>

2019-02-20 02:14:47

by Zhang, Rui

[permalink] [raw]
Subject: Re: [PATCH v7 0/3] Fixes for Tegra soctherm

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 <[email protected]> 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(-)
> > > >

2019-02-20 08:44:12

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH v7 0/3] Fixes for Tegra soctherm



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 <[email protected]> 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(-)
>>>>>

2020-03-30 17:25:48

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH v7 3/3] thermal: tegra: add get_trend ops

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