2 * Backlight driver for Analog Devices ADP8860 Backlight Devices
4 * Copyright 2009-2010 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #include <linux/module.h>
10 #include <linux/version.h>
11 #include <linux/init.h>
12 #include <linux/errno.h>
14 #include <linux/platform_device.h>
15 #include <linux/i2c.h>
17 #include <linux/backlight.h>
18 #include <linux/leds.h>
19 #include <linux/workqueue.h>
21 #include <linux/i2c/adp8860.h>
22 #define ADP8860_EXT_FEATURES
23 #define ADP8860_USE_LEDS
25 #define ADP8860_MFDVID 0x00 /* Manufacturer and device ID */
26 #define ADP8860_MDCR 0x01 /* Device mode and status */
27 #define ADP8860_MDCR2 0x02 /* Device mode and Status Register 2 */
28 #define ADP8860_INTR_EN 0x03 /* Interrupts enable */
29 #define ADP8860_CFGR 0x04 /* Configuration register */
30 #define ADP8860_BLSEN 0x05 /* Sink enable backlight or independent */
31 #define ADP8860_BLOFF 0x06 /* Backlight off timeout */
32 #define ADP8860_BLDIM 0x07 /* Backlight dim timeout */
33 #define ADP8860_BLFR 0x08 /* Backlight fade in and out rates */
34 #define ADP8860_BLMX1 0x09 /* Backlight (Brightness Level 1-daylight) maximum current */
35 #define ADP8860_BLDM1 0x0A /* Backlight (Brightness Level 1-daylight) dim current */
36 #define ADP8860_BLMX2 0x0B /* Backlight (Brightness Level 2-office) maximum current */
37 #define ADP8860_BLDM2 0x0C /* Backlight (Brightness Level 2-office) dim current */
38 #define ADP8860_BLMX3 0x0D /* Backlight (Brightness Level 3-dark) maximum current */
39 #define ADP8860_BLDM3 0x0E /* Backlight (Brightness Level 3-dark) dim current */
40 #define ADP8860_ISCFR 0x0F /* Independent sink current fade control register */
41 #define ADP8860_ISCC 0x10 /* Independent sink current control register */
42 #define ADP8860_ISCT1 0x11 /* Independent Sink Current Timer Register LED[7:5] */
43 #define ADP8860_ISCT2 0x12 /* Independent Sink Current Timer Register LED[4:1] */
44 #define ADP8860_ISCF 0x13 /* Independent sink current fade register */
45 #define ADP8860_ISC7 0x14 /* Independent Sink Current LED7 */
46 #define ADP8860_ISC6 0x15 /* Independent Sink Current LED6 */
47 #define ADP8860_ISC5 0x16 /* Independent Sink Current LED5 */
48 #define ADP8860_ISC4 0x17 /* Independent Sink Current LED4 */
49 #define ADP8860_ISC3 0x18 /* Independent Sink Current LED3 */
50 #define ADP8860_ISC2 0x19 /* Independent Sink Current LED2 */
51 #define ADP8860_ISC1 0x1A /* Independent Sink Current LED1 */
52 #define ADP8860_CCFG 0x1B /* Comparator configuration */
53 #define ADP8860_CCFG2 0x1C /* Second comparator configuration */
54 #define ADP8860_L2_TRP 0x1D /* L2 comparator reference */
55 #define ADP8860_L2_HYS 0x1E /* L2 hysteresis */
56 #define ADP8860_L3_TRP 0x1F /* L3 comparator reference */
57 #define ADP8860_L3_HYS 0x20 /* L3 hysteresis */
58 #define ADP8860_PH1LEVL 0x21 /* First phototransistor ambient light level-low byte register */
59 #define ADP8860_PH1LEVH 0x22 /* First phototransistor ambient light level-high byte register */
60 #define ADP8860_PH2LEVL 0x23 /* Second phototransistor ambient light level-low byte register */
61 #define ADP8860_PH2LEVH 0x24 /* Second phototransistor ambient light level-high byte register */
63 #define ADP8860_MANUFID 0x0 /* Analog Devices ADP8860 Manufacturer ID */
64 #define ADP8860_DEVICEID 0x7 /* Analog Devices ADP8860 Device ID */
65 #define ADP8860_DEVID(x) ((x) & 0xF)
66 #define ADP8860_MANID(x) ((x) >> 4)
68 /* MDCR Device mode and status */
69 #define INT_CFG (1 << 6)
70 #define NSTBY (1 << 5)
71 #define DIM_EN (1 << 4)
72 #define SIS_EN (1 << 2)
73 #define CMP_AUTOEN (1 << 1)
76 /* ADP8860_CCFG Main ALS comparator level enable */
77 #define L3_EN (1 << 1)
78 #define L2_EN (1 << 0)
80 #define CFGR_BLV_SHIFT 3
81 #define CFGR_BLV_MASK 0x3
82 #define ADP8860_FLAG_LED_MASK 0xFF
84 #define FADE_VAL(in, out) ((0xF & (in)) | ((0xF & (out)) << 4))
85 #define BL_CFGR_VAL(law, blv) ((((blv) & CFGR_BLV_MASK) << CFGR_BLV_SHIFT) | ((0x3 & (law)) << 1))
86 #define ALS_CCFG_VAL(filt) ((0x7 & filt) << 5)
89 struct led_classdev cdev;
90 struct work_struct work;
91 struct i2c_client *client;
92 enum led_brightness new_brightness;
98 struct i2c_client *client;
99 struct backlight_device *bl;
100 struct adp8860_led *led;
101 struct adp8860_backlight_platform_data *pdata;
103 unsigned long cached_daylight_max;
106 int current_brightness;
109 static int adp8860_read(struct i2c_client *client, int reg, uint8_t *val)
113 ret = i2c_smbus_read_byte_data(client, reg);
115 dev_err(&client->dev, "failed reading at 0x%02x\n", reg);
124 static int adp8860_write(struct i2c_client *client, u8 reg, u8 val)
126 return i2c_smbus_write_byte_data(client, reg, val);
129 static int adp8860_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask)
131 struct adp8860_bl *data = i2c_get_clientdata(client);
135 mutex_lock(&data->lock);
137 ret = adp8860_read(client, reg, ®_val);
139 if (!ret && ((reg_val & bit_mask) == 0)) {
141 ret = adp8860_write(client, reg, reg_val);
144 mutex_unlock(&data->lock);
148 static int adp8860_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask)
150 struct adp8860_bl *data = i2c_get_clientdata(client);
154 mutex_lock(&data->lock);
156 ret = adp8860_read(client, reg, ®_val);
158 if (!ret && (reg_val & bit_mask)) {
159 reg_val &= ~bit_mask;
160 ret = adp8860_write(client, reg, reg_val);
163 mutex_unlock(&data->lock);
168 * Independent sink / LED
170 #if defined(ADP8860_USE_LEDS)
171 static void adp8860_led_work(struct work_struct *work)
173 struct adp8860_led *led = container_of(work, struct adp8860_led, work);
174 adp8860_write(led->client, ADP8860_ISC1 - led->id + 1,
175 led->new_brightness >> 1);
178 static void adp8860_led_set(struct led_classdev *led_cdev,
179 enum led_brightness value)
181 struct adp8860_led *led;
183 led = container_of(led_cdev, struct adp8860_led, cdev);
184 led->new_brightness = value;
185 schedule_work(&led->work);
188 static int adp8860_led_setup(struct adp8860_led *led)
190 struct i2c_client *client = led->client;
193 ret = adp8860_write(client, ADP8860_ISC1 - led->id + 1, 0);
194 ret |= adp8860_set_bits(client, ADP8860_ISCC, 1 << (led->id - 1));
197 ret |= adp8860_set_bits(client, ADP8860_ISCT1,
198 (led->flags & 0x3) << ((led->id - 5) * 2));
200 ret |= adp8860_set_bits(client, ADP8860_ISCT2,
201 (led->flags & 0x3) << ((led->id - 1) * 2));
206 static int __devinit adp8860_led_probe(struct i2c_client *client)
208 struct adp8860_backlight_platform_data *pdata =
209 client->dev.platform_data;
210 struct adp8860_bl *data = i2c_get_clientdata(client);
211 struct adp8860_led *led, *led_dat;
212 struct led_info *cur_led;
215 led = kzalloc(sizeof(*led) * pdata->num_leds, GFP_KERNEL);
217 dev_err(&client->dev, "failed to alloc memory\n");
221 ret = adp8860_write(client, ADP8860_ISCFR, pdata->led_fade_law);
222 ret = adp8860_write(client, ADP8860_ISCT1,
223 (pdata->led_on_time & 0x3) << 6);
224 ret |= adp8860_write(client, ADP8860_ISCF,
225 FADE_VAL(pdata->led_fade_in, pdata->led_fade_out));
228 dev_err(&client->dev, "failed to write\n");
232 for (i = 0; i < pdata->num_leds; ++i) {
233 cur_led = &pdata->leds[i];
236 led_dat->id = cur_led->flags & ADP8860_FLAG_LED_MASK;
238 if (led_dat->id > 7 || led_dat->id < 1) {
239 dev_err(&client->dev, "Invalid LED ID %d\n",
244 if (pdata->bl_led_assign & (1 << (led_dat->id - 1))) {
245 dev_err(&client->dev, "LED %d used by Backlight\n",
250 led_dat->cdev.name = cur_led->name;
251 led_dat->cdev.default_trigger = cur_led->default_trigger;
252 led_dat->cdev.brightness_set = adp8860_led_set;
253 led_dat->cdev.brightness = LED_OFF;
254 led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT;
255 led_dat->client = client;
256 led_dat->new_brightness = LED_OFF;
257 INIT_WORK(&led_dat->work, adp8860_led_work);
259 ret = led_classdev_register(&client->dev, &led_dat->cdev);
261 dev_err(&client->dev, "failed to register LED %d\n",
266 ret = adp8860_led_setup(led_dat);
268 dev_err(&client->dev, "failed to write\n");
279 for (i = i - 1; i >= 0; --i) {
280 led_classdev_unregister(&led[i].cdev);
281 cancel_work_sync(&led[i].work);
290 static int __devexit adp8860_led_remove(struct i2c_client *client)
292 struct adp8860_backlight_platform_data *pdata =
293 client->dev.platform_data;
294 struct adp8860_bl *data = i2c_get_clientdata(client);
297 for (i = 0; i < pdata->num_leds; i++) {
298 led_classdev_unregister(&data->led[i].cdev);
299 cancel_work_sync(&data->led[i].work);
306 static int __devinit adp8860_led_probe(struct i2c_client *client)
311 static int __devexit adp8860_led_remove(struct i2c_client *client)
317 static int adp8860_bl_set(struct backlight_device *bl, int brightness)
319 struct adp8860_bl *data = bl_get_data(bl);
320 struct i2c_client *client = data->client;
323 if (data->pdata->en_ambl_sens) {
324 if ((brightness > 0) && (brightness < ADP8860_MAX_BRIGHTNESS)) {
325 /* Disable Ambient Light auto adjust */
326 ret |= adp8860_clr_bits(client, ADP8860_MDCR,
328 ret |= adp8860_write(client, ADP8860_BLMX1, brightness);
331 * MAX_BRIGHTNESS -> Enable Ambient Light auto adjust
332 * restore daylight l1 sysfs brightness
334 ret |= adp8860_write(client, ADP8860_BLMX1,
335 data->cached_daylight_max);
336 ret |= adp8860_set_bits(client, ADP8860_MDCR,
340 ret |= adp8860_write(client, ADP8860_BLMX1, brightness);
342 if (data->current_brightness && brightness == 0)
343 ret |= adp8860_set_bits(client,
344 ADP8860_MDCR, DIM_EN);
345 else if (data->current_brightness == 0 && brightness)
346 ret |= adp8860_clr_bits(client,
347 ADP8860_MDCR, DIM_EN);
350 data->current_brightness = brightness;
355 static int adp8860_bl_update_status(struct backlight_device *bl)
357 int brightness = bl->props.brightness;
358 if (bl->props.power != FB_BLANK_UNBLANK)
361 if (bl->props.fb_blank != FB_BLANK_UNBLANK)
364 return adp8860_bl_set(bl, brightness);
367 static int adp8860_bl_get_brightness(struct backlight_device *bl)
369 struct adp8860_bl *data = bl_get_data(bl);
371 return data->current_brightness;
374 static const struct backlight_ops adp8860_bl_ops = {
375 .update_status = adp8860_bl_update_status,
376 .get_brightness = adp8860_bl_get_brightness,
379 static int adp8860_bl_setup(struct backlight_device *bl)
381 struct adp8860_bl *data = bl_get_data(bl);
382 struct i2c_client *client = data->client;
383 struct adp8860_backlight_platform_data *pdata = data->pdata;
386 ret |= adp8860_write(client, ADP8860_BLSEN, ~pdata->bl_led_assign);
387 ret |= adp8860_write(client, ADP8860_BLMX1, pdata->l1_daylight_max);
388 ret |= adp8860_write(client, ADP8860_BLDM1, pdata->l1_daylight_dim);
390 if (pdata->en_ambl_sens) {
391 data->cached_daylight_max = pdata->l1_daylight_max;
392 ret |= adp8860_write(client, ADP8860_BLMX2,
393 pdata->l2_office_max);
394 ret |= adp8860_write(client, ADP8860_BLDM2,
395 pdata->l2_office_dim);
396 ret |= adp8860_write(client, ADP8860_BLMX3,
398 ret |= adp8860_write(client, ADP8860_BLDM3,
401 ret |= adp8860_write(client, ADP8860_L2_TRP, pdata->l2_trip);
402 ret |= adp8860_write(client, ADP8860_L2_HYS, pdata->l2_hyst);
403 ret |= adp8860_write(client, ADP8860_L3_TRP, pdata->l3_trip);
404 ret |= adp8860_write(client, ADP8860_L3_HYS, pdata->l3_hyst);
405 ret |= adp8860_write(client, ADP8860_CCFG, L2_EN | L3_EN |
406 ALS_CCFG_VAL(pdata->abml_filt));
409 ret |= adp8860_write(client, ADP8860_CFGR,
410 BL_CFGR_VAL(pdata->bl_fade_law, 0));
412 ret |= adp8860_write(client, ADP8860_BLFR, FADE_VAL(pdata->bl_fade_in,
413 pdata->bl_fade_out));
415 ret |= adp8860_set_bits(client, ADP8860_MDCR, BLEN | DIM_EN | NSTBY);
420 static ssize_t adp8860_show(struct device *dev, char *buf, int reg)
422 struct adp8860_bl *data = dev_get_drvdata(dev);
426 mutex_lock(&data->lock);
427 error = adp8860_read(data->client, reg, ®_val);
428 mutex_unlock(&data->lock);
433 return sprintf(buf, "%u\n", reg_val);
436 static ssize_t adp8860_store(struct device *dev, const char *buf,
437 size_t count, int reg)
439 struct adp8860_bl *data = dev_get_drvdata(dev);
443 ret = strict_strtoul(buf, 10, &val);
447 mutex_lock(&data->lock);
448 adp8860_write(data->client, reg, val);
449 mutex_unlock(&data->lock);
454 static ssize_t adp8860_bl_l3_dark_max_show(struct device *dev,
455 struct device_attribute *attr, char *buf)
457 return adp8860_show(dev, buf, ADP8860_BLMX3);
460 static ssize_t adp8860_bl_l3_dark_max_store(struct device *dev,
461 struct device_attribute *attr, const char *buf, size_t count)
463 return adp8860_store(dev, buf, count, ADP8860_BLMX3);
466 static DEVICE_ATTR(l3_dark_max, 0664, adp8860_bl_l3_dark_max_show,
467 adp8860_bl_l3_dark_max_store);
469 static ssize_t adp8860_bl_l2_office_max_show(struct device *dev,
470 struct device_attribute *attr, char *buf)
472 return adp8860_show(dev, buf, ADP8860_BLMX2);
475 static ssize_t adp8860_bl_l2_office_max_store(struct device *dev,
476 struct device_attribute *attr, const char *buf, size_t count)
478 return adp8860_store(dev, buf, count, ADP8860_BLMX2);
480 static DEVICE_ATTR(l2_office_max, 0664, adp8860_bl_l2_office_max_show,
481 adp8860_bl_l2_office_max_store);
483 static ssize_t adp8860_bl_l1_daylight_max_show(struct device *dev,
484 struct device_attribute *attr, char *buf)
486 return adp8860_show(dev, buf, ADP8860_BLMX1);
489 static ssize_t adp8860_bl_l1_daylight_max_store(struct device *dev,
490 struct device_attribute *attr, const char *buf, size_t count)
492 struct adp8860_bl *data = dev_get_drvdata(dev);
494 strict_strtoul(buf, 10, &data->cached_daylight_max);
495 return adp8860_store(dev, buf, count, ADP8860_BLMX1);
497 static DEVICE_ATTR(l1_daylight_max, 0664, adp8860_bl_l1_daylight_max_show,
498 adp8860_bl_l1_daylight_max_store);
500 static ssize_t adp8860_bl_l3_dark_dim_show(struct device *dev,
501 struct device_attribute *attr, char *buf)
503 return adp8860_show(dev, buf, ADP8860_BLDM3);
506 static ssize_t adp8860_bl_l3_dark_dim_store(struct device *dev,
507 struct device_attribute *attr,
508 const char *buf, size_t count)
510 return adp8860_store(dev, buf, count, ADP8860_BLDM3);
512 static DEVICE_ATTR(l3_dark_dim, 0664, adp8860_bl_l3_dark_dim_show,
513 adp8860_bl_l3_dark_dim_store);
515 static ssize_t adp8860_bl_l2_office_dim_show(struct device *dev,
516 struct device_attribute *attr, char *buf)
518 return adp8860_show(dev, buf, ADP8860_BLDM2);
521 static ssize_t adp8860_bl_l2_office_dim_store(struct device *dev,
522 struct device_attribute *attr,
523 const char *buf, size_t count)
525 return adp8860_store(dev, buf, count, ADP8860_BLDM2);
527 static DEVICE_ATTR(l2_office_dim, 0664, adp8860_bl_l2_office_dim_show,
528 adp8860_bl_l2_office_dim_store);
530 static ssize_t adp8860_bl_l1_daylight_dim_show(struct device *dev,
531 struct device_attribute *attr, char *buf)
533 return adp8860_show(dev, buf, ADP8860_BLDM1);
536 static ssize_t adp8860_bl_l1_daylight_dim_store(struct device *dev,
537 struct device_attribute *attr,
538 const char *buf, size_t count)
540 return adp8860_store(dev, buf, count, ADP8860_BLDM1);
542 static DEVICE_ATTR(l1_daylight_dim, 0664, adp8860_bl_l1_daylight_dim_show,
543 adp8860_bl_l1_daylight_dim_store);
545 #ifdef ADP8860_EXT_FEATURES
546 static ssize_t adp8860_bl_ambient_light_level_show(struct device *dev,
547 struct device_attribute *attr, char *buf)
549 struct adp8860_bl *data = dev_get_drvdata(dev);
554 mutex_lock(&data->lock);
555 error = adp8860_read(data->client, ADP8860_PH1LEVL, ®_val);
557 error |= adp8860_read(data->client, ADP8860_PH1LEVH, ®_val);
558 mutex_unlock(&data->lock);
563 /* Return 13-bit conversion value for the first light sensor */
564 ret_val += (reg_val & 0x1F) << 8;
566 return sprintf(buf, "%u\n", ret_val);
568 static DEVICE_ATTR(ambient_light_level, 0444,
569 adp8860_bl_ambient_light_level_show, NULL);
571 static ssize_t adp8860_bl_ambient_light_zone_show(struct device *dev,
572 struct device_attribute *attr, char *buf)
574 struct adp8860_bl *data = dev_get_drvdata(dev);
578 mutex_lock(&data->lock);
579 error = adp8860_read(data->client, ADP8860_CFGR, ®_val);
580 mutex_unlock(&data->lock);
585 return sprintf(buf, "%u\n",
586 ((reg_val >> CFGR_BLV_SHIFT) & CFGR_BLV_MASK) + 1);
589 static ssize_t adp8860_bl_ambient_light_zone_store(struct device *dev,
590 struct device_attribute *attr,
591 const char *buf, size_t count)
593 struct adp8860_bl *data = dev_get_drvdata(dev);
598 ret = strict_strtoul(buf, 10, &val);
603 /* Enable automatic ambient light sensing */
604 adp8860_set_bits(data->client, ADP8860_MDCR, CMP_AUTOEN);
605 } else if ((val > 0) && (val < 6)) {
606 /* Disable automatic ambient light sensing */
607 adp8860_clr_bits(data->client, ADP8860_MDCR, CMP_AUTOEN);
609 /* Set user supplied ambient light zone */
610 mutex_lock(&data->lock);
611 adp8860_read(data->client, ADP8860_CFGR, ®_val);
612 reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT);
613 reg_val |= val << CFGR_BLV_SHIFT;
614 adp8860_write(data->client, ADP8860_CFGR, reg_val);
615 mutex_unlock(&data->lock);
620 static DEVICE_ATTR(ambient_light_zone, 0664,
621 adp8860_bl_ambient_light_zone_show,
622 adp8860_bl_ambient_light_zone_store);
625 static struct attribute *adp8860_bl_attributes[] = {
626 &dev_attr_l3_dark_max.attr,
627 &dev_attr_l3_dark_dim.attr,
628 &dev_attr_l2_office_max.attr,
629 &dev_attr_l2_office_dim.attr,
630 &dev_attr_l1_daylight_max.attr,
631 &dev_attr_l1_daylight_dim.attr,
632 #ifdef ADP8860_EXT_FEATURES
633 &dev_attr_ambient_light_level.attr,
634 &dev_attr_ambient_light_zone.attr,
639 static const struct attribute_group adp8860_bl_attr_group = {
640 .attrs = adp8860_bl_attributes,
643 static int __devinit adp8860_probe(struct i2c_client *client,
644 const struct i2c_device_id *id)
646 struct backlight_device *bl;
647 struct adp8860_bl *data;
648 struct adp8860_backlight_platform_data *pdata =
649 client->dev.platform_data;
653 if (!i2c_check_functionality(client->adapter,
654 I2C_FUNC_SMBUS_BYTE_DATA)) {
655 dev_err(&client->dev, "SMBUS Byte Data not Supported\n");
660 dev_err(&client->dev, "no platform data?\n");
664 ret = adp8860_read(client, ADP8860_MFDVID, ®_val);
668 if (ADP8860_MANID(reg_val) != ADP8860_MANUFID) {
669 dev_err(&client->dev, "failed to probe\n");
673 data = kzalloc(sizeof(*data), GFP_KERNEL);
677 /* It's confirmed that the DEVID field is actually a REVID */
679 data->revid = ADP8860_DEVID(reg_val);
680 data->client = client;
682 data->id = id->driver_data;
683 data->current_brightness = 0;
684 i2c_set_clientdata(client, data);
686 mutex_init(&data->lock);
688 bl = backlight_device_register(dev_driver_string(&client->dev),
689 &client->dev, data, &adp8860_bl_ops);
691 dev_err(&client->dev, "failed to register backlight\n");
696 bl->props.max_brightness =
697 bl->props.brightness = ADP8860_MAX_BRIGHTNESS;
701 if (pdata->en_ambl_sens)
702 ret = sysfs_create_group(&bl->dev.kobj,
703 &adp8860_bl_attr_group);
706 dev_err(&client->dev, "failed to register sysfs\n");
710 ret = adp8860_bl_setup(bl);
716 backlight_update_status(bl);
718 dev_info(&client->dev, "Rev.%d Backlight\n", data->revid);
721 adp8860_led_probe(client);
726 if (data->pdata->en_ambl_sens)
727 sysfs_remove_group(&data->bl->dev.kobj,
728 &adp8860_bl_attr_group);
730 backlight_device_unregister(bl);
732 i2c_set_clientdata(client, NULL);
738 static int __devexit adp8860_remove(struct i2c_client *client)
740 struct adp8860_bl *data = i2c_get_clientdata(client);
742 adp8860_clr_bits(client, ADP8860_MDCR, NSTBY);
745 adp8860_led_remove(client);
747 if (data->pdata->en_ambl_sens)
748 sysfs_remove_group(&data->bl->dev.kobj,
749 &adp8860_bl_attr_group);
751 backlight_device_unregister(data->bl);
752 i2c_set_clientdata(client, NULL);
759 static int adp8860_i2c_suspend(struct i2c_client *client, pm_message_t message)
761 adp8860_clr_bits(client, ADP8860_MDCR, NSTBY);
766 static int adp8860_i2c_resume(struct i2c_client *client)
768 adp8860_set_bits(client, ADP8860_MDCR, NSTBY);
773 #define adp8860_i2c_suspend NULL
774 #define adp8860_i2c_resume NULL
777 static const struct i2c_device_id adp8860_id[] = {
781 MODULE_DEVICE_TABLE(i2c, adp8860_id);
783 static struct i2c_driver adp8860_driver = {
785 .name = KBUILD_MODNAME,
787 .probe = adp8860_probe,
788 .remove = __devexit_p(adp8860_remove),
789 .suspend = adp8860_i2c_suspend,
790 .resume = adp8860_i2c_resume,
791 .id_table = adp8860_id,
794 static int __init adp8860_init(void)
796 return i2c_add_driver(&adp8860_driver);
798 module_init(adp8860_init);
800 static void __exit adp8860_exit(void)
802 i2c_del_driver(&adp8860_driver);
804 module_exit(adp8860_exit);
806 MODULE_LICENSE("GPL v2");
807 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
808 MODULE_DESCRIPTION("ADP8860 Backlight driver");
809 MODULE_ALIAS("i2c:adp8860-backlight");