33 #include <linux/module.h>
36 #include <linux/slab.h>
38 #include <linux/i2c.h>
52 static const unsigned short normal_i2c[] = { 0x2e,
I2C_CLIENT_END };
59 #define W83L785TS_REG_MAN_ID1 0x4D
60 #define W83L785TS_REG_MAN_ID2 0x4C
61 #define W83L785TS_REG_CHIP_ID 0x4E
62 #define W83L785TS_REG_CONFIG 0x40
63 #define W83L785TS_REG_TYPE 0x52
64 #define W83L785TS_REG_TEMP 0x27
65 #define W83L785TS_REG_TEMP_OVER 0x53
72 #define TEMP_FROM_REG(val) ((val) * 1000)
101 .probe = w83l785ts_probe,
102 .remove = w83l785ts_remove,
103 .id_table = w83l785ts_id,
104 .detect = w83l785ts_detect,
105 .address_list = normal_i2c,
156 "W83L785TS-S detection failed at 0x%02x\n",
167 || chip_id != 0x70) {
169 "Unsupported chip (man_id=0x%04X, chip_id=0x%02X)\n",
179 static int w83l785ts_probe(
struct i2c_client *client,
190 i2c_set_clientdata(client, data);
225 static int w83l785ts_remove(
struct i2c_client *client)
231 &sensor_dev_attr_temp1_input.dev_attr);
233 &sensor_dev_attr_temp1_max.dev_attr);
248 if (i2c_get_clientdata(client)) {
253 prefix =
"w83l785ts: ";
264 dev_dbg(dev,
"%sRead 0x%02x from register 0x%02x.\n",
268 dev_dbg(dev,
"%sRead failed, will retry in %d.\n", prefix, i);
272 dev_err(dev,
"%sCouldn't read value from register 0x%02x.\n", prefix,
285 dev_dbg(&client->
dev,
"Updating w83l785ts data.\n");
286 data->
temp[0] = w83l785ts_read_value(client,
288 data->
temp[1] = w83l785ts_read_value(client,