aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/88pm860x-core.c
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@gmail.com>2012-08-08 11:17:26 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-11 05:38:03 -0400
commita6ccdcd98c39ac13508570dbd943a1cf1b569f55 (patch)
treecabab74ae3665d0d3e4a59a7b74d9a39d2d03854 /drivers/mfd/88pm860x-core.c
parent015625a20f630c798a8c5fdf5d472be091b8ac7d (diff)
mfd: 88pm860x: Use REG resource for backlight
Now resource of 88pm860x backlight is changed from IORESOURCE_IO to IORESOURCE_REG. In original driver, the resource is using self-defined IORESOURCE_IO. So change the resource to register offset to match the definition of IORESOURCE_REG. Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/88pm860x-core.c')
-rw-r--r--drivers/mfd/88pm860x-core.c78
1 files changed, 43 insertions, 35 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index 75864383573d..b72628e8d6ee 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -21,10 +21,20 @@
21 21
22#define INT_STATUS_NUM 3 22#define INT_STATUS_NUM 3
23 23
24static struct resource bk_resources[] __devinitdata = { 24static struct resource bk0_resources[] __devinitdata = {
25 {PM8606_BACKLIGHT1, PM8606_BACKLIGHT1, "backlight-0", IORESOURCE_REG,}, 25 {2, 2, "duty cycle", IORESOURCE_REG, },
26 {PM8606_BACKLIGHT2, PM8606_BACKLIGHT2, "backlight-1", IORESOURCE_REG,}, 26 {3, 3, "always on", IORESOURCE_REG, },
27 {PM8606_BACKLIGHT3, PM8606_BACKLIGHT3, "backlight-2", IORESOURCE_REG,}, 27 {3, 3, "current", IORESOURCE_REG, },
28};
29static struct resource bk1_resources[] __devinitdata = {
30 {4, 4, "duty cycle", IORESOURCE_REG, },
31 {5, 5, "always on", IORESOURCE_REG, },
32 {5, 5, "current", IORESOURCE_REG, },
33};
34static struct resource bk2_resources[] __devinitdata = {
35 {6, 6, "duty cycle", IORESOURCE_REG, },
36 {7, 7, "always on", IORESOURCE_REG, },
37 {5, 5, "current", IORESOURCE_REG, },
28}; 38};
29 39
30static struct resource led_resources[] __devinitdata = { 40static struct resource led_resources[] __devinitdata = {
@@ -99,9 +109,22 @@ static struct resource rtc_resources[] __devinitdata = {
99}; 109};
100 110
101static struct mfd_cell bk_devs[] = { 111static struct mfd_cell bk_devs[] = {
102 {"88pm860x-backlight", 0,}, 112 {
103 {"88pm860x-backlight", 1,}, 113 .name = "88pm860x-backlight",
104 {"88pm860x-backlight", 2,}, 114 .id = 0,
115 .num_resources = ARRAY_SIZE(bk0_resources),
116 .resources = bk0_resources,
117 }, {
118 .name = "88pm860x-backlight",
119 .id = 1,
120 .num_resources = ARRAY_SIZE(bk1_resources),
121 .resources = bk1_resources,
122 }, {
123 .name = "88pm860x-backlight",
124 .id = 2,
125 .num_resources = ARRAY_SIZE(bk2_resources),
126 .resources = bk2_resources,
127 },
105}; 128};
106 129
107static struct mfd_cell led_devs[] = { 130static struct mfd_cell led_devs[] = {
@@ -615,36 +638,21 @@ static void __devinit device_osc_init(struct i2c_client *i2c)
615static void __devinit device_bk_init(struct pm860x_chip *chip, 638static void __devinit device_bk_init(struct pm860x_chip *chip,
616 struct pm860x_platform_data *pdata) 639 struct pm860x_platform_data *pdata)
617{ 640{
618 int ret; 641 int ret, i;
619 int i, j, id; 642
620 643 if (pdata && pdata->backlight) {
621 if ((pdata == NULL) || (pdata->backlight == NULL)) 644 if (pdata->num_backlights > ARRAY_SIZE(bk_devs))
622 return; 645 pdata->num_backlights = ARRAY_SIZE(bk_devs);
623 646 for (i = 0; i < pdata->num_backlights; i++) {
624 if (pdata->num_backlights > ARRAY_SIZE(bk_devs)) 647 bk_devs[i].platform_data = &pdata->backlight[i];
625 pdata->num_backlights = ARRAY_SIZE(bk_devs); 648 bk_devs[i].pdata_size =
626 649 sizeof(struct pm860x_backlight_pdata);
627 for (i = 0; i < pdata->num_backlights; i++) {
628 bk_devs[i].platform_data = &pdata->backlight[i];
629 bk_devs[i].pdata_size = sizeof(struct pm860x_backlight_pdata);
630
631 for (j = 0; j < ARRAY_SIZE(bk_devs); j++) {
632 id = bk_resources[j].start;
633 if (pdata->backlight[i].flags != id)
634 continue;
635
636 bk_devs[i].num_resources = 1;
637 bk_devs[i].resources = &bk_resources[j];
638 ret = mfd_add_devices(chip->dev, 0,
639 &bk_devs[i], 1,
640 &bk_resources[j], 0);
641 if (ret < 0) {
642 dev_err(chip->dev, "Failed to add "
643 "backlight subdev\n");
644 return;
645 }
646 } 650 }
647 } 651 }
652 ret = mfd_add_devices(chip->dev, 0, bk_devs,
653 ARRAY_SIZE(bk_devs), NULL, 0);
654 if (ret < 0)
655 dev_err(chip->dev, "Failed to add backlight subdev\n");
648} 656}
649 657
650static void __devinit device_led_init(struct pm860x_chip *chip, 658static void __devinit device_led_init(struct pm860x_chip *chip,