diff options
Diffstat (limited to 'drivers/hwmon/lm70.c')
-rw-r--r-- | drivers/hwmon/lm70.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index 1da62f616db5..789753d0df79 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -43,6 +43,8 @@ | |||
43 | 43 | ||
44 | #define LM70_CHIP_LM70 0 /* original NS LM70 */ | 44 | #define LM70_CHIP_LM70 0 /* original NS LM70 */ |
45 | #define LM70_CHIP_TMP121 1 /* TI TMP121/TMP123 */ | 45 | #define LM70_CHIP_TMP121 1 /* TI TMP121/TMP123 */ |
46 | #define LM70_CHIP_LM71 2 /* NS LM71 */ | ||
47 | #define LM70_CHIP_LM74 3 /* NS LM74 */ | ||
46 | 48 | ||
47 | struct lm70 { | 49 | struct lm70 { |
48 | struct device *hwmon_dev; | 50 | struct device *hwmon_dev; |
@@ -88,9 +90,13 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
88 | * Celsius. | 90 | * Celsius. |
89 | * So it's equivalent to multiplying by 0.25 * 1000 = 250. | 91 | * So it's equivalent to multiplying by 0.25 * 1000 = 250. |
90 | * | 92 | * |
91 | * TMP121/TMP123: | 93 | * LM74 and TMP121/TMP123: |
92 | * 13 bits of 2's complement data, discard LSB 3 bits, | 94 | * 13 bits of 2's complement data, discard LSB 3 bits, |
93 | * resolution 0.0625 degrees celsius. | 95 | * resolution 0.0625 degrees celsius. |
96 | * | ||
97 | * LM71: | ||
98 | * 14 bits of 2's complement data, discard LSB 2 bits, | ||
99 | * resolution 0.0312 degrees celsius. | ||
94 | */ | 100 | */ |
95 | switch (p_lm70->chip) { | 101 | switch (p_lm70->chip) { |
96 | case LM70_CHIP_LM70: | 102 | case LM70_CHIP_LM70: |
@@ -98,8 +104,13 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
98 | break; | 104 | break; |
99 | 105 | ||
100 | case LM70_CHIP_TMP121: | 106 | case LM70_CHIP_TMP121: |
107 | case LM70_CHIP_LM74: | ||
101 | val = ((int)raw / 8) * 625 / 10; | 108 | val = ((int)raw / 8) * 625 / 10; |
102 | break; | 109 | break; |
110 | |||
111 | case LM70_CHIP_LM71: | ||
112 | val = ((int)raw / 4) * 3125 / 100; | ||
113 | break; | ||
103 | } | 114 | } |
104 | 115 | ||
105 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ | 116 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ |
@@ -123,6 +134,12 @@ static ssize_t lm70_show_name(struct device *dev, struct device_attribute | |||
123 | case LM70_CHIP_TMP121: | 134 | case LM70_CHIP_TMP121: |
124 | ret = sprintf(buf, "tmp121\n"); | 135 | ret = sprintf(buf, "tmp121\n"); |
125 | break; | 136 | break; |
137 | case LM70_CHIP_LM71: | ||
138 | ret = sprintf(buf, "lm71\n"); | ||
139 | break; | ||
140 | case LM70_CHIP_LM74: | ||
141 | ret = sprintf(buf, "lm74\n"); | ||
142 | break; | ||
126 | default: | 143 | default: |
127 | ret = -EINVAL; | 144 | ret = -EINVAL; |
128 | } | 145 | } |
@@ -139,7 +156,7 @@ static int __devinit lm70_probe(struct spi_device *spi) | |||
139 | struct lm70 *p_lm70; | 156 | struct lm70 *p_lm70; |
140 | int status; | 157 | int status; |
141 | 158 | ||
142 | /* signaling is SPI_MODE_0 for both LM70 and TMP121 */ | 159 | /* signaling is SPI_MODE_0 */ |
143 | if (spi->mode & (SPI_CPOL | SPI_CPHA)) | 160 | if (spi->mode & (SPI_CPOL | SPI_CPHA)) |
144 | return -EINVAL; | 161 | return -EINVAL; |
145 | 162 | ||
@@ -196,6 +213,8 @@ static int __devexit lm70_remove(struct spi_device *spi) | |||
196 | static const struct spi_device_id lm70_ids[] = { | 213 | static const struct spi_device_id lm70_ids[] = { |
197 | { "lm70", LM70_CHIP_LM70 }, | 214 | { "lm70", LM70_CHIP_LM70 }, |
198 | { "tmp121", LM70_CHIP_TMP121 }, | 215 | { "tmp121", LM70_CHIP_TMP121 }, |
216 | { "lm71", LM70_CHIP_LM71 }, | ||
217 | { "lm74", LM70_CHIP_LM74 }, | ||
199 | { }, | 218 | { }, |
200 | }; | 219 | }; |
201 | MODULE_DEVICE_TABLE(spi, lm70_ids); | 220 | MODULE_DEVICE_TABLE(spi, lm70_ids); |
@@ -213,5 +232,5 @@ static struct spi_driver lm70_driver = { | |||
213 | module_spi_driver(lm70_driver); | 232 | module_spi_driver(lm70_driver); |
214 | 233 | ||
215 | MODULE_AUTHOR("Kaiwan N Billimoria"); | 234 | MODULE_AUTHOR("Kaiwan N Billimoria"); |
216 | MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver"); | 235 | MODULE_DESCRIPTION("NS LM70 and compatibles Linux driver"); |
217 | MODULE_LICENSE("GPL"); | 236 | MODULE_LICENSE("GPL"); |