aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-07-05 14:37:21 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:30 -0400
commit6b9aad2d8acf309f99213875dd94f2ec691fe820 (patch)
treea7a04fff758b33446674eec4cebf74aec75c309e /drivers
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')
-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);
595show_in_reg(2); 595show_in_reg(2);
596show_in_reg(3); 596show_in_reg(3);
597show_in_reg(4); 597show_in_reg(4);
598show_in_reg(5);
599show_in_reg(6);
600show_in_reg(7);
598 601
599/* Temps */ 602/* Temps */
600 603
@@ -1030,15 +1033,32 @@ static const struct attribute_group lm85_group = {
1030 .attrs = lm85_attributes, 1033 .attrs = lm85_attributes,
1031}; 1034};
1032 1035
1033static struct attribute *lm85_attributes_opt[] = { 1036static struct attribute *lm85_attributes_in4[] = {
1034 &sensor_dev_attr_in4_input.dev_attr.attr, 1037 &sensor_dev_attr_in4_input.dev_attr.attr,
1035 &sensor_dev_attr_in4_min.dev_attr.attr, 1038 &sensor_dev_attr_in4_min.dev_attr.attr,
1036 &sensor_dev_attr_in4_max.dev_attr.attr, 1039 &sensor_dev_attr_in4_max.dev_attr.attr,
1037 NULL 1040 NULL
1038}; 1041};
1039 1042
1040static const struct attribute_group lm85_group_opt = { 1043static const struct attribute_group lm85_group_in4 = {
1041 .attrs = lm85_attributes_opt, 1044 .attrs = lm85_attributes_in4,
1045};
1046
1047static struct attribute *lm85_attributes_in567[] = {
1048 &sensor_dev_attr_in5_input.dev_attr.attr,
1049 &sensor_dev_attr_in6_input.dev_attr.attr,
1050 &sensor_dev_attr_in7_input.dev_attr.attr,
1051 &sensor_dev_attr_in5_min.dev_attr.attr,
1052 &sensor_dev_attr_in6_min.dev_attr.attr,
1053 &sensor_dev_attr_in7_min.dev_attr.attr,
1054 &sensor_dev_attr_in5_max.dev_attr.attr,
1055 &sensor_dev_attr_in6_max.dev_attr.attr,
1056 &sensor_dev_attr_in7_max.dev_attr.attr,
1057 NULL
1058};
1059
1060static const struct attribute_group lm85_group_in567 = {
1061 .attrs = lm85_attributes_in567,
1042}; 1062};
1043 1063
1044static int lm85_detect(struct i2c_adapter *adapter, int address, 1064static int lm85_detect(struct i2c_adapter *adapter, int address,
@@ -1186,12 +1206,14 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
1186 as a sixth digital VID input rather than an analog input. */ 1206 as a sixth digital VID input rather than an analog input. */
1187 data->vid = lm85_read_value(new_client, LM85_REG_VID); 1207 data->vid = lm85_read_value(new_client, LM85_REG_VID);
1188 if (!(kind == adt7463 && (data->vid & 0x80))) 1208 if (!(kind == adt7463 && (data->vid & 0x80)))
1189 if ((err = device_create_file(&new_client->dev, 1209 if ((err = sysfs_create_group(&new_client->dev.kobj,
1190 &sensor_dev_attr_in4_input.dev_attr)) 1210 &lm85_group_in4)))
1191 || (err = device_create_file(&new_client->dev, 1211 goto ERROR3;
1192 &sensor_dev_attr_in4_min.dev_attr)) 1212
1193 || (err = device_create_file(&new_client->dev, 1213 /* The EMC6D100 has 3 additional voltage inputs */
1194 &sensor_dev_attr_in4_max.dev_attr))) 1214 if (kind == emc6d100)
1215 if ((err = sysfs_create_group(&new_client->dev.kobj,
1216 &lm85_group_in567)))
1195 goto ERROR3; 1217 goto ERROR3;
1196 1218
1197 data->hwmon_dev = hwmon_device_register(&new_client->dev); 1219 data->hwmon_dev = hwmon_device_register(&new_client->dev);
@@ -1205,7 +1227,9 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
1205 /* Error out and cleanup code */ 1227 /* Error out and cleanup code */
1206 ERROR3: 1228 ERROR3:
1207 sysfs_remove_group(&new_client->dev.kobj, &lm85_group); 1229 sysfs_remove_group(&new_client->dev.kobj, &lm85_group);
1208 sysfs_remove_group(&new_client->dev.kobj, &lm85_group_opt); 1230 sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in4);
1231 if (kind == emc6d100)
1232 sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in567);
1209 ERROR2: 1233 ERROR2:
1210 i2c_detach_client(new_client); 1234 i2c_detach_client(new_client);
1211 ERROR1: 1235 ERROR1:
@@ -1219,7 +1243,9 @@ static int lm85_detach_client(struct i2c_client *client)
1219 struct lm85_data *data = i2c_get_clientdata(client); 1243 struct lm85_data *data = i2c_get_clientdata(client);
1220 hwmon_device_unregister(data->hwmon_dev); 1244 hwmon_device_unregister(data->hwmon_dev);
1221 sysfs_remove_group(&client->dev.kobj, &lm85_group); 1245 sysfs_remove_group(&client->dev.kobj, &lm85_group);
1222 sysfs_remove_group(&client->dev.kobj, &lm85_group_opt); 1246 sysfs_remove_group(&client->dev.kobj, &lm85_group_in4);
1247 if (data->type == emc6d100)
1248 sysfs_remove_group(&client->dev.kobj, &lm85_group_in567);
1223 i2c_detach_client(client); 1249 i2c_detach_client(client);
1224 kfree(data); 1250 kfree(data);
1225 return 0; 1251 return 0;