* [PATCH v8 0/3] Fixes for Tegra soctherm
@ 2019-02-19 4:27 Wei Ni
2019-02-19 4:27 ` [PATCH v8 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wei Ni @ 2019-02-19 4:27 UTC (permalink / raw)
To: daniel.lezcano, edubezval, linux-tegra
Cc: thierry.reding, rui.zhang, srikars, linux-kernel, linux-pm,
devicetree, Wei Ni
This series fixed some issues for Tegra soctherm,
and add get_trend().
Main changes from v7:
1. use READ_ONCE to get temperature in 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"
*** BLURB HERE ***
Wei Ni (3):
thermal: tegra: remove unnecessary warnings
thermal: tegra: fix memory allocation
thermal: tegra: add get_trend ops
drivers/thermal/tegra/soctherm.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v8 1/3] thermal: tegra: remove unnecessary warnings
2019-02-19 4:27 [PATCH v8 0/3] Fixes for Tegra soctherm Wei Ni
@ 2019-02-19 4:27 ` Wei Ni
2019-02-19 4:27 ` [PATCH v8 2/3] thermal: tegra: fix memory allocation Wei Ni
2019-02-19 4:27 ` [PATCH v8 3/3] thermal: tegra: add get_trend ops Wei Ni
2 siblings, 0 replies; 4+ messages in thread
From: Wei Ni @ 2019-02-19 4:27 UTC (permalink / raw)
To: daniel.lezcano, edubezval, linux-tegra
Cc: thierry.reding, rui.zhang, srikars, linux-kernel, linux-pm,
devicetree, 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>
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 45b41b885f49..fa50484e1c84 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] 4+ messages in thread
* [PATCH v8 2/3] thermal: tegra: fix memory allocation
2019-02-19 4:27 [PATCH v8 0/3] Fixes for Tegra soctherm Wei Ni
2019-02-19 4:27 ` [PATCH v8 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
@ 2019-02-19 4:27 ` Wei Ni
2019-02-19 4:27 ` [PATCH v8 3/3] thermal: tegra: add get_trend ops Wei Ni
2 siblings, 0 replies; 4+ messages in thread
From: Wei Ni @ 2019-02-19 4:27 UTC (permalink / raw)
To: daniel.lezcano, edubezval, linux-tegra
Cc: thierry.reding, rui.zhang, srikars, linux-kernel, linux-pm,
devicetree, 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>
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 fa50484e1c84..b1ead6ea4c73 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -1329,7 +1329,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] 4+ messages in thread
* [PATCH v8 3/3] thermal: tegra: add get_trend ops
2019-02-19 4:27 [PATCH v8 0/3] Fixes for Tegra soctherm Wei Ni
2019-02-19 4:27 ` [PATCH v8 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
2019-02-19 4:27 ` [PATCH v8 2/3] thermal: tegra: fix memory allocation Wei Ni
@ 2019-02-19 4:27 ` Wei Ni
2 siblings, 0 replies; 4+ messages in thread
From: Wei Ni @ 2019-02-19 4:27 UTC (permalink / raw)
To: daniel.lezcano, edubezval, linux-tegra
Cc: thierry.reding, rui.zhang, srikars, linux-kernel, linux-pm,
devicetree, 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 | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index b1ead6ea4c73..70043a28eb7a 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -488,9 +488,41 @@ 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;
+
+ temp = READ_ONCE(tz->temperature);
+ last_temp = READ_ONCE(tz->last_temperature);
+
+ 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] 4+ messages in thread
end of thread, other threads:[~2019-02-19 4:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 4:27 [PATCH v8 0/3] Fixes for Tegra soctherm Wei Ni
2019-02-19 4:27 ` [PATCH v8 1/3] thermal: tegra: remove unnecessary warnings Wei Ni
2019-02-19 4:27 ` [PATCH v8 2/3] thermal: tegra: fix memory allocation Wei Ni
2019-02-19 4:27 ` [PATCH v8 3/3] thermal: tegra: add get_trend ops 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).