summaryrefslogtreecommitdiff
path: root/drivers/hwmon/lm85.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-07-05 20:37:21 +0200
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:30 -0400
commit6b9aad2d8acf309f99213875dd94f2ec691fe820 (patch)
treea7a04fff758b33446674eec4cebf74aec75c309e /drivers/hwmon/lm85.c
parentb353a487b9d835da331edb443afedfd7977b3d76 (diff)
hwmon: (lm85) Export in5, in6 and in7 voltage channels
The SMSC EMC6D100 supports 3 additional voltage channels. The lm85 driver reads the register values for these, but doesn't create the corresponding sysfs files, so the user can't read the values nor write the limits. Create the missing sysfs files. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Juerg Haefliger <juergh at gmail.com> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/lm85.c')
-rw-r--r--drivers/hwmon/lm85.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index 111c2c800100..6229e7d488cb 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -595,6 +595,9 @@ show_in_reg(1);
show_in_reg(2);
show_in_reg(3);
show_in_reg(4);
+show_in_reg(5);
+show_in_reg(6);
+show_in_reg(7);
/* Temps */
@@ -1030,15 +1033,32 @@ static const struct attribute_group lm85_group = {
.attrs = lm85_attributes,
};
-static struct attribute *lm85_attributes_opt[] = {
+static struct attribute *lm85_attributes_in4[] = {
&sensor_dev_attr_in4_input.dev_attr.attr,
&sensor_dev_attr_in4_min.dev_attr.attr,
&sensor_dev_attr_in4_max.dev_attr.attr,
NULL
};
-static const struct attribute_group lm85_group_opt = {
- .attrs = lm85_attributes_opt,
+static const struct attribute_group lm85_group_in4 = {
+ .attrs = lm85_attributes_in4,
+};
+
+static struct attribute *lm85_attributes_in567[] = {
+ &sensor_dev_attr_in5_input.dev_attr.attr,
+ &sensor_dev_attr_in6_input.dev_attr.attr,
+ &sensor_dev_attr_in7_input.dev_attr.attr,
+ &sensor_dev_attr_in5_min.dev_attr.attr,
+ &sensor_dev_attr_in6_min.dev_attr.attr,
+ &sensor_dev_attr_in7_min.dev_attr.attr,
+ &sensor_dev_attr_in5_max.dev_attr.attr,
+ &sensor_dev_attr_in6_max.dev_attr.attr,
+ &sensor_dev_attr_in7_max.dev_attr.attr,
+ NULL
+};
+
+static const struct attribute_group lm85_group_in567 = {
+ .attrs = lm85_attributes_in567,
};
static int lm85_detect(struct i2c_adapter *adapter, int address,
@@ -1186,12 +1206,14 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
as a sixth digital VID input rather than an analog input. */
data->vid = lm85_read_value(new_client, LM85_REG_VID);
if (!(kind == adt7463 && (data->vid & 0x80)))
- if ((err = device_create_file(&new_client->dev,
- &sensor_dev_attr_in4_input.dev_attr))
- || (err = device_create_file(&new_client->dev,
- &sensor_dev_attr_in4_min.dev_attr))
- || (err = device_create_file(&new_client->dev,
- &sensor_dev_attr_in4_max.dev_attr)))
+ if ((err = sysfs_create_group(&new_client->dev.kobj,
+ &lm85_group_in4)))
+ goto ERROR3;
+
+ /* The EMC6D100 has 3 additional voltage inputs */
+ if (kind == emc6d100)
+ if ((err = sysfs_create_group(&new_client->dev.kobj,
+ &lm85_group_in567)))
goto ERROR3;
data->hwmon_dev = hwmon_device_register(&new_client->dev);
@@ -1205,7 +1227,9 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
/* Error out and cleanup code */
ERROR3:
sysfs_remove_group(&new_client->dev.kobj, &lm85_group);
- sysfs_remove_group(&new_client->dev.kobj, &lm85_group_opt);
+ sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in4);
+ if (kind == emc6d100)
+ sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in567);
ERROR2:
i2c_detach_client(new_client);
ERROR1:
@@ -1219,7 +1243,9 @@ static int lm85_detach_client(struct i2c_client *client)
struct lm85_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &lm85_group);
- sysfs_remove_group(&client->dev.kobj, &lm85_group_opt);
+ sysfs_remove_group(&client->dev.kobj, &lm85_group_in4);
+ if (data->type == emc6d100)
+ sysfs_remove_group(&client->dev.kobj, &lm85_group_in567);
i2c_detach_client(client);
kfree(data);
return 0;