aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-06-27 06:40:44 -0400
committerDave Airlie <airlied@redhat.com>2013-06-27 06:40:44 -0400
commit4300a0f8bdcce5a03b88bfa16fc9827e15c52dc4 (patch)
treedea0276d7d0a12147f04ddbef9121e32e903c5ca /drivers/video
parent160954b7bca43da7cd3cfbce310e6df919a8216e (diff)
parent9e895ace5d82df8929b16f58e9f515f6d54ab82d (diff)
Merge tag 'v3.10-rc7' into drm-next
Linux 3.10-rc7 The sdvo lvds fix in this -fixes pull commit c3456fb3e4712d0448592af3c5d644c9472cd3c1 Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Mon Jun 10 09:47:58 2013 +0200 drm/i915: prefer VBT modes for SVDO-LVDS over EDID has a silent functional conflict with commit 990256aec2f10800595dddf4d1c3441fcd6b2616 Author: Ville Syrjälä <ville.syrjala@linux.intel.com> Date: Fri May 31 12:17:07 2013 +0000 drm: Add probed modes in probe order in drm-next. W simply need to add the vbt modes before edid modes, i.e. the other way round than now. Conflicts: drivers/gpu/drm/drm_prime.c drivers/gpu/drm/i915/intel_sdvo.c
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig19
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/atmel_lcdfb.c15
-rw-r--r--drivers/video/omap2/dss/core.c20
-rw-r--r--drivers/video/omap2/omapfb/omapfb-main.c3
-rw-r--r--drivers/video/ps3fb.c2
-rw-r--r--drivers/video/simplefb.c234
7 files changed, 288 insertions, 6 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d71d60f94fc1..2e937bdace6f 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2199,7 +2199,7 @@ config FB_XILINX
2199 2199
2200config FB_GOLDFISH 2200config FB_GOLDFISH
2201 tristate "Goldfish Framebuffer" 2201 tristate "Goldfish Framebuffer"
2202 depends on FB 2202 depends on FB && HAS_DMA
2203 select FB_CFB_FILLRECT 2203 select FB_CFB_FILLRECT
2204 select FB_CFB_COPYAREA 2204 select FB_CFB_COPYAREA
2205 select FB_CFB_IMAGEBLIT 2205 select FB_CFB_IMAGEBLIT
@@ -2453,6 +2453,23 @@ config FB_HYPERV
2453 help 2453 help
2454 This framebuffer driver supports Microsoft Hyper-V Synthetic Video. 2454 This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
2455 2455
2456config FB_SIMPLE
2457 bool "Simple framebuffer support"
2458 depends on (FB = y) && OF
2459 select FB_CFB_FILLRECT
2460 select FB_CFB_COPYAREA
2461 select FB_CFB_IMAGEBLIT
2462 help
2463 Say Y if you want support for a simple frame-buffer.
2464
2465 This driver assumes that the display hardware has been initialized
2466 before the kernel boots, and the kernel will simply render to the
2467 pre-allocated frame buffer surface.
2468
2469 Configuration re: surface address, size, and format must be provided
2470 through device tree, or potentially plain old platform data in the
2471 future.
2472
2456source "drivers/video/omap/Kconfig" 2473source "drivers/video/omap/Kconfig"
2457source "drivers/video/omap2/Kconfig" 2474source "drivers/video/omap2/Kconfig"
2458source "drivers/video/exynos/Kconfig" 2475source "drivers/video/exynos/Kconfig"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 7234e4a959e8..e8bae8dd4804 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -166,6 +166,7 @@ obj-$(CONFIG_FB_MX3) += mx3fb.o
166obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o 166obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o
167obj-$(CONFIG_FB_MXS) += mxsfb.o 167obj-$(CONFIG_FB_MXS) += mxsfb.o
168obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o 168obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o
169obj-$(CONFIG_FB_SIMPLE) += simplefb.o
169 170
170# the test framebuffer is last 171# the test framebuffer is last
171obj-$(CONFIG_FB_VIRTUAL) += vfb.o 172obj-$(CONFIG_FB_VIRTUAL) += vfb.o
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 540909de6247..effdb373b8db 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -223,8 +223,14 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)
223 223
224static void exit_backlight(struct atmel_lcdfb_info *sinfo) 224static void exit_backlight(struct atmel_lcdfb_info *sinfo)
225{ 225{
226 if (sinfo->backlight) 226 if (!sinfo->backlight)
227 backlight_device_unregister(sinfo->backlight); 227 return;
228
229 if (sinfo->backlight->ops) {
230 sinfo->backlight->props.power = FB_BLANK_POWERDOWN;
231 sinfo->backlight->ops->update_status(sinfo->backlight);
232 }
233 backlight_device_unregister(sinfo->backlight);
228} 234}
229 235
230#else 236#else
@@ -461,8 +467,11 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
461 if (info->fix.smem_len) { 467 if (info->fix.smem_len) {
462 unsigned int smem_len = (var->xres_virtual * var->yres_virtual 468 unsigned int smem_len = (var->xres_virtual * var->yres_virtual
463 * ((var->bits_per_pixel + 7) / 8)); 469 * ((var->bits_per_pixel + 7) / 8));
464 if (smem_len > info->fix.smem_len) 470 if (smem_len > info->fix.smem_len) {
471 dev_err(dev, "Frame buffer is too small (%u) for screen size (need at least %u)\n",
472 info->fix.smem_len, smem_len);
465 return -EINVAL; 473 return -EINVAL;
474 }
466 } 475 }
467 476
468 /* Saturate vertical and horizontal timings at maximum values */ 477 /* Saturate vertical and horizontal timings at maximum values */
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 60cc6fee6548..c9c2252e3719 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -53,6 +53,8 @@ static char *def_disp_name;
53module_param_named(def_disp, def_disp_name, charp, 0); 53module_param_named(def_disp, def_disp_name, charp, 0);
54MODULE_PARM_DESC(def_disp, "default display name"); 54MODULE_PARM_DESC(def_disp, "default display name");
55 55
56static bool dss_initialized;
57
56const char *omapdss_get_default_display_name(void) 58const char *omapdss_get_default_display_name(void)
57{ 59{
58 return core.default_display_name; 60 return core.default_display_name;
@@ -66,6 +68,12 @@ enum omapdss_version omapdss_get_version(void)
66} 68}
67EXPORT_SYMBOL(omapdss_get_version); 69EXPORT_SYMBOL(omapdss_get_version);
68 70
71bool omapdss_is_initialized(void)
72{
73 return dss_initialized;
74}
75EXPORT_SYMBOL(omapdss_is_initialized);
76
69struct platform_device *dss_get_core_pdev(void) 77struct platform_device *dss_get_core_pdev(void)
70{ 78{
71 return core.pdev; 79 return core.pdev;
@@ -603,6 +611,8 @@ static int __init omap_dss_init(void)
603 return r; 611 return r;
604 } 612 }
605 613
614 dss_initialized = true;
615
606 return 0; 616 return 0;
607} 617}
608 618
@@ -633,7 +643,15 @@ static int __init omap_dss_init(void)
633 643
634static int __init omap_dss_init2(void) 644static int __init omap_dss_init2(void)
635{ 645{
636 return omap_dss_register_drivers(); 646 int r;
647
648 r = omap_dss_register_drivers();
649 if (r)
650 return r;
651
652 dss_initialized = true;
653
654 return 0;
637} 655}
638 656
639core_initcall(omap_dss_init); 657core_initcall(omap_dss_init);
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index c84bb8a4d0c4..856917b33616 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2416,6 +2416,9 @@ static int omapfb_probe(struct platform_device *pdev)
2416 2416
2417 DBG("omapfb_probe\n"); 2417 DBG("omapfb_probe\n");
2418 2418
2419 if (omapdss_is_initialized() == false)
2420 return -EPROBE_DEFER;
2421
2419 if (pdev->num_resources != 0) { 2422 if (pdev->num_resources != 0) {
2420 dev_err(&pdev->dev, "probed for an unknown device\n"); 2423 dev_err(&pdev->dev, "probed for an unknown device\n");
2421 r = -ENODEV; 2424 r = -ENODEV;
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index d9f08c653d62..dbfe2c18a434 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -710,7 +710,7 @@ static int ps3fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
710 r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len); 710 r = vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len);
711 711
712 dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n", 712 dev_dbg(info->device, "ps3fb: mmap framebuffer P(%lx)->V(%lx)\n",
713 info->fix.smem_start + vma->vm_pgoff << PAGE_SHIFT, 713 info->fix.smem_start + (vma->vm_pgoff << PAGE_SHIFT),
714 vma->vm_start); 714 vma->vm_start);
715 715
716 return r; 716 return r;
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
new file mode 100644
index 000000000000..e2e9e3e61b72
--- /dev/null
+++ b/drivers/video/simplefb.c
@@ -0,0 +1,234 @@
1/*
2 * Simplest possible simple frame-buffer driver, as a platform device
3 *
4 * Copyright (c) 2013, Stephen Warren
5 *
6 * Based on q40fb.c, which was:
7 * Copyright (C) 2001 Richard Zidlicky <rz@linux-m68k.org>
8 *
9 * Also based on offb.c, which was:
10 * Copyright (C) 1997 Geert Uytterhoeven
11 * Copyright (C) 1996 Paul Mackerras
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms and conditions of the GNU General Public License,
15 * version 2, as published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20 * more details.
21 */
22
23#include <linux/errno.h>
24#include <linux/fb.h>
25#include <linux/io.h>
26#include <linux/module.h>
27#include <linux/platform_device.h>
28
29static struct fb_fix_screeninfo simplefb_fix = {
30 .id = "simple",
31 .type = FB_TYPE_PACKED_PIXELS,
32 .visual = FB_VISUAL_TRUECOLOR,
33 .accel = FB_ACCEL_NONE,
34};
35
36static struct fb_var_screeninfo simplefb_var = {
37 .height = -1,
38 .width = -1,
39 .activate = FB_ACTIVATE_NOW,
40 .vmode = FB_VMODE_NONINTERLACED,
41};
42
43static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
44 u_int transp, struct fb_info *info)
45{
46 u32 *pal = info->pseudo_palette;
47 u32 cr = red >> (16 - info->var.red.length);
48 u32 cg = green >> (16 - info->var.green.length);
49 u32 cb = blue >> (16 - info->var.blue.length);
50 u32 value;
51
52 if (regno >= 16)
53 return -EINVAL;
54
55 value = (cr << info->var.red.offset) |
56 (cg << info->var.green.offset) |
57 (cb << info->var.blue.offset);
58 if (info->var.transp.length > 0) {
59 u32 mask = (1 << info->var.transp.length) - 1;
60 mask <<= info->var.transp.offset;
61 value |= mask;
62 }
63 pal[regno] = value;
64
65 return 0;
66}
67
68static struct fb_ops simplefb_ops = {
69 .owner = THIS_MODULE,
70 .fb_setcolreg = simplefb_setcolreg,
71 .fb_fillrect = cfb_fillrect,
72 .fb_copyarea = cfb_copyarea,
73 .fb_imageblit = cfb_imageblit,
74};
75
76struct simplefb_format {
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
89struct simplefb_params {
90 u32 width;
91 u32 height;
92 u32 stride;
93 struct simplefb_format *format;
94};
95
96static int simplefb_parse_dt(struct platform_device *pdev,
97 struct simplefb_params *params)
98{
99 struct device_node *np = pdev->dev.of_node;
100 int ret;
101 const char *format;
102 int i;
103
104 ret = of_property_read_u32(np, "width", &params->width);
105 if (ret) {
106 dev_err(&pdev->dev, "Can't parse width property\n");
107 return ret;
108 }
109
110 ret = of_property_read_u32(np, "height", &params->height);
111 if (ret) {
112 dev_err(&pdev->dev, "Can't parse height property\n");
113 return ret;
114 }
115
116 ret = of_property_read_u32(np, "stride", &params->stride);
117 if (ret) {
118 dev_err(&pdev->dev, "Can't parse stride property\n");
119 return ret;
120 }
121
122 ret = of_property_read_string(np, "format", &format);
123 if (ret) {
124 dev_err(&pdev->dev, "Can't parse format property\n");
125 return ret;
126 }
127 params->format = NULL;
128 for (i = 0; i < ARRAY_SIZE(simplefb_formats); i++) {
129 if (strcmp(format, simplefb_formats[i].name))
130 continue;
131 params->format = &simplefb_formats[i];
132 break;
133 }
134 if (!params->format) {
135 dev_err(&pdev->dev, "Invalid format value\n");
136 return -EINVAL;
137 }
138
139 return 0;
140}
141
142static int simplefb_probe(struct platform_device *pdev)
143{
144 int ret;
145 struct simplefb_params params;
146 struct fb_info *info;
147 struct resource *mem;
148
149 if (fb_get_options("simplefb", NULL))
150 return -ENODEV;
151
152 ret = simplefb_parse_dt(pdev, &params);
153 if (ret)
154 return ret;
155
156 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
157 if (!mem) {
158 dev_err(&pdev->dev, "No memory resource\n");
159 return -EINVAL;
160 }
161
162 info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev);
163 if (!info)
164 return -ENOMEM;
165 platform_set_drvdata(pdev, info);
166
167 info->fix = simplefb_fix;
168 info->fix.smem_start = mem->start;
169 info->fix.smem_len = resource_size(mem);
170 info->fix.line_length = params.stride;
171
172 info->var = simplefb_var;
173 info->var.xres = params.width;
174 info->var.yres = params.height;
175 info->var.xres_virtual = params.width;
176 info->var.yres_virtual = params.height;
177 info->var.bits_per_pixel = params.format->bits_per_pixel;
178 info->var.red = params.format->red;
179 info->var.green = params.format->green;
180 info->var.blue = params.format->blue;
181 info->var.transp = params.format->transp;
182
183 info->fbops = &simplefb_ops;
184 info->flags = FBINFO_DEFAULT;
185 info->screen_base = devm_ioremap(&pdev->dev, info->fix.smem_start,
186 info->fix.smem_len);
187 if (!info->screen_base) {
188 framebuffer_release(info);
189 return -ENODEV;
190 }
191 info->pseudo_palette = (void *)(info + 1);
192
193 ret = register_framebuffer(info);
194 if (ret < 0) {
195 dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);
196 framebuffer_release(info);
197 return ret;
198 }
199
200 dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node);
201
202 return 0;
203}
204
205static int simplefb_remove(struct platform_device *pdev)
206{
207 struct fb_info *info = platform_get_drvdata(pdev);
208
209 unregister_framebuffer(info);
210 framebuffer_release(info);
211
212 return 0;
213}
214
215static const struct of_device_id simplefb_of_match[] = {
216 { .compatible = "simple-framebuffer", },
217 { },
218};
219MODULE_DEVICE_TABLE(of, simplefb_of_match);
220
221static struct platform_driver simplefb_driver = {
222 .driver = {
223 .name = "simple-framebuffer",
224 .owner = THIS_MODULE,
225 .of_match_table = simplefb_of_match,
226 },
227 .probe = simplefb_probe,
228 .remove = simplefb_remove,
229};
230module_platform_driver(simplefb_driver);
231
232MODULE_AUTHOR("Stephen Warren <swarren@wwwdotorg.org>");
233MODULE_DESCRIPTION("Simple framebuffer driver");
234MODULE_LICENSE("GPL v2");