* [PATCH AUTOSEL 4.20 100/304] Thermal: do not clear passive state during system sleep
[not found] <20190128154341.47195-1-sashal@kernel.org>
@ 2019-01-28 15:40 ` Sasha Levin
2019-01-28 15:40 ` [PATCH AUTOSEL 4.20 101/304] thermal: Fix locking in cooling device sysfs update cur_state Sasha Levin
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2019-01-28 15:40 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Wei Wang, Zhang Rui, Sasha Levin, linux-pm
From: Wei Wang <wvw@google.com>
[ Upstream commit 964f4843a455d2ffb199512b08be8d5f077c4cac ]
commit ff140fea847e ("Thermal: handle thermal zone device properly
during system sleep") added PM hook to call thermal zone reset during
sleep. However resetting thermal zone will also clear the passive state
and thus cancel the polling queue which leads the passive cooling device
state not being cleared properly after sleep.
thermal_pm_notify => thermal_zone_device_reset set passive to 0
thermal_zone_trip_update will skip update passive as `old_target ==
instance->target'.
monitor_thermal_zone => thermal_zone_device_set_polling will cancel
tz->poll_queue, so the cooling device state will not be changed
afterwards.
Reported-by: Kame Wang <kamewang@google.com>
Signed-off-by: Wei Wang <wvw@google.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/thermal/thermal_core.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d6ebc1cf6aa9..3a014cd8daf0 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -453,16 +453,20 @@ static void update_temperature(struct thermal_zone_device *tz)
tz->last_temperature, tz->temperature);
}
-static void thermal_zone_device_reset(struct thermal_zone_device *tz)
+static void thermal_zone_device_init(struct thermal_zone_device *tz)
{
struct thermal_instance *pos;
-
tz->temperature = THERMAL_TEMP_INVALID;
- tz->passive = 0;
list_for_each_entry(pos, &tz->thermal_instances, tz_node)
pos->initialized = false;
}
+static void thermal_zone_device_reset(struct thermal_zone_device *tz)
+{
+ tz->passive = 0;
+ thermal_zone_device_init(tz);
+}
+
void thermal_zone_device_update(struct thermal_zone_device *tz,
enum thermal_notify_event event)
{
@@ -1504,7 +1508,7 @@ static int thermal_pm_notify(struct notifier_block *nb,
case PM_POST_SUSPEND:
atomic_set(&in_suspend, 0);
list_for_each_entry(tz, &thermal_tz_list, node) {
- thermal_zone_device_reset(tz);
+ thermal_zone_device_init(tz);
thermal_zone_device_update(tz,
THERMAL_EVENT_UNSPECIFIED);
}
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 4.20 101/304] thermal: Fix locking in cooling device sysfs update cur_state
[not found] <20190128154341.47195-1-sashal@kernel.org>
2019-01-28 15:40 ` [PATCH AUTOSEL 4.20 100/304] Thermal: do not clear passive state during system sleep Sasha Levin
@ 2019-01-28 15:40 ` Sasha Levin
2019-01-28 15:41 ` [PATCH AUTOSEL 4.20 158/304] cpuidle: big.LITTLE: fix refcount leak Sasha Levin
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2019-01-28 15:40 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Thara Gopinath, Zhang Rui, Sasha Levin, linux-pm
From: Thara Gopinath <thara.gopinath@linaro.org>
[ Upstream commit 68000a0d983f539c95ebe5dccd4f29535c7ac0af ]
Sysfs interface to update cooling device cur_state does not
currently holding cooling device lock sometimes leading to
stale values in cur_state if getting updated simultanelously
from user space and thermal framework. Adding the proper locking
code fixes this issue.
Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/thermal/thermal_sysfs.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 2241ceae7d7f..aa99edb4dff7 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -712,11 +712,14 @@ cur_state_store(struct device *dev, struct device_attribute *attr,
if ((long)state < 0)
return -EINVAL;
+ mutex_lock(&cdev->lock);
+
result = cdev->ops->set_cur_state(cdev, state);
- if (result)
- return result;
- thermal_cooling_device_stats_update(cdev, state);
- return count;
+ if (!result)
+ thermal_cooling_device_stats_update(cdev, state);
+
+ mutex_unlock(&cdev->lock);
+ return result ? result : count;
}
static struct device_attribute
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 4.20 158/304] cpuidle: big.LITTLE: fix refcount leak
[not found] <20190128154341.47195-1-sashal@kernel.org>
2019-01-28 15:40 ` [PATCH AUTOSEL 4.20 100/304] Thermal: do not clear passive state during system sleep Sasha Levin
2019-01-28 15:40 ` [PATCH AUTOSEL 4.20 101/304] thermal: Fix locking in cooling device sysfs update cur_state Sasha Levin
@ 2019-01-28 15:41 ` Sasha Levin
2019-01-28 15:41 ` [PATCH AUTOSEL 4.20 159/304] OPP: Use opp_table->regulators to verify no regulator case Sasha Levin
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2019-01-28 15:41 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Yangtao Li, Sasha Levin, Rafael J . Wysocki, linux-arm-kernel,
linux-pm
From: Yangtao Li <tiny.windzz@gmail.com>
[ Upstream commit 9456823c842f346c74265fcd98d008d87a7eb6f5 ]
of_find_node_by_path() acquires a reference to the node
returned by it and that reference needs to be dropped by its caller.
bl_idle_init() doesn't do that, so fix it.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/cpuidle/cpuidle-big_little.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
index db2ede565f1a..b44476a1b7ad 100644
--- a/drivers/cpuidle/cpuidle-big_little.c
+++ b/drivers/cpuidle/cpuidle-big_little.c
@@ -167,6 +167,7 @@ static int __init bl_idle_init(void)
{
int ret;
struct device_node *root = of_find_node_by_path("/");
+ const struct of_device_id *match_id;
if (!root)
return -ENODEV;
@@ -174,7 +175,11 @@ static int __init bl_idle_init(void)
/*
* Initialize the driver just for a compliant set of machines
*/
- if (!of_match_node(compatible_machine_match, root))
+ match_id = of_match_node(compatible_machine_match, root);
+
+ of_node_put(root);
+
+ if (!match_id)
return -ENODEV;
if (!mcpm_is_available())
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 4.20 159/304] OPP: Use opp_table->regulators to verify no regulator case
[not found] <20190128154341.47195-1-sashal@kernel.org>
` (2 preceding siblings ...)
2019-01-28 15:41 ` [PATCH AUTOSEL 4.20 158/304] cpuidle: big.LITTLE: fix refcount leak Sasha Levin
@ 2019-01-28 15:41 ` Sasha Levin
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 287/304] thermal: bcm2835: enable hwmon explicitly Sasha Levin
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2019-01-28 15:41 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Viresh Kumar, Sasha Levin, linux-pm
From: Viresh Kumar <viresh.kumar@linaro.org>
[ Upstream commit 90e3577b5feb42bac1269e16bb3d2bdd8f6df40f ]
The value of opp_table->regulator_count is not very consistent right now
and it may end up being 0 while we do have a "opp-microvolt" property in
the OPP table. It was kept that way as we used to check if any
regulators are set with the OPP core for a device or not using value of
regulator_count.
Lets use opp_table->regulators for that purpose as the meaning of
regulator_count is going to change in the later patches.
Reported-by: Quentin Perret <quentin.perret@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/opp/core.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 9280f51f1ce6..82baed4b80d4 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -196,12 +196,12 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
if (IS_ERR(opp_table))
return 0;
- count = opp_table->regulator_count;
-
/* Regulator may not be required for the device */
- if (!count)
+ if (!opp_table->regulators)
goto put_opp_table;
+ count = opp_table->regulator_count;
+
uV = kmalloc_array(count, sizeof(*uV), GFP_KERNEL);
if (!uV)
goto put_opp_table;
@@ -1102,6 +1102,9 @@ static bool _opp_supported_by_regulators(struct dev_pm_opp *opp,
struct regulator *reg;
int i;
+ if (!opp_table->regulators)
+ return true;
+
for (i = 0; i < opp_table->regulator_count; i++) {
reg = opp_table->regulators[i];
@@ -1386,7 +1389,7 @@ static int _allocate_set_opp_data(struct opp_table *opp_table)
struct dev_pm_set_opp_data *data;
int len, count = opp_table->regulator_count;
- if (WARN_ON(!count))
+ if (WARN_ON(!opp_table->regulators))
return -EINVAL;
/* space for set_opp_data */
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 4.20 287/304] thermal: bcm2835: enable hwmon explicitly
[not found] <20190128154341.47195-1-sashal@kernel.org>
` (3 preceding siblings ...)
2019-01-28 15:41 ` [PATCH AUTOSEL 4.20 159/304] OPP: Use opp_table->regulators to verify no regulator case Sasha Levin
@ 2019-01-28 15:43 ` Sasha Levin
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 289/304] thermal: tsens: qcom: do not create duplicate regmap debugfs entries Sasha Levin
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 292/304] thermal: generic-adc: Fix adc to temp interpolation Sasha Levin
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2019-01-28 15:43 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Matthias Brugger, Eduardo Valentin, Sasha Levin, linux-pm
From: Matthias Brugger <mbrugger@suse.com>
[ Upstream commit d56c19d07e0bc3ceff366a49b7d7a2440c967b1b ]
By defaul of-based thermal driver do not enable hwmon.
This patch does this explicitly, so that the temperature can be read
through the common hwmon sysfs.
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/thermal/broadcom/bcm2835_thermal.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index b9d90f0ed504..720760cd493f 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -18,6 +18,8 @@
#include <linux/platform_device.h>
#include <linux/thermal.h>
+#include "../thermal_hwmon.h"
+
#define BCM2835_TS_TSENSCTL 0x00
#define BCM2835_TS_TSENSSTAT 0x04
@@ -266,6 +268,15 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, tz);
+ /*
+ * Thermal_zone doesn't enable hwmon as default,
+ * enable it here
+ */
+ tz->tzp->no_hwmon = false;
+ err = thermal_add_hwmon_sysfs(tz);
+ if (err)
+ goto err_tz;
+
bcm2835_thermal_debugfs(pdev);
return 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 4.20 289/304] thermal: tsens: qcom: do not create duplicate regmap debugfs entries
[not found] <20190128154341.47195-1-sashal@kernel.org>
` (4 preceding siblings ...)
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 287/304] thermal: bcm2835: enable hwmon explicitly Sasha Levin
@ 2019-01-28 15:43 ` Sasha Levin
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 292/304] thermal: generic-adc: Fix adc to temp interpolation Sasha Levin
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2019-01-28 15:43 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Srinivas Kandagatla, Eduardo Valentin, Sasha Levin, linux-pm,
linux-arm-msm
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
[ Upstream commit 4ab248b3b10a58e379e2d32333fff99ea5ca256c ]
Regmap would use device name to create debugfs entries. If the device
has multiple regmaps it is recommended to use name field in regmap_config.
Fix this by providing name to the regmap configs correctly.
Without this patch we would see below error on DB820c.
qcom-tsens 4a9000.thermal-sensor: Failed to create 4a9000.thermal-sensor
debugfs directory
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Amit Kucheria <amit.kucheria@linaro.org>
Tested-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/thermal/qcom/tsens-common.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
index 3be4be2e0465..78652cac7f3d 100644
--- a/drivers/thermal/qcom/tsens-common.c
+++ b/drivers/thermal/qcom/tsens-common.c
@@ -114,6 +114,14 @@ int get_temp_common(struct tsens_device *tmdev, int id, int *temp)
}
static const struct regmap_config tsens_config = {
+ .name = "tm",
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+};
+
+static const struct regmap_config tsens_srot_config = {
+ .name = "srot",
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
@@ -139,8 +147,8 @@ int __init init_common(struct tsens_device *tmdev)
if (IS_ERR(srot_base))
return PTR_ERR(srot_base);
- tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev,
- srot_base, &tsens_config);
+ tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, srot_base,
+ &tsens_srot_config);
if (IS_ERR(tmdev->srot_map))
return PTR_ERR(tmdev->srot_map);
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH AUTOSEL 4.20 292/304] thermal: generic-adc: Fix adc to temp interpolation
[not found] <20190128154341.47195-1-sashal@kernel.org>
` (5 preceding siblings ...)
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 289/304] thermal: tsens: qcom: do not create duplicate regmap debugfs entries Sasha Levin
@ 2019-01-28 15:43 ` Sasha Levin
6 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2019-01-28 15:43 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Bjorn Andersson, Laxman Dewangan, Eduardo Valentin, Sasha Levin,
linux-pm
From: Bjorn Andersson <bjorn.andersson@linaro.org>
[ Upstream commit 9d216211fded20fff301d0317af3238d8383634c ]
First correct the edge case to return the last element if we're
outside the range, rather than at the last element, so that
interpolation is not omitted for points between the two last entries in
the table.
Then correct the formula to perform linear interpolation based the two
points surrounding the read ADC value. The indices for temp are kept as
"hi" and "lo" to pair with the adc indices, but there's no requirement
that the temperature is provided in descendent order. mult_frac() is
used to prevent issues with overflowing the int.
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/thermal/thermal-generic-adc.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c
index bf1c628d4a7a..e22fc60ad36d 100644
--- a/drivers/thermal/thermal-generic-adc.c
+++ b/drivers/thermal/thermal-generic-adc.c
@@ -26,7 +26,7 @@ struct gadc_thermal_info {
static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
{
- int temp, adc_hi, adc_lo;
+ int temp, temp_hi, temp_lo, adc_hi, adc_lo;
int i;
for (i = 0; i < gti->nlookup_table; i++) {
@@ -36,13 +36,17 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
if (i == 0) {
temp = gti->lookup_table[0];
- } else if (i >= (gti->nlookup_table - 1)) {
+ } else if (i >= gti->nlookup_table) {
temp = gti->lookup_table[2 * (gti->nlookup_table - 1)];
} else {
adc_hi = gti->lookup_table[2 * i - 1];
adc_lo = gti->lookup_table[2 * i + 1];
- temp = gti->lookup_table[2 * i];
- temp -= ((val - adc_lo) * 1000) / (adc_hi - adc_lo);
+
+ temp_hi = gti->lookup_table[2 * i - 2];
+ temp_lo = gti->lookup_table[2 * i];
+
+ temp = temp_hi + mult_frac(temp_lo - temp_hi, val - adc_hi,
+ adc_lo - adc_hi);
}
return temp;
--
2.19.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-01-28 15:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190128154341.47195-1-sashal@kernel.org>
2019-01-28 15:40 ` [PATCH AUTOSEL 4.20 100/304] Thermal: do not clear passive state during system sleep Sasha Levin
2019-01-28 15:40 ` [PATCH AUTOSEL 4.20 101/304] thermal: Fix locking in cooling device sysfs update cur_state Sasha Levin
2019-01-28 15:41 ` [PATCH AUTOSEL 4.20 158/304] cpuidle: big.LITTLE: fix refcount leak Sasha Levin
2019-01-28 15:41 ` [PATCH AUTOSEL 4.20 159/304] OPP: Use opp_table->regulators to verify no regulator case Sasha Levin
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 287/304] thermal: bcm2835: enable hwmon explicitly Sasha Levin
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 289/304] thermal: tsens: qcom: do not create duplicate regmap debugfs entries Sasha Levin
2019-01-28 15:43 ` [PATCH AUTOSEL 4.20 292/304] thermal: generic-adc: Fix adc to temp interpolation Sasha Levin
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).