aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/88pm860x_bl.c34
-rw-r--r--drivers/video/tmiofb.c28
2 files changed, 20 insertions, 42 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
164static 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
183static int pm860x_backlight_probe(struct platform_device *pdev) 165static 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);
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
index dfef88c803d4..9710bf8caeae 100644
--- a/drivers/video/tmiofb.c
+++ b/drivers/video/tmiofb.c
@@ -250,8 +250,7 @@ static irqreturn_t tmiofb_irq(int irq, void *__info)
250 */ 250 */
251static int tmiofb_hw_stop(struct platform_device *dev) 251static int tmiofb_hw_stop(struct platform_device *dev)
252{ 252{
253 struct mfd_cell *cell = dev->dev.platform_data; 253 struct tmio_fb_data *data = mfd_get_data(dev);
254 struct tmio_fb_data *data = cell->driver_data;
255 struct fb_info *info = platform_get_drvdata(dev); 254 struct fb_info *info = platform_get_drvdata(dev);
256 struct tmiofb_par *par = info->par; 255 struct tmiofb_par *par = info->par;
257 256
@@ -268,7 +267,7 @@ static int tmiofb_hw_stop(struct platform_device *dev)
268 */ 267 */
269static int tmiofb_hw_init(struct platform_device *dev) 268static int tmiofb_hw_init(struct platform_device *dev)
270{ 269{
271 struct mfd_cell *cell = dev->dev.platform_data; 270 const struct mfd_cell *cell = mfd_get_cell(dev);
272 struct fb_info *info = platform_get_drvdata(dev); 271 struct fb_info *info = platform_get_drvdata(dev);
273 struct tmiofb_par *par = info->par; 272 struct tmiofb_par *par = info->par;
274 const struct resource *nlcr = &cell->resources[0]; 273 const struct resource *nlcr = &cell->resources[0];
@@ -312,8 +311,7 @@ static int tmiofb_hw_init(struct platform_device *dev)
312 */ 311 */
313static void tmiofb_hw_mode(struct platform_device *dev) 312static void tmiofb_hw_mode(struct platform_device *dev)
314{ 313{
315 struct mfd_cell *cell = dev->dev.platform_data; 314 struct tmio_fb_data *data = mfd_get_data(dev);
316 struct tmio_fb_data *data = cell->driver_data;
317 struct fb_info *info = platform_get_drvdata(dev); 315 struct fb_info *info = platform_get_drvdata(dev);
318 struct fb_videomode *mode = info->mode; 316 struct fb_videomode *mode = info->mode;
319 struct tmiofb_par *par = info->par; 317 struct tmiofb_par *par = info->par;
@@ -559,9 +557,8 @@ static int tmiofb_ioctl(struct fb_info *fbi,
559static struct fb_videomode * 557static struct fb_videomode *
560tmiofb_find_mode(struct fb_info *info, struct fb_var_screeninfo *var) 558tmiofb_find_mode(struct fb_info *info, struct fb_var_screeninfo *var)
561{ 559{
562 struct mfd_cell *cell = 560 struct tmio_fb_data *data =
563 info->device->platform_data; 561 mfd_get_data(to_platform_device(info->device));
564 struct tmio_fb_data *data = cell->driver_data;
565 struct fb_videomode *best = NULL; 562 struct fb_videomode *best = NULL;
566 int i; 563 int i;
567 564
@@ -581,9 +578,8 @@ static int tmiofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
581{ 578{
582 579
583 struct fb_videomode *mode; 580 struct fb_videomode *mode;
584 struct mfd_cell *cell = 581 struct tmio_fb_data *data =
585 info->device->platform_data; 582 mfd_get_data(to_platform_device(info->device));
586 struct tmio_fb_data *data = cell->driver_data;
587 583
588 mode = tmiofb_find_mode(info, var); 584 mode = tmiofb_find_mode(info, var);
589 if (!mode || var->bits_per_pixel > 16) 585 if (!mode || var->bits_per_pixel > 16)
@@ -683,8 +679,8 @@ static struct fb_ops tmiofb_ops = {
683 679
684static int __devinit tmiofb_probe(struct platform_device *dev) 680static int __devinit tmiofb_probe(struct platform_device *dev)
685{ 681{
686 struct mfd_cell *cell = dev->dev.platform_data; 682 const struct mfd_cell *cell = mfd_get_cell(dev);
687 struct tmio_fb_data *data = cell->driver_data; 683 struct tmio_fb_data *data = mfd_get_data(dev);
688 struct resource *ccr = platform_get_resource(dev, IORESOURCE_MEM, 1); 684 struct resource *ccr = platform_get_resource(dev, IORESOURCE_MEM, 1);
689 struct resource *lcr = platform_get_resource(dev, IORESOURCE_MEM, 0); 685 struct resource *lcr = platform_get_resource(dev, IORESOURCE_MEM, 0);
690 struct resource *vram = platform_get_resource(dev, IORESOURCE_MEM, 2); 686 struct resource *vram = platform_get_resource(dev, IORESOURCE_MEM, 2);
@@ -811,7 +807,7 @@ err_ioremap_ccr:
811 807
812static int __devexit tmiofb_remove(struct platform_device *dev) 808static int __devexit tmiofb_remove(struct platform_device *dev)
813{ 809{
814 struct mfd_cell *cell = dev->dev.platform_data; 810 const struct mfd_cell *cell = mfd_get_cell(dev);
815 struct fb_info *info = platform_get_drvdata(dev); 811 struct fb_info *info = platform_get_drvdata(dev);
816 int irq = platform_get_irq(dev, 0); 812 int irq = platform_get_irq(dev, 0);
817 struct tmiofb_par *par; 813 struct tmiofb_par *par;
@@ -941,7 +937,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state)
941#ifdef CONFIG_FB_TMIO_ACCELL 937#ifdef CONFIG_FB_TMIO_ACCELL
942 struct tmiofb_par *par = info->par; 938 struct tmiofb_par *par = info->par;
943#endif 939#endif
944 struct mfd_cell *cell = dev->dev.platform_data; 940 const struct mfd_cell *cell = mfd_get_cell(dev);
945 int retval = 0; 941 int retval = 0;
946 942
947 console_lock(); 943 console_lock();
@@ -973,7 +969,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state)
973static int tmiofb_resume(struct platform_device *dev) 969static int tmiofb_resume(struct platform_device *dev)
974{ 970{
975 struct fb_info *info = platform_get_drvdata(dev); 971 struct fb_info *info = platform_get_drvdata(dev);
976 struct mfd_cell *cell = dev->dev.platform_data; 972 const struct mfd_cell *cell = mfd_get_cell(dev);
977 int retval = 0; 973 int retval = 0;
978 974
979 console_lock(); 975 console_lock();