blob: bcaf31ec176e9c4bbc2e29a07b9e9bd3216d15f7 [file] [log] [blame]
Thomas Gleixnerc942fdd2019-05-27 08:55:06 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * lm83.c - Part of lm_sensors, Linux kernel modules for hardware
4 * monitoring
Jean Delvare7c81c60f2014-01-29 20:40:08 +01005 * Copyright (C) 2003-2009 Jean Delvare <jdelvare@suse.de>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * Heavily inspired from the lm78, lm75 and adm1021 drivers. The LM83 is
8 * a sensor chip made by National Semiconductor. It reports up to four
9 * temperatures (its own plus up to three external ones) with a 1 deg
10 * resolution and a 3-4 deg accuracy. Complete datasheet can be obtained
11 * from National's website at:
12 * http://www.national.com/pf/LM/LM83.html
13 * Since the datasheet omits to give the chip stepping code, I give it
14 * here: 0x03 (at register 0xff).
15 *
Jordan Crouse43cb7eb2006-03-23 16:19:49 +010016 * Also supports the LM82 temp sensor, which is basically a stripped down
17 * model of the LM83. Datasheet is here:
18 * http://www.national.com/pf/LM/LM82.html
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 */
20
Guenter Roeckc291f612021-12-22 20:24:02 -080021#include <linux/bits.h>
Mark M. Hoffman943b0832005-07-15 21:39:18 -040022#include <linux/err.h>
Guenter Roeck7c68c2c2021-12-22 11:42:38 -080023#include <linux/i2c.h>
24#include <linux/init.h>
Guenter Roeck7c68c2c2021-12-22 11:42:38 -080025#include <linux/hwmon.h>
Guenter Roeck7c68c2c2021-12-22 11:42:38 -080026#include <linux/module.h>
Guenter Roeck719af4f12021-12-22 16:22:00 -080027#include <linux/regmap.h>
Guenter Roeck7c68c2c2021-12-22 11:42:38 -080028#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30/*
31 * Addresses to scan
32 * Address is selected using 2 three-level pins, resulting in 9 possible
33 * addresses.
34 */
35
Mark M. Hoffman25e9c862008-02-17 22:28:03 -050036static const unsigned short normal_i2c[] = {
37 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Jean Delvaree5e9f442009-12-14 21:17:27 +010039enum chips { lm83, lm82 };
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41/*
42 * The LM83 registers
43 * Manufacturer ID is 0x01 for National Semiconductor.
44 */
45
46#define LM83_REG_R_MAN_ID 0xFE
47#define LM83_REG_R_CHIP_ID 0xFF
48#define LM83_REG_R_CONFIG 0x03
49#define LM83_REG_W_CONFIG 0x09
50#define LM83_REG_R_STATUS1 0x02
51#define LM83_REG_R_STATUS2 0x35
52#define LM83_REG_R_LOCAL_TEMP 0x00
53#define LM83_REG_R_LOCAL_HIGH 0x05
54#define LM83_REG_W_LOCAL_HIGH 0x0B
55#define LM83_REG_R_REMOTE1_TEMP 0x30
56#define LM83_REG_R_REMOTE1_HIGH 0x38
57#define LM83_REG_W_REMOTE1_HIGH 0x50
58#define LM83_REG_R_REMOTE2_TEMP 0x01
59#define LM83_REG_R_REMOTE2_HIGH 0x07
60#define LM83_REG_W_REMOTE2_HIGH 0x0D
61#define LM83_REG_R_REMOTE3_TEMP 0x31
62#define LM83_REG_R_REMOTE3_HIGH 0x3A
63#define LM83_REG_W_REMOTE3_HIGH 0x52
64#define LM83_REG_R_TCRIT 0x42
65#define LM83_REG_W_TCRIT 0x5A
66
Guenter Roeck719af4f12021-12-22 16:22:00 -080067static const u8 LM83_REG_TEMP[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 LM83_REG_R_LOCAL_TEMP,
69 LM83_REG_R_REMOTE1_TEMP,
70 LM83_REG_R_REMOTE2_TEMP,
Jean Delvare1a86c052005-06-05 21:16:39 +020071 LM83_REG_R_REMOTE3_TEMP,
Guenter Roeckc291f612021-12-22 20:24:02 -080072};
73
74static const u8 LM83_REG_MAX[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 LM83_REG_R_LOCAL_HIGH,
76 LM83_REG_R_REMOTE1_HIGH,
77 LM83_REG_R_REMOTE2_HIGH,
Jean Delvare1a86c052005-06-05 21:16:39 +020078 LM83_REG_R_REMOTE3_HIGH,
Guenter Roeckc291f612021-12-22 20:24:02 -080079};
80
81/* alarm and fault registers and bits, indexed by channel */
82static const u8 LM83_ALARM_REG[] = {
83 LM83_REG_R_STATUS1, LM83_REG_R_STATUS2, LM83_REG_R_STATUS1, LM83_REG_R_STATUS2
84};
85
86static const u8 LM83_MAX_ALARM_BIT[] = {
87 BIT(6), BIT(7), BIT(4), BIT(4)
88};
89
90static const u8 LM83_CRIT_ALARM_BIT[] = {
91 BIT(0), BIT(0), BIT(1), BIT(1)
92};
93
94static const u8 LM83_FAULT_BIT[] = {
95 0, BIT(5), BIT(2), BIT(2)
Linus Torvalds1da177e2005-04-16 15:20:36 -070096};
97
Linus Torvalds1da177e2005-04-16 15:20:36 -070098/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 * Client data (each client gets its own)
100 */
101
102struct lm83_data {
Guenter Roeck719af4f12021-12-22 16:22:00 -0800103 struct regmap *regmap;
Guenter Roeckc291f612021-12-22 20:24:02 -0800104 enum chips type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105};
106
Guenter Roeck719af4f12021-12-22 16:22:00 -0800107/* regmap code */
108
109static int lm83_regmap_reg_read(void *context, unsigned int reg, unsigned int *val)
Guenter Roeck41936372014-04-12 12:39:41 -0700110{
Guenter Roeck719af4f12021-12-22 16:22:00 -0800111 struct i2c_client *client = context;
112 int ret;
Guenter Roeck41936372014-04-12 12:39:41 -0700113
Guenter Roeck719af4f12021-12-22 16:22:00 -0800114 ret = i2c_smbus_read_byte_data(client, reg);
115 if (ret < 0)
116 return ret;
Guenter Roeck41936372014-04-12 12:39:41 -0700117
Guenter Roeck719af4f12021-12-22 16:22:00 -0800118 *val = ret;
119 return 0;
120}
Guenter Roeck41936372014-04-12 12:39:41 -0700121
Guenter Roeck719af4f12021-12-22 16:22:00 -0800122/*
123 * The regmap write function maps read register addresses to write register
124 * addresses. This is necessary for regmap register caching to work.
125 * An alternative would be to clear the regmap cache whenever a register is
126 * written, but that would be much more expensive.
127 */
128static int lm83_regmap_reg_write(void *context, unsigned int reg, unsigned int val)
129{
130 struct i2c_client *client = context;
Guenter Roeck41936372014-04-12 12:39:41 -0700131
Guenter Roeck719af4f12021-12-22 16:22:00 -0800132 switch (reg) {
133 case LM83_REG_R_CONFIG:
134 case LM83_REG_R_LOCAL_HIGH:
135 case LM83_REG_R_REMOTE2_HIGH:
136 reg += 0x06;
137 break;
138 case LM83_REG_R_REMOTE1_HIGH:
139 case LM83_REG_R_REMOTE3_HIGH:
140 case LM83_REG_R_TCRIT:
141 reg += 0x18;
142 break;
143 default:
144 break;
Guenter Roeck41936372014-04-12 12:39:41 -0700145 }
146
Guenter Roeck719af4f12021-12-22 16:22:00 -0800147 return i2c_smbus_write_byte_data(client, reg, val);
Guenter Roeck41936372014-04-12 12:39:41 -0700148}
149
Guenter Roeck719af4f12021-12-22 16:22:00 -0800150static bool lm83_regmap_is_volatile(struct device *dev, unsigned int reg)
151{
152 switch (reg) {
153 case LM83_REG_R_LOCAL_TEMP:
154 case LM83_REG_R_REMOTE1_TEMP:
155 case LM83_REG_R_REMOTE2_TEMP:
156 case LM83_REG_R_REMOTE3_TEMP:
157 case LM83_REG_R_STATUS1:
158 case LM83_REG_R_STATUS2:
159 return true;
160 default:
161 return false;
162 }
163}
164
165static const struct regmap_config lm83_regmap_config = {
166 .reg_bits = 8,
167 .val_bits = 8,
168 .cache_type = REGCACHE_RBTREE,
169 .volatile_reg = lm83_regmap_is_volatile,
170 .reg_read = lm83_regmap_reg_read,
171 .reg_write = lm83_regmap_reg_write,
172};
173
Guenter Roeckc291f612021-12-22 20:24:02 -0800174/* hwmon API */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175
Guenter Roeckc291f612021-12-22 20:24:02 -0800176static int lm83_temp_read(struct device *dev, u32 attr, int channel, long *val)
Jean Delvare1a86c052005-06-05 21:16:39 +0200177{
Guenter Roeck719af4f12021-12-22 16:22:00 -0800178 struct lm83_data *data = dev_get_drvdata(dev);
179 unsigned int regval;
Frans Meulenbroeksb3789a02012-01-10 23:01:40 +0100180 int err;
181
Guenter Roeckc291f612021-12-22 20:24:02 -0800182 switch (attr) {
183 case hwmon_temp_input:
184 err = regmap_read(data->regmap, LM83_REG_TEMP[channel], &regval);
185 if (err < 0)
186 return err;
187 *val = (s8)regval * 1000;
188 break;
189 case hwmon_temp_max:
190 err = regmap_read(data->regmap, LM83_REG_MAX[channel], &regval);
191 if (err < 0)
192 return err;
193 *val = (s8)regval * 1000;
194 break;
195 case hwmon_temp_crit:
196 err = regmap_read(data->regmap, LM83_REG_R_TCRIT, &regval);
197 if (err < 0)
198 return err;
199 *val = (s8)regval * 1000;
200 break;
201 case hwmon_temp_max_alarm:
202 err = regmap_read(data->regmap, LM83_ALARM_REG[channel], &regval);
203 if (err < 0)
204 return err;
205 *val = !!(regval & LM83_MAX_ALARM_BIT[channel]);
206 break;
207 case hwmon_temp_crit_alarm:
208 err = regmap_read(data->regmap, LM83_ALARM_REG[channel], &regval);
209 if (err < 0)
210 return err;
211 *val = !!(regval & LM83_CRIT_ALARM_BIT[channel]);
212 break;
213 case hwmon_temp_fault:
214 err = regmap_read(data->regmap, LM83_ALARM_REG[channel], &regval);
215 if (err < 0)
216 return err;
217 *val = !!(regval & LM83_FAULT_BIT[channel]);
218 break;
219 default:
220 return -EOPNOTSUPP;
221 }
222 return 0;
223}
224
225static int lm83_temp_write(struct device *dev, u32 attr, int channel, long val)
226{
227 struct lm83_data *data = dev_get_drvdata(dev);
228 unsigned int regval;
229 int err;
Jean Delvare1a86c052005-06-05 21:16:39 +0200230
Guenter Roeck362c5662021-12-22 19:03:04 -0800231 regval = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000);
Guenter Roeckc291f612021-12-22 20:24:02 -0800232
233 switch (attr) {
234 case hwmon_temp_max:
235 err = regmap_write(data->regmap, LM83_REG_MAX[channel], regval);
236 if (err < 0)
237 return err;
238 break;
239 case hwmon_temp_crit:
240 err = regmap_write(data->regmap, LM83_REG_R_TCRIT, regval);
241 if (err < 0)
242 return err;
243 break;
244 default:
245 return -EOPNOTSUPP;
246 }
247 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249
Guenter Roeckc291f612021-12-22 20:24:02 -0800250static int lm83_chip_read(struct device *dev, u32 attr, int channel, long *val)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251{
Guenter Roeck719af4f12021-12-22 16:22:00 -0800252 struct lm83_data *data = dev_get_drvdata(dev);
Guenter Roeckc291f612021-12-22 20:24:02 -0800253 unsigned int regval;
Guenter Roeck719af4f12021-12-22 16:22:00 -0800254 int err;
255
Guenter Roeckc291f612021-12-22 20:24:02 -0800256 switch (attr) {
257 case hwmon_chip_alarms:
258 err = regmap_read(data->regmap, LM83_REG_R_STATUS1, &regval);
259 if (err < 0)
260 return err;
261 *val = regval;
262 err = regmap_read(data->regmap, LM83_REG_R_STATUS2, &regval);
263 if (err < 0)
264 return err;
265 *val |= regval << 8;
266 return 0;
267 default:
268 return -EOPNOTSUPP;
Guenter Roeck719af4f12021-12-22 16:22:00 -0800269 }
Guenter Roeckc291f612021-12-22 20:24:02 -0800270
271 return 0;
Jean Delvare2d457712006-09-24 20:52:15 +0200272}
273
Guenter Roeckc291f612021-12-22 20:24:02 -0800274static int lm83_read(struct device *dev, enum hwmon_sensor_types type,
275 u32 attr, int channel, long *val)
276{
277 switch (type) {
278 case hwmon_chip:
279 return lm83_chip_read(dev, attr, channel, val);
280 case hwmon_temp:
281 return lm83_temp_read(dev, attr, channel, val);
282 default:
283 return -EOPNOTSUPP;
284 }
285}
Jean Delvare2d457712006-09-24 20:52:15 +0200286
Guenter Roeckc291f612021-12-22 20:24:02 -0800287static int lm83_write(struct device *dev, enum hwmon_sensor_types type,
288 u32 attr, int channel, long val)
289{
290 switch (type) {
291 case hwmon_temp:
292 return lm83_temp_write(dev, attr, channel, val);
293 default:
294 return -EOPNOTSUPP;
295 }
296}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700297
Guenter Roeckc291f612021-12-22 20:24:02 -0800298static umode_t lm83_is_visible(const void *_data, enum hwmon_sensor_types type,
299 u32 attr, int channel)
300{
301 const struct lm83_data *data = _data;
Jean Delvare0e39e012006-09-24 21:16:40 +0200302
Guenter Roeckc291f612021-12-22 20:24:02 -0800303 /*
304 * LM82 only supports a single external channel, modeled as channel 2.
305 */
306 if (data->type == lm82 && (channel == 1 || channel == 3))
307 return 0;
308
309 switch (type) {
310 case hwmon_chip:
311 if (attr == hwmon_chip_alarms)
312 return 0444;
313 break;
314 case hwmon_temp:
315 switch (attr) {
316 case hwmon_temp_input:
317 case hwmon_temp_max_alarm:
318 case hwmon_temp_crit_alarm:
319 return 0444;
320 case hwmon_temp_fault:
321 if (channel)
322 return 0444;
323 break;
324 case hwmon_temp_max:
325 return 0644;
326 case hwmon_temp_crit:
327 if (channel == 2)
328 return 0644;
329 return 0444;
330 default:
331 break;
332 }
333 break;
334 default:
335 break;
336 }
337 return 0;
338}
339
Krzysztof Kozlowski3c370242023-04-06 22:30:22 +0200340static const struct hwmon_channel_info * const lm83_info[] = {
Guenter Roeckc291f612021-12-22 20:24:02 -0800341 HWMON_CHANNEL_INFO(chip, HWMON_C_ALARMS),
342 HWMON_CHANNEL_INFO(temp,
343 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT |
344 HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM,
345 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT |
346 HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM | HWMON_T_FAULT,
347 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT |
348 HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM | HWMON_T_FAULT,
349 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT |
350 HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM | HWMON_T_FAULT
351 ),
Jean Delvare0e39e012006-09-24 21:16:40 +0200352 NULL
353};
354
Guenter Roeckc291f612021-12-22 20:24:02 -0800355static const struct hwmon_ops lm83_hwmon_ops = {
356 .is_visible = lm83_is_visible,
357 .read = lm83_read,
358 .write = lm83_write,
Jean Delvare0e39e012006-09-24 21:16:40 +0200359};
360
Guenter Roeckc291f612021-12-22 20:24:02 -0800361static const struct hwmon_chip_info lm83_chip_info = {
362 .ops = &lm83_hwmon_ops,
363 .info = lm83_info,
Jean Delvare0e39e012006-09-24 21:16:40 +0200364};
365
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200366/* Return 0 if detection is successful, -ENODEV otherwise */
Guenter Roeck81de0ee2021-12-22 16:23:31 -0800367static int lm83_detect(struct i2c_client *client,
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200368 struct i2c_board_info *info)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369{
Guenter Roeck81de0ee2021-12-22 16:23:31 -0800370 struct i2c_adapter *adapter = client->adapter;
Jean Delvareb57dc392009-12-09 20:35:52 +0100371 const char *name;
372 u8 man_id, chip_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373
374 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200375 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376
Jean Delvareb57dc392009-12-09 20:35:52 +0100377 /* Detection */
Guenter Roeck81de0ee2021-12-22 16:23:31 -0800378 if ((i2c_smbus_read_byte_data(client, LM83_REG_R_STATUS1) & 0xA8) ||
379 (i2c_smbus_read_byte_data(client, LM83_REG_R_STATUS2) & 0x48) ||
380 (i2c_smbus_read_byte_data(client, LM83_REG_R_CONFIG) & 0x41)) {
Jean Delvareb57dc392009-12-09 20:35:52 +0100381 dev_dbg(&adapter->dev, "LM83 detection failed at 0x%02x\n",
Guenter Roeck81de0ee2021-12-22 16:23:31 -0800382 client->addr);
Jean Delvareb57dc392009-12-09 20:35:52 +0100383 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384 }
385
Jean Delvareb57dc392009-12-09 20:35:52 +0100386 /* Identification */
Guenter Roeck81de0ee2021-12-22 16:23:31 -0800387 man_id = i2c_smbus_read_byte_data(client, LM83_REG_R_MAN_ID);
Jean Delvareb57dc392009-12-09 20:35:52 +0100388 if (man_id != 0x01) /* National Semiconductor */
389 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390
Guenter Roeck81de0ee2021-12-22 16:23:31 -0800391 chip_id = i2c_smbus_read_byte_data(client, LM83_REG_R_CHIP_ID);
Jean Delvareb57dc392009-12-09 20:35:52 +0100392 switch (chip_id) {
393 case 0x03:
Guenter Roeck913ac022021-12-24 11:31:32 -0800394 /*
395 * According to the LM82 datasheet dated March 2013, recent
396 * revisions of LM82 have a die revision of 0x03. This was
397 * confirmed with a real chip. Further details in this revision
398 * of the LM82 datasheet strongly suggest that LM82 is just a
399 * repackaged LM83. It is therefore impossible to distinguish
400 * those chips from LM83, and they will be misdetected as LM83.
401 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 name = "lm83";
Jean Delvareb57dc392009-12-09 20:35:52 +0100403 break;
404 case 0x01:
Jordan Crouse43cb7eb2006-03-23 16:19:49 +0100405 name = "lm82";
Jean Delvareb57dc392009-12-09 20:35:52 +0100406 break;
407 default:
408 /* identification failed */
Guenter Roeck4d63c2d2021-12-22 23:49:59 -0800409 dev_dbg(&adapter->dev,
410 "Unsupported chip (man_id=0x%02X, chip_id=0x%02X)\n",
411 man_id, chip_id);
Jean Delvareb57dc392009-12-09 20:35:52 +0100412 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 }
414
Wolfram Sangf2f394d2022-08-18 23:00:11 +0200415 strscpy(info->type, name, I2C_NAME_SIZE);
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200416
417 return 0;
418}
419
Guenter Roeck11e33772021-12-22 11:49:04 -0800420static const struct i2c_device_id lm83_id[] = {
421 { "lm83", lm83 },
422 { "lm82", lm82 },
423 { }
424};
425MODULE_DEVICE_TABLE(i2c, lm83_id);
Stephen Kitt67487032020-08-13 18:02:22 +0200426
Guenter Roeck81de0ee2021-12-22 16:23:31 -0800427static int lm83_probe(struct i2c_client *client)
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200428{
Guenter Roeck719af4f12021-12-22 16:22:00 -0800429 struct device *dev = &client->dev;
Guenter Roecka0ac8402014-04-12 12:46:34 -0700430 struct device *hwmon_dev;
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200431 struct lm83_data *data;
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200432
Guenter Roeck719af4f12021-12-22 16:22:00 -0800433 data = devm_kzalloc(dev, sizeof(struct lm83_data), GFP_KERNEL);
Guenter Roeckc087f732012-06-02 09:58:10 -0700434 if (!data)
435 return -ENOMEM;
Jean Delvareb6aacdc2008-07-16 19:30:14 +0200436
Guenter Roeck719af4f12021-12-22 16:22:00 -0800437 data->regmap = devm_regmap_init(dev, NULL, client, &lm83_regmap_config);
438 if (IS_ERR(data->regmap))
439 return PTR_ERR(data->regmap);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440
Guenter Roeckc291f612021-12-22 20:24:02 -0800441 data->type = i2c_match_id(lm83_id, client)->driver_data;
Jordan Crouse43cb7eb2006-03-23 16:19:49 +0100442
Guenter Roeckc291f612021-12-22 20:24:02 -0800443 hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name,
444 data, &lm83_chip_info, NULL);
Guenter Roecka0ac8402014-04-12 12:46:34 -0700445 return PTR_ERR_OR_ZERO(hwmon_dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446}
447
Guenter Roeck41936372014-04-12 12:39:41 -0700448/*
449 * Driver data (common to all clients)
450 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451
Guenter Roeck41936372014-04-12 12:39:41 -0700452static struct i2c_driver lm83_driver = {
453 .class = I2C_CLASS_HWMON,
454 .driver = {
455 .name = "lm83",
456 },
Stephen Kitt67487032020-08-13 18:02:22 +0200457 .probe_new = lm83_probe,
Guenter Roeck41936372014-04-12 12:39:41 -0700458 .id_table = lm83_id,
459 .detect = lm83_detect,
460 .address_list = normal_i2c,
461};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462
Axel Linf0967ee2012-01-20 15:38:18 +0800463module_i2c_driver(lm83_driver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464
Jean Delvare7c81c60f2014-01-29 20:40:08 +0100465MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466MODULE_DESCRIPTION("LM83 driver");
467MODULE_LICENSE("GPL");