aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2011-04-06 10:26:56 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-05-26 13:45:12 -0400
commit07259a7092e47b9fbb5c8bfdad45fa4c7dbbc051 (patch)
tree73d3c059141e3b418ac40b3f63a165fc1b326013 /drivers
parenta7c98ce25cfa600bd614134a82d22bcb7bcb9d65 (diff)
mfd: Use mfd cell platform_data for 88pm860x cells platform bits
With the addition of a platform device mfd_cell pointer, MFD drivers can go back to passing platform back to their sub drivers. This allows for an mfd_cell->mfd_data removal and thus keep the sub drivers MFD agnostic. This is mostly needed for non MFD aware sub drivers. Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Cc: Richard Purdie <rpurdie@rpsys.net> Acked-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/leds-88pm860x.c7
-rw-r--r--drivers/mfd/88pm860x-core.c18
-rw-r--r--drivers/regulator/88pm8607.c7
-rw-r--r--drivers/video/backlight/88pm860x_bl.c7
4 files changed, 15 insertions, 24 deletions
diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c
index 416def84d045..0d4c16678ace 100644
--- a/drivers/leds/leds-88pm860x.c
+++ b/drivers/leds/leds-88pm860x.c
@@ -17,7 +17,6 @@
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/mfd/core.h>
21#include <linux/mfd/88pm860x.h> 20#include <linux/mfd/88pm860x.h>
22 21
23#define LED_PWM_SHIFT (3) 22#define LED_PWM_SHIFT (3)
@@ -171,7 +170,6 @@ static int pm860x_led_probe(struct platform_device *pdev)
171 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 170 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
172 struct pm860x_led_pdata *pdata; 171 struct pm860x_led_pdata *pdata;
173 struct pm860x_led *data; 172 struct pm860x_led *data;
174 struct mfd_cell *cell;
175 struct resource *res; 173 struct resource *res;
176 int ret; 174 int ret;
177 175
@@ -181,10 +179,7 @@ static int pm860x_led_probe(struct platform_device *pdev)
181 return -EINVAL; 179 return -EINVAL;
182 } 180 }
183 181
184 cell = pdev->dev.platform_data; 182 pdata = pdev->dev.platform_data;
185 if (cell == NULL)
186 return -ENODEV;
187 pdata = cell->mfd_data;
188 if (pdata == NULL) { 183 if (pdata == NULL) {
189 dev_err(&pdev->dev, "No platform data!\n"); 184 dev_err(&pdev->dev, "No platform data!\n");
190 return -EINVAL; 185 return -EINVAL;
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index 011cb6ce861b..801aff7c8bab 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -516,7 +516,8 @@ static void __devinit device_bk_init(struct pm860x_chip *chip,
516 for (i = 0; i < pdata->num_backlights; i++) { 516 for (i = 0; i < pdata->num_backlights; i++) {
517 memcpy(&bk_pdata[i], &pdata->backlight[i], 517 memcpy(&bk_pdata[i], &pdata->backlight[i],
518 sizeof(struct pm860x_backlight_pdata)); 518 sizeof(struct pm860x_backlight_pdata));
519 bk_devs[i].mfd_data = &bk_pdata[i]; 519 bk_devs[i].platform_data = &bk_pdata[i];
520 bk_devs[i].pdata_size = sizeof(bk_pdata[i]);
520 521
521 for (j = 0; j < ARRAY_SIZE(bk_devs); j++) { 522 for (j = 0; j < ARRAY_SIZE(bk_devs); j++) {
522 id = bk_resources[j].start; 523 id = bk_resources[j].start;
@@ -553,7 +554,8 @@ static void __devinit device_led_init(struct pm860x_chip *chip,
553 for (i = 0; i < pdata->num_leds; i++) { 554 for (i = 0; i < pdata->num_leds; i++) {
554 memcpy(&led_pdata[i], &pdata->led[i], 555 memcpy(&led_pdata[i], &pdata->led[i],
555 sizeof(struct pm860x_led_pdata)); 556 sizeof(struct pm860x_led_pdata));
556 led_devs[i].mfd_data = &led_pdata[i]; 557 led_devs[i].platform_data = &led_pdata[i];
558 led_devs[i].pdata_size = sizeof(led_pdata[i]);
557 559
558 for (j = 0; j < ARRAY_SIZE(led_devs); j++) { 560 for (j = 0; j < ARRAY_SIZE(led_devs); j++) {
559 id = led_resources[j].start; 561 id = led_resources[j].start;
@@ -617,7 +619,8 @@ static void __devinit device_regulator_init(struct pm860x_chip *chip,
617 } 619 }
618 memcpy(&regulator_pdata[i], &pdata->regulator[i], 620 memcpy(&regulator_pdata[i], &pdata->regulator[i],
619 sizeof(struct regulator_init_data)); 621 sizeof(struct regulator_init_data));
620 regulator_devs[i].mfd_data = &regulator_pdata[i]; 622 regulator_devs[i].platform_data = &regulator_pdata[i];
623 regulator_devs[i].pdata_size = sizeof(regulator_pdata[i]);
621 regulator_devs[i].num_resources = 1; 624 regulator_devs[i].num_resources = 1;
622 regulator_devs[i].resources = &regulator_resources[j]; 625 regulator_devs[i].resources = &regulator_resources[j];
623 626
@@ -642,7 +645,8 @@ static void __devinit device_touch_init(struct pm860x_chip *chip,
642 return; 645 return;
643 646
644 memcpy(&touch_pdata, pdata->touch, sizeof(struct pm860x_touch_pdata)); 647 memcpy(&touch_pdata, pdata->touch, sizeof(struct pm860x_touch_pdata));
645 touch_devs[0].mfd_data = &touch_pdata; 648 touch_devs[0].platform_data = &touch_pdata;
649 touch_devs[0].pdata_size = sizeof(touch_pdata);
646 touch_devs[0].num_resources = ARRAY_SIZE(touch_resources); 650 touch_devs[0].num_resources = ARRAY_SIZE(touch_resources);
647 touch_devs[0].resources = &touch_resources[0]; 651 touch_devs[0].resources = &touch_resources[0];
648 ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], 652 ret = mfd_add_devices(chip->dev, 0, &touch_devs[0],
@@ -662,7 +666,8 @@ static void __devinit device_power_init(struct pm860x_chip *chip,
662 return; 666 return;
663 667
664 memcpy(&power_pdata, pdata->power, sizeof(struct pm860x_power_pdata)); 668 memcpy(&power_pdata, pdata->power, sizeof(struct pm860x_power_pdata));
665 power_devs[0].mfd_data = &power_pdata; 669 power_devs[0].platform_data = &power_pdata;
670 power_devs[0].pdata_size = sizeof(power_pdata);
666 power_devs[0].num_resources = ARRAY_SIZE(battery_resources); 671 power_devs[0].num_resources = ARRAY_SIZE(battery_resources);
667 power_devs[0].resources = &battery_resources[0], 672 power_devs[0].resources = &battery_resources[0],
668 ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 1, 673 ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 1,
@@ -670,7 +675,8 @@ static void __devinit device_power_init(struct pm860x_chip *chip,
670 if (ret < 0) 675 if (ret < 0)
671 dev_err(chip->dev, "Failed to add battery subdev\n"); 676 dev_err(chip->dev, "Failed to add battery subdev\n");
672 677
673 power_devs[1].mfd_data = &power_pdata; 678 power_devs[1].platform_data = &power_pdata;
679 power_devs[0].pdata_size = sizeof(power_pdata);
674 power_devs[1].num_resources = ARRAY_SIZE(charger_resources); 680 power_devs[1].num_resources = ARRAY_SIZE(charger_resources);
675 power_devs[1].resources = &charger_resources[0], 681 power_devs[1].resources = &charger_resources[0],
676 ret = mfd_add_devices(chip->dev, 0, &power_devs[1], 1, 682 ret = mfd_add_devices(chip->dev, 0, &power_devs[1], 1,
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 859251250b55..784ea7724c7a 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -15,7 +15,6 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/regulator/driver.h> 16#include <linux/regulator/driver.h>
17#include <linux/regulator/machine.h> 17#include <linux/regulator/machine.h>
18#include <linux/mfd/core.h>
19#include <linux/mfd/88pm860x.h> 18#include <linux/mfd/88pm860x.h>
20 19
21struct pm8607_regulator_info { 20struct pm8607_regulator_info {
@@ -400,13 +399,9 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
400 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 399 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
401 struct pm8607_regulator_info *info = NULL; 400 struct pm8607_regulator_info *info = NULL;
402 struct regulator_init_data *pdata; 401 struct regulator_init_data *pdata;
403 struct mfd_cell *cell;
404 int i; 402 int i;
405 403
406 cell = pdev->dev.platform_data; 404 pdata = pdev->dev.platform_data;
407 if (cell == NULL)
408 return -ENODEV;
409 pdata = cell->mfd_data;
410 if (pdata == NULL) 405 if (pdata == NULL)
411 return -EINVAL; 406 return -EINVAL;
412 407
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c
index c8b520e9a11a..c04b94da81f7 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -16,7 +16,6 @@
16#include <linux/fb.h> 16#include <linux/fb.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/backlight.h> 18#include <linux/backlight.h>
19#include <linux/mfd/core.h>
20#include <linux/mfd/88pm860x.h> 19#include <linux/mfd/88pm860x.h>
21 20
22#define MAX_BRIGHTNESS (0xFF) 21#define MAX_BRIGHTNESS (0xFF)
@@ -168,7 +167,6 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
168 struct pm860x_backlight_pdata *pdata = NULL; 167 struct pm860x_backlight_pdata *pdata = NULL;
169 struct pm860x_backlight_data *data; 168 struct pm860x_backlight_data *data;
170 struct backlight_device *bl; 169 struct backlight_device *bl;
171 struct mfd_cell *cell;
172 struct resource *res; 170 struct resource *res;
173 struct backlight_properties props; 171 struct backlight_properties props;
174 unsigned char value; 172 unsigned char value;
@@ -181,10 +179,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
181 return -EINVAL; 179 return -EINVAL;
182 } 180 }
183 181
184 cell = pdev->dev.platform_data; 182 pdata = pdev->dev.platform_data;
185 if (cell == NULL)
186 return -ENODEV;
187 pdata = cell->mfd_data;
188 if (pdata == NULL) { 183 if (pdata == NULL) {
189 dev_err(&pdev->dev, "platform data isn't assigned to " 184 dev_err(&pdev->dev, "platform data isn't assigned to "
190 "backlight\n"); 185 "backlight\n");