* [PATCH v2] drivers/thermal/thermal_of: Add change_mode ops support for thermal_of sensor
@ 2022-03-08 19:26 Manaf Meethalavalappu Pallikunhi
2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/thermal_of: " thermal-bot for Manaf Meethalavalappu Pallikunhi
0 siblings, 1 reply; 2+ messages in thread
From: Manaf Meethalavalappu Pallikunhi @ 2022-03-08 19:26 UTC (permalink / raw)
To: Rafael J . Wysocki, Daniel Lezcano, Amit Kucheria, Zhang Rui
Cc: linux-pm, linux-kernel, Manaf Meethalavalappu Pallikunhi
The sensor driver which register through thermal_of interface doesn't
have an option to get thermal zone mode change notification from
thermal core.
Add support for change_mode ops in thermal_of interface so that sensor
driver can use this ops for mode change notification.
Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
---
drivers/thermal/thermal_of.c | 12 ++++++++++++
include/linux/thermal.h | 3 +++
2 files changed, 15 insertions(+)
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 9233f7e..da48480 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -203,6 +203,14 @@ static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip,
return data->ops->get_trend(data->sensor_data, trip, trend);
}
+static int of_thermal_change_mode(struct thermal_zone_device *tz,
+ enum thermal_device_mode mode)
+{
+ struct __thermal_zone *data = tz->devdata;
+
+ return data->ops->change_mode(data->sensor_data, mode);
+}
+
static int of_thermal_bind(struct thermal_zone_device *thermal,
struct thermal_cooling_device *cdev)
{
@@ -408,6 +416,9 @@ thermal_zone_of_add_sensor(struct device_node *zone,
if (ops->set_emul_temp)
tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
+ if (ops->change_mode)
+ tzd->ops->change_mode = of_thermal_change_mode;
+
mutex_unlock(&tzd->lock);
return tzd;
@@ -569,6 +580,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
tzd->ops->get_temp = NULL;
tzd->ops->get_trend = NULL;
tzd->ops->set_emul_temp = NULL;
+ tzd->ops->change_mode = NULL;
tz->ops = NULL;
tz->sensor_data = NULL;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index c3148939..365733b 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -299,6 +299,8 @@ struct thermal_zone_params {
* temperature.
* @set_trip_temp: a pointer to a function that sets the trip temperature on
* hardware.
+ * @change_mode: a pointer to a function that notifies the thermal zone
+ * mode change.
*/
struct thermal_zone_of_device_ops {
int (*get_temp)(void *, int *);
@@ -306,6 +308,7 @@ struct thermal_zone_of_device_ops {
int (*set_trips)(void *, int, int);
int (*set_emul_temp)(void *, int);
int (*set_trip_temp)(void *, int, int);
+ int (*change_mode) (void *, enum thermal_device_mode);
};
/* Function declarations */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [thermal: thermal/next] thermal/drivers/thermal_of: Add change_mode ops support for thermal_of sensor
2022-03-08 19:26 [PATCH v2] drivers/thermal/thermal_of: Add change_mode ops support for thermal_of sensor Manaf Meethalavalappu Pallikunhi
@ 2022-05-19 12:44 ` thermal-bot for Manaf Meethalavalappu Pallikunhi
0 siblings, 0 replies; 2+ messages in thread
From: thermal-bot for Manaf Meethalavalappu Pallikunhi @ 2022-05-19 12:44 UTC (permalink / raw)
To: linux-pm; +Cc: Manaf Meethalavalappu Pallikunhi, Daniel Lezcano, rui.zhang,
amitk
The following commit has been merged into the thermal/next branch of thermal:
Commit-ID: bf70c577516b8d9fbe703371aa98bbea13661cec
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//bf70c577516b8d9fbe703371aa98bbea13661cec
Author: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
AuthorDate: Wed, 09 Mar 2022 00:56:26 +05:30
Committer: Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 19 May 2022 12:11:51 +02:00
thermal/drivers/thermal_of: Add change_mode ops support for thermal_of sensor
The sensor driver which register through thermal_of interface doesn't
have an option to get thermal zone mode change notification from
thermal core.
Add support for change_mode ops in thermal_of interface so that sensor
driver can use this ops for mode change notification.
Signed-off-by: Manaf Meethalavalappu Pallikunhi <quic_manafm@quicinc.com>
Link: https://lore.kernel.org/r/1646767586-31908-1-git-send-email-quic_manafm@quicinc.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/thermal/thermal_of.c | 12 ++++++++++++
include/linux/thermal.h | 3 +++
2 files changed, 15 insertions(+)
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 9233f7e..da48480 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -203,6 +203,14 @@ static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip,
return data->ops->get_trend(data->sensor_data, trip, trend);
}
+static int of_thermal_change_mode(struct thermal_zone_device *tz,
+ enum thermal_device_mode mode)
+{
+ struct __thermal_zone *data = tz->devdata;
+
+ return data->ops->change_mode(data->sensor_data, mode);
+}
+
static int of_thermal_bind(struct thermal_zone_device *thermal,
struct thermal_cooling_device *cdev)
{
@@ -408,6 +416,9 @@ thermal_zone_of_add_sensor(struct device_node *zone,
if (ops->set_emul_temp)
tzd->ops->set_emul_temp = of_thermal_set_emul_temp;
+ if (ops->change_mode)
+ tzd->ops->change_mode = of_thermal_change_mode;
+
mutex_unlock(&tzd->lock);
return tzd;
@@ -569,6 +580,7 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
tzd->ops->get_temp = NULL;
tzd->ops->get_trend = NULL;
tzd->ops->set_emul_temp = NULL;
+ tzd->ops->change_mode = NULL;
tz->ops = NULL;
tz->sensor_data = NULL;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index c314893..365733b 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -299,6 +299,8 @@ struct thermal_zone_params {
* temperature.
* @set_trip_temp: a pointer to a function that sets the trip temperature on
* hardware.
+ * @change_mode: a pointer to a function that notifies the thermal zone
+ * mode change.
*/
struct thermal_zone_of_device_ops {
int (*get_temp)(void *, int *);
@@ -306,6 +308,7 @@ struct thermal_zone_of_device_ops {
int (*set_trips)(void *, int, int);
int (*set_emul_temp)(void *, int);
int (*set_trip_temp)(void *, int, int);
+ int (*change_mode) (void *, enum thermal_device_mode);
};
/* Function declarations */
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-19 12:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-08 19:26 [PATCH v2] drivers/thermal/thermal_of: Add change_mode ops support for thermal_of sensor Manaf Meethalavalappu Pallikunhi
2022-05-19 12:44 ` [thermal: thermal/next] thermal/drivers/thermal_of: " thermal-bot for Manaf Meethalavalappu Pallikunhi
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).