* Re: [PATCH] Adding_write_support_to_trip_points
2010-10-26 19:46 [PATCH] Adding_write_support_to_trip_points durgadoss.r
@ 2010-10-26 9:00 ` Len Brown
2010-10-26 9:22 ` R, Durgadoss
2010-10-26 9:52 ` Alan Cox
2010-10-26 13:22 ` Matthew Garrett
2 siblings, 1 reply; 6+ messages in thread
From: Len Brown @ 2010-10-26 9:00 UTC (permalink / raw)
To: durgadoss.r; +Cc: alan, rui.zhang, linux-acpi, ramesh.agarwal, len.brown
On Wed, 27 Oct 2010, durgadoss.r@intel.com wrote:
> From: R.Durgadoss <durgadoss.r@intel.com>
>
> This patch makes the thermal trip points 'write'able.
> Thus, enabling the trip points to be configured at runtime.
> Please review and apply.
We've been through this with ACPI, and the decision was NOT
to allow writable trip points.
The reason is that the FIRMWARE is responsible for deciding when
to notify Linux if when a trip point actually trips -- and if the
firmware doesn't know that your trip point has moved, then
its notifications effectively become random, and the user
has been fooled into thinking that the trip point they moved
actually does something, when it may do nothing.
The only way to fix that is to POLL, and nobody likes polling.
Thus, no writable trip points.
thanks,
-Len Brown, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] Adding_write_support_to_trip_points
2010-10-26 9:00 ` Len Brown
@ 2010-10-26 9:22 ` R, Durgadoss
0 siblings, 0 replies; 6+ messages in thread
From: R, Durgadoss @ 2010-10-26 9:22 UTC (permalink / raw)
To: Len Brown
Cc: alan@linux.intel.com, Zhang, Rui, linux-acpi@vger.kernel.org,
Agarwal, Ramesh, Brown, Len, R, Durgadoss
> The reason is that the FIRMWARE is responsible for deciding when
> to notify Linux if when a trip point actually trips -- and if the
> firmware doesn't know that your trip point has moved, then
> its notifications effectively become random, and the user
> has been fooled into thinking that the trip point they moved
> actually does something, when it may do nothing.
I am trying to add this support for the platform DTS, for which
the thresholds need to be configured at run time.
In this case, the firmware is not involved. Also, the new
thresholds are written into the h/w registers. So, everybody
down the stack, will know that the trip points have moved. And
notifications will be w.r.t the newly written thresholds only.
Thanks,
Durgadoss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Adding_write_support_to_trip_points
2010-10-26 19:46 [PATCH] Adding_write_support_to_trip_points durgadoss.r
2010-10-26 9:00 ` Len Brown
@ 2010-10-26 9:52 ` Alan Cox
2010-10-26 10:49 ` R, Durgadoss
2010-10-26 13:22 ` Matthew Garrett
2 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2010-10-26 9:52 UTC (permalink / raw)
To: durgadoss.r; +Cc: lenb, rui.zhang, linux-acpi, ramesh.agarwal, len.brown
On Wed, 27 Oct 2010 01:16:50 +0530
durgadoss.r@intel.com wrote:
> From: R.Durgadoss <durgadoss.r@intel.com>
>
> This patch makes the thermal trip points 'write'able.
> Thus, enabling the trip points to be configured at runtime.
> Please review and apply.
Is the expectation that these would be set once at platform initialize
or that the trip points would be dynamically managed to generate
interrupts at different points for power management ?
Alan
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] Adding_write_support_to_trip_points
2010-10-26 9:52 ` Alan Cox
@ 2010-10-26 10:49 ` R, Durgadoss
0 siblings, 0 replies; 6+ messages in thread
From: R, Durgadoss @ 2010-10-26 10:49 UTC (permalink / raw)
To: Alan Cox
Cc: lenb@kernel.org, Zhang, Rui, linux-acpi@vger.kernel.org,
Agarwal, Ramesh, Brown, Len
> Is the expectation that these would be set once at platform initialize
> or that the trip points would be dynamically managed to generate
> interrupts at different points for power management ?
Yes. The trip points would be dynamically managed to generate
interrupts at various temperatures.
Thanks,
Durgadoss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Adding_write_support_to_trip_points
2010-10-26 19:46 [PATCH] Adding_write_support_to_trip_points durgadoss.r
2010-10-26 9:00 ` Len Brown
2010-10-26 9:52 ` Alan Cox
@ 2010-10-26 13:22 ` Matthew Garrett
2 siblings, 0 replies; 6+ messages in thread
From: Matthew Garrett @ 2010-10-26 13:22 UTC (permalink / raw)
To: durgadoss.r; +Cc: lenb, alan, rui.zhang, linux-acpi, ramesh.agarwal, len.brown
On Wed, Oct 27, 2010 at 01:16:50AM +0530, durgadoss.r@intel.com wrote:
> From: R.Durgadoss <durgadoss.r@intel.com>
>
> This patch makes the thermal trip points 'write'able.
> Thus, enabling the trip points to be configured at runtime.
> Please review and apply.
If you're going to do this then you need to have a callback to determine
whether the platform supports this behaviour. ACPI doesn't and writes
should fail in that case.
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Adding_write_support_to_trip_points
@ 2010-10-26 19:46 durgadoss.r
2010-10-26 9:00 ` Len Brown
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: durgadoss.r @ 2010-10-26 19:46 UTC (permalink / raw)
To: lenb; +Cc: alan, rui.zhang, linux-acpi, durgadoss.r, ramesh.agarwal,
len.brown
From: R.Durgadoss <durgadoss.r@intel.com>
This patch makes the thermal trip points 'write'able.
Thus, enabling the trip points to be configured at runtime.
Please review and apply.
Signed-off-by: R.Durgadoss <durgadoss.r@intel.com>
---
drivers/thermal/thermal_sys.c | 60 ++++++++++++++++++++++++++++++++--------
include/linux/thermal.h | 2 +
2 files changed, 50 insertions(+), 12 deletions(-)
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 13c72c6..63b75dc 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -216,6 +216,30 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
}
static ssize_t
+trip_point_temp_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct thermal_zone_device *tz = to_thermal_zone(dev);
+ int trip, result;
+ unsigned long temperature;
+
+ if (!tz->ops->set_trip_temp)
+ return -EPERM;
+
+ if (!sscanf(attr->attr.name, "trip_point_%d_type", &trip))
+ return -EINVAL;
+
+ if (strict_strtoul(buf, 10, &temperature))
+ return -EINVAL;
+
+ mutex_lock(&thermal_trip_lock);
+ result = tz->ops->set_trip_temp(tz, trip, temperature);
+ mutex_unlock(&thermal_trip_lock);
+
+ return (result == 0) ? count : -EINVAL;
+}
+
+static ssize_t
passive_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -284,29 +308,41 @@ static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, \
static struct device_attribute trip_point_attrs[] = {
__ATTR(trip_point_0_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_0_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_0_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_1_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_1_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_1_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_2_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_2_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_2_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_3_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_3_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_3_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_4_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_4_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_4_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_5_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_5_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_5_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_6_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_6_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_6_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_7_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_7_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_7_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_8_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_8_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_8_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_9_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_9_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_9_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_10_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_10_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_10_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_11_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_11_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_11_temp, S_IRUGO | S_IWUSR, trip_point_temp_show,
+ trip_point_temp_store),
};
#define TRIP_POINT_ATTR_ADD(_dev, _index, result) \
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 1de8b9e..e5cc53b 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -58,6 +58,8 @@ struct thermal_zone_device_ops {
enum thermal_trip_type *);
int (*get_trip_temp) (struct thermal_zone_device *, int,
unsigned long *);
+ int (*set_trip_temp) (struct thermal_zone_device *, int,
+ unsigned long);
int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
int (*notify) (struct thermal_zone_device *, int,
enum thermal_trip_type);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-10-26 13:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 19:46 [PATCH] Adding_write_support_to_trip_points durgadoss.r
2010-10-26 9:00 ` Len Brown
2010-10-26 9:22 ` R, Durgadoss
2010-10-26 9:52 ` Alan Cox
2010-10-26 10:49 ` R, Durgadoss
2010-10-26 13:22 ` Matthew Garrett
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).