17 #include <linux/module.h>
19 #include <linux/i2c.h>
26 static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4c,
30 #define LM73_REG_INPUT 0x00
31 #define LM73_REG_CONF 0x01
32 #define LM73_REG_MAX 0x02
33 #define LM73_REG_MIN 0x03
34 #define LM73_REG_CTRL 0x04
35 #define LM73_REG_ID 0x07
37 #define LM73_ID 0x9001
38 #define DRVNAME "lm73"
39 #define LM73_TEMP_MIN (-40)
40 #define LM73_TEMP_MAX 150
53 int status = kstrtol(buf, 10, &temp);
60 i2c_smbus_write_word_swapped(client, attr->
index, value);
71 int temp = ((
s16) (i2c_smbus_read_word_swapped(client,
72 attr->
index))*250) / 32;
73 return sprintf(buf,
"%d\n", temp);
89 static struct attribute *lm73_attributes[] = {
90 &sensor_dev_attr_temp1_input.dev_attr.attr,
91 &sensor_dev_attr_temp1_max.dev_attr.attr,
92 &sensor_dev_attr_temp1_min.dev_attr.attr,
98 .attrs = lm73_attributes,
117 if (IS_ERR(hwmon_dev)) {
118 status = PTR_ERR(hwmon_dev);
121 i2c_set_clientdata(client, hwmon_dev);
124 dev_name(hwmon_dev), client->
name);
133 static int lm73_remove(
struct i2c_client *client)
135 struct device *hwmon_dev = i2c_get_clientdata(client);
149 static int lm73_detect(
struct i2c_client *new_client,
164 if (ctrl < 0 || (ctrl & 0x10))
168 if (conf < 0 || (conf & 0x0c))
172 if (
id < 0 ||
id != (
LM73_ID & 0xff))
191 .remove = lm73_remove,
192 .id_table = lm73_ids,
193 .detect = lm73_detect,
194 .address_list = normal_i2c,