Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1366129

[PATCH V9 RESEND 07/14] thermal: of-thermal: allow setting trip_temp on hardware

From Wei Ni <wni@nvidia.com>
Newsgroups linux.kernel
Subject [PATCH V9 RESEND 07/14] thermal: of-thermal: allow setting trip_temp on hardware
Date 2016-03-29 12:40 +0200
Message-ID <rhZe2-4MC-27@gated-at.bofh.it> (permalink)
References <rhZ4m-4HB-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In current of-thermal, the .set_trip_temp only support to
set trip_temp for SW. But some sensors support to set
trip_temp on hardware, so that can trigger interrupt,
shutdown or any other events.
This patch adds .set_trip_temp() callback in
thermal_zone_of_device_ops{}, so that the sensor device can
use it to set trip_temp on hardware.

Signed-off-by: Wei Ni <wni@nvidia.com>
---
 drivers/thermal/of-thermal.c | 8 ++++++++
 include/linux/thermal.h      | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index acc767b6fdee..85288029b46c 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -331,6 +331,14 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
 	if (trip >= data->ntrips || trip < 0)
 		return -EDOM;
 
+	if (data->ops->set_trip_temp) {
+		int ret;
+
+		ret = data->ops->set_trip_temp(data->sensor_data, trip, temp);
+		if (ret)
+			return ret;
+	}
+
 	/* thermal framework should take care of data->mask & (1 << trip) */
 	data->trips[trip].temperature = temp;
 
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index a55d0523f75d..97b86c549df1 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -340,6 +340,7 @@ struct thermal_zone_of_device_ops {
 	int (*get_temp)(void *, int *);
 	int (*get_trend)(void *, long *);
 	int (*set_emul_temp)(void *, int);
+	int (*set_trip_temp)(void *, int, int);
 };
 
 /**
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V9 RESEND 00/14] Add T210 support in Tegra soctherm Wei Ni <wni@nvidia.com> - 2016-03-29 12:30 +0200
  [PATCH V9 RESEND 06/14] thermal: tegra: add a debugfs to show registers Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  Re: [PATCH V9 RESEND 00/14] Add T210 support in Tegra soctherm Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
    Re: [PATCH V9 RESEND 00/14] Add T210 support in Tegra soctherm Eduardo Valentin <edubezval@gmail.com> - 2016-03-29 17:20 +0200
  [PATCH V9 RESEND 03/14] thermal: tegra: get rid of PDIV/HOTSPOT hack Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 13/14] arm64: tegra: add soctherm node for Tegra210 Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
    Re: [PATCH V9 RESEND 13/14] arm64: tegra: add soctherm node for  Tegra210 Eduardo Valentin <edubezval@gmail.com> - 2016-03-29 17:20 +0200
      Re: [PATCH V9 RESEND 13/14] arm64: tegra: add soctherm node for Tegra210 Wei Ni <wni@nvidia.com> - 2016-03-30 05:30 +0200
        Re: [PATCH V9 RESEND 13/14] arm64: tegra: add soctherm node for Tegra210 Wei Ni <wni@nvidia.com> - 2016-03-30 12:30 +0200
      Re: [PATCH V9 RESEND 13/14] arm64: tegra: add soctherm node for Tegra210 Wei Ni <wni@nvidia.com> - 2016-04-01 09:10 +0200
  [PATCH V9 RESEND 02/14] thermal: tegra: combine sensor group-related data Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 11/14] thermal: tegra: handle HW initialization in one funcotion Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 07/14] thermal: of-thermal: allow setting trip_temp on hardware Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 01/14] thermal: tegra: move tegra thermal files into tegra directory Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 05/14] thermal: tegra: add Tegra210 specific SOC_THERM driver Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 09/14] thermal: tegra: add thermtrip function Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 10/14] thermal: tegra: handle clocks in one function Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 14/14] arm: tegra: set critical trips for Tegra124 Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
    Re: [PATCH V9 RESEND 14/14] arm: tegra: set critical trips for  Tegra124 Eduardo Valentin <edubezval@gmail.com> - 2016-03-29 17:20 +0200
      Re: [PATCH V9 RESEND 14/14] arm: tegra: set critical trips for Tegra124 Wei Ni <wni@nvidia.com> - 2016-04-01 09:10 +0200
    Re: [PATCH V9 RESEND 14/14] arm: tegra: set critical trips for Tegra124 Wei Ni <wni@nvidia.com> - 2016-03-30 12:40 +0200
  [PATCH V9 RESEND 12/14] thermal: tegra: add PM support Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  [PATCH V9 RESEND 08/14] of: add notes of critical trips for soctherm Wei Ni <wni@nvidia.com> - 2016-03-29 12:40 +0200
  Re: [PATCH V9 RESEND 00/14] Add T210 support in Tegra soctherm Eduardo Valentin <edubezval@gmail.com> - 2016-03-29 17:20 +0200

csiph-web