Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / hwmon / chipcap2.c
blobedf454474f11c9300a1b6ea7b27f72760173617c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * cc2.c - Support for the Amphenol ChipCap 2 relative humidity, temperature sensor
5 * Part numbers supported:
6 * CC2D23, CC2D23S, CC2D25, CC2D25S, CC2D33, CC2D33S, CC2D35, CC2D35S
8 * Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
10 * Datasheet and application notes:
11 * https://www.amphenol-sensors.com/en/telaire/humidity/527-humidity-sensors/3095-chipcap-2
14 #include <linux/bitfield.h>
15 #include <linux/bits.h>
16 #include <linux/completion.h>
17 #include <linux/delay.h>
18 #include <linux/hwmon.h>
19 #include <linux/i2c.h>
20 #include <linux/interrupt.h>
21 #include <linux/irq.h>
22 #include <linux/module.h>
23 #include <linux/regulator/consumer.h>
25 #define CC2_START_CM 0xA0
26 #define CC2_START_NOM 0x80
27 #define CC2_R_ALARM_H_ON 0x18
28 #define CC2_R_ALARM_H_OFF 0x19
29 #define CC2_R_ALARM_L_ON 0x1A
30 #define CC2_R_ALARM_L_OFF 0x1B
31 #define CC2_RW_OFFSET 0x40
32 #define CC2_W_ALARM_H_ON (CC2_R_ALARM_H_ON + CC2_RW_OFFSET)
33 #define CC2_W_ALARM_H_OFF (CC2_R_ALARM_H_OFF + CC2_RW_OFFSET)
34 #define CC2_W_ALARM_L_ON (CC2_R_ALARM_L_ON + CC2_RW_OFFSET)
35 #define CC2_W_ALARM_L_OFF (CC2_R_ALARM_L_OFF + CC2_RW_OFFSET)
37 #define CC2_STATUS_FIELD GENMASK(7, 6)
38 #define CC2_STATUS_VALID_DATA 0x00
39 #define CC2_STATUS_STALE_DATA 0x01
40 #define CC2_STATUS_CMD_MODE 0x02
42 #define CC2_RESPONSE_FIELD GENMASK(1, 0)
43 #define CC2_RESPONSE_BUSY 0x00
44 #define CC2_RESPONSE_ACK 0x01
45 #define CC2_RESPONSE_NACK 0x02
47 #define CC2_ERR_CORR_EEPROM BIT(2)
48 #define CC2_ERR_UNCORR_EEPROM BIT(3)
49 #define CC2_ERR_RAM_PARITY BIT(4)
50 #define CC2_ERR_CONFIG_LOAD BIT(5)
52 #define CC2_EEPROM_SIZE 10
53 #define CC2_EEPROM_DATA_LEN 3
54 #define CC2_MEASUREMENT_DATA_LEN 4
56 #define CC2_RH_DATA_FIELD GENMASK(13, 0)
58 /* ensure clean off -> on transitions */
59 #define CC2_POWER_CYCLE_MS 80
61 #define CC2_STARTUP_TO_DATA_MS 55
62 #define CC2_RESP_START_CM_US 100
63 #define CC2_RESP_EEPROM_R_US 100
64 #define CC2_RESP_EEPROM_W_MS 12
65 #define CC2_STARTUP_TIME_US 1250
67 #define CC2_RH_MAX (100 * 1000U)
69 #define CC2_CM_RETRIES 5
71 struct cc2_rh_alarm_info {
72 bool low_alarm;
73 bool high_alarm;
74 bool low_alarm_visible;
75 bool high_alarm_visible;
78 struct cc2_data {
79 struct cc2_rh_alarm_info rh_alarm;
80 struct completion complete;
81 struct device *hwmon;
82 struct i2c_client *client;
83 struct mutex dev_access_lock; /* device access lock */
84 struct regulator *regulator;
85 const char *name;
86 int irq_ready;
87 int irq_low;
88 int irq_high;
89 bool process_irqs;
92 enum cc2_chan_addr {
93 CC2_CHAN_TEMP = 0,
94 CC2_CHAN_HUMIDITY,
97 /* %RH as a per cent mille from a register value */
98 static long cc2_rh_convert(u16 data)
100 unsigned long tmp = (data & CC2_RH_DATA_FIELD) * CC2_RH_MAX;
102 return tmp / ((1 << 14) - 1);
105 /* convert %RH to a register value */
106 static u16 cc2_rh_to_reg(long data)
108 return data * ((1 << 14) - 1) / CC2_RH_MAX;
111 /* temperature in milli degrees celsius from a register value */
112 static long cc2_temp_convert(u16 data)
114 unsigned long tmp = ((data >> 2) * 165 * 1000U) / ((1 << 14) - 1);
116 return tmp - 40 * 1000U;
119 static int cc2_enable(struct cc2_data *data)
121 int ret;
123 /* exclusive regulator, check in case a disable failed */
124 if (regulator_is_enabled(data->regulator))
125 return 0;
127 /* clear any pending completion */
128 try_wait_for_completion(&data->complete);
130 ret = regulator_enable(data->regulator);
131 if (ret < 0)
132 return ret;
134 usleep_range(CC2_STARTUP_TIME_US, CC2_STARTUP_TIME_US + 125);
136 data->process_irqs = true;
138 return 0;
141 static void cc2_disable(struct cc2_data *data)
143 int err;
145 /* ignore alarms triggered by voltage toggling when powering up */
146 data->process_irqs = false;
148 /* exclusive regulator, check in case an enable failed */
149 if (regulator_is_enabled(data->regulator)) {
150 err = regulator_disable(data->regulator);
151 if (err)
152 dev_dbg(&data->client->dev, "Failed to disable device");
156 static int cc2_cmd_response_diagnostic(struct device *dev, u8 status)
158 int resp;
160 if (FIELD_GET(CC2_STATUS_FIELD, status) != CC2_STATUS_CMD_MODE) {
161 dev_dbg(dev, "Command sent out of command window\n");
162 return -ETIMEDOUT;
165 resp = FIELD_GET(CC2_RESPONSE_FIELD, status);
166 switch (resp) {
167 case CC2_RESPONSE_ACK:
168 return 0;
169 case CC2_RESPONSE_BUSY:
170 return -EBUSY;
171 case CC2_RESPONSE_NACK:
172 if (resp & CC2_ERR_CORR_EEPROM)
173 dev_dbg(dev, "Command failed: corrected EEPROM\n");
174 if (resp & CC2_ERR_UNCORR_EEPROM)
175 dev_dbg(dev, "Command failed: uncorrected EEPROM\n");
176 if (resp & CC2_ERR_RAM_PARITY)
177 dev_dbg(dev, "Command failed: RAM parity\n");
178 if (resp & CC2_ERR_RAM_PARITY)
179 dev_dbg(dev, "Command failed: configuration error\n");
180 return -ENODATA;
181 default:
182 dev_dbg(dev, "Unknown command reply\n");
183 return -EINVAL;
187 static int cc2_read_command_status(struct i2c_client *client)
189 u8 status;
190 int ret;
192 ret = i2c_master_recv(client, &status, 1);
193 if (ret != 1) {
194 ret = ret < 0 ? ret : -EIO;
195 return ret;
198 return cc2_cmd_response_diagnostic(&client->dev, status);
202 * The command mode is only accessible after sending the START_CM command in the
203 * first 10 ms after power-up. Only in case the command window is missed,
204 * CC2_CM_RETRIES retries are attempted before giving up and returning an error.
206 static int cc2_command_mode_start(struct cc2_data *data)
208 unsigned long timeout;
209 int i, ret;
211 for (i = 0; i < CC2_CM_RETRIES; i++) {
212 ret = cc2_enable(data);
213 if (ret < 0)
214 return ret;
216 ret = i2c_smbus_write_word_data(data->client, CC2_START_CM, 0);
217 if (ret < 0)
218 return ret;
220 if (data->irq_ready > 0) {
221 timeout = usecs_to_jiffies(2 * CC2_RESP_START_CM_US);
222 ret = wait_for_completion_timeout(&data->complete,
223 timeout);
224 if (!ret)
225 return -ETIMEDOUT;
226 } else {
227 usleep_range(CC2_RESP_START_CM_US,
228 2 * CC2_RESP_START_CM_US);
230 ret = cc2_read_command_status(data->client);
231 if (ret != -ETIMEDOUT || i == CC2_CM_RETRIES)
232 break;
234 /* command window missed, prepare for a retry */
235 cc2_disable(data);
236 msleep(CC2_POWER_CYCLE_MS);
239 return ret;
242 /* Sending a Start_NOM command finishes the command mode immediately with no
243 * reply and the device enters normal operation mode
245 static int cc2_command_mode_finish(struct cc2_data *data)
247 int ret;
249 ret = i2c_smbus_write_word_data(data->client, CC2_START_NOM, 0);
250 if (ret < 0)
251 return ret;
253 return 0;
256 static int cc2_write_reg(struct cc2_data *data, u8 reg, u16 val)
258 unsigned long timeout;
259 int ret;
261 ret = cc2_command_mode_start(data);
262 if (ret < 0)
263 goto disable;
265 cpu_to_be16s(&val);
266 ret = i2c_smbus_write_word_data(data->client, reg, val);
267 if (ret < 0)
268 goto disable;
270 if (data->irq_ready > 0) {
271 timeout = msecs_to_jiffies(2 * CC2_RESP_EEPROM_W_MS);
272 ret = wait_for_completion_timeout(&data->complete, timeout);
273 if (!ret) {
274 ret = -ETIMEDOUT;
275 goto disable;
277 } else {
278 msleep(CC2_RESP_EEPROM_W_MS);
281 ret = cc2_read_command_status(data->client);
283 disable:
284 cc2_disable(data);
286 return ret;
289 static int cc2_read_reg(struct cc2_data *data, u8 reg, u16 *val)
291 u8 buf[CC2_EEPROM_DATA_LEN];
292 unsigned long timeout;
293 int ret;
295 ret = cc2_command_mode_start(data);
296 if (ret < 0)
297 return ret;
299 ret = i2c_smbus_write_word_data(data->client, reg, 0);
300 if (ret < 0)
301 return ret;
303 if (data->irq_ready > 0) {
304 timeout = usecs_to_jiffies(2 * CC2_RESP_EEPROM_R_US);
305 ret = wait_for_completion_timeout(&data->complete, timeout);
306 if (!ret)
307 return -ETIMEDOUT;
309 } else {
310 usleep_range(CC2_RESP_EEPROM_R_US, CC2_RESP_EEPROM_R_US + 10);
312 ret = i2c_master_recv(data->client, buf, CC2_EEPROM_DATA_LEN);
313 if (ret != CC2_EEPROM_DATA_LEN)
314 return ret < 0 ? ret : -EIO;
316 *val = be16_to_cpup((__be16 *)&buf[1]);
318 return cc2_read_command_status(data->client);
321 static int cc2_get_reg_val(struct cc2_data *data, u8 reg, long *val)
323 u16 reg_val;
324 int ret;
326 ret = cc2_read_reg(data, reg, &reg_val);
327 if (!ret)
328 *val = cc2_rh_convert(reg_val);
330 cc2_disable(data);
332 return ret;
335 static int cc2_data_fetch(struct i2c_client *client,
336 enum hwmon_sensor_types type, long *val)
338 u8 data[CC2_MEASUREMENT_DATA_LEN];
339 u8 status;
340 int ret;
342 ret = i2c_master_recv(client, data, CC2_MEASUREMENT_DATA_LEN);
343 if (ret != CC2_MEASUREMENT_DATA_LEN) {
344 ret = ret < 0 ? ret : -EIO;
345 return ret;
347 status = FIELD_GET(CC2_STATUS_FIELD, data[0]);
348 if (status == CC2_STATUS_STALE_DATA)
349 return -EBUSY;
351 if (status != CC2_STATUS_VALID_DATA)
352 return -EIO;
354 switch (type) {
355 case hwmon_humidity:
356 *val = cc2_rh_convert(be16_to_cpup((__be16 *)&data[0]));
357 break;
358 case hwmon_temp:
359 *val = cc2_temp_convert(be16_to_cpup((__be16 *)&data[2]));
360 break;
361 default:
362 return -EINVAL;
365 return 0;
368 static int cc2_read_measurement(struct cc2_data *data,
369 enum hwmon_sensor_types type, long *val)
371 unsigned long timeout;
372 int ret;
374 if (data->irq_ready > 0) {
375 timeout = msecs_to_jiffies(CC2_STARTUP_TO_DATA_MS * 2);
376 ret = wait_for_completion_timeout(&data->complete, timeout);
377 if (!ret)
378 return -ETIMEDOUT;
380 } else {
381 msleep(CC2_STARTUP_TO_DATA_MS);
384 ret = cc2_data_fetch(data->client, type, val);
386 return ret;
390 * A measurement requires enabling the device, waiting for the automatic
391 * measurement to finish, reading the measurement data and disabling the device
392 * again.
394 static int cc2_measurement(struct cc2_data *data, enum hwmon_sensor_types type,
395 long *val)
397 int ret;
399 ret = cc2_enable(data);
400 if (ret)
401 return ret;
403 ret = cc2_read_measurement(data, type, val);
405 cc2_disable(data);
407 return ret;
411 * In order to check alarm status, the corresponding ALARM_OFF (hysteresis)
412 * register must be read and a new measurement must be carried out to trigger
413 * the alarm signals. Given that the device carries out a measurement after
414 * exiting the command mode, there is no need to force two power-up sequences.
415 * Instead, a NOM command is sent and the device is disabled after the
416 * measurement is read.
418 static int cc2_read_hyst_and_measure(struct cc2_data *data, u8 reg,
419 long *hyst, long *measurement)
421 u16 reg_val;
422 int ret;
424 ret = cc2_read_reg(data, reg, &reg_val);
425 if (ret)
426 goto disable;
428 *hyst = cc2_rh_convert(reg_val);
430 ret = cc2_command_mode_finish(data);
431 if (ret)
432 goto disable;
434 ret = cc2_read_measurement(data, hwmon_humidity, measurement);
436 disable:
437 cc2_disable(data);
439 return ret;
442 static umode_t cc2_is_visible(const void *data, enum hwmon_sensor_types type,
443 u32 attr, int channel)
445 const struct cc2_data *cc2 = data;
447 switch (type) {
448 case hwmon_humidity:
449 switch (attr) {
450 case hwmon_humidity_input:
451 return 0444;
452 case hwmon_humidity_min_alarm:
453 return cc2->rh_alarm.low_alarm_visible ? 0444 : 0;
454 case hwmon_humidity_max_alarm:
455 return cc2->rh_alarm.high_alarm_visible ? 0444 : 0;
456 case hwmon_humidity_min:
457 case hwmon_humidity_min_hyst:
458 return cc2->rh_alarm.low_alarm_visible ? 0644 : 0;
459 case hwmon_humidity_max:
460 case hwmon_humidity_max_hyst:
461 return cc2->rh_alarm.high_alarm_visible ? 0644 : 0;
462 default:
463 return 0;
465 case hwmon_temp:
466 switch (attr) {
467 case hwmon_temp_input:
468 return 0444;
469 default:
470 return 0;
472 default:
473 break;
476 return 0;
479 static irqreturn_t cc2_ready_interrupt(int irq, void *data)
481 struct cc2_data *cc2 = data;
483 if (cc2->process_irqs)
484 complete(&cc2->complete);
486 return IRQ_HANDLED;
489 static irqreturn_t cc2_low_interrupt(int irq, void *data)
491 struct cc2_data *cc2 = data;
493 if (cc2->process_irqs) {
494 hwmon_notify_event(cc2->hwmon, hwmon_humidity,
495 hwmon_humidity_min_alarm, CC2_CHAN_HUMIDITY);
496 cc2->rh_alarm.low_alarm = true;
499 return IRQ_HANDLED;
502 static irqreturn_t cc2_high_interrupt(int irq, void *data)
504 struct cc2_data *cc2 = data;
506 if (cc2->process_irqs) {
507 hwmon_notify_event(cc2->hwmon, hwmon_humidity,
508 hwmon_humidity_max_alarm, CC2_CHAN_HUMIDITY);
509 cc2->rh_alarm.high_alarm = true;
512 return IRQ_HANDLED;
515 static int cc2_humidity_min_alarm_status(struct cc2_data *data, long *val)
517 long measurement, min_hyst;
518 int ret;
520 ret = cc2_read_hyst_and_measure(data, CC2_R_ALARM_L_OFF, &min_hyst,
521 &measurement);
522 if (ret < 0)
523 return ret;
525 if (data->rh_alarm.low_alarm) {
526 *val = (measurement < min_hyst) ? 1 : 0;
527 data->rh_alarm.low_alarm = *val;
528 } else {
529 *val = 0;
532 return 0;
535 static int cc2_humidity_max_alarm_status(struct cc2_data *data, long *val)
537 long measurement, max_hyst;
538 int ret;
540 ret = cc2_read_hyst_and_measure(data, CC2_R_ALARM_H_OFF, &max_hyst,
541 &measurement);
542 if (ret < 0)
543 return ret;
545 if (data->rh_alarm.high_alarm) {
546 *val = (measurement > max_hyst) ? 1 : 0;
547 data->rh_alarm.high_alarm = *val;
548 } else {
549 *val = 0;
552 return 0;
555 static int cc2_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
556 int channel, long *val)
558 struct cc2_data *data = dev_get_drvdata(dev);
559 int ret = 0;
561 mutex_lock(&data->dev_access_lock);
563 switch (type) {
564 case hwmon_temp:
565 ret = cc2_measurement(data, type, val);
566 break;
567 case hwmon_humidity:
568 switch (attr) {
569 case hwmon_humidity_input:
570 ret = cc2_measurement(data, type, val);
571 break;
572 case hwmon_humidity_min:
573 ret = cc2_get_reg_val(data, CC2_R_ALARM_L_ON, val);
574 break;
575 case hwmon_humidity_min_hyst:
576 ret = cc2_get_reg_val(data, CC2_R_ALARM_L_OFF, val);
577 break;
578 case hwmon_humidity_max:
579 ret = cc2_get_reg_val(data, CC2_R_ALARM_H_ON, val);
580 break;
581 case hwmon_humidity_max_hyst:
582 ret = cc2_get_reg_val(data, CC2_R_ALARM_H_OFF, val);
583 break;
584 case hwmon_humidity_min_alarm:
585 ret = cc2_humidity_min_alarm_status(data, val);
586 break;
587 case hwmon_humidity_max_alarm:
588 ret = cc2_humidity_max_alarm_status(data, val);
589 break;
590 default:
591 ret = -EOPNOTSUPP;
593 break;
594 default:
595 ret = -EOPNOTSUPP;
598 mutex_unlock(&data->dev_access_lock);
600 return ret;
603 static int cc2_write(struct device *dev, enum hwmon_sensor_types type, u32 attr,
604 int channel, long val)
606 struct cc2_data *data = dev_get_drvdata(dev);
607 int ret;
608 u16 arg;
609 u8 cmd;
611 if (type != hwmon_humidity)
612 return -EOPNOTSUPP;
614 if (val < 0 || val > CC2_RH_MAX)
615 return -EINVAL;
617 mutex_lock(&data->dev_access_lock);
619 switch (attr) {
620 case hwmon_humidity_min:
621 cmd = CC2_W_ALARM_L_ON;
622 arg = cc2_rh_to_reg(val);
623 ret = cc2_write_reg(data, cmd, arg);
624 break;
626 case hwmon_humidity_min_hyst:
627 cmd = CC2_W_ALARM_L_OFF;
628 arg = cc2_rh_to_reg(val);
629 ret = cc2_write_reg(data, cmd, arg);
630 break;
632 case hwmon_humidity_max:
633 cmd = CC2_W_ALARM_H_ON;
634 arg = cc2_rh_to_reg(val);
635 ret = cc2_write_reg(data, cmd, arg);
636 break;
638 case hwmon_humidity_max_hyst:
639 cmd = CC2_W_ALARM_H_OFF;
640 arg = cc2_rh_to_reg(val);
641 ret = cc2_write_reg(data, cmd, arg);
642 break;
644 default:
645 ret = -EOPNOTSUPP;
646 break;
649 mutex_unlock(&data->dev_access_lock);
651 return ret;
654 static int cc2_request_ready_irq(struct cc2_data *data, struct device *dev)
656 int ret = 0;
658 data->irq_ready = fwnode_irq_get_byname(dev_fwnode(dev), "ready");
659 if (data->irq_ready > 0) {
660 init_completion(&data->complete);
661 ret = devm_request_threaded_irq(dev, data->irq_ready, NULL,
662 cc2_ready_interrupt,
663 IRQF_ONESHOT |
664 IRQF_TRIGGER_RISING,
665 dev_name(dev), data);
668 return ret;
671 static int cc2_request_alarm_irqs(struct cc2_data *data, struct device *dev)
673 int ret = 0;
675 data->irq_low = fwnode_irq_get_byname(dev_fwnode(dev), "low");
676 if (data->irq_low > 0) {
677 ret = devm_request_threaded_irq(dev, data->irq_low, NULL,
678 cc2_low_interrupt,
679 IRQF_ONESHOT |
680 IRQF_TRIGGER_RISING,
681 dev_name(dev), data);
682 if (ret)
683 return ret;
685 data->rh_alarm.low_alarm_visible = true;
688 data->irq_high = fwnode_irq_get_byname(dev_fwnode(dev), "high");
689 if (data->irq_high > 0) {
690 ret = devm_request_threaded_irq(dev, data->irq_high, NULL,
691 cc2_high_interrupt,
692 IRQF_ONESHOT |
693 IRQF_TRIGGER_RISING,
694 dev_name(dev), data);
695 if (ret)
696 return ret;
698 data->rh_alarm.high_alarm_visible = true;
701 return ret;
704 static const struct hwmon_channel_info *cc2_info[] = {
705 HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
706 HWMON_CHANNEL_INFO(humidity, HWMON_H_INPUT | HWMON_H_MIN | HWMON_H_MAX |
707 HWMON_H_MIN_HYST | HWMON_H_MAX_HYST |
708 HWMON_H_MIN_ALARM | HWMON_H_MAX_ALARM),
709 NULL
712 static const struct hwmon_ops cc2_hwmon_ops = {
713 .is_visible = cc2_is_visible,
714 .read = cc2_read,
715 .write = cc2_write,
718 static const struct hwmon_chip_info cc2_chip_info = {
719 .ops = &cc2_hwmon_ops,
720 .info = cc2_info,
723 static int cc2_probe(struct i2c_client *client)
725 struct cc2_data *data;
726 struct device *dev = &client->dev;
727 int ret;
729 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
730 return -EOPNOTSUPP;
732 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
733 if (!data)
734 return -ENOMEM;
736 i2c_set_clientdata(client, data);
738 mutex_init(&data->dev_access_lock);
740 data->client = client;
742 data->regulator = devm_regulator_get_exclusive(dev, "vdd");
743 if (IS_ERR(data->regulator))
744 return dev_err_probe(dev, PTR_ERR(data->regulator),
745 "Failed to get regulator\n");
747 ret = cc2_request_ready_irq(data, dev);
748 if (ret)
749 return dev_err_probe(dev, ret, "Failed to request ready irq\n");
751 ret = cc2_request_alarm_irqs(data, dev);
752 if (ret)
753 return dev_err_probe(dev, ret, "Failed to request alarm irqs\n");
755 data->hwmon = devm_hwmon_device_register_with_info(dev, client->name,
756 data, &cc2_chip_info,
757 NULL);
758 if (IS_ERR(data->hwmon))
759 return dev_err_probe(dev, PTR_ERR(data->hwmon),
760 "Failed to register hwmon device\n");
762 return 0;
765 static void cc2_remove(struct i2c_client *client)
767 struct cc2_data *data = i2c_get_clientdata(client);
769 cc2_disable(data);
772 static const struct i2c_device_id cc2_id[] = {
773 { "cc2d23" },
774 { "cc2d23s" },
775 { "cc2d25" },
776 { "cc2d25s" },
777 { "cc2d33" },
778 { "cc2d33s" },
779 { "cc2d35" },
780 { "cc2d35s" },
783 MODULE_DEVICE_TABLE(i2c, cc2_id);
785 static const struct of_device_id cc2_of_match[] = {
786 { .compatible = "amphenol,cc2d23" },
787 { .compatible = "amphenol,cc2d23s" },
788 { .compatible = "amphenol,cc2d25" },
789 { .compatible = "amphenol,cc2d25s" },
790 { .compatible = "amphenol,cc2d33" },
791 { .compatible = "amphenol,cc2d33s" },
792 { .compatible = "amphenol,cc2d35" },
793 { .compatible = "amphenol,cc2d35s" },
794 { },
796 MODULE_DEVICE_TABLE(of, cc2_of_match);
798 static struct i2c_driver cc2_driver = {
799 .driver = {
800 .name = "cc2d23",
801 .of_match_table = cc2_of_match,
803 .probe = cc2_probe,
804 .remove = cc2_remove,
805 .id_table = cc2_id,
807 module_i2c_driver(cc2_driver);
809 MODULE_AUTHOR("Javier Carrasco <javier.carrasco.cruz@gamil.com>");
810 MODULE_DESCRIPTION("Amphenol ChipCap 2 humidity and temperature sensor driver");
811 MODULE_LICENSE("GPL");