diff options
author | Luc Verhaegen <libv@skynet.be> | 2014-11-14 07:26:48 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-11-14 08:28:33 -0500 |
commit | 1270be4a4fb852630280638cbb169b67c485b3e3 (patch) | |
tree | d46e830f67aef08924395ce4e9c4800921bf6a95 | |
parent | 9ee4cd1aa3eec2f405652dc51779612104feebef (diff) |
simplefb: formalize pseudo palette handling
Add a proper struct describing simplefb private data, with the palette in there,
instead of directly storing the palette in the fb_info->par pointer.
Signed-off-by: Luc Verhaegen <libv@skynet.be>
Acked-by: Stephen Warren <swarren@nvidia.com>
[hdegoede@redhat.com: drop unnecessary void * cast]
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/fbdev/simplefb.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 210f3a02121a..ec112c13eb05 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c | |||
@@ -41,6 +41,8 @@ static struct fb_var_screeninfo simplefb_var = { | |||
41 | .vmode = FB_VMODE_NONINTERLACED, | 41 | .vmode = FB_VMODE_NONINTERLACED, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #define PSEUDO_PALETTE_SIZE 16 | ||
45 | |||
44 | static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | 46 | static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, |
45 | u_int transp, struct fb_info *info) | 47 | u_int transp, struct fb_info *info) |
46 | { | 48 | { |
@@ -50,7 +52,7 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
50 | u32 cb = blue >> (16 - info->var.blue.length); | 52 | u32 cb = blue >> (16 - info->var.blue.length); |
51 | u32 value; | 53 | u32 value; |
52 | 54 | ||
53 | if (regno >= 16) | 55 | if (regno >= PSEUDO_PALETTE_SIZE) |
54 | return -EINVAL; | 56 | return -EINVAL; |
55 | 57 | ||
56 | value = (cr << info->var.red.offset) | | 58 | value = (cr << info->var.red.offset) | |
@@ -163,11 +165,16 @@ static int simplefb_parse_pd(struct platform_device *pdev, | |||
163 | return 0; | 165 | return 0; |
164 | } | 166 | } |
165 | 167 | ||
168 | struct simplefb_par { | ||
169 | u32 palette[PSEUDO_PALETTE_SIZE]; | ||
170 | }; | ||
171 | |||
166 | static int simplefb_probe(struct platform_device *pdev) | 172 | static int simplefb_probe(struct platform_device *pdev) |
167 | { | 173 | { |
168 | int ret; | 174 | int ret; |
169 | struct simplefb_params params; | 175 | struct simplefb_params params; |
170 | struct fb_info *info; | 176 | struct fb_info *info; |
177 | struct simplefb_par *par; | ||
171 | struct resource *mem; | 178 | struct resource *mem; |
172 | 179 | ||
173 | if (fb_get_options("simplefb", NULL)) | 180 | if (fb_get_options("simplefb", NULL)) |
@@ -188,11 +195,13 @@ static int simplefb_probe(struct platform_device *pdev) | |||
188 | return -EINVAL; | 195 | return -EINVAL; |
189 | } | 196 | } |
190 | 197 | ||
191 | info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev); | 198 | info = framebuffer_alloc(sizeof(struct simplefb_par), &pdev->dev); |
192 | if (!info) | 199 | if (!info) |
193 | return -ENOMEM; | 200 | return -ENOMEM; |
194 | platform_set_drvdata(pdev, info); | 201 | platform_set_drvdata(pdev, info); |
195 | 202 | ||
203 | par = info->par; | ||
204 | |||
196 | info->fix = simplefb_fix; | 205 | info->fix = simplefb_fix; |
197 | info->fix.smem_start = mem->start; | 206 | info->fix.smem_start = mem->start; |
198 | info->fix.smem_len = resource_size(mem); | 207 | info->fix.smem_len = resource_size(mem); |
@@ -225,7 +234,7 @@ static int simplefb_probe(struct platform_device *pdev) | |||
225 | framebuffer_release(info); | 234 | framebuffer_release(info); |
226 | return -ENODEV; | 235 | return -ENODEV; |
227 | } | 236 | } |
228 | info->pseudo_palette = (void *)(info + 1); | 237 | info->pseudo_palette = par->palette; |
229 | 238 | ||
230 | dev_info(&pdev->dev, "framebuffer at 0x%lx, 0x%x bytes, mapped to 0x%p\n", | 239 | dev_info(&pdev->dev, "framebuffer at 0x%lx, 0x%x bytes, mapped to 0x%p\n", |
231 | info->fix.smem_start, info->fix.smem_len, | 240 | info->fix.smem_start, info->fix.smem_len, |