2 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
3 * Author: Beomho Seo <beomho.seo@samsung.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2, as published
7 * by the Free Software Foundation.
10 #include <linux/delay.h>
11 #include <linux/err.h>
12 #include <linux/i2c.h>
13 #include <linux/mutex.h>
14 #include <linux/module.h>
15 #include <linux/interrupt.h>
16 #include <linux/regulator/consumer.h>
17 #include <linux/iio/iio.h>
18 #include <linux/iio/sysfs.h>
19 #include <linux/iio/events.h>
21 /* Slave address 0x19 for PS of 7 bit addressing protocol for I2C */
22 #define CM36651_I2C_ADDR_PS 0x19
23 /* Alert Response Address */
24 #define CM36651_ARA 0x0C
26 /* Ambient light sensor */
27 #define CM36651_CS_CONF1 0x00
28 #define CM36651_CS_CONF2 0x01
29 #define CM36651_ALS_WH_M 0x02
30 #define CM36651_ALS_WH_L 0x03
31 #define CM36651_ALS_WL_M 0x04
32 #define CM36651_ALS_WL_L 0x05
33 #define CM36651_CS_CONF3 0x06
34 #define CM36651_CS_CONF_REG_NUM 0x02
36 /* Proximity sensor */
37 #define CM36651_PS_CONF1 0x00
38 #define CM36651_PS_THD 0x01
39 #define CM36651_PS_CANC 0x02
40 #define CM36651_PS_CONF2 0x03
41 #define CM36651_PS_REG_NUM 0x04
43 /* CS_CONF1 command code */
44 #define CM36651_ALS_ENABLE 0x00
45 #define CM36651_ALS_DISABLE 0x01
46 #define CM36651_ALS_INT_EN 0x02
47 #define CM36651_ALS_THRES 0x04
49 /* CS_CONF2 command code */
50 #define CM36651_CS_CONF2_DEFAULT_BIT 0x08
52 /* CS_CONF3 channel integration time */
53 #define CM36651_CS_IT1 0x00 /* Integration time 80 msec */
54 #define CM36651_CS_IT2 0x40 /* Integration time 160 msec */
55 #define CM36651_CS_IT3 0x80 /* Integration time 320 msec */
56 #define CM36651_CS_IT4 0xC0 /* Integration time 640 msec */
58 /* PS_CONF1 command code */
59 #define CM36651_PS_ENABLE 0x00
60 #define CM36651_PS_DISABLE 0x01
61 #define CM36651_PS_INT_EN 0x02
62 #define CM36651_PS_PERS2 0x04
63 #define CM36651_PS_PERS3 0x08
64 #define CM36651_PS_PERS4 0x0C
66 /* PS_CONF1 command code: integration time */
67 #define CM36651_PS_IT1 0x00 /* Integration time 0.32 msec */
68 #define CM36651_PS_IT2 0x10 /* Integration time 0.42 msec */
69 #define CM36651_PS_IT3 0x20 /* Integration time 0.52 msec */
70 #define CM36651_PS_IT4 0x30 /* Integration time 0.64 msec */
72 /* PS_CONF1 command code: duty ratio */
73 #define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */
74 #define CM36651_PS_DR2 0x40 /* Duty ratio 1/160 */
75 #define CM36651_PS_DR3 0x80 /* Duty ratio 1/320 */
76 #define CM36651_PS_DR4 0xC0 /* Duty ratio 1/640 */
78 /* PS_THD command code */
79 #define CM36651_PS_INITIAL_THD 0x05
81 /* PS_CANC command code */
82 #define CM36651_PS_CANC_DEFAULT 0x00
84 /* PS_CONF2 command code */
85 #define CM36651_PS_HYS1 0x00
86 #define CM36651_PS_HYS2 0x01
87 #define CM36651_PS_SMART_PERS_EN 0x02
88 #define CM36651_PS_DIR_INT 0x04
89 #define CM36651_PS_MS 0x10
91 #define CM36651_CS_COLOR_NUM 4
93 #define CM36651_CLOSE_PROXIMITY 0x32
94 #define CM36651_FAR_PROXIMITY 0x33
96 #define CM36651_CS_INT_TIME_AVAIL "0.08 0.16 0.32 0.64"
97 #define CM36651_PS_INT_TIME_AVAIL "0.000320 0.000420 0.000520 0.000640"
99 enum cm36651_operation_mode
{
101 CM36651_PROXIMITY_EN
,
102 CM36651_PROXIMITY_EV_EN
,
105 enum cm36651_light_channel_idx
{
106 CM36651_LIGHT_CHANNEL_IDX_RED
,
107 CM36651_LIGHT_CHANNEL_IDX_GREEN
,
108 CM36651_LIGHT_CHANNEL_IDX_BLUE
,
109 CM36651_LIGHT_CHANNEL_IDX_CLEAR
,
112 enum cm36651_command
{
113 CM36651_CMD_READ_RAW_LIGHT
,
114 CM36651_CMD_READ_RAW_PROXIMITY
,
115 CM36651_CMD_PROX_EV_EN
,
116 CM36651_CMD_PROX_EV_DIS
,
119 static const u8 cm36651_cs_reg
[CM36651_CS_CONF_REG_NUM
] = {
124 static const u8 cm36651_ps_reg
[CM36651_PS_REG_NUM
] = {
131 struct cm36651_data
{
132 const struct cm36651_platform_data
*pdata
;
133 struct i2c_client
*client
;
134 struct i2c_client
*ps_client
;
135 struct i2c_client
*ara_client
;
137 struct regulator
*vled_reg
;
139 int cs_int_time
[CM36651_CS_COLOR_NUM
];
141 u8 cs_ctrl_regs
[CM36651_CS_CONF_REG_NUM
];
142 u8 ps_ctrl_regs
[CM36651_PS_REG_NUM
];
143 u16 color
[CM36651_CS_COLOR_NUM
];
146 static int cm36651_setup_reg(struct cm36651_data
*cm36651
)
148 struct i2c_client
*client
= cm36651
->client
;
149 struct i2c_client
*ps_client
= cm36651
->ps_client
;
152 /* CS initialization */
153 cm36651
->cs_ctrl_regs
[CM36651_CS_CONF1
] = CM36651_ALS_ENABLE
|
155 cm36651
->cs_ctrl_regs
[CM36651_CS_CONF2
] = CM36651_CS_CONF2_DEFAULT_BIT
;
157 for (i
= 0; i
< CM36651_CS_CONF_REG_NUM
; i
++) {
158 ret
= i2c_smbus_write_byte_data(client
, cm36651_cs_reg
[i
],
159 cm36651
->cs_ctrl_regs
[i
]);
164 /* PS initialization */
165 cm36651
->ps_ctrl_regs
[CM36651_PS_CONF1
] = CM36651_PS_ENABLE
|
167 cm36651
->ps_ctrl_regs
[CM36651_PS_THD
] = CM36651_PS_INITIAL_THD
;
168 cm36651
->ps_ctrl_regs
[CM36651_PS_CANC
] = CM36651_PS_CANC_DEFAULT
;
169 cm36651
->ps_ctrl_regs
[CM36651_PS_CONF2
] = CM36651_PS_HYS2
|
170 CM36651_PS_DIR_INT
| CM36651_PS_SMART_PERS_EN
;
172 for (i
= 0; i
< CM36651_PS_REG_NUM
; i
++) {
173 ret
= i2c_smbus_write_byte_data(ps_client
, cm36651_ps_reg
[i
],
174 cm36651
->ps_ctrl_regs
[i
]);
179 /* Set shutdown mode */
180 ret
= i2c_smbus_write_byte_data(client
, CM36651_CS_CONF1
,
181 CM36651_ALS_DISABLE
);
185 ret
= i2c_smbus_write_byte_data(cm36651
->ps_client
,
186 CM36651_PS_CONF1
, CM36651_PS_DISABLE
);
193 static int cm36651_read_output(struct cm36651_data
*cm36651
,
194 struct iio_chan_spec
const *chan
, int *val
)
196 struct i2c_client
*client
= cm36651
->client
;
199 switch (chan
->type
) {
201 *val
= i2c_smbus_read_word_data(client
, chan
->address
);
205 ret
= i2c_smbus_write_byte_data(client
, CM36651_CS_CONF1
,
206 CM36651_ALS_DISABLE
);
213 *val
= i2c_smbus_read_byte(cm36651
->ps_client
);
217 if (!test_bit(CM36651_PROXIMITY_EV_EN
, &cm36651
->flags
)) {
218 ret
= i2c_smbus_write_byte_data(cm36651
->ps_client
,
219 CM36651_PS_CONF1
, CM36651_PS_DISABLE
);
233 static irqreturn_t
cm36651_irq_handler(int irq
, void *data
)
235 struct iio_dev
*indio_dev
= data
;
236 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
237 struct i2c_client
*client
= cm36651
->client
;
242 * The PS INT pin is an active low signal that PS INT move logic low
243 * when the object is detect. Once the MCU host received the PS INT
244 * "LOW" signal, the Host needs to read the data at Alert Response
245 * Address(ARA) to clear the PS INT signal. After clearing the PS
246 * INT pin, the PS INT signal toggles from low to high.
248 ret
= i2c_smbus_read_byte(cm36651
->ara_client
);
250 dev_err(&client
->dev
,
251 "%s: Data read failed: %d\n", __func__
, ret
);
255 case CM36651_CLOSE_PROXIMITY
:
256 ev_dir
= IIO_EV_DIR_RISING
;
258 case CM36651_FAR_PROXIMITY
:
259 ev_dir
= IIO_EV_DIR_FALLING
;
262 dev_err(&client
->dev
,
263 "%s: Data read wrong: %d\n", __func__
, ret
);
267 ev_code
= IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY
,
268 CM36651_CMD_READ_RAW_PROXIMITY
,
269 IIO_EV_TYPE_THRESH
, ev_dir
);
271 iio_push_event(indio_dev
, ev_code
, iio_get_time_ns(indio_dev
));
276 static int cm36651_set_operation_mode(struct cm36651_data
*cm36651
, int cmd
)
278 struct i2c_client
*client
= cm36651
->client
;
279 struct i2c_client
*ps_client
= cm36651
->ps_client
;
283 case CM36651_CMD_READ_RAW_LIGHT
:
284 ret
= i2c_smbus_write_byte_data(client
, CM36651_CS_CONF1
,
285 cm36651
->cs_ctrl_regs
[CM36651_CS_CONF1
]);
287 case CM36651_CMD_READ_RAW_PROXIMITY
:
288 if (test_bit(CM36651_PROXIMITY_EV_EN
, &cm36651
->flags
))
289 return CM36651_PROXIMITY_EV_EN
;
291 ret
= i2c_smbus_write_byte_data(ps_client
, CM36651_PS_CONF1
,
292 cm36651
->ps_ctrl_regs
[CM36651_PS_CONF1
]);
294 case CM36651_CMD_PROX_EV_EN
:
295 if (test_bit(CM36651_PROXIMITY_EV_EN
, &cm36651
->flags
)) {
296 dev_err(&client
->dev
,
297 "Already proximity event enable state\n");
300 set_bit(CM36651_PROXIMITY_EV_EN
, &cm36651
->flags
);
302 ret
= i2c_smbus_write_byte_data(ps_client
,
303 cm36651_ps_reg
[CM36651_PS_CONF1
],
304 CM36651_PS_INT_EN
| CM36651_PS_PERS2
| CM36651_PS_IT2
);
307 dev_err(&client
->dev
, "Proximity enable event failed\n");
311 case CM36651_CMD_PROX_EV_DIS
:
312 if (!test_bit(CM36651_PROXIMITY_EV_EN
, &cm36651
->flags
)) {
313 dev_err(&client
->dev
,
314 "Already proximity event disable state\n");
317 clear_bit(CM36651_PROXIMITY_EV_EN
, &cm36651
->flags
);
318 ret
= i2c_smbus_write_byte_data(ps_client
,
319 CM36651_PS_CONF1
, CM36651_PS_DISABLE
);
324 dev_err(&client
->dev
, "Write register failed\n");
329 static int cm36651_read_channel(struct cm36651_data
*cm36651
,
330 struct iio_chan_spec
const *chan
, int *val
)
332 struct i2c_client
*client
= cm36651
->client
;
335 if (chan
->type
== IIO_LIGHT
)
336 cmd
= CM36651_CMD_READ_RAW_LIGHT
;
337 else if (chan
->type
== IIO_PROXIMITY
)
338 cmd
= CM36651_CMD_READ_RAW_PROXIMITY
;
342 ret
= cm36651_set_operation_mode(cm36651
, cmd
);
344 dev_err(&client
->dev
, "CM36651 set operation mode failed\n");
347 /* Delay for work after enable operation */
349 ret
= cm36651_read_output(cm36651
, chan
, val
);
351 dev_err(&client
->dev
, "CM36651 read output failed\n");
358 static int cm36651_read_int_time(struct cm36651_data
*cm36651
,
359 struct iio_chan_spec
const *chan
, int *val2
)
361 switch (chan
->type
) {
363 if (cm36651
->cs_int_time
[chan
->address
] == CM36651_CS_IT1
)
365 else if (cm36651
->cs_int_time
[chan
->address
] == CM36651_CS_IT2
)
367 else if (cm36651
->cs_int_time
[chan
->address
] == CM36651_CS_IT3
)
369 else if (cm36651
->cs_int_time
[chan
->address
] == CM36651_CS_IT4
)
375 if (cm36651
->ps_int_time
== CM36651_PS_IT1
)
377 else if (cm36651
->ps_int_time
== CM36651_PS_IT2
)
379 else if (cm36651
->ps_int_time
== CM36651_PS_IT3
)
381 else if (cm36651
->ps_int_time
== CM36651_PS_IT4
)
390 return IIO_VAL_INT_PLUS_MICRO
;
393 static int cm36651_write_int_time(struct cm36651_data
*cm36651
,
394 struct iio_chan_spec
const *chan
, int val
)
396 struct i2c_client
*client
= cm36651
->client
;
397 struct i2c_client
*ps_client
= cm36651
->ps_client
;
400 switch (chan
->type
) {
403 int_time
= CM36651_CS_IT1
;
404 else if (val
== 160000)
405 int_time
= CM36651_CS_IT2
;
406 else if (val
== 320000)
407 int_time
= CM36651_CS_IT3
;
408 else if (val
== 640000)
409 int_time
= CM36651_CS_IT4
;
413 ret
= i2c_smbus_write_byte_data(client
, CM36651_CS_CONF3
,
414 int_time
>> 2 * (chan
->address
));
416 dev_err(&client
->dev
, "CS integration time write failed\n");
419 cm36651
->cs_int_time
[chan
->address
] = int_time
;
423 int_time
= CM36651_PS_IT1
;
425 int_time
= CM36651_PS_IT2
;
427 int_time
= CM36651_PS_IT3
;
429 int_time
= CM36651_PS_IT4
;
433 ret
= i2c_smbus_write_byte_data(ps_client
,
434 CM36651_PS_CONF1
, int_time
);
436 dev_err(&client
->dev
, "PS integration time write failed\n");
439 cm36651
->ps_int_time
= int_time
;
448 static int cm36651_read_raw(struct iio_dev
*indio_dev
,
449 struct iio_chan_spec
const *chan
,
450 int *val
, int *val2
, long mask
)
452 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
455 mutex_lock(&cm36651
->lock
);
458 case IIO_CHAN_INFO_RAW
:
459 ret
= cm36651_read_channel(cm36651
, chan
, val
);
461 case IIO_CHAN_INFO_INT_TIME
:
463 ret
= cm36651_read_int_time(cm36651
, chan
, val2
);
469 mutex_unlock(&cm36651
->lock
);
474 static int cm36651_write_raw(struct iio_dev
*indio_dev
,
475 struct iio_chan_spec
const *chan
,
476 int val
, int val2
, long mask
)
478 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
479 struct i2c_client
*client
= cm36651
->client
;
482 if (mask
== IIO_CHAN_INFO_INT_TIME
) {
483 ret
= cm36651_write_int_time(cm36651
, chan
, val2
);
485 dev_err(&client
->dev
, "Integration time write failed\n");
491 static int cm36651_read_prox_thresh(struct iio_dev
*indio_dev
,
492 const struct iio_chan_spec
*chan
,
493 enum iio_event_type type
,
494 enum iio_event_direction dir
,
495 enum iio_event_info info
,
498 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
500 *val
= cm36651
->ps_ctrl_regs
[CM36651_PS_THD
];
505 static int cm36651_write_prox_thresh(struct iio_dev
*indio_dev
,
506 const struct iio_chan_spec
*chan
,
507 enum iio_event_type type
,
508 enum iio_event_direction dir
,
509 enum iio_event_info info
,
512 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
513 struct i2c_client
*client
= cm36651
->client
;
516 if (val
< 3 || val
> 255)
519 cm36651
->ps_ctrl_regs
[CM36651_PS_THD
] = val
;
520 ret
= i2c_smbus_write_byte_data(cm36651
->ps_client
, CM36651_PS_THD
,
521 cm36651
->ps_ctrl_regs
[CM36651_PS_THD
]);
524 dev_err(&client
->dev
, "PS threshold write failed: %d\n", ret
);
531 static int cm36651_write_prox_event_config(struct iio_dev
*indio_dev
,
532 const struct iio_chan_spec
*chan
,
533 enum iio_event_type type
,
534 enum iio_event_direction dir
,
537 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
538 int cmd
, ret
= -EINVAL
;
540 mutex_lock(&cm36651
->lock
);
542 cmd
= state
? CM36651_CMD_PROX_EV_EN
: CM36651_CMD_PROX_EV_DIS
;
543 ret
= cm36651_set_operation_mode(cm36651
, cmd
);
545 mutex_unlock(&cm36651
->lock
);
550 static int cm36651_read_prox_event_config(struct iio_dev
*indio_dev
,
551 const struct iio_chan_spec
*chan
,
552 enum iio_event_type type
,
553 enum iio_event_direction dir
)
555 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
558 mutex_lock(&cm36651
->lock
);
560 event_en
= test_bit(CM36651_PROXIMITY_EV_EN
, &cm36651
->flags
);
562 mutex_unlock(&cm36651
->lock
);
567 #define CM36651_LIGHT_CHANNEL(_color, _idx) { \
569 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
570 BIT(IIO_CHAN_INFO_INT_TIME), \
573 .channel2 = IIO_MOD_LIGHT_##_color, \
576 static const struct iio_event_spec cm36651_event_spec[] = {
578 .type
= IIO_EV_TYPE_THRESH
,
579 .dir
= IIO_EV_DIR_EITHER
,
580 .mask_separate
= BIT(IIO_EV_INFO_VALUE
) |
581 BIT(IIO_EV_INFO_ENABLE
),
585 static const struct iio_chan_spec cm36651_channels
[] = {
587 .type
= IIO_PROXIMITY
,
588 .info_mask_separate
= BIT(IIO_CHAN_INFO_RAW
) |
589 BIT(IIO_CHAN_INFO_INT_TIME
),
590 .event_spec
= cm36651_event_spec
,
591 .num_event_specs
= ARRAY_SIZE(cm36651_event_spec
),
593 CM36651_LIGHT_CHANNEL(RED
, CM36651_LIGHT_CHANNEL_IDX_RED
),
594 CM36651_LIGHT_CHANNEL(GREEN
, CM36651_LIGHT_CHANNEL_IDX_GREEN
),
595 CM36651_LIGHT_CHANNEL(BLUE
, CM36651_LIGHT_CHANNEL_IDX_BLUE
),
596 CM36651_LIGHT_CHANNEL(CLEAR
, CM36651_LIGHT_CHANNEL_IDX_CLEAR
),
599 static IIO_CONST_ATTR(in_illuminance_integration_time_available
,
600 CM36651_CS_INT_TIME_AVAIL
);
601 static IIO_CONST_ATTR(in_proximity_integration_time_available
,
602 CM36651_PS_INT_TIME_AVAIL
);
604 static struct attribute
*cm36651_attributes
[] = {
605 &iio_const_attr_in_illuminance_integration_time_available
.dev_attr
.attr
,
606 &iio_const_attr_in_proximity_integration_time_available
.dev_attr
.attr
,
610 static const struct attribute_group cm36651_attribute_group
= {
611 .attrs
= cm36651_attributes
614 static const struct iio_info cm36651_info
= {
615 .driver_module
= THIS_MODULE
,
616 .read_raw
= &cm36651_read_raw
,
617 .write_raw
= &cm36651_write_raw
,
618 .read_event_value
= &cm36651_read_prox_thresh
,
619 .write_event_value
= &cm36651_write_prox_thresh
,
620 .read_event_config
= &cm36651_read_prox_event_config
,
621 .write_event_config
= &cm36651_write_prox_event_config
,
622 .attrs
= &cm36651_attribute_group
,
625 static int cm36651_probe(struct i2c_client
*client
,
626 const struct i2c_device_id
*id
)
628 struct cm36651_data
*cm36651
;
629 struct iio_dev
*indio_dev
;
632 indio_dev
= devm_iio_device_alloc(&client
->dev
, sizeof(*cm36651
));
636 cm36651
= iio_priv(indio_dev
);
638 cm36651
->vled_reg
= devm_regulator_get(&client
->dev
, "vled");
639 if (IS_ERR(cm36651
->vled_reg
)) {
640 dev_err(&client
->dev
, "get regulator vled failed\n");
641 return PTR_ERR(cm36651
->vled_reg
);
644 ret
= regulator_enable(cm36651
->vled_reg
);
646 dev_err(&client
->dev
, "enable regulator vled failed\n");
650 i2c_set_clientdata(client
, indio_dev
);
652 cm36651
->client
= client
;
653 cm36651
->ps_client
= i2c_new_dummy(client
->adapter
,
654 CM36651_I2C_ADDR_PS
);
655 if (!cm36651
->ps_client
) {
656 dev_err(&client
->dev
, "%s: new i2c device failed\n", __func__
);
658 goto error_disable_reg
;
661 cm36651
->ara_client
= i2c_new_dummy(client
->adapter
, CM36651_ARA
);
662 if (!cm36651
->ara_client
) {
663 dev_err(&client
->dev
, "%s: new i2c device failed\n", __func__
);
665 goto error_i2c_unregister_ps
;
668 mutex_init(&cm36651
->lock
);
669 indio_dev
->dev
.parent
= &client
->dev
;
670 indio_dev
->channels
= cm36651_channels
;
671 indio_dev
->num_channels
= ARRAY_SIZE(cm36651_channels
);
672 indio_dev
->info
= &cm36651_info
;
673 indio_dev
->name
= id
->name
;
674 indio_dev
->modes
= INDIO_DIRECT_MODE
;
676 ret
= cm36651_setup_reg(cm36651
);
678 dev_err(&client
->dev
, "%s: register setup failed\n", __func__
);
679 goto error_i2c_unregister_ara
;
682 ret
= request_threaded_irq(client
->irq
, NULL
, cm36651_irq_handler
,
683 IRQF_TRIGGER_FALLING
| IRQF_ONESHOT
,
684 "cm36651", indio_dev
);
686 dev_err(&client
->dev
, "%s: request irq failed\n", __func__
);
687 goto error_i2c_unregister_ara
;
690 ret
= iio_device_register(indio_dev
);
692 dev_err(&client
->dev
, "%s: regist device failed\n", __func__
);
699 free_irq(client
->irq
, indio_dev
);
700 error_i2c_unregister_ara
:
701 i2c_unregister_device(cm36651
->ara_client
);
702 error_i2c_unregister_ps
:
703 i2c_unregister_device(cm36651
->ps_client
);
705 regulator_disable(cm36651
->vled_reg
);
709 static int cm36651_remove(struct i2c_client
*client
)
711 struct iio_dev
*indio_dev
= i2c_get_clientdata(client
);
712 struct cm36651_data
*cm36651
= iio_priv(indio_dev
);
714 iio_device_unregister(indio_dev
);
715 regulator_disable(cm36651
->vled_reg
);
716 free_irq(client
->irq
, indio_dev
);
717 i2c_unregister_device(cm36651
->ps_client
);
718 i2c_unregister_device(cm36651
->ara_client
);
723 static const struct i2c_device_id cm36651_id
[] = {
728 MODULE_DEVICE_TABLE(i2c
, cm36651_id
);
730 static const struct of_device_id cm36651_of_match
[] = {
731 { .compatible
= "capella,cm36651" },
734 MODULE_DEVICE_TABLE(of
, cm36651_of_match
);
736 static struct i2c_driver cm36651_driver
= {
739 .of_match_table
= cm36651_of_match
,
741 .probe
= cm36651_probe
,
742 .remove
= cm36651_remove
,
743 .id_table
= cm36651_id
,
746 module_i2c_driver(cm36651_driver
);
748 MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>");
749 MODULE_DESCRIPTION("CM36651 proximity/ambient light sensor driver");
750 MODULE_LICENSE("GPL v2");