1 // SPDX-License-Identifier: GPL-2.0-only
3 * drivers/iio/light/tsl2563.c
5 * Copyright (C) 2008 Nokia Corporation
7 * Written by Timo O. Karjalainen <timo.o.karjalainen@nokia.com>
8 * Contact: Amit Kucheria <amit.kucheria@verdurent.com>
10 * Converted to IIO driver
11 * Amit Kucheria <amit.kucheria@verdurent.com>
14 #include <linux/bits.h>
15 #include <linux/delay.h>
16 #include <linux/err.h>
17 #include <linux/i2c.h>
18 #include <linux/interrupt.h>
19 #include <linux/irq.h>
20 #include <linux/math.h>
21 #include <linux/mod_devicetable.h>
22 #include <linux/module.h>
23 #include <linux/mutex.h>
25 #include <linux/property.h>
26 #include <linux/sched.h>
27 #include <linux/slab.h>
29 #include <linux/iio/events.h>
30 #include <linux/iio/iio.h>
31 #include <linux/iio/sysfs.h>
33 /* Use this many bits for fraction part. */
34 #define ADC_FRAC_BITS 14
36 /* Given number of 1/10000's in ADC_FRAC_BITS precision. */
37 #define FRAC10K(f) (((f) * BIT(ADC_FRAC_BITS)) / (10000))
39 /* Bits used for fraction in calibration coefficients.*/
40 #define CALIB_FRAC_BITS 10
41 /* Decimal 10^(digits in sysfs presentation) */
42 #define CALIB_BASE_SYSFS 1000
44 #define TSL2563_CMD BIT(7)
45 #define TSL2563_CLEARINT BIT(6)
47 #define TSL2563_REG_CTRL 0x00
48 #define TSL2563_REG_TIMING 0x01
49 #define TSL2563_REG_LOW 0x02 /* data0 low threshold, 2 bytes */
50 #define TSL2563_REG_HIGH 0x04 /* data0 high threshold, 2 bytes */
51 #define TSL2563_REG_INT 0x06
52 #define TSL2563_REG_ID 0x0a
53 #define TSL2563_REG_DATA0 0x0c /* broadband sensor value, 2 bytes */
54 #define TSL2563_REG_DATA1 0x0e /* infrared sensor value, 2 bytes */
56 #define TSL2563_CMD_POWER_ON 0x03
57 #define TSL2563_CMD_POWER_OFF 0x00
58 #define TSL2563_CTRL_POWER_MASK GENMASK(1, 0)
60 #define TSL2563_TIMING_13MS 0x00
61 #define TSL2563_TIMING_100MS 0x01
62 #define TSL2563_TIMING_400MS 0x02
63 #define TSL2563_TIMING_MASK GENMASK(1, 0)
64 #define TSL2563_TIMING_GAIN16 0x10
65 #define TSL2563_TIMING_GAIN1 0x00
67 #define TSL2563_INT_DISABLED 0x00
68 #define TSL2563_INT_LEVEL 0x10
69 #define TSL2563_INT_MASK GENMASK(5, 4)
70 #define TSL2563_INT_PERSIST(n) ((n) & GENMASK(3, 0))
72 struct tsl2563_gainlevel_coeff
{
78 static const struct tsl2563_gainlevel_coeff tsl2563_gainlevel_table
[] = {
80 .gaintime
= TSL2563_TIMING_400MS
| TSL2563_TIMING_GAIN16
,
84 .gaintime
= TSL2563_TIMING_400MS
| TSL2563_TIMING_GAIN1
,
88 .gaintime
= TSL2563_TIMING_100MS
| TSL2563_TIMING_GAIN1
,
92 .gaintime
= TSL2563_TIMING_13MS
| TSL2563_TIMING_GAIN1
,
100 struct i2c_client
*client
;
101 struct delayed_work poweroff_work
;
103 /* Remember state for suspend and resume functions */
106 struct tsl2563_gainlevel_coeff
const *gainlevel
;
113 /* Calibration coefficients */
118 /* Cache current values, to be returned while suspended */
123 static int tsl2563_set_power(struct tsl2563_chip
*chip
, int on
)
125 struct i2c_client
*client
= chip
->client
;
128 cmd
= on
? TSL2563_CMD_POWER_ON
: TSL2563_CMD_POWER_OFF
;
129 return i2c_smbus_write_byte_data(client
,
130 TSL2563_CMD
| TSL2563_REG_CTRL
, cmd
);
134 * Return value is 0 for off, 1 for on, or a negative error
135 * code if reading failed.
137 static int tsl2563_get_power(struct tsl2563_chip
*chip
)
139 struct i2c_client
*client
= chip
->client
;
142 ret
= i2c_smbus_read_byte_data(client
, TSL2563_CMD
| TSL2563_REG_CTRL
);
146 return (ret
& TSL2563_CTRL_POWER_MASK
) == TSL2563_CMD_POWER_ON
;
149 static int tsl2563_configure(struct tsl2563_chip
*chip
)
153 ret
= i2c_smbus_write_byte_data(chip
->client
,
154 TSL2563_CMD
| TSL2563_REG_TIMING
,
155 chip
->gainlevel
->gaintime
);
158 ret
= i2c_smbus_write_word_data(chip
->client
,
159 TSL2563_CMD
| TSL2563_REG_HIGH
,
163 ret
= i2c_smbus_write_word_data(chip
->client
,
164 TSL2563_CMD
| TSL2563_REG_LOW
,
169 * Interrupt register is automatically written anyway if it is relevant
176 static void tsl2563_poweroff_work(struct work_struct
*work
)
178 struct tsl2563_chip
*chip
=
179 container_of(work
, struct tsl2563_chip
, poweroff_work
.work
);
180 tsl2563_set_power(chip
, 0);
183 static int tsl2563_detect(struct tsl2563_chip
*chip
)
187 ret
= tsl2563_set_power(chip
, 1);
191 ret
= tsl2563_get_power(chip
);
195 return ret
? 0 : -ENODEV
;
198 static int tsl2563_read_id(struct tsl2563_chip
*chip
, u8
*id
)
200 struct i2c_client
*client
= chip
->client
;
203 ret
= i2c_smbus_read_byte_data(client
, TSL2563_CMD
| TSL2563_REG_ID
);
212 static int tsl2563_configure_irq(struct tsl2563_chip
*chip
, bool enable
)
216 chip
->intr
&= ~TSL2563_INT_MASK
;
218 chip
->intr
|= TSL2563_INT_LEVEL
;
220 ret
= i2c_smbus_write_byte_data(chip
->client
,
221 TSL2563_CMD
| TSL2563_REG_INT
,
226 chip
->int_enabled
= enable
;
231 * "Normalized" ADC value is one obtained with 400ms of integration time and
232 * 16x gain. This function returns the number of bits of shift needed to
233 * convert between normalized values and HW values obtained using given
234 * timing and gain settings.
236 static int tsl2563_adc_shiftbits(u8 timing
)
240 switch (timing
& TSL2563_TIMING_MASK
) {
241 case TSL2563_TIMING_13MS
:
244 case TSL2563_TIMING_100MS
:
247 case TSL2563_TIMING_400MS
:
252 if (!(timing
& TSL2563_TIMING_GAIN16
))
258 /* Convert a HW ADC value to normalized scale. */
259 static u32
tsl2563_normalize_adc(u16 adc
, u8 timing
)
261 return adc
<< tsl2563_adc_shiftbits(timing
);
264 static void tsl2563_wait_adc(struct tsl2563_chip
*chip
)
268 switch (chip
->gainlevel
->gaintime
& TSL2563_TIMING_MASK
) {
269 case TSL2563_TIMING_13MS
:
272 case TSL2563_TIMING_100MS
:
279 * TODO: Make sure that we wait at least required delay but why we
280 * have to extend it one tick more?
282 schedule_timeout_interruptible(msecs_to_jiffies(delay
) + 2);
285 static int tsl2563_adjust_gainlevel(struct tsl2563_chip
*chip
, u16 adc
)
287 struct i2c_client
*client
= chip
->client
;
289 if (adc
> chip
->gainlevel
->max
|| adc
< chip
->gainlevel
->min
) {
291 (adc
> chip
->gainlevel
->max
) ?
292 chip
->gainlevel
++ : chip
->gainlevel
--;
294 i2c_smbus_write_byte_data(client
,
295 TSL2563_CMD
| TSL2563_REG_TIMING
,
296 chip
->gainlevel
->gaintime
);
298 tsl2563_wait_adc(chip
);
299 tsl2563_wait_adc(chip
);
306 static int tsl2563_get_adc(struct tsl2563_chip
*chip
)
308 struct i2c_client
*client
= chip
->client
;
316 if (!chip
->int_enabled
) {
317 cancel_delayed_work_sync(&chip
->poweroff_work
);
319 if (!tsl2563_get_power(chip
)) {
320 ret
= tsl2563_set_power(chip
, 1);
323 ret
= tsl2563_configure(chip
);
326 tsl2563_wait_adc(chip
);
331 ret
= i2c_smbus_read_word_data(client
,
332 TSL2563_CMD
| TSL2563_REG_DATA0
);
337 ret
= i2c_smbus_read_word_data(client
,
338 TSL2563_CMD
| TSL2563_REG_DATA1
);
343 retry
= tsl2563_adjust_gainlevel(chip
, adc0
);
346 chip
->data0
= tsl2563_normalize_adc(adc0
, chip
->gainlevel
->gaintime
);
347 chip
->data1
= tsl2563_normalize_adc(adc1
, chip
->gainlevel
->gaintime
);
349 if (!chip
->int_enabled
)
350 schedule_delayed_work(&chip
->poweroff_work
, 5 * HZ
);
357 static inline int tsl2563_calib_to_sysfs(u32 calib
)
359 return (int)DIV_ROUND_CLOSEST(calib
* CALIB_BASE_SYSFS
, BIT(CALIB_FRAC_BITS
));
362 static inline u32
tsl2563_calib_from_sysfs(int value
)
364 /* Make a fraction from a number n that was multiplied with b. */
365 return (((u32
) value
) << CALIB_FRAC_BITS
) / CALIB_BASE_SYSFS
;
369 * Conversions between lux and ADC values.
371 * The basic formula is lux = c0 * adc0 - c1 * adc1, where c0 and c1 are
372 * appropriate constants. Different constants are needed for different
373 * kinds of light, determined by the ratio adc1/adc0 (basically the ratio
374 * of the intensities in infrared and visible wavelengths). lux_table below
375 * lists the upper threshold of the adc1/adc0 ratio and the corresponding
379 struct tsl2563_lux_coeff
{
380 unsigned long ch_ratio
;
381 unsigned long ch0_coeff
;
382 unsigned long ch1_coeff
;
385 static const struct tsl2563_lux_coeff lux_table
[] = {
387 .ch_ratio
= FRAC10K(1300),
388 .ch0_coeff
= FRAC10K(315),
389 .ch1_coeff
= FRAC10K(262),
391 .ch_ratio
= FRAC10K(2600),
392 .ch0_coeff
= FRAC10K(337),
393 .ch1_coeff
= FRAC10K(430),
395 .ch_ratio
= FRAC10K(3900),
396 .ch0_coeff
= FRAC10K(363),
397 .ch1_coeff
= FRAC10K(529),
399 .ch_ratio
= FRAC10K(5200),
400 .ch0_coeff
= FRAC10K(392),
401 .ch1_coeff
= FRAC10K(605),
403 .ch_ratio
= FRAC10K(6500),
404 .ch0_coeff
= FRAC10K(229),
405 .ch1_coeff
= FRAC10K(291),
407 .ch_ratio
= FRAC10K(8000),
408 .ch0_coeff
= FRAC10K(157),
409 .ch1_coeff
= FRAC10K(180),
411 .ch_ratio
= FRAC10K(13000),
412 .ch0_coeff
= FRAC10K(34),
413 .ch1_coeff
= FRAC10K(26),
415 .ch_ratio
= ULONG_MAX
,
421 /* Convert normalized, scaled ADC values to lux. */
422 static unsigned int tsl2563_adc_to_lux(u32 adc0
, u32 adc1
)
424 const struct tsl2563_lux_coeff
*lp
= lux_table
;
425 unsigned long ratio
, lux
, ch0
= adc0
, ch1
= adc1
;
427 ratio
= ch0
? ((ch1
<< ADC_FRAC_BITS
) / ch0
) : ULONG_MAX
;
429 while (lp
->ch_ratio
< ratio
)
432 lux
= ch0
* lp
->ch0_coeff
- ch1
* lp
->ch1_coeff
;
434 return (unsigned int) (lux
>> ADC_FRAC_BITS
);
437 /* Apply calibration coefficient to ADC count. */
438 static u32
tsl2563_calib_adc(u32 adc
, u32 calib
)
440 unsigned long scaled
= adc
;
443 scaled
>>= CALIB_FRAC_BITS
;
448 static int tsl2563_write_raw(struct iio_dev
*indio_dev
,
449 struct iio_chan_spec
const *chan
,
454 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
456 if (mask
!= IIO_CHAN_INFO_CALIBSCALE
)
458 if (chan
->channel2
== IIO_MOD_LIGHT_BOTH
)
459 chip
->calib0
= tsl2563_calib_from_sysfs(val
);
460 else if (chan
->channel2
== IIO_MOD_LIGHT_IR
)
461 chip
->calib1
= tsl2563_calib_from_sysfs(val
);
468 static int tsl2563_read_raw(struct iio_dev
*indio_dev
,
469 struct iio_chan_spec
const *chan
,
476 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
478 mutex_lock(&chip
->lock
);
480 case IIO_CHAN_INFO_RAW
:
481 case IIO_CHAN_INFO_PROCESSED
:
482 switch (chan
->type
) {
484 ret
= tsl2563_get_adc(chip
);
487 calib0
= tsl2563_calib_adc(chip
->data0
, chip
->calib0
) *
488 chip
->cover_comp_gain
;
489 calib1
= tsl2563_calib_adc(chip
->data1
, chip
->calib1
) *
490 chip
->cover_comp_gain
;
491 *val
= tsl2563_adc_to_lux(calib0
, calib1
);
495 ret
= tsl2563_get_adc(chip
);
498 if (chan
->channel2
== IIO_MOD_LIGHT_BOTH
)
509 case IIO_CHAN_INFO_CALIBSCALE
:
510 if (chan
->channel2
== IIO_MOD_LIGHT_BOTH
)
511 *val
= tsl2563_calib_to_sysfs(chip
->calib0
);
513 *val
= tsl2563_calib_to_sysfs(chip
->calib1
);
522 mutex_unlock(&chip
->lock
);
526 static const struct iio_event_spec tsl2563_events
[] = {
528 .type
= IIO_EV_TYPE_THRESH
,
529 .dir
= IIO_EV_DIR_RISING
,
530 .mask_separate
= BIT(IIO_EV_INFO_VALUE
) |
531 BIT(IIO_EV_INFO_ENABLE
),
533 .type
= IIO_EV_TYPE_THRESH
,
534 .dir
= IIO_EV_DIR_FALLING
,
535 .mask_separate
= BIT(IIO_EV_INFO_VALUE
) |
536 BIT(IIO_EV_INFO_ENABLE
),
540 static const struct iio_chan_spec tsl2563_channels
[] = {
544 .info_mask_separate
= BIT(IIO_CHAN_INFO_PROCESSED
),
547 .type
= IIO_INTENSITY
,
549 .channel2
= IIO_MOD_LIGHT_BOTH
,
550 .info_mask_separate
= BIT(IIO_CHAN_INFO_RAW
) |
551 BIT(IIO_CHAN_INFO_CALIBSCALE
),
552 .event_spec
= tsl2563_events
,
553 .num_event_specs
= ARRAY_SIZE(tsl2563_events
),
555 .type
= IIO_INTENSITY
,
557 .channel2
= IIO_MOD_LIGHT_IR
,
558 .info_mask_separate
= BIT(IIO_CHAN_INFO_RAW
) |
559 BIT(IIO_CHAN_INFO_CALIBSCALE
),
563 static int tsl2563_read_thresh(struct iio_dev
*indio_dev
,
564 const struct iio_chan_spec
*chan
, enum iio_event_type type
,
565 enum iio_event_direction dir
, enum iio_event_info info
, int *val
,
568 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
571 case IIO_EV_DIR_RISING
:
572 *val
= chip
->high_thres
;
574 case IIO_EV_DIR_FALLING
:
575 *val
= chip
->low_thres
;
584 static int tsl2563_write_thresh(struct iio_dev
*indio_dev
,
585 const struct iio_chan_spec
*chan
, enum iio_event_type type
,
586 enum iio_event_direction dir
, enum iio_event_info info
, int val
,
589 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
592 mutex_lock(&chip
->lock
);
594 if (dir
== IIO_EV_DIR_RISING
)
595 ret
= i2c_smbus_write_word_data(chip
->client
,
596 TSL2563_CMD
| TSL2563_REG_HIGH
, val
);
598 ret
= i2c_smbus_write_word_data(chip
->client
,
599 TSL2563_CMD
| TSL2563_REG_LOW
, val
);
603 if (dir
== IIO_EV_DIR_RISING
)
604 chip
->high_thres
= val
;
606 chip
->low_thres
= val
;
609 mutex_unlock(&chip
->lock
);
614 static irqreturn_t
tsl2563_event_handler(int irq
, void *private)
616 struct iio_dev
*dev_info
= private;
617 struct tsl2563_chip
*chip
= iio_priv(dev_info
);
619 iio_push_event(dev_info
,
620 IIO_UNMOD_EVENT_CODE(IIO_INTENSITY
,
624 iio_get_time_ns(dev_info
));
626 /* clear the interrupt and push the event */
627 i2c_smbus_write_byte(chip
->client
, TSL2563_CMD
| TSL2563_CLEARINT
);
631 static int tsl2563_write_interrupt_config(struct iio_dev
*indio_dev
,
632 const struct iio_chan_spec
*chan
, enum iio_event_type type
,
633 enum iio_event_direction dir
, bool state
)
635 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
638 mutex_lock(&chip
->lock
);
639 if (state
&& !(chip
->intr
& TSL2563_INT_MASK
)) {
640 /* ensure the chip is actually on */
641 cancel_delayed_work_sync(&chip
->poweroff_work
);
642 if (!tsl2563_get_power(chip
)) {
643 ret
= tsl2563_set_power(chip
, 1);
646 ret
= tsl2563_configure(chip
);
650 ret
= tsl2563_configure_irq(chip
, true);
653 if (!state
&& (chip
->intr
& TSL2563_INT_MASK
)) {
654 ret
= tsl2563_configure_irq(chip
, false);
655 /* now the interrupt is not enabled, we can go to sleep */
656 schedule_delayed_work(&chip
->poweroff_work
, 5 * HZ
);
659 mutex_unlock(&chip
->lock
);
664 static int tsl2563_read_interrupt_config(struct iio_dev
*indio_dev
,
665 const struct iio_chan_spec
*chan
, enum iio_event_type type
,
666 enum iio_event_direction dir
)
668 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
671 mutex_lock(&chip
->lock
);
672 ret
= i2c_smbus_read_byte_data(chip
->client
,
673 TSL2563_CMD
| TSL2563_REG_INT
);
674 mutex_unlock(&chip
->lock
);
678 return !!(ret
& TSL2563_INT_MASK
);
681 static const struct iio_info tsl2563_info_no_irq
= {
682 .read_raw
= &tsl2563_read_raw
,
683 .write_raw
= &tsl2563_write_raw
,
686 static const struct iio_info tsl2563_info
= {
687 .read_raw
= &tsl2563_read_raw
,
688 .write_raw
= &tsl2563_write_raw
,
689 .read_event_value
= &tsl2563_read_thresh
,
690 .write_event_value
= &tsl2563_write_thresh
,
691 .read_event_config
= &tsl2563_read_interrupt_config
,
692 .write_event_config
= &tsl2563_write_interrupt_config
,
695 static int tsl2563_probe(struct i2c_client
*client
)
697 struct device
*dev
= &client
->dev
;
698 struct iio_dev
*indio_dev
;
699 struct tsl2563_chip
*chip
;
700 unsigned long irq_flags
;
704 indio_dev
= devm_iio_device_alloc(dev
, sizeof(*chip
));
708 chip
= iio_priv(indio_dev
);
710 i2c_set_clientdata(client
, indio_dev
);
711 chip
->client
= client
;
713 err
= tsl2563_detect(chip
);
715 return dev_err_probe(dev
, err
, "detect error\n");
717 err
= tsl2563_read_id(chip
, &id
);
719 return dev_err_probe(dev
, err
, "read id error\n");
721 mutex_init(&chip
->lock
);
723 /* Default values used until userspace says otherwise */
724 chip
->low_thres
= 0x0;
725 chip
->high_thres
= 0xffff;
726 chip
->gainlevel
= tsl2563_gainlevel_table
;
727 chip
->intr
= TSL2563_INT_PERSIST(4);
728 chip
->calib0
= tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS
);
729 chip
->calib1
= tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS
);
731 chip
->cover_comp_gain
= 1;
732 device_property_read_u32(dev
, "amstaos,cover-comp-gain", &chip
->cover_comp_gain
);
734 dev_info(dev
, "model %d, rev. %d\n", id
>> 4, id
& 0x0f);
735 indio_dev
->name
= client
->name
;
736 indio_dev
->channels
= tsl2563_channels
;
737 indio_dev
->num_channels
= ARRAY_SIZE(tsl2563_channels
);
738 indio_dev
->modes
= INDIO_DIRECT_MODE
;
741 indio_dev
->info
= &tsl2563_info
;
743 indio_dev
->info
= &tsl2563_info_no_irq
;
746 irq_flags
= irq_get_trigger_type(client
->irq
);
747 if (irq_flags
== IRQF_TRIGGER_NONE
)
748 irq_flags
= IRQF_TRIGGER_RISING
;
749 irq_flags
|= IRQF_ONESHOT
;
751 err
= devm_request_threaded_irq(dev
, client
->irq
,
753 &tsl2563_event_handler
,
758 return dev_err_probe(dev
, err
, "irq request error\n");
761 err
= tsl2563_configure(chip
);
763 return dev_err_probe(dev
, err
, "configure error\n");
765 INIT_DELAYED_WORK(&chip
->poweroff_work
, tsl2563_poweroff_work
);
767 /* The interrupt cannot yet be enabled so this is fine without lock */
768 schedule_delayed_work(&chip
->poweroff_work
, 5 * HZ
);
770 err
= iio_device_register(indio_dev
);
772 dev_err_probe(dev
, err
, "iio registration error\n");
779 cancel_delayed_work_sync(&chip
->poweroff_work
);
783 static void tsl2563_remove(struct i2c_client
*client
)
785 struct iio_dev
*indio_dev
= i2c_get_clientdata(client
);
786 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
788 iio_device_unregister(indio_dev
);
789 if (!chip
->int_enabled
)
790 cancel_delayed_work_sync(&chip
->poweroff_work
);
791 /* Ensure that interrupts are disabled - then flush any bottom halves */
792 tsl2563_configure_irq(chip
, false);
793 tsl2563_set_power(chip
, 0);
796 static int tsl2563_suspend(struct device
*dev
)
798 struct iio_dev
*indio_dev
= dev_get_drvdata(dev
);
799 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
802 mutex_lock(&chip
->lock
);
804 ret
= tsl2563_set_power(chip
, 0);
808 chip
->suspended
= true;
811 mutex_unlock(&chip
->lock
);
815 static int tsl2563_resume(struct device
*dev
)
817 struct iio_dev
*indio_dev
= dev_get_drvdata(dev
);
818 struct tsl2563_chip
*chip
= iio_priv(indio_dev
);
821 mutex_lock(&chip
->lock
);
823 ret
= tsl2563_set_power(chip
, 1);
827 ret
= tsl2563_configure(chip
);
831 chip
->suspended
= false;
834 mutex_unlock(&chip
->lock
);
838 static DEFINE_SIMPLE_DEV_PM_OPS(tsl2563_pm_ops
, tsl2563_suspend
,
841 static const struct i2c_device_id tsl2563_id
[] = {
848 MODULE_DEVICE_TABLE(i2c
, tsl2563_id
);
850 static const struct of_device_id tsl2563_of_match
[] = {
851 { .compatible
= "amstaos,tsl2560" },
852 { .compatible
= "amstaos,tsl2561" },
853 { .compatible
= "amstaos,tsl2562" },
854 { .compatible
= "amstaos,tsl2563" },
857 MODULE_DEVICE_TABLE(of
, tsl2563_of_match
);
859 static struct i2c_driver tsl2563_i2c_driver
= {
862 .of_match_table
= tsl2563_of_match
,
863 .pm
= pm_sleep_ptr(&tsl2563_pm_ops
),
865 .probe
= tsl2563_probe
,
866 .remove
= tsl2563_remove
,
867 .id_table
= tsl2563_id
,
869 module_i2c_driver(tsl2563_i2c_driver
);
871 MODULE_AUTHOR("Nokia Corporation");
872 MODULE_DESCRIPTION("tsl2563 light sensor driver");
873 MODULE_LICENSE("GPL");