aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-03-15 10:27:06 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-03-15 10:27:06 -0400
commit2d3b5fa3a39d16c880bda3cf2bd9dd6ed5a01f74 (patch)
treee20283fe2ed46aa35c8ca5fc1724ba067cd2e2f8 /drivers/video
parent3f17522ce461a31e7ced6311b28fcf5b8a763316 (diff)
parent7278a22143b003e9af7b9ca1b5f1c40ae4b55d98 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/genesis-2.6
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/Kconfig14
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/sunxvr1000.c228
3 files changed, 242 insertions, 1 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 1c60053439a9..4be9b4832c55 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -912,6 +912,18 @@ config FB_XVR2500
912 mostly initialized the card already. It is treated as a 912 mostly initialized the card already. It is treated as a
913 completely dumb framebuffer device. 913 completely dumb framebuffer device.
914 914
915config FB_XVR1000
916 bool "Sun XVR-1000 support"
917 depends on SPARC64
918 select FB_CFB_FILLRECT
919 select FB_CFB_COPYAREA
920 select FB_CFB_IMAGEBLIT
921 help
922 This is the framebuffer device for the Sun XVR-1000 and similar
923 graphics cards. The driver only works on sparc64 systems where
924 the system firmware has mostly initialized the card already. It
925 is treated as a completely dumb framebuffer device.
926
915config FB_PVR2 927config FB_PVR2
916 tristate "NEC PowerVR 2 display support" 928 tristate "NEC PowerVR 2 display support"
917 depends on FB && SH_DREAMCAST 929 depends on FB && SH_DREAMCAST
@@ -1869,7 +1881,7 @@ config FB_W100
1869 1881
1870config FB_SH_MOBILE_LCDC 1882config FB_SH_MOBILE_LCDC
1871 tristate "SuperH Mobile LCDC framebuffer support" 1883 tristate "SuperH Mobile LCDC framebuffer support"
1872 depends on FB && SUPERH && HAVE_CLK 1884 depends on FB && (SUPERH || ARCH_SHMOBILE) && HAVE_CLK
1873 select FB_SYS_FILLRECT 1885 select FB_SYS_FILLRECT
1874 select FB_SYS_COPYAREA 1886 select FB_SYS_COPYAREA
1875 select FB_SYS_IMAGEBLIT 1887 select FB_SYS_IMAGEBLIT
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index a42ad55e3a15..ddc2af2ba45b 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -79,6 +79,7 @@ obj-$(CONFIG_FB_N411) += n411.o
79obj-$(CONFIG_FB_HGA) += hgafb.o 79obj-$(CONFIG_FB_HGA) += hgafb.o
80obj-$(CONFIG_FB_XVR500) += sunxvr500.o 80obj-$(CONFIG_FB_XVR500) += sunxvr500.o
81obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o 81obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o
82obj-$(CONFIG_FB_XVR1000) += sunxvr1000.o
82obj-$(CONFIG_FB_IGA) += igafb.o 83obj-$(CONFIG_FB_IGA) += igafb.o
83obj-$(CONFIG_FB_APOLLO) += dnfb.o 84obj-$(CONFIG_FB_APOLLO) += dnfb.o
84obj-$(CONFIG_FB_Q40) += q40fb.o 85obj-$(CONFIG_FB_Q40) += q40fb.o
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c
new file mode 100644
index 000000000000..a8248c0b9192
--- /dev/null
+++ b/drivers/video/sunxvr1000.c
@@ -0,0 +1,228 @@
1/* sunxvr1000.c: Sun XVR-1000 driver for sparc64 systems
2 *
3 * Copyright (C) 2010 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/module.h>
7#include <linux/kernel.h>
8#include <linux/slab.h>
9#include <linux/fb.h>
10#include <linux/init.h>
11#include <linux/of_device.h>
12
13struct gfb_info {
14 struct fb_info *info;
15
16 char __iomem *fb_base;
17 unsigned long fb_base_phys;
18
19 struct device_node *of_node;
20
21 unsigned int width;
22 unsigned int height;
23 unsigned int depth;
24 unsigned int fb_size;
25
26 u32 pseudo_palette[16];
27};
28
29static int __devinit gfb_get_props(struct gfb_info *gp)
30{
31 gp->width = of_getintprop_default(gp->of_node, "width", 0);
32 gp->height = of_getintprop_default(gp->of_node, "height", 0);
33 gp->depth = of_getintprop_default(gp->of_node, "depth", 32);
34
35 if (!gp->width || !gp->height) {
36 printk(KERN_ERR "gfb: Critical properties missing for %s\n",
37 gp->of_node->full_name);
38 return -EINVAL;
39 }
40
41 return 0;
42}
43
44static int gfb_setcolreg(unsigned regno,
45 unsigned red, unsigned green, unsigned blue,
46 unsigned transp, struct fb_info *info)
47{
48 u32 value;
49
50 if (regno < 16) {
51 red >>= 8;
52 green >>= 8;
53 blue >>= 8;
54
55 value = (blue << 16) | (green << 8) | red;
56 ((u32 *)info->pseudo_palette)[regno] = value;
57 }
58
59 return 0;
60}
61
62static struct fb_ops gfb_ops = {
63 .owner = THIS_MODULE,
64 .fb_setcolreg = gfb_setcolreg,
65 .fb_fillrect = cfb_fillrect,
66 .fb_copyarea = cfb_copyarea,
67 .fb_imageblit = cfb_imageblit,
68};
69
70static int __devinit gfb_set_fbinfo(struct gfb_info *gp)
71{
72 struct fb_info *info = gp->info;
73 struct fb_var_screeninfo *var = &info->var;
74
75 info->flags = FBINFO_DEFAULT;
76 info->fbops = &gfb_ops;
77 info->screen_base = gp->fb_base;
78 info->screen_size = gp->fb_size;
79
80 info->pseudo_palette = gp->pseudo_palette;
81
82 /* Fill fix common fields */
83 strlcpy(info->fix.id, "gfb", sizeof(info->fix.id));
84 info->fix.smem_start = gp->fb_base_phys;
85 info->fix.smem_len = gp->fb_size;
86 info->fix.type = FB_TYPE_PACKED_PIXELS;
87 if (gp->depth == 32 || gp->depth == 24)
88 info->fix.visual = FB_VISUAL_TRUECOLOR;
89 else
90 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
91
92 var->xres = gp->width;
93 var->yres = gp->height;
94 var->xres_virtual = var->xres;
95 var->yres_virtual = var->yres;
96 var->bits_per_pixel = gp->depth;
97
98 var->red.offset = 0;
99 var->red.length = 8;
100 var->green.offset = 8;
101 var->green.length = 8;
102 var->blue.offset = 16;
103 var->blue.length = 8;
104 var->transp.offset = 0;
105 var->transp.length = 0;
106
107 if (fb_alloc_cmap(&info->cmap, 256, 0)) {
108 printk(KERN_ERR "gfb: Cannot allocate color map.\n");
109 return -ENOMEM;
110 }
111
112 return 0;
113}
114
115static int __devinit gfb_probe(struct of_device *op,
116 const struct of_device_id *match)
117{
118 struct device_node *dp = op->node;
119 struct fb_info *info;
120 struct gfb_info *gp;
121 int err;
122
123 info = framebuffer_alloc(sizeof(struct gfb_info), &op->dev);
124 if (!info) {
125 printk(KERN_ERR "gfb: Cannot allocate fb_info\n");
126 err = -ENOMEM;
127 goto err_out;
128 }
129
130 gp = info->par;
131 gp->info = info;
132 gp->of_node = dp;
133
134 gp->fb_base_phys = op->resource[6].start;
135
136 err = gfb_get_props(gp);
137 if (err)
138 goto err_release_fb;
139
140 /* Framebuffer length is the same regardless of resolution. */
141 info->fix.line_length = 16384;
142 gp->fb_size = info->fix.line_length * gp->height;
143
144 gp->fb_base = of_ioremap(&op->resource[6], 0,
145 gp->fb_size, "gfb fb");
146 if (!gp->fb_base)
147 goto err_release_fb;
148
149 err = gfb_set_fbinfo(gp);
150 if (err)
151 goto err_unmap_fb;
152
153 printk("gfb: Found device at %s\n", dp->full_name);
154
155 err = register_framebuffer(info);
156 if (err < 0) {
157 printk(KERN_ERR "gfb: Could not register framebuffer %s\n",
158 dp->full_name);
159 goto err_unmap_fb;
160 }
161
162 dev_set_drvdata(&op->dev, info);
163
164 return 0;
165
166err_unmap_fb:
167 of_iounmap(&op->resource[6], gp->fb_base, gp->fb_size);
168
169err_release_fb:
170 framebuffer_release(info);
171
172err_out:
173 return err;
174}
175
176static int __devexit gfb_remove(struct of_device *op)
177{
178 struct fb_info *info = dev_get_drvdata(&op->dev);
179 struct gfb_info *gp = info->par;
180
181 unregister_framebuffer(info);
182
183 iounmap(gp->fb_base);
184
185 of_iounmap(&op->resource[6], gp->fb_base, gp->fb_size);
186
187 framebuffer_release(info);
188
189 dev_set_drvdata(&op->dev, NULL);
190
191 return 0;
192}
193
194static const struct of_device_id gfb_match[] = {
195 {
196 .name = "SUNW,gfb",
197 },
198 {},
199};
200MODULE_DEVICE_TABLE(of, ffb_match);
201
202static struct of_platform_driver gfb_driver = {
203 .name = "gfb",
204 .match_table = gfb_match,
205 .probe = gfb_probe,
206 .remove = __devexit_p(gfb_remove),
207};
208
209static int __init gfb_init(void)
210{
211 if (fb_get_options("gfb", NULL))
212 return -ENODEV;
213
214 return of_register_driver(&gfb_driver, &of_bus_type);
215}
216
217static void __exit gfb_exit(void)
218{
219 of_unregister_driver(&gfb_driver);
220}
221
222module_init(gfb_init);
223module_exit(gfb_exit);
224
225MODULE_DESCRIPTION("framebuffer driver for Sun XVR-1000 graphics");
226MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
227MODULE_VERSION("1.0");
228MODULE_LICENSE("GPL");