diff options
author | Haojian Zhuang <haojian.zhuang@marvell.com> | 2011-03-07 10:43:09 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-03-23 05:42:05 -0400 |
commit | adb70483f4d560323db9aaca5f066fde4d96f339 (patch) | |
tree | b429a9a294fde03d21df32c1a4cb243174997df6 /drivers/video/backlight | |
parent | d7e8c01a97429101cb0ca2c09380e683c3814af8 (diff) |
mfd: Adopt mfd_data in 88pm860x backlight
Copy 88pm860x platform data into different mfd_data structure for
backlight driver. So move the identification of device node from
backlight driver to mfd driver.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/88pm860x_bl.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index e59623a15f3f..c8b520e9a11a 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c | |||
@@ -12,11 +12,12 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
16 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
17 | #include <linux/backlight.h> | 18 | #include <linux/backlight.h> |
19 | #include <linux/mfd/core.h> | ||
18 | #include <linux/mfd/88pm860x.h> | 20 | #include <linux/mfd/88pm860x.h> |
19 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | #define MAX_BRIGHTNESS (0xFF) | 22 | #define MAX_BRIGHTNESS (0xFF) |
22 | #define MIN_BRIGHTNESS (0) | 23 | #define MIN_BRIGHTNESS (0) |
@@ -161,32 +162,13 @@ static const struct backlight_ops pm860x_backlight_ops = { | |||
161 | .get_brightness = pm860x_backlight_get_brightness, | 162 | .get_brightness = pm860x_backlight_get_brightness, |
162 | }; | 163 | }; |
163 | 164 | ||
164 | static int __check_device(struct pm860x_backlight_pdata *pdata, char *name) | ||
165 | { | ||
166 | struct pm860x_backlight_pdata *p = pdata; | ||
167 | int ret = -EINVAL; | ||
168 | |||
169 | while (p && p->id) { | ||
170 | if ((p->id != PM8606_ID_BACKLIGHT) || (p->flags < 0)) | ||
171 | break; | ||
172 | |||
173 | if (!strncmp(name, pm860x_backlight_name[p->flags], | ||
174 | MFD_NAME_SIZE)) { | ||
175 | ret = (int)p->flags; | ||
176 | break; | ||
177 | } | ||
178 | p++; | ||
179 | } | ||
180 | return ret; | ||
181 | } | ||
182 | |||
183 | static int pm860x_backlight_probe(struct platform_device *pdev) | 165 | static int pm860x_backlight_probe(struct platform_device *pdev) |
184 | { | 166 | { |
185 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | 167 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); |
186 | struct pm860x_platform_data *pm860x_pdata; | ||
187 | struct pm860x_backlight_pdata *pdata = NULL; | 168 | struct pm860x_backlight_pdata *pdata = NULL; |
188 | struct pm860x_backlight_data *data; | 169 | struct pm860x_backlight_data *data; |
189 | struct backlight_device *bl; | 170 | struct backlight_device *bl; |
171 | struct mfd_cell *cell; | ||
190 | struct resource *res; | 172 | struct resource *res; |
191 | struct backlight_properties props; | 173 | struct backlight_properties props; |
192 | unsigned char value; | 174 | unsigned char value; |
@@ -199,10 +181,10 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
199 | return -EINVAL; | 181 | return -EINVAL; |
200 | } | 182 | } |
201 | 183 | ||
202 | if (pdev->dev.parent->platform_data) { | 184 | cell = pdev->dev.platform_data; |
203 | pm860x_pdata = pdev->dev.parent->platform_data; | 185 | if (cell == NULL) |
204 | pdata = pm860x_pdata->backlight; | 186 | return -ENODEV; |
205 | } | 187 | pdata = cell->mfd_data; |
206 | if (pdata == NULL) { | 188 | if (pdata == NULL) { |
207 | dev_err(&pdev->dev, "platform data isn't assigned to " | 189 | dev_err(&pdev->dev, "platform data isn't assigned to " |
208 | "backlight\n"); | 190 | "backlight\n"); |
@@ -219,7 +201,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
219 | data->current_brightness = MAX_BRIGHTNESS; | 201 | data->current_brightness = MAX_BRIGHTNESS; |
220 | data->pwm = pdata->pwm; | 202 | data->pwm = pdata->pwm; |
221 | data->iset = pdata->iset; | 203 | data->iset = pdata->iset; |
222 | data->port = __check_device(pdata, name); | 204 | data->port = pdata->flags; |
223 | if (data->port < 0) { | 205 | if (data->port < 0) { |
224 | dev_err(&pdev->dev, "wrong platform data is assigned"); | 206 | dev_err(&pdev->dev, "wrong platform data is assigned"); |
225 | kfree(data); | 207 | kfree(data); |