diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/xilinxfb.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index dec602c23075..b3b57f4a35a2 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c | |||
@@ -84,6 +84,12 @@ | |||
84 | #define PALETTE_ENTRIES_NO 16 /* passed to fb_alloc_cmap() */ | 84 | #define PALETTE_ENTRIES_NO 16 /* passed to fb_alloc_cmap() */ |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * Default xilinxfb configuration | ||
88 | */ | ||
89 | static struct xilinxfb_platform_data xilinx_fb_default_pdata = { | ||
90 | }; | ||
91 | |||
92 | /* | ||
87 | * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures | 93 | * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures |
88 | */ | 94 | */ |
89 | static struct fb_fix_screeninfo xilinx_fb_fix = { | 95 | static struct fb_fix_screeninfo xilinx_fb_fix = { |
@@ -207,7 +213,7 @@ static struct fb_ops xilinxfb_ops = | |||
207 | */ | 213 | */ |
208 | 214 | ||
209 | static int xilinxfb_assign(struct device *dev, unsigned long physaddr, | 215 | static int xilinxfb_assign(struct device *dev, unsigned long physaddr, |
210 | int width_mm, int height_mm, int rotate) | 216 | struct xilinxfb_platform_data *pdata) |
211 | { | 217 | { |
212 | struct xilinxfb_drvdata *drvdata; | 218 | struct xilinxfb_drvdata *drvdata; |
213 | int rc; | 219 | int rc; |
@@ -253,7 +259,7 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr, | |||
253 | 259 | ||
254 | /* Turn on the display */ | 260 | /* Turn on the display */ |
255 | drvdata->reg_ctrl_default = REG_CTRL_ENABLE; | 261 | drvdata->reg_ctrl_default = REG_CTRL_ENABLE; |
256 | if (rotate) | 262 | if (pdata->rotate_screen) |
257 | drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; | 263 | drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; |
258 | xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); | 264 | xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); |
259 | 265 | ||
@@ -267,8 +273,8 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr, | |||
267 | drvdata->info.flags = FBINFO_DEFAULT; | 273 | drvdata->info.flags = FBINFO_DEFAULT; |
268 | drvdata->info.var = xilinx_fb_var; | 274 | drvdata->info.var = xilinx_fb_var; |
269 | 275 | ||
270 | xilinx_fb_var.height = height_mm; | 276 | xilinx_fb_var.height = pdata->screen_height_mm; |
271 | xilinx_fb_var.width = width_mm; | 277 | xilinx_fb_var.width = pdata->screen_width_mm; |
272 | 278 | ||
273 | /* Allocate a colour map */ | 279 | /* Allocate a colour map */ |
274 | rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0); | 280 | rc = fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0); |
@@ -349,9 +355,6 @@ xilinxfb_platform_probe(struct platform_device *pdev) | |||
349 | { | 355 | { |
350 | struct xilinxfb_platform_data *pdata; | 356 | struct xilinxfb_platform_data *pdata; |
351 | struct resource *res; | 357 | struct resource *res; |
352 | int width_mm = 0; | ||
353 | int height_mm = 0; | ||
354 | int rotate = 0; | ||
355 | 358 | ||
356 | /* Find the registers address */ | 359 | /* Find the registers address */ |
357 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 360 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
@@ -361,15 +364,12 @@ xilinxfb_platform_probe(struct platform_device *pdev) | |||
361 | } | 364 | } |
362 | 365 | ||
363 | /* If a pdata structure is provided, then extract the parameters */ | 366 | /* If a pdata structure is provided, then extract the parameters */ |
364 | pdata = pdev->dev.platform_data; | 367 | if (pdev->dev.platform_data) |
365 | if (pdata) { | 368 | pdata = pdev->dev.platform_data; |
366 | height_mm = pdata->screen_height_mm; | 369 | else |
367 | width_mm = pdata->screen_width_mm; | 370 | pdata = &xilinx_fb_default_pdata; |
368 | rotate = pdata->rotate_screen ? 1 : 0; | ||
369 | } | ||
370 | 371 | ||
371 | return xilinxfb_assign(&pdev->dev, res->start, width_mm, height_mm, | 372 | return xilinxfb_assign(&pdev->dev, res->start, pdata); |
372 | rotate); | ||
373 | } | 373 | } |
374 | 374 | ||
375 | static int | 375 | static int |
@@ -398,9 +398,12 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) | |||
398 | { | 398 | { |
399 | struct resource res; | 399 | struct resource res; |
400 | const u32 *prop; | 400 | const u32 *prop; |
401 | int width = 0, height = 0, rotate = 0; | 401 | struct xilinxfb_platform_data pdata; |
402 | int size, rc; | 402 | int size, rc; |
403 | 403 | ||
404 | /* Copy with the default pdata (not a ptr reference!) */ | ||
405 | pdata = xilinx_fb_default_pdata; | ||
406 | |||
404 | dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match); | 407 | dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match); |
405 | 408 | ||
406 | rc = of_address_to_resource(op->node, 0, &res); | 409 | rc = of_address_to_resource(op->node, 0, &res); |
@@ -411,14 +414,14 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) | |||
411 | 414 | ||
412 | prop = of_get_property(op->node, "display-number", &size); | 415 | prop = of_get_property(op->node, "display-number", &size); |
413 | if ((prop) && (size >= sizeof(u32)*2)) { | 416 | if ((prop) && (size >= sizeof(u32)*2)) { |
414 | width = prop[0]; | 417 | pdata.screen_width_mm = prop[0]; |
415 | height = prop[1]; | 418 | pdata.screen_height_mm = prop[1]; |
416 | } | 419 | } |
417 | 420 | ||
418 | if (of_find_property(op->node, "rotate-display", NULL)) | 421 | if (of_find_property(op->node, "rotate-display", NULL)) |
419 | rotate = 1; | 422 | pdata.rotate_screen = 1; |
420 | 423 | ||
421 | return xilinxfb_assign(&op->dev, res.start, width, height, rotate); | 424 | return xilinxfb_assign(&op->dev, res.start, &pdata); |
422 | } | 425 | } |
423 | 426 | ||
424 | static int __devexit xilinxfb_of_remove(struct of_device *op) | 427 | static int __devexit xilinxfb_of_remove(struct of_device *op) |