macfb: fix black and white modes
macfb won't init in black & white modes since fb_alloc_cmap() no longer works for zero cmap length. Fix this and also clean up a few printk's and some stylistic inconsistencies. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
parent
aa557875cc
commit
d9070fc499
1 changed files with 28 additions and 32 deletions
|
@ -592,12 +592,12 @@ static int __init macfb_init(void)
|
||||||
if (!fb_info.screen_base)
|
if (!fb_info.screen_base)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
|
pr_info("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
|
||||||
macfb_fix.smem_start, fb_info.screen_base,
|
macfb_fix.smem_start, fb_info.screen_base,
|
||||||
macfb_fix.smem_len / 1024);
|
macfb_fix.smem_len / 1024);
|
||||||
printk("macfb: mode is %dx%dx%d, linelength=%d\n",
|
pr_info("macfb: mode is %dx%dx%d, linelength=%d\n",
|
||||||
macfb_defined.xres, macfb_defined.yres,
|
macfb_defined.xres, macfb_defined.yres,
|
||||||
macfb_defined.bits_per_pixel, macfb_fix.line_length);
|
macfb_defined.bits_per_pixel, macfb_fix.line_length);
|
||||||
|
|
||||||
/* Fill in the available video resolution */
|
/* Fill in the available video resolution */
|
||||||
macfb_defined.xres_virtual = macfb_defined.xres;
|
macfb_defined.xres_virtual = macfb_defined.xres;
|
||||||
|
@ -613,14 +613,10 @@ static int __init macfb_init(void)
|
||||||
|
|
||||||
switch (macfb_defined.bits_per_pixel) {
|
switch (macfb_defined.bits_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
/*
|
|
||||||
* XXX: I think this will catch any program that tries
|
|
||||||
* to do FBIO_PUTCMAP when the visual is monochrome.
|
|
||||||
*/
|
|
||||||
macfb_defined.red.length = macfb_defined.bits_per_pixel;
|
macfb_defined.red.length = macfb_defined.bits_per_pixel;
|
||||||
macfb_defined.green.length = macfb_defined.bits_per_pixel;
|
macfb_defined.green.length = macfb_defined.bits_per_pixel;
|
||||||
macfb_defined.blue.length = macfb_defined.bits_per_pixel;
|
macfb_defined.blue.length = macfb_defined.bits_per_pixel;
|
||||||
video_cmap_len = 0;
|
video_cmap_len = 2;
|
||||||
macfb_fix.visual = FB_VISUAL_MONO01;
|
macfb_fix.visual = FB_VISUAL_MONO01;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -660,11 +656,10 @@ static int __init macfb_init(void)
|
||||||
macfb_fix.visual = FB_VISUAL_TRUECOLOR;
|
macfb_fix.visual = FB_VISUAL_TRUECOLOR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
video_cmap_len = 0;
|
pr_err("macfb: unknown or unsupported bit depth: %d\n",
|
||||||
macfb_fix.visual = FB_VISUAL_MONO01;
|
|
||||||
printk("macfb: unknown or unsupported bit depth: %d\n",
|
|
||||||
macfb_defined.bits_per_pixel);
|
macfb_defined.bits_per_pixel);
|
||||||
break;
|
err = -EINVAL;
|
||||||
|
goto fail_unmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -734,8 +729,8 @@ static int __init macfb_init(void)
|
||||||
case MAC_MODEL_Q950:
|
case MAC_MODEL_Q950:
|
||||||
strcpy(macfb_fix.id, "DAFB");
|
strcpy(macfb_fix.id, "DAFB");
|
||||||
macfb_setpalette = dafb_setpalette;
|
macfb_setpalette = dafb_setpalette;
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000);
|
dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -744,8 +739,8 @@ static int __init macfb_init(void)
|
||||||
case MAC_MODEL_LCII:
|
case MAC_MODEL_LCII:
|
||||||
strcpy(macfb_fix.id, "V8");
|
strcpy(macfb_fix.id, "V8");
|
||||||
macfb_setpalette = v8_brazil_setpalette;
|
macfb_setpalette = v8_brazil_setpalette;
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -758,8 +753,8 @@ static int __init macfb_init(void)
|
||||||
case MAC_MODEL_P600:
|
case MAC_MODEL_P600:
|
||||||
strcpy(macfb_fix.id, "Brazil");
|
strcpy(macfb_fix.id, "Brazil");
|
||||||
macfb_setpalette = v8_brazil_setpalette;
|
macfb_setpalette = v8_brazil_setpalette;
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -773,10 +768,10 @@ static int __init macfb_init(void)
|
||||||
case MAC_MODEL_P520:
|
case MAC_MODEL_P520:
|
||||||
case MAC_MODEL_P550:
|
case MAC_MODEL_P550:
|
||||||
case MAC_MODEL_P460:
|
case MAC_MODEL_P460:
|
||||||
macfb_setpalette = v8_brazil_setpalette;
|
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
strcpy(macfb_fix.id, "Sonora");
|
strcpy(macfb_fix.id, "Sonora");
|
||||||
|
macfb_setpalette = v8_brazil_setpalette;
|
||||||
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -786,10 +781,10 @@ static int __init macfb_init(void)
|
||||||
*/
|
*/
|
||||||
case MAC_MODEL_IICI:
|
case MAC_MODEL_IICI:
|
||||||
case MAC_MODEL_IISI:
|
case MAC_MODEL_IISI:
|
||||||
macfb_setpalette = rbv_setpalette;
|
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
strcpy(macfb_fix.id, "RBV");
|
strcpy(macfb_fix.id, "RBV");
|
||||||
|
macfb_setpalette = rbv_setpalette;
|
||||||
rbv_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
rbv_cmap_regs = ioremap(DAC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -797,10 +792,10 @@ static int __init macfb_init(void)
|
||||||
*/
|
*/
|
||||||
case MAC_MODEL_Q840:
|
case MAC_MODEL_Q840:
|
||||||
case MAC_MODEL_C660:
|
case MAC_MODEL_C660:
|
||||||
macfb_setpalette = civic_setpalette;
|
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
strcpy(macfb_fix.id, "Civic");
|
strcpy(macfb_fix.id, "Civic");
|
||||||
|
macfb_setpalette = civic_setpalette;
|
||||||
civic_cmap_regs = ioremap(CIVIC_BASE, 0x1000);
|
civic_cmap_regs = ioremap(CIVIC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -809,26 +804,26 @@ static int __init macfb_init(void)
|
||||||
* We think this may be like the LC II
|
* We think this may be like the LC II
|
||||||
*/
|
*/
|
||||||
case MAC_MODEL_LC:
|
case MAC_MODEL_LC:
|
||||||
|
strcpy(macfb_fix.id, "LC");
|
||||||
if (vidtest) {
|
if (vidtest) {
|
||||||
macfb_setpalette = v8_brazil_setpalette;
|
macfb_setpalette = v8_brazil_setpalette;
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
v8_brazil_cmap_regs =
|
v8_brazil_cmap_regs =
|
||||||
ioremap(DAC_BASE, 0x1000);
|
ioremap(DAC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
}
|
}
|
||||||
strcpy(macfb_fix.id, "LC");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We think this may be like the LC II
|
* We think this may be like the LC II
|
||||||
*/
|
*/
|
||||||
case MAC_MODEL_CCL:
|
case MAC_MODEL_CCL:
|
||||||
|
strcpy(macfb_fix.id, "Color Classic");
|
||||||
if (vidtest) {
|
if (vidtest) {
|
||||||
macfb_setpalette = v8_brazil_setpalette;
|
macfb_setpalette = v8_brazil_setpalette;
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
v8_brazil_cmap_regs =
|
v8_brazil_cmap_regs =
|
||||||
ioremap(DAC_BASE, 0x1000);
|
ioremap(DAC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
}
|
}
|
||||||
strcpy(macfb_fix.id, "Color Classic");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -893,10 +888,10 @@ static int __init macfb_init(void)
|
||||||
case MAC_MODEL_PB270C:
|
case MAC_MODEL_PB270C:
|
||||||
case MAC_MODEL_PB280:
|
case MAC_MODEL_PB280:
|
||||||
case MAC_MODEL_PB280C:
|
case MAC_MODEL_PB280C:
|
||||||
macfb_setpalette = csc_setpalette;
|
|
||||||
macfb_defined.activate = FB_ACTIVATE_NOW;
|
|
||||||
strcpy(macfb_fix.id, "CSC");
|
strcpy(macfb_fix.id, "CSC");
|
||||||
|
macfb_setpalette = csc_setpalette;
|
||||||
csc_cmap_regs = ioremap(CSC_BASE, 0x1000);
|
csc_cmap_regs = ioremap(CSC_BASE, 0x1000);
|
||||||
|
macfb_defined.activate = FB_ACTIVATE_NOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -918,8 +913,9 @@ static int __init macfb_init(void)
|
||||||
if (err)
|
if (err)
|
||||||
goto fail_dealloc;
|
goto fail_dealloc;
|
||||||
|
|
||||||
printk("fb%d: %s frame buffer device\n",
|
pr_info("fb%d: %s frame buffer device\n",
|
||||||
fb_info.node, fb_info.fix.id);
|
fb_info.node, fb_info.fix.id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail_dealloc:
|
fail_dealloc:
|
||||||
|
|
Loading…
Reference in a new issue