aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-08-02 08:05:20 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2013-08-02 19:17:44 -0400
commit5ef76da644bf346d29200007d8d3779e7009dabb (patch)
treee9e248f6a7f06211d03a8d89cf5466d5adcb885d /drivers/video
parent5ae90d8e467e625e447000cb4335c4db973b1095 (diff)
fbdev: simplefb: add init through platform_data
If we create proper platform-devices in x86 boot-code, we can use simplefb for VBE or EFI framebuffers, too. However, there is normally no OF support so we introduce a platform_data object so x86 boot-code can pass the parameters via plain old platform-data. This also removes the OF dependency as it is not needed. The headers provide proper dummies for the case OF is disabled. Furthermore, we move the FORMAT-definitions to the common platform header so initialization code can use it to transform "struct screen_info" to the right format-name. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Link: http://lkml.kernel.org/r/1375445127-15480-2-git-send-email-dh.herrmann@gmail.com Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig5
-rw-r--r--drivers/video/simplefb.c48
2 files changed, 37 insertions, 16 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4cf1e1dd5621..34c3d960634d 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2457,7 +2457,7 @@ config FB_HYPERV
2457 2457
2458config FB_SIMPLE 2458config FB_SIMPLE
2459 bool "Simple framebuffer support" 2459 bool "Simple framebuffer support"
2460 depends on (FB = y) && OF 2460 depends on (FB = y)
2461 select FB_CFB_FILLRECT 2461 select FB_CFB_FILLRECT
2462 select FB_CFB_COPYAREA 2462 select FB_CFB_COPYAREA
2463 select FB_CFB_IMAGEBLIT 2463 select FB_CFB_IMAGEBLIT
@@ -2469,8 +2469,7 @@ config FB_SIMPLE
2469 pre-allocated frame buffer surface. 2469 pre-allocated frame buffer surface.
2470 2470
2471 Configuration re: surface address, size, and format must be provided 2471 Configuration re: surface address, size, and format must be provided
2472 through device tree, or potentially plain old platform data in the 2472 through device tree, or plain old platform data.
2473 future.
2474 2473
2475source "drivers/video/omap/Kconfig" 2474source "drivers/video/omap/Kconfig"
2476source "drivers/video/omap2/Kconfig" 2475source "drivers/video/omap2/Kconfig"
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
index e2e9e3e61b72..588698986ce1 100644
--- a/drivers/video/simplefb.c
+++ b/drivers/video/simplefb.c
@@ -24,6 +24,7 @@
24#include <linux/fb.h> 24#include <linux/fb.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/platform_data/simplefb.h>
27#include <linux/platform_device.h> 28#include <linux/platform_device.h>
28 29
29static struct fb_fix_screeninfo simplefb_fix = { 30static struct fb_fix_screeninfo simplefb_fix = {
@@ -73,18 +74,7 @@ static struct fb_ops simplefb_ops = {
73 .fb_imageblit = cfb_imageblit, 74 .fb_imageblit = cfb_imageblit,
74}; 75};
75 76
76struct simplefb_format { 77static struct simplefb_format simplefb_formats[] = SIMPLEFB_FORMATS;
77 const char *name;
78 u32 bits_per_pixel;
79 struct fb_bitfield red;
80 struct fb_bitfield green;
81 struct fb_bitfield blue;
82 struct fb_bitfield transp;
83};
84
85static struct simplefb_format simplefb_formats[] = {
86 { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0} },
87};
88 78
89struct simplefb_params { 79struct simplefb_params {
90 u32 width; 80 u32 width;
@@ -139,6 +129,33 @@ static int simplefb_parse_dt(struct platform_device *pdev,
139 return 0; 129 return 0;
140} 130}
141 131
132static int simplefb_parse_pd(struct platform_device *pdev,
133 struct simplefb_params *params)
134{
135 struct simplefb_platform_data *pd = pdev->dev.platform_data;
136 int i;
137
138 params->width = pd->width;
139 params->height = pd->height;
140 params->stride = pd->stride;
141
142 params->format = NULL;
143 for (i = 0; i < ARRAY_SIZE(simplefb_formats); i++) {
144 if (strcmp(pd->format, simplefb_formats[i].name))
145 continue;
146
147 params->format = &simplefb_formats[i];
148 break;
149 }
150
151 if (!params->format) {
152 dev_err(&pdev->dev, "Invalid format value\n");
153 return -EINVAL;
154 }
155
156 return 0;
157}
158
142static int simplefb_probe(struct platform_device *pdev) 159static int simplefb_probe(struct platform_device *pdev)
143{ 160{
144 int ret; 161 int ret;
@@ -149,7 +166,12 @@ static int simplefb_probe(struct platform_device *pdev)
149 if (fb_get_options("simplefb", NULL)) 166 if (fb_get_options("simplefb", NULL))
150 return -ENODEV; 167 return -ENODEV;
151 168
152 ret = simplefb_parse_dt(pdev, &params); 169 ret = -ENODEV;
170 if (pdev->dev.platform_data)
171 ret = simplefb_parse_pd(pdev, &params);
172 else if (pdev->dev.of_node)
173 ret = simplefb_parse_dt(pdev, &params);
174
153 if (ret) 175 if (ret)
154 return ret; 176 return ret;
155 177