public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@vger.kernel.org,
	Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	linux-fbdev@vger.kernel.org
Subject: [PATCH 02/16] macfb: fix black and white modes
Date: Mon, 24 Oct 2011 01:11:10 +1100	[thread overview]
Message-ID: <20111023141119.848736612@telegraphics.com.au> (raw)
In-Reply-To: 20111023141108.856998818@telegraphics.com.au

[-- Attachment #1: macfb-bw-fix --]
[-- Type: text/plain, Size: 5966 bytes --]

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>

Index: linux-m68k/drivers/video/macfb.c
===================================================================
--- linux-m68k.orig/drivers/video/macfb.c	2011-10-22 23:02:22.000000000 +1100
+++ linux-m68k/drivers/video/macfb.c	2011-10-23 00:50:51.000000000 +1100
@@ -592,12 +592,12 @@ static int __init macfb_init(void)
 	if (!fb_info.screen_base)
 		return -ENODEV;
 
-	printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
-	       macfb_fix.smem_start, fb_info.screen_base,
-	       macfb_fix.smem_len / 1024);
-	printk("macfb: mode is %dx%dx%d, linelength=%d\n",
-	       macfb_defined.xres, macfb_defined.yres,
-	       macfb_defined.bits_per_pixel, macfb_fix.line_length);
+	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_len / 1024);
+	pr_info("macfb: mode is %dx%dx%d, linelength=%d\n",
+	        macfb_defined.xres, macfb_defined.yres,
+	        macfb_defined.bits_per_pixel, macfb_fix.line_length);
 
 	/* Fill in the available video resolution */
 	macfb_defined.xres_virtual = macfb_defined.xres;
@@ -613,14 +613,10 @@ static int __init macfb_init(void)
 
 	switch (macfb_defined.bits_per_pixel) {
 	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.green.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;
 		break;
 	case 2:
@@ -660,11 +656,10 @@ static int __init macfb_init(void)
 		macfb_fix.visual = FB_VISUAL_TRUECOLOR;
 		break;
 	default:
-		video_cmap_len = 0;
-		macfb_fix.visual = FB_VISUAL_MONO01;
-		printk("macfb: unknown or unsupported bit depth: %d\n",
+		pr_err("macfb: unknown or unsupported bit depth: %d\n",
 		       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:
 			strcpy(macfb_fix.id, "DAFB");
 			macfb_setpalette = dafb_setpalette;
-			macfb_defined.activate = FB_ACTIVATE_NOW;
 			dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000);
+			macfb_defined.activate = FB_ACTIVATE_NOW;
 			break;
 
 		/*
@@ -744,8 +739,8 @@ static int __init macfb_init(void)
 		case MAC_MODEL_LCII:
 			strcpy(macfb_fix.id, "V8");
 			macfb_setpalette = v8_brazil_setpalette;
-			macfb_defined.activate = FB_ACTIVATE_NOW;
 			v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
+			macfb_defined.activate = FB_ACTIVATE_NOW;
 			break;
 
 		/*
@@ -758,8 +753,8 @@ static int __init macfb_init(void)
 		case MAC_MODEL_P600:
 			strcpy(macfb_fix.id, "Brazil");
 			macfb_setpalette = v8_brazil_setpalette;
-			macfb_defined.activate = FB_ACTIVATE_NOW;
 			v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
+			macfb_defined.activate = FB_ACTIVATE_NOW;
 			break;
 
 		/*
@@ -773,10 +768,10 @@ static int __init macfb_init(void)
 		case MAC_MODEL_P520:
 		case MAC_MODEL_P550:
 		case MAC_MODEL_P460:
-			macfb_setpalette = v8_brazil_setpalette;
-			macfb_defined.activate = FB_ACTIVATE_NOW;
 			strcpy(macfb_fix.id, "Sonora");
+			macfb_setpalette = v8_brazil_setpalette;
 			v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
+			macfb_defined.activate = FB_ACTIVATE_NOW;
 			break;
 
 		/*
@@ -786,10 +781,10 @@ static int __init macfb_init(void)
 		 */
 		case MAC_MODEL_IICI:
 		case MAC_MODEL_IISI:
-			macfb_setpalette = rbv_setpalette;
-			macfb_defined.activate = FB_ACTIVATE_NOW;
 			strcpy(macfb_fix.id, "RBV");
+			macfb_setpalette = rbv_setpalette;
 			rbv_cmap_regs = ioremap(DAC_BASE, 0x1000);
+			macfb_defined.activate = FB_ACTIVATE_NOW;
 			break;
 
 		/*
@@ -797,10 +792,10 @@ static int __init macfb_init(void)
 		 */
 		case MAC_MODEL_Q840:
 		case MAC_MODEL_C660:
-			macfb_setpalette = civic_setpalette;
-			macfb_defined.activate = FB_ACTIVATE_NOW;
 			strcpy(macfb_fix.id, "Civic");
+			macfb_setpalette = civic_setpalette;
 			civic_cmap_regs = ioremap(CIVIC_BASE, 0x1000);
+			macfb_defined.activate = FB_ACTIVATE_NOW;
 			break;
 
 		
@@ -809,26 +804,26 @@ static int __init macfb_init(void)
 		 * We think this may be like the LC II
 		 */
 		case MAC_MODEL_LC:
+			strcpy(macfb_fix.id, "LC");
 			if (vidtest) {
 				macfb_setpalette = v8_brazil_setpalette;
-				macfb_defined.activate = FB_ACTIVATE_NOW;
 				v8_brazil_cmap_regs =
 					ioremap(DAC_BASE, 0x1000);
+				macfb_defined.activate = FB_ACTIVATE_NOW;
 			}
-			strcpy(macfb_fix.id, "LC");
 			break;
 
 		/*
 		 * We think this may be like the LC II
 		 */
 		case MAC_MODEL_CCL:
+			strcpy(macfb_fix.id, "Color Classic");
 			if (vidtest) {
 				macfb_setpalette = v8_brazil_setpalette;
-				macfb_defined.activate = FB_ACTIVATE_NOW;
 				v8_brazil_cmap_regs =
 					ioremap(DAC_BASE, 0x1000);
+				macfb_defined.activate = FB_ACTIVATE_NOW;
 			}
-			strcpy(macfb_fix.id, "Color Classic");
 			break;
 
 		/*
@@ -893,10 +888,10 @@ static int __init macfb_init(void)
 		case MAC_MODEL_PB270C:
 		case MAC_MODEL_PB280:
 		case MAC_MODEL_PB280C:
-			macfb_setpalette = csc_setpalette;
-			macfb_defined.activate = FB_ACTIVATE_NOW;
 			strcpy(macfb_fix.id, "CSC");
+			macfb_setpalette = csc_setpalette;
 			csc_cmap_regs = ioremap(CSC_BASE, 0x1000);
+			macfb_defined.activate = FB_ACTIVATE_NOW;
 			break;
 
 		default:
@@ -918,8 +913,9 @@ static int __init macfb_init(void)
 	if (err)
 		goto fail_dealloc;
 
-	printk("fb%d: %s frame buffer device\n",
-	       fb_info.node, fb_info.fix.id);
+	pr_info("fb%d: %s frame buffer device\n",
+	        fb_info.node, fb_info.fix.id);
+
 	return 0;
 
 fail_dealloc:

  parent reply	other threads:[~2011-10-23 14:11 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-23 14:11 [PATCH 00/16] more mac68k fixes and cleanup Finn Thain
2011-10-23 14:11 ` [PATCH 01/16] pmac_zilog: fix unexpected irq Finn Thain
2011-11-24 14:34   ` Finn Thain
2011-11-24 14:56     ` Alan Cox
2011-11-24 20:41       ` Benjamin Herrenschmidt
2011-11-25  3:15       ` Finn Thain
2011-11-28  0:30         ` Benjamin Herrenschmidt
2011-11-24 15:28     ` David Laight
2011-11-24 20:43       ` Benjamin Herrenschmidt
2011-12-06 15:13   ` [PATCH 01/16 v2] " Finn Thain
2011-12-06 15:27     ` Geert Uytterhoeven
2011-12-07  1:26       ` Finn Thain
2011-12-06 15:39     ` Alan Cox
2011-12-07  3:49     ` [PATCH 01/16 v3] " Finn Thain
2011-12-08  3:17       ` Benjamin Herrenschmidt
2011-12-08  4:20       ` Benjamin Herrenschmidt
2011-12-08  4:30         ` Benjamin Herrenschmidt
2011-12-08 11:26           ` Finn Thain
2011-12-08 11:54             ` Geert Uytterhoeven
2011-12-08 19:44             ` Benjamin Herrenschmidt
2011-12-11 23:48             ` Benjamin Herrenschmidt
2011-12-11 23:55               ` Benjamin Herrenschmidt
2011-12-12 13:34               ` Finn Thain
2011-12-12 20:06                 ` Benjamin Herrenschmidt
2011-12-13  1:24                   ` Finn Thain
2011-10-23 14:11 ` Finn Thain [this message]
2011-12-10  5:23   ` [PATCH 02/16] macfb: fix black and white modes Finn Thain
2011-10-23 14:11 ` [PATCH 03/16] mac_sonic: add irq resources and cleanup Finn Thain
2011-11-13 10:28   ` Geert Uytterhoeven
2011-11-13 14:30     ` Finn Thain
2011-11-13 17:36       ` Geert Uytterhoeven
2011-12-10  5:23   ` Finn Thain
2011-10-23 14:11 ` [PATCH 04/16] m68k/mac: early console Finn Thain
2011-10-23 14:11 ` [PATCH 05/16] m68k/mac: cleanup mac_clear_irq Finn Thain
2011-10-23 14:11 ` [PATCH 06/16] m68k/mac: cleanup mac_irq_pending Finn Thain
2011-12-10  5:24   ` Finn Thain
2011-10-23 14:11 ` [PATCH 07/16] m68k/mac: cleanup forward declarations Finn Thain
2011-10-23 14:11 ` [PATCH 08/16] m68k/mac: enable via_alt_mapping on performa 580 Finn Thain
2011-10-23 14:11 ` [PATCH 09/16] m68k/mac: fix nubus slot irq disable and shutdown Finn Thain
2011-10-23 14:11 ` [PATCH 10/16] m68k/mac: oss irq fixes Finn Thain
2011-10-23 14:11 ` [PATCH 11/16] m68k/mac: fix baboon irq disable and shutdown Finn Thain
2011-10-23 14:11 ` [PATCH 12/16] m68k/mac: fix powerbook 150 adb_type Finn Thain
2011-10-23 14:11 ` [PATCH 13/16] mac_scsi: fix mac_scsi on some powerbooks Finn Thain
2011-12-10  5:24   ` Finn Thain
2011-10-23 14:11 ` [PATCH 14/16] m68k/mac: cleanup macro case Finn Thain
2011-10-23 14:11 ` [PATCH 15/16] mac_scsi: dont enable mac_scsi irq before requesting it Finn Thain
2011-12-10  5:24   ` Finn Thain
2011-10-23 14:11 ` [PATCH 16/16] mac_esp: rename irq Finn Thain
2011-12-10  5:24   ` Finn Thain
2011-10-31 18:35 ` [PATCH 00/16] more mac68k fixes and cleanup Geert Uytterhoeven
2011-10-31 19:16   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111023141119.848736612@telegraphics.com.au \
    --to=fthain@telegraphics.com.au \
    --cc=FlorianSchandinat@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox