27 #include <linux/module.h>
29 #include <linux/slab.h>
30 #include <linux/i2c.h>
38 #define THERMAL_PID_REG 0xfd
39 #define THERMAL_SMSC_ID_REG 0xfe
40 #define THERMAL_REVISION_REG 0xff
62 return sprintf(buf,
"%d000\n", retval);
75 return sprintf(buf,
"%d\n", retval ? 1 : 0);
86 if (kstrtoul(buf, 10, &val))
104 if (kstrtoul(buf, 10, &val))
112 retval &= ~sda->
index;
114 retval |= sda->
index;
157 if (kstrtoul(buf, 10, &val))
165 hyst = val - retval * 1000;
167 if (hyst < 0 || hyst > 255) {
195 show_bit,
NULL, 0x36, 0x01);
197 show_bit,
NULL, 0x35, 0x01);
199 show_bit,
NULL, 0x37, 0x01);
201 show_hyst, store_hyst, 0x20);
211 show_bit,
NULL, 0x36, 0x02);
213 show_bit,
NULL, 0x35, 0x02);
215 show_bit,
NULL, 0x37, 0x02);
217 show_hyst, store_hyst, 0x19);
227 show_bit,
NULL, 0x36, 0x04);
229 show_bit,
NULL, 0x35, 0x04);
231 show_bit,
NULL, 0x37, 0x04);
233 show_hyst, store_hyst, 0x1A);
236 show_bit, store_bit, 0x03, 0x40);
238 static struct attribute *mid_att_thermal[] = {
239 &sensor_dev_attr_temp1_min.dev_attr.attr,
240 &sensor_dev_attr_temp1_max.dev_attr.attr,
241 &sensor_dev_attr_temp1_crit.dev_attr.attr,
242 &sensor_dev_attr_temp1_input.dev_attr.attr,
243 &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
244 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
245 &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
246 &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,
247 &sensor_dev_attr_temp2_min.dev_attr.attr,
248 &sensor_dev_attr_temp2_max.dev_attr.attr,
249 &sensor_dev_attr_temp2_crit.dev_attr.attr,
250 &sensor_dev_attr_temp2_input.dev_attr.attr,
251 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
252 &sensor_dev_attr_temp2_max_alarm.dev_attr.attr,
253 &sensor_dev_attr_temp2_crit_alarm.dev_attr.attr,
254 &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr,
255 &sensor_dev_attr_temp3_min.dev_attr.attr,
256 &sensor_dev_attr_temp3_max.dev_attr.attr,
257 &sensor_dev_attr_temp3_crit.dev_attr.attr,
258 &sensor_dev_attr_temp3_input.dev_attr.attr,
259 &sensor_dev_attr_temp3_min_alarm.dev_attr.attr,
260 &sensor_dev_attr_temp3_max_alarm.dev_attr.attr,
261 &sensor_dev_attr_temp3_crit_alarm.dev_attr.attr,
262 &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr,
263 &sensor_dev_attr_power_state.dev_attr.attr,
268 .attrs = mid_att_thermal
271 static int emc1403_detect(
struct i2c_client *client,
304 static int emc1403_probe(
struct i2c_client *client,
315 i2c_set_clientdata(client, data);
327 dev_warn(&client->
dev,
"register hwmon dev failed\n");
330 dev_info(&client->
dev,
"EMC1403 Thermal chip found\n");
338 static int emc1403_remove(
struct i2c_client *client)
347 static const unsigned short emc1403_address_list[] = {
363 .detect = emc1403_detect,
364 .probe = emc1403_probe,
365 .remove = emc1403_remove,
366 .id_table = emc1403_idtable,
367 .address_list = emc1403_address_list,