2 * STTS751 sensor driver
4 * Copyright (C) 2016-2017 Istituto Italiano di Tecnologia - RBCS - EDL
5 * Robotics, Brain and Cognitive Sciences department
6 * Electronic Design Laboratory
8 * Written by Andrea Merello <andrea.merello@gmail.com>
10 * Based on LM95241 driver and LM90 driver
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
23 #include <linux/bitops.h>
24 #include <linux/err.h>
25 #include <linux/hwmon.h>
26 #include <linux/hwmon-sysfs.h>
27 #include <linux/i2c.h>
28 #include <linux/init.h>
29 #include <linux/interrupt.h>
30 #include <linux/jiffies.h>
31 #include <linux/module.h>
32 #include <linux/mutex.h>
33 #include <linux/property.h>
34 #include <linux/slab.h>
35 #include <linux/sysfs.h>
36 #include <linux/util_macros.h>
38 #define DEVNAME "stts751"
40 static const unsigned short normal_i2c
[] = {
41 0x48, 0x49, 0x38, 0x39, /* STTS751-0 */
42 0x4A, 0x4B, 0x3A, 0x3B, /* STTS751-1 */
45 #define STTS751_REG_TEMP_H 0x00
46 #define STTS751_REG_STATUS 0x01
47 #define STTS751_STATUS_TRIPT BIT(0)
48 #define STTS751_STATUS_TRIPL BIT(5)
49 #define STTS751_STATUS_TRIPH BIT(6)
50 #define STTS751_REG_TEMP_L 0x02
51 #define STTS751_REG_CONF 0x03
52 #define STTS751_CONF_RES_MASK 0x0C
53 #define STTS751_CONF_RES_SHIFT 2
54 #define STTS751_CONF_EVENT_DIS BIT(7)
55 #define STTS751_CONF_STOP BIT(6)
56 #define STTS751_REG_RATE 0x04
57 #define STTS751_REG_HLIM_H 0x05
58 #define STTS751_REG_HLIM_L 0x06
59 #define STTS751_REG_LLIM_H 0x07
60 #define STTS751_REG_LLIM_L 0x08
61 #define STTS751_REG_TLIM 0x20
62 #define STTS751_REG_HYST 0x21
63 #define STTS751_REG_SMBUS_TO 0x22
65 #define STTS751_REG_PROD_ID 0xFD
66 #define STTS751_REG_MAN_ID 0xFE
67 #define STTS751_REG_REV_ID 0xFF
69 #define STTS751_0_PROD_ID 0x00
70 #define STTS751_1_PROD_ID 0x01
71 #define ST_MAN_ID 0x53
74 * Possible update intervals are (in mS):
75 * 16000, 8000, 4000, 2000, 1000, 500, 250, 125, 62.5, 31.25
76 * However we are not going to complicate things too much and we stick to the
79 static const int stts751_intervals
[] = {
80 16000, 8000, 4000, 2000, 1000, 500, 250, 125, 63, 31
83 static const struct i2c_device_id stts751_id
[] = {
90 struct i2c_client
*client
;
91 struct mutex access_lock
;
94 int event_max
, event_min
;
99 unsigned long last_update
, last_alert_update
;
101 bool min_alert
, max_alert
, therm_trip
;
102 bool data_valid
, alert_valid
;
103 bool notify_max
, notify_min
;
107 * These functions converts temperature from HW format to integer format and
108 * vice-vers. They are (mostly) taken from lm90 driver. Unit is in mC.
110 static int stts751_to_deg(s16 hw_val
)
112 return hw_val
* 125 / 32;
115 static s32
stts751_to_hw(int val
)
117 return DIV_ROUND_CLOSEST(val
, 125) * 32;
120 static int stts751_adjust_resolution(struct stts751_priv
*priv
)
124 switch (priv
->interval
) {
139 if (priv
->res
== res
)
142 priv
->config
&= ~STTS751_CONF_RES_MASK
;
143 priv
->config
|= res
<< STTS751_CONF_RES_SHIFT
;
144 dev_dbg(&priv
->client
->dev
, "setting res %d. config %x",
148 return i2c_smbus_write_byte_data(priv
->client
,
149 STTS751_REG_CONF
, priv
->config
);
152 static int stts751_update_temp(struct stts751_priv
*priv
)
154 s32 integer1
, integer2
, frac
;
157 * There is a trick here, like in the lm90 driver. We have to read two
158 * registers to get the sensor temperature, but we have to beware a
159 * conversion could occur between the readings. We could use the
160 * one-shot conversion register, but we don't want to do this (disables
161 * hardware monitoring). So the solution used here is to read the high
162 * byte once, then the low byte, then the high byte again. If the new
163 * high byte matches the old one, then we have a valid reading. Else we
164 * have to read the low byte again, and now we believe we have a correct
167 integer1
= i2c_smbus_read_byte_data(priv
->client
, STTS751_REG_TEMP_H
);
169 dev_dbg(&priv
->client
->dev
,
170 "I2C read failed (temp H). ret: %x\n", integer1
);
174 frac
= i2c_smbus_read_byte_data(priv
->client
, STTS751_REG_TEMP_L
);
176 dev_dbg(&priv
->client
->dev
,
177 "I2C read failed (temp L). ret: %x\n", frac
);
181 integer2
= i2c_smbus_read_byte_data(priv
->client
, STTS751_REG_TEMP_H
);
183 dev_dbg(&priv
->client
->dev
,
184 "I2C 2nd read failed (temp H). ret: %x\n", integer2
);
188 if (integer1
!= integer2
) {
189 frac
= i2c_smbus_read_byte_data(priv
->client
,
192 dev_dbg(&priv
->client
->dev
,
193 "I2C 2nd read failed (temp L). ret: %x\n",
199 priv
->temp
= stts751_to_deg((integer1
<< 8) | frac
);
203 static int stts751_set_temp_reg16(struct stts751_priv
*priv
, int temp
,
209 hwval
= stts751_to_hw(temp
);
211 ret
= i2c_smbus_write_byte_data(priv
->client
, hreg
, hwval
>> 8);
215 return i2c_smbus_write_byte_data(priv
->client
, lreg
, hwval
& 0xff);
218 static int stts751_set_temp_reg8(struct stts751_priv
*priv
, int temp
, u8 reg
)
222 hwval
= stts751_to_hw(temp
);
223 return i2c_smbus_write_byte_data(priv
->client
, reg
, hwval
>> 8);
226 static int stts751_read_reg16(struct stts751_priv
*priv
, int *temp
,
231 integer
= i2c_smbus_read_byte_data(priv
->client
, hreg
);
235 frac
= i2c_smbus_read_byte_data(priv
->client
, lreg
);
239 *temp
= stts751_to_deg((integer
<< 8) | frac
);
244 static int stts751_read_reg8(struct stts751_priv
*priv
, int *temp
, u8 reg
)
248 integer
= i2c_smbus_read_byte_data(priv
->client
, reg
);
252 *temp
= stts751_to_deg(integer
<< 8);
258 * Update alert flags without waiting for cache to expire. We detects alerts
259 * immediately for the sake of the alert handler; we still need to deal with
260 * caching to workaround the fact that alarm flags int the status register,
261 * despite what the datasheet claims, gets always cleared on read.
263 static int stts751_update_alert(struct stts751_priv
*priv
)
267 int cache_time
= msecs_to_jiffies(stts751_intervals
[priv
->interval
]);
270 * Add another 10% because if we run faster than the HW conversion
271 * rate we will end up in reporting incorrectly alarms.
273 cache_time
+= cache_time
/ 10;
275 ret
= i2c_smbus_read_byte_data(priv
->client
, STTS751_REG_STATUS
);
279 dev_dbg(&priv
->client
->dev
, "status reg %x\n", ret
);
280 conv_done
= ret
& (STTS751_STATUS_TRIPH
| STTS751_STATUS_TRIPL
);
282 * Reset the cache if the cache time expired, or if we are sure
283 * we have valid data from a device conversion, or if we know
284 * our cache has been never written.
286 * Note that when the cache has been never written the point is
287 * to correctly initialize the timestamp, rather than clearing
290 * Note that updating the cache timestamp when we get an alarm flag
291 * is required, otherwise we could incorrectly report alarms to be zero.
293 if (time_after(jiffies
, priv
->last_alert_update
+ cache_time
) ||
294 conv_done
|| !priv
->alert_valid
) {
295 priv
->max_alert
= false;
296 priv
->min_alert
= false;
297 priv
->alert_valid
= true;
298 priv
->last_alert_update
= jiffies
;
299 dev_dbg(&priv
->client
->dev
, "invalidating alert cache\n");
302 priv
->max_alert
|= !!(ret
& STTS751_STATUS_TRIPH
);
303 priv
->min_alert
|= !!(ret
& STTS751_STATUS_TRIPL
);
304 priv
->therm_trip
= !!(ret
& STTS751_STATUS_TRIPT
);
306 dev_dbg(&priv
->client
->dev
, "max_alert: %d, min_alert: %d, therm_trip: %d\n",
307 priv
->max_alert
, priv
->min_alert
, priv
->therm_trip
);
312 static void stts751_alert(struct i2c_client
*client
,
313 enum i2c_alert_protocol type
, unsigned int data
)
316 struct stts751_priv
*priv
= i2c_get_clientdata(client
);
318 if (type
!= I2C_PROTOCOL_SMBUS_ALERT
)
321 dev_dbg(&client
->dev
, "alert!");
323 mutex_lock(&priv
->access_lock
);
324 ret
= stts751_update_alert(priv
);
326 /* default to worst case */
327 priv
->max_alert
= true;
328 priv
->min_alert
= true;
331 "Alert received, but can't communicate to the device. Triggering all alarms!");
334 if (priv
->max_alert
) {
335 if (priv
->notify_max
)
336 dev_notice(priv
->dev
, "got alert for HIGH temperature");
337 priv
->notify_max
= false;
339 /* unblock alert poll */
340 sysfs_notify(&priv
->dev
->kobj
, NULL
, "temp1_max_alarm");
343 if (priv
->min_alert
) {
344 if (priv
->notify_min
)
345 dev_notice(priv
->dev
, "got alert for LOW temperature");
346 priv
->notify_min
= false;
348 /* unblock alert poll */
349 sysfs_notify(&priv
->dev
->kobj
, NULL
, "temp1_min_alarm");
352 if (priv
->min_alert
|| priv
->max_alert
)
353 kobject_uevent(&priv
->dev
->kobj
, KOBJ_CHANGE
);
355 mutex_unlock(&priv
->access_lock
);
358 static int stts751_update(struct stts751_priv
*priv
)
361 int cache_time
= msecs_to_jiffies(stts751_intervals
[priv
->interval
]);
363 if (time_after(jiffies
, priv
->last_update
+ cache_time
) ||
365 ret
= stts751_update_temp(priv
);
369 ret
= stts751_update_alert(priv
);
372 priv
->data_valid
= true;
373 priv
->last_update
= jiffies
;
379 static ssize_t
show_max_alarm(struct device
*dev
, struct device_attribute
*attr
,
383 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
385 mutex_lock(&priv
->access_lock
);
386 ret
= stts751_update(priv
);
388 priv
->notify_max
= true;
389 mutex_unlock(&priv
->access_lock
);
393 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->max_alert
);
396 static ssize_t
show_min_alarm(struct device
*dev
, struct device_attribute
*attr
,
400 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
402 mutex_lock(&priv
->access_lock
);
403 ret
= stts751_update(priv
);
405 priv
->notify_min
= true;
406 mutex_unlock(&priv
->access_lock
);
410 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->min_alert
);
413 static ssize_t
show_input(struct device
*dev
, struct device_attribute
*attr
,
417 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
419 mutex_lock(&priv
->access_lock
);
420 ret
= stts751_update(priv
);
421 mutex_unlock(&priv
->access_lock
);
425 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->temp
);
428 static ssize_t
show_therm(struct device
*dev
, struct device_attribute
*attr
,
431 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
433 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->therm
);
436 static ssize_t
set_therm(struct device
*dev
, struct device_attribute
*attr
,
437 const char *buf
, size_t count
)
441 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
443 if (kstrtol(buf
, 10, &temp
) < 0)
446 /* HW works in range -64C to +127.937C */
447 temp
= clamp_val(temp
, -64000, 127937);
448 mutex_lock(&priv
->access_lock
);
449 ret
= stts751_set_temp_reg8(priv
, temp
, STTS751_REG_TLIM
);
453 dev_dbg(&priv
->client
->dev
, "setting therm %ld", temp
);
456 * hysteresis reg is relative to therm, so the HW does not need to be
457 * adjusted, we need to update our local copy only.
459 priv
->hyst
= temp
- (priv
->therm
- priv
->hyst
);
463 mutex_unlock(&priv
->access_lock
);
470 static ssize_t
show_hyst(struct device
*dev
, struct device_attribute
*attr
,
473 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
475 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->hyst
);
478 static ssize_t
set_hyst(struct device
*dev
, struct device_attribute
*attr
,
479 const char *buf
, size_t count
)
484 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
486 if (kstrtol(buf
, 10, &temp
) < 0)
489 mutex_lock(&priv
->access_lock
);
490 /* HW works in range -64C to +127.937C */
491 temp
= clamp_val(temp
, -64000, priv
->therm
);
493 dev_dbg(&priv
->client
->dev
, "setting hyst %ld", temp
);
494 temp
= priv
->therm
- temp
;
495 ret
= stts751_set_temp_reg8(priv
, temp
, STTS751_REG_HYST
);
496 mutex_unlock(&priv
->access_lock
);
503 static ssize_t
show_therm_trip(struct device
*dev
,
504 struct device_attribute
*attr
, char *buf
)
507 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
509 mutex_lock(&priv
->access_lock
);
510 ret
= stts751_update(priv
);
511 mutex_unlock(&priv
->access_lock
);
515 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->therm_trip
);
518 static ssize_t
show_max(struct device
*dev
, struct device_attribute
*attr
,
521 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
523 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->event_max
);
526 static ssize_t
set_max(struct device
*dev
, struct device_attribute
*attr
,
527 const char *buf
, size_t count
)
531 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
533 if (kstrtol(buf
, 10, &temp
) < 0)
536 mutex_lock(&priv
->access_lock
);
537 /* HW works in range -64C to +127.937C */
538 temp
= clamp_val(temp
, priv
->event_min
, 127937);
539 ret
= stts751_set_temp_reg16(priv
, temp
,
540 STTS751_REG_HLIM_H
, STTS751_REG_HLIM_L
);
544 dev_dbg(&priv
->client
->dev
, "setting event max %ld", temp
);
545 priv
->event_max
= temp
;
548 mutex_unlock(&priv
->access_lock
);
552 static ssize_t
show_min(struct device
*dev
, struct device_attribute
*attr
,
555 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
557 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n", priv
->event_min
);
560 static ssize_t
set_min(struct device
*dev
, struct device_attribute
*attr
,
561 const char *buf
, size_t count
)
565 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
567 if (kstrtol(buf
, 10, &temp
) < 0)
570 mutex_lock(&priv
->access_lock
);
571 /* HW works in range -64C to +127.937C */
572 temp
= clamp_val(temp
, -64000, priv
->event_max
);
573 ret
= stts751_set_temp_reg16(priv
, temp
,
574 STTS751_REG_LLIM_H
, STTS751_REG_LLIM_L
);
578 dev_dbg(&priv
->client
->dev
, "setting event min %ld", temp
);
579 priv
->event_min
= temp
;
582 mutex_unlock(&priv
->access_lock
);
586 static ssize_t
show_interval(struct device
*dev
, struct device_attribute
*attr
,
589 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
591 return snprintf(buf
, PAGE_SIZE
- 1, "%d\n",
592 stts751_intervals
[priv
->interval
]);
595 static ssize_t
set_interval(struct device
*dev
, struct device_attribute
*attr
,
596 const char *buf
, size_t count
)
601 struct stts751_priv
*priv
= dev_get_drvdata(dev
);
603 if (kstrtoul(buf
, 10, &val
) < 0)
606 idx
= find_closest_descending(val
, stts751_intervals
,
607 ARRAY_SIZE(stts751_intervals
));
609 dev_dbg(&priv
->client
->dev
, "setting interval. req:%lu, idx: %d, val: %d",
610 val
, idx
, stts751_intervals
[idx
]);
612 mutex_lock(&priv
->access_lock
);
613 if (priv
->interval
== idx
)
617 * In early development stages I've become suspicious about the chip
618 * starting to misbehave if I ever set, even briefly, an invalid
619 * configuration. While I'm not sure this is really needed, be
620 * conservative and set rate/resolution in such an order that avoids
621 * passing through an invalid configuration.
624 /* speed up: lower the resolution, then modify convrate */
625 if (priv
->interval
< idx
) {
626 dev_dbg(&priv
->client
->dev
, "lower resolution, then modify convrate");
627 priv
->interval
= idx
;
628 ret
= stts751_adjust_resolution(priv
);
633 ret
= i2c_smbus_write_byte_data(priv
->client
, STTS751_REG_RATE
, idx
);
636 /* slow down: modify convrate, then raise resolution */
637 if (priv
->interval
!= idx
) {
638 dev_dbg(&priv
->client
->dev
, "modify convrate, then raise resolution");
639 priv
->interval
= idx
;
640 ret
= stts751_adjust_resolution(priv
);
646 mutex_unlock(&priv
->access_lock
);
651 static int stts751_detect(struct i2c_client
*new_client
,
652 struct i2c_board_info
*info
)
654 struct i2c_adapter
*adapter
= new_client
->adapter
;
658 if (!i2c_check_functionality(adapter
, I2C_FUNC_SMBUS_BYTE_DATA
))
661 tmp
= i2c_smbus_read_byte_data(new_client
, STTS751_REG_MAN_ID
);
662 if (tmp
!= ST_MAN_ID
)
665 /* lower temperaure registers always have bits 0-3 set to zero */
666 tmp
= i2c_smbus_read_byte_data(new_client
, STTS751_REG_TEMP_L
);
670 tmp
= i2c_smbus_read_byte_data(new_client
, STTS751_REG_HLIM_L
);
674 tmp
= i2c_smbus_read_byte_data(new_client
, STTS751_REG_LLIM_L
);
678 /* smbus timeout register always have bits 0-7 set to zero */
679 tmp
= i2c_smbus_read_byte_data(new_client
, STTS751_REG_SMBUS_TO
);
683 tmp
= i2c_smbus_read_byte_data(new_client
, STTS751_REG_PROD_ID
);
686 case STTS751_0_PROD_ID
:
689 case STTS751_1_PROD_ID
:
695 dev_dbg(&new_client
->dev
, "Chip %s detected", name
);
697 strlcpy(info
->type
, stts751_id
[0].name
, I2C_NAME_SIZE
);
701 static int stts751_read_chip_config(struct stts751_priv
*priv
)
706 ret
= i2c_smbus_read_byte_data(priv
->client
, STTS751_REG_CONF
);
710 priv
->res
= (ret
& STTS751_CONF_RES_MASK
) >> STTS751_CONF_RES_SHIFT
;
712 ret
= i2c_smbus_read_byte_data(priv
->client
, STTS751_REG_RATE
);
715 priv
->interval
= ret
;
717 ret
= stts751_read_reg16(priv
, &priv
->event_max
,
718 STTS751_REG_HLIM_H
, STTS751_REG_HLIM_L
);
722 ret
= stts751_read_reg16(priv
, &priv
->event_min
,
723 STTS751_REG_LLIM_H
, STTS751_REG_LLIM_L
);
727 ret
= stts751_read_reg8(priv
, &priv
->therm
, STTS751_REG_TLIM
);
731 ret
= stts751_read_reg8(priv
, &tmp
, STTS751_REG_HYST
);
734 priv
->hyst
= priv
->therm
- tmp
;
739 static SENSOR_DEVICE_ATTR(temp1_input
, 0444, show_input
, NULL
, 0);
740 static SENSOR_DEVICE_ATTR(temp1_min
, 0644, show_min
, set_min
, 0);
741 static SENSOR_DEVICE_ATTR(temp1_max
, 0644, show_max
, set_max
, 0);
742 static SENSOR_DEVICE_ATTR(temp1_min_alarm
, 0444, show_min_alarm
, NULL
, 0);
743 static SENSOR_DEVICE_ATTR(temp1_max_alarm
, 0444, show_max_alarm
, NULL
, 0);
744 static SENSOR_DEVICE_ATTR(temp1_crit
, 0644, show_therm
, set_therm
, 0);
745 static SENSOR_DEVICE_ATTR(temp1_crit_hyst
, 0644, show_hyst
, set_hyst
, 0);
746 static SENSOR_DEVICE_ATTR(temp1_crit_alarm
, 0444, show_therm_trip
, NULL
, 0);
747 static SENSOR_DEVICE_ATTR(update_interval
, 0644,
748 show_interval
, set_interval
, 0);
750 static struct attribute
*stts751_attrs
[] = {
751 &sensor_dev_attr_temp1_input
.dev_attr
.attr
,
752 &sensor_dev_attr_temp1_min
.dev_attr
.attr
,
753 &sensor_dev_attr_temp1_max
.dev_attr
.attr
,
754 &sensor_dev_attr_temp1_min_alarm
.dev_attr
.attr
,
755 &sensor_dev_attr_temp1_max_alarm
.dev_attr
.attr
,
756 &sensor_dev_attr_temp1_crit
.dev_attr
.attr
,
757 &sensor_dev_attr_temp1_crit_hyst
.dev_attr
.attr
,
758 &sensor_dev_attr_temp1_crit_alarm
.dev_attr
.attr
,
759 &sensor_dev_attr_update_interval
.dev_attr
.attr
,
762 ATTRIBUTE_GROUPS(stts751
);
764 static int stts751_probe(struct i2c_client
*client
,
765 const struct i2c_device_id
*id
)
767 struct stts751_priv
*priv
;
772 priv
= devm_kzalloc(&client
->dev
, sizeof(*priv
), GFP_KERNEL
);
776 priv
->client
= client
;
777 priv
->notify_max
= true;
778 priv
->notify_min
= true;
779 i2c_set_clientdata(client
, priv
);
780 mutex_init(&priv
->access_lock
);
782 if (device_property_present(&client
->dev
,
783 "smbus-timeout-disable")) {
784 smbus_nto
= device_property_read_bool(&client
->dev
,
785 "smbus-timeout-disable");
787 ret
= i2c_smbus_write_byte_data(client
, STTS751_REG_SMBUS_TO
,
788 smbus_nto
? 0 : 0x80);
793 rev_id
= i2c_smbus_read_byte_data(client
, STTS751_REG_REV_ID
);
797 dev_dbg(&client
->dev
, "Chip revision 0x%x is untested\n",
801 ret
= stts751_read_chip_config(priv
);
805 priv
->config
&= ~(STTS751_CONF_STOP
| STTS751_CONF_EVENT_DIS
);
806 ret
= i2c_smbus_write_byte_data(client
, STTS751_REG_CONF
, priv
->config
);
810 priv
->dev
= devm_hwmon_device_register_with_groups(&client
->dev
,
813 return PTR_ERR_OR_ZERO(priv
->dev
);
816 MODULE_DEVICE_TABLE(i2c
, stts751_id
);
818 static struct i2c_driver stts751_driver
= {
819 .class = I2C_CLASS_HWMON
,
823 .probe
= stts751_probe
,
824 .id_table
= stts751_id
,
825 .detect
= stts751_detect
,
826 .alert
= stts751_alert
,
827 .address_list
= normal_i2c
,
830 module_i2c_driver(stts751_driver
);
832 MODULE_AUTHOR("Andrea Merello <andrea.merello@gmail.com>");
833 MODULE_DESCRIPTION("STTS751 sensor driver");
834 MODULE_LICENSE("GPL");