aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-12-14 08:58:29 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-01-02 20:09:23 -0500
commit9b961ed21a7c92c4768b9871a1c7e68d90f5267d (patch)
tree5e4897dd6ee5aaad495a5da058fb5262eb0e01b7
parentc055fe0797b7bd8f6f21a13598a55a16d5c13ae7 (diff)
offb: Add palette hack for qemu "standard vga" framebuffer
We rename the mach64 hack to "simple" since that's also applicable to anything using VGA-style DAC IO ports (set to 8-bit DAC) and we use it for qemu vga. Note that this is keyed on a device-tree "compatible" property that is currently only set by an upcoming version of SLOF when using the qemu "pseries" platform. This is on purpose as other qemu ppc platforms using OpenBIOS aren't properly setting the DAC to 8-bit at the time of the writing of this patch. We can fix OpenBIOS later to do that and add the required property, in which case it will be matched by this change. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--drivers/video/offb.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index 915acaecdbe1..da7cf7936b24 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -41,13 +41,14 @@
41/* Supported palette hacks */ 41/* Supported palette hacks */
42enum { 42enum {
43 cmap_unknown, 43 cmap_unknown,
44 cmap_m64, /* ATI Mach64 */ 44 cmap_simple, /* ATI Mach64 */
45 cmap_r128, /* ATI Rage128 */ 45 cmap_r128, /* ATI Rage128 */
46 cmap_M3A, /* ATI Rage Mobility M3 Head A */ 46 cmap_M3A, /* ATI Rage Mobility M3 Head A */
47 cmap_M3B, /* ATI Rage Mobility M3 Head B */ 47 cmap_M3B, /* ATI Rage Mobility M3 Head B */
48 cmap_radeon, /* ATI Radeon */ 48 cmap_radeon, /* ATI Radeon */
49 cmap_gxt2000, /* IBM GXT2000 */ 49 cmap_gxt2000, /* IBM GXT2000 */
50 cmap_avivo, /* ATI R5xx */ 50 cmap_avivo, /* ATI R5xx */
51 cmap_qemu, /* qemu vga */
51}; 52};
52 53
53struct offb_par { 54struct offb_par {
@@ -138,7 +139,7 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
138 return 0; 139 return 0;
139 140
140 switch (par->cmap_type) { 141 switch (par->cmap_type) {
141 case cmap_m64: 142 case cmap_simple:
142 writeb(regno, par->cmap_adr); 143 writeb(regno, par->cmap_adr);
143 writeb(red, par->cmap_data); 144 writeb(red, par->cmap_data);
144 writeb(green, par->cmap_data); 145 writeb(green, par->cmap_data);
@@ -208,7 +209,7 @@ static int offb_blank(int blank, struct fb_info *info)
208 if (blank) 209 if (blank)
209 for (i = 0; i < 256; i++) { 210 for (i = 0; i < 256; i++) {
210 switch (par->cmap_type) { 211 switch (par->cmap_type) {
211 case cmap_m64: 212 case cmap_simple:
212 writeb(i, par->cmap_adr); 213 writeb(i, par->cmap_adr);
213 for (j = 0; j < 3; j++) 214 for (j = 0; j < 3; j++)
214 writeb(0, par->cmap_data); 215 writeb(0, par->cmap_data);
@@ -350,7 +351,7 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp
350 par->cmap_adr = 351 par->cmap_adr =
351 ioremap(base + 0x7ff000, 0x1000) + 0xcc0; 352 ioremap(base + 0x7ff000, 0x1000) + 0xcc0;
352 par->cmap_data = par->cmap_adr + 1; 353 par->cmap_data = par->cmap_adr + 1;
353 par->cmap_type = cmap_m64; 354 par->cmap_type = cmap_simple;
354 } else if (dp && (of_device_is_compatible(dp, "pci1014,b7") || 355 } else if (dp && (of_device_is_compatible(dp, "pci1014,b7") ||
355 of_device_is_compatible(dp, "pci1014,21c"))) { 356 of_device_is_compatible(dp, "pci1014,21c"))) {
356 par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); 357 par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000);
@@ -371,6 +372,16 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp
371 par->cmap_type = cmap_avivo; 372 par->cmap_type = cmap_avivo;
372 } 373 }
373 of_node_put(pciparent); 374 of_node_put(pciparent);
375 } else if (dp && of_device_is_compatible(dp, "qemu,std-vga")) {
376 const u32 io_of_addr[3] = { 0x01000000, 0x0, 0x0 };
377 u64 io_addr = of_translate_address(dp, io_of_addr);
378 if (io_addr != OF_BAD_ADDR) {
379 par->cmap_adr = ioremap(io_addr + 0x3c8, 2);
380 if (par->cmap_adr) {
381 par->cmap_type = cmap_simple;
382 par->cmap_data = par->cmap_adr + 1;
383 }
384 }
374 } 385 }
375 info->fix.visual = (par->cmap_type != cmap_unknown) ? 386 info->fix.visual = (par->cmap_type != cmap_unknown) ?
376 FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR; 387 FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR;