On 18-09-2013 05:38, Ajit Pal Singh wrote:[snip]Adds support for thermal sensors on STiH41x series SOCs.
Single trip point 'THERMAL_TRIP_CRITICAL' is supported.
STIH416 MPE sensor supports interrupt reporting when a preset
threshold temperature is crossed.
For rest of the thermal sensors a polling delay of 10000ms is
set.
CC: Stephen Gallimore <stephen.gallimore@xxxxxx>
CC: Srinivas Kandagatla <srinivas.kandagatla@xxxxxx>
Signed-off-by: Ajit Pal Singh <ajitpal.singh@xxxxxx>
+static irqreturn_t st_thermal_thresh_int(int irq, void *data)
+{
+ struct st_thermal_sensor *sensor = data;
+ struct device *dev = sensor_to_dev(sensor);
+
+ dev_dbg(dev, "%s,called\n", __func__);
+ thermal_zone_device_update(sensor->th_dev);
Are you sure you want to do this here? The above call might sleep.
[snip]
+ return IRQ_HANDLED;
+}
+static int st_thermal_notify(struct thermal_zone_device *th,
+ int trip, enum thermal_trip_type type)
+{
+ struct st_thermal_sensor *sensor = thzone_to_sensor(th);
+ struct device *dev = sensor_to_dev(sensor);
+
+ switch (type) {
+ case THERMAL_TRIP_CRITICAL:
+ /* TODO: Send event to user space */
It depends on what you mean by that. The core code will attempt to call
the shutdown command, in user space.
[snip]
+ dev_err(dev, "Critical temp reached:Going for shutdown\n");
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+module_platform_driver(st_thermal_driver);
+MODULE_AUTHOR("STMicroelectronics (R&D) Limited");
+MODULE_DESCRIPTION("STMicroelectronics STIH41x SOC thermal sensor driver");
+MODULE_LICENSE("GPL");
GPL v2?