diff options
author | Rajagopala V <rajagopala.v@stericsson.com> | 2011-09-26 18:05:36 +0530 |
---|---|---|
committer | Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | 2011-09-27 12:56:55 +0200 |
commit | fc08bb7e25e8bb430259d3d9740b110b75c38735 (patch) | |
tree | b4a378af74662e9c2a26a26dfb500b1cbfa527f1 | |
parent | 06b497a5ae4ebf03fb14210c3a6dd8bc40257739 (diff) |
abx500: support for ab5500 die temp monitoring
add support for ab5500 die temperature monitoring
as hardware supports reading input temperature
ST-Ericsson Linux next: NA
ST-Ericsson ID: 339643
ST-Ericsson FOSS-OUT ID: NA
Change-Id: I26db88645c4e627829211366bdc1df22ad8ac067
Signed-off-by: Rajagopala V <rajagopala.v@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/31981
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r-- | drivers/hwmon/ab5500.c | 6 | ||||
-rw-r--r-- | drivers/hwmon/ab8500.c | 22 | ||||
-rw-r--r-- | drivers/hwmon/abx500.c | 25 | ||||
-rw-r--r-- | drivers/hwmon/abx500.h | 2 |
4 files changed, 48 insertions, 7 deletions
diff --git a/drivers/hwmon/ab5500.c b/drivers/hwmon/ab5500.c index 79540c9a79b..7352e07ffde 100644 --- a/drivers/hwmon/ab5500.c +++ b/drivers/hwmon/ab5500.c @@ -139,6 +139,11 @@ static int ab5500_temp_shutdown_auto(struct abx500_temp *data) return ret; } +static int ab5500_is_visible(struct attribute *attr, int n) +{ + return attr->mode; +} + static int ab5500_temp_irq_handler(int irq, struct abx500_temp *data) { /* @@ -195,6 +200,7 @@ int __init abx500_hwmon_init(struct abx500_temp *data) data->ops.irq_handler = ab5500_temp_irq_handler; data->ops.show_name = ab5500_show_name; data->ops.show_label = ab5500_show_label; + data->ops.is_visible = ab5500_is_visible; return 0; } diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c index 67118a4f11d..9e81445322b 100644 --- a/drivers/hwmon/ab8500.c +++ b/drivers/hwmon/ab8500.c @@ -41,13 +41,8 @@ static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor) * Special treatment for the BAT_CTRL node, since this * temperature measurement is more complex than just * an ADC readout - * - * DIE_TEMP input temperature reading is not supported - * in AB8500 */ - if (sensor == DIE_TEMP) - val = 0; - else if (sensor == BAT_CTRL) + if (sensor == BAT_CTRL) val = ab8500_btemp_get_batctrl_temp(data->ab8500_btemp); else val = ab8500_gpadc_convert(data->ab8500_gpadc, sensor); @@ -107,6 +102,20 @@ static ssize_t ab8500_show_label(struct device *dev, return sprintf(buf, "%s\n", name); } +static int ab8500_is_visible(struct attribute *attr, int n) +{ + if (!strcmp(attr->name, "temp5_input") || + !strcmp(attr->name, "temp5_min") || + !strcmp(attr->name, "temp5_max") || + !strcmp(attr->name, "temp5_max_hyst") || + !strcmp(attr->name, "temp5_min_alarm") || + !strcmp(attr->name, "temp5_max_alarm") || + !strcmp(attr->name, "temp5_max_hyst_alarm")) + return 0; + + return attr->mode; +} + static int ab8500_temp_irq_handler(int irq, struct abx500_temp *data) { unsigned long delay_in_jiffies; @@ -168,6 +177,7 @@ int __init abx500_hwmon_init(struct abx500_temp *data) data->ops.irq_handler = ab8500_temp_irq_handler; data->ops.show_name = ab8500_show_name; data->ops.show_label = ab8500_show_label; + data->ops.is_visible = ab8500_is_visible; return 0; } diff --git a/drivers/hwmon/abx500.c b/drivers/hwmon/abx500.c index 68da2d03dbd..b26a13e8438 100644 --- a/drivers/hwmon/abx500.c +++ b/drivers/hwmon/abx500.c @@ -436,6 +436,14 @@ static ssize_t show_crit_alarm(struct device *dev, return sprintf(buf, "%ld\n", data->crit_alarm[attr->index - 1]); } +static mode_t abx500_attrs_visible(struct kobject *kobj, + struct attribute *a, int n) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct abx500_temp *data = dev_get_drvdata(dev); + return data->ops.is_visible(a, n); +} + static SENSOR_DEVICE_ATTR(temp_monitor_delay, S_IRUGO | S_IWUSR, show_temp_monitor_delay, set_temp_monitor_delay, 0); static SENSOR_DEVICE_ATTR(temp_power_off_delay, S_IRUGO | S_IWUSR, @@ -493,9 +501,17 @@ static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_max_alarm, NULL, 4); static SENSOR_DEVICE_ATTR(temp4_max_hyst_alarm, S_IRUGO, show_max_hyst_alarm, NULL, 4); -/* GPADC - SENSOR4 */ +/* GPADC - SENSOR5 */ static SENSOR_DEVICE_ATTR(temp5_label, S_IRUGO, show_label, NULL, 5); static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_input, NULL, 5); +static SENSOR_DEVICE_ATTR(temp5_min, S_IWUSR | S_IRUGO, show_min, set_min, 4); +static SENSOR_DEVICE_ATTR(temp5_max, S_IWUSR | S_IRUGO, show_max, set_max, 4); +static SENSOR_DEVICE_ATTR(temp5_max_hyst, S_IWUSR | S_IRUGO, + show_max_hyst, set_max_hyst, 4); +static SENSOR_DEVICE_ATTR(temp5_min_alarm, S_IRUGO, show_min_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR(temp5_max_alarm, S_IRUGO, show_max_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR(temp5_max_hyst_alarm, S_IRUGO, + show_max_hyst_alarm, NULL, 4); static SENSOR_DEVICE_ATTR(temp5_crit_alarm, S_IRUGO, show_crit_alarm, NULL, 5); @@ -542,12 +558,19 @@ struct attribute *abx500_temp_attributes[] = { /* GPADC SENSOR5*/ &sensor_dev_attr_temp5_label.dev_attr.attr, &sensor_dev_attr_temp5_input.dev_attr.attr, + &sensor_dev_attr_temp5_min.dev_attr.attr, + &sensor_dev_attr_temp5_max.dev_attr.attr, + &sensor_dev_attr_temp5_max_hyst.dev_attr.attr, + &sensor_dev_attr_temp5_min_alarm.dev_attr.attr, + &sensor_dev_attr_temp5_max_alarm.dev_attr.attr, + &sensor_dev_attr_temp5_max_hyst_alarm.dev_attr.attr, &sensor_dev_attr_temp5_crit_alarm.dev_attr.attr, NULL }; static const struct attribute_group abx500_temp_group = { .attrs = abx500_temp_attributes, + .is_visible = abx500_attrs_visible, }; static irqreturn_t abx500_temp_irq_handler(int irq, void *irq_data) diff --git a/drivers/hwmon/abx500.h b/drivers/hwmon/abx500.h index 77ae7cbd5c1..65a9a8238ba 100644 --- a/drivers/hwmon/abx500.h +++ b/drivers/hwmon/abx500.h @@ -22,6 +22,7 @@ struct abx500_temp; * @irq_handler: irq handler * @show_name: hwmon device name * @show_label: hwmon attribute label + * @is_visible: is attribute visible */ struct abx500_temp_ops { int (*read_sensor)(struct abx500_temp *, u8); @@ -30,6 +31,7 @@ struct abx500_temp_ops { struct device_attribute *, char *); ssize_t (*show_label) (struct device *, struct device_attribute *, char *); + int (*is_visible)(struct attribute *, int); }; /** |