aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/adm1021.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/adm1021.c')
-rw-r--r--drivers/i2c/chips/adm1021.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
index 9c59a370b6d9..d2c774c32f45 100644
--- a/drivers/i2c/chips/adm1021.c
+++ b/drivers/i2c/chips/adm1021.c
@@ -19,7 +19,6 @@
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/ 20*/
21 21
22#include <linux/config.h>
23#include <linux/module.h> 22#include <linux/module.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
@@ -103,8 +102,6 @@ struct adm1021_data {
103 u8 remote_temp_hyst; 102 u8 remote_temp_hyst;
104 u8 remote_temp_input; 103 u8 remote_temp_input;
105 u8 alarms; 104 u8 alarms;
106 /* special values for ADM1021 only */
107 u8 die_code;
108 /* Special values for ADM1023 only */ 105 /* Special values for ADM1023 only */
109 u8 remote_temp_prec; 106 u8 remote_temp_prec;
110 u8 remote_temp_os_prec; 107 u8 remote_temp_os_prec;
@@ -137,7 +134,7 @@ static struct i2c_driver adm1021_driver = {
137}; 134};
138 135
139#define show(value) \ 136#define show(value) \
140static ssize_t show_##value(struct device *dev, char *buf) \ 137static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
141{ \ 138{ \
142 struct adm1021_data *data = adm1021_update_device(dev); \ 139 struct adm1021_data *data = adm1021_update_device(dev); \
143 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ 140 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \
@@ -150,16 +147,15 @@ show(remote_temp_hyst);
150show(remote_temp_input); 147show(remote_temp_input);
151 148
152#define show2(value) \ 149#define show2(value) \
153static ssize_t show_##value(struct device *dev, char *buf) \ 150static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
154{ \ 151{ \
155 struct adm1021_data *data = adm1021_update_device(dev); \ 152 struct adm1021_data *data = adm1021_update_device(dev); \
156 return sprintf(buf, "%d\n", data->value); \ 153 return sprintf(buf, "%d\n", data->value); \
157} 154}
158show2(alarms); 155show2(alarms);
159show2(die_code);
160 156
161#define set(value, reg) \ 157#define set(value, reg) \
162static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ 158static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
163{ \ 159{ \
164 struct i2c_client *client = to_i2c_client(dev); \ 160 struct i2c_client *client = to_i2c_client(dev); \
165 struct adm1021_data *data = i2c_get_clientdata(client); \ 161 struct adm1021_data *data = i2c_get_clientdata(client); \
@@ -183,7 +179,6 @@ static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_remote_temp_max, set_remot
183static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_remote_temp_hyst, set_remote_temp_hyst); 179static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_remote_temp_hyst, set_remote_temp_hyst);
184static DEVICE_ATTR(temp2_input, S_IRUGO, show_remote_temp_input, NULL); 180static DEVICE_ATTR(temp2_input, S_IRUGO, show_remote_temp_input, NULL);
185static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 181static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
186static DEVICE_ATTR(die_code, S_IRUGO, show_die_code, NULL);
187 182
188 183
189static int adm1021_attach_adapter(struct i2c_adapter *adapter) 184static int adm1021_attach_adapter(struct i2c_adapter *adapter)
@@ -307,8 +302,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
307 device_create_file(&new_client->dev, &dev_attr_temp2_min); 302 device_create_file(&new_client->dev, &dev_attr_temp2_min);
308 device_create_file(&new_client->dev, &dev_attr_temp2_input); 303 device_create_file(&new_client->dev, &dev_attr_temp2_input);
309 device_create_file(&new_client->dev, &dev_attr_alarms); 304 device_create_file(&new_client->dev, &dev_attr_alarms);
310 if (data->type == adm1021)
311 device_create_file(&new_client->dev, &dev_attr_die_code);
312 305
313 return 0; 306 return 0;
314 307
@@ -371,8 +364,6 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
371 data->remote_temp_max = adm1021_read_value(client, ADM1021_REG_REMOTE_TOS_R); 364 data->remote_temp_max = adm1021_read_value(client, ADM1021_REG_REMOTE_TOS_R);
372 data->remote_temp_hyst = adm1021_read_value(client, ADM1021_REG_REMOTE_THYST_R); 365 data->remote_temp_hyst = adm1021_read_value(client, ADM1021_REG_REMOTE_THYST_R);
373 data->alarms = adm1021_read_value(client, ADM1021_REG_STATUS) & 0x7c; 366 data->alarms = adm1021_read_value(client, ADM1021_REG_STATUS) & 0x7c;
374 if (data->type == adm1021)
375 data->die_code = adm1021_read_value(client, ADM1021_REG_DIE_CODE);
376 if (data->type == adm1023) { 367 if (data->type == adm1023) {
377 data->remote_temp_prec = adm1021_read_value(client, ADM1021_REG_REM_TEMP_PREC); 368 data->remote_temp_prec = adm1021_read_value(client, ADM1021_REG_REM_TEMP_PREC);
378 data->remote_temp_os_prec = adm1021_read_value(client, ADM1021_REG_REM_TOS_PREC); 369 data->remote_temp_os_prec = adm1021_read_value(client, ADM1021_REG_REM_TOS_PREC);