patch-2.3.99-pre9 linux/drivers/macintosh/mac_keyb.c

Next file: linux/drivers/macintosh/macserial.c
Previous file: linux/drivers/macintosh/adb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre8/linux/drivers/macintosh/mac_keyb.c linux/drivers/macintosh/mac_keyb.c
@@ -16,7 +16,7 @@
  *
  * - Standard 1 button mouse
  * - All standard Apple Extended protocol (handler ID 4)
- * - mouseman and trackman mice & trackballs 
+ * - mouseman and trackman mice & trackballs
  * - PowerBook Trackpad (default setup: enable tapping)
  * - MicroSpeed mouse & trackball (needs testing)
  * - CH Products Trackball Pro (needs testing)
@@ -344,7 +344,7 @@
 #ifdef CONFIG_ADBMOUSE
 	/*
 	 * XXX: Add mouse button 2+3 fake codes here if mouse open.
-	 *	Keep track of 'button' states here as we only send 
+	 *	Keep track of 'button' states here as we only send
 	 *	single up/down events!
 	 *	Really messy; might need to check if keyboard is in
 	 *	VC_RAW mode.
@@ -591,11 +591,12 @@
 static void
 buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll)
 {
+#ifdef CONFIG_ADB_PMU
 	/*
 	 * XXX: Where is the contrast control for the passive?
 	 *  -- Cort
 	 */
-	 
+
 	/* Ignore data from register other than 0 */
 #if 0
 	if ((adb_hardware != ADB_VIAPMU) || (data[0] & 0x3) || (nb < 2))
@@ -603,7 +604,7 @@
 	if ((data[0] & 0x3) || (nb < 2))
 #endif
 		return;
-		
+
 	switch (data[1]&0xf )
 	{
 		/* mute */
@@ -627,28 +628,25 @@
 		/* brightness decrease */
 		case 0xa:
 			/* down event */
-#ifdef CONFIG_PPC
 			if ( data[1] == (data[1]&0xf) ) {
 				if (backlight_level > 2)
 					pmu_set_brightness(backlight_level-2);
 				else
 					pmu_set_brightness(0);
 			}
-#endif
 			break;
 		/* brightness increase */
 		case 0x9:
 			/* down event */
-#ifdef CONFIG_PPC
 			if ( data[1] == (data[1]&0xf) ) {
 				if (backlight_level < 0x1e)
 					pmu_set_brightness(backlight_level+2);
-				else 
+				else
 					pmu_set_brightness(0x1f);
 			}
-#endif
 			break;
 	}
+#endif /* CONFIG_ADB_PMU */
 }
 
 /* Map led flags as defined in kbd_kern.h to bits for Apple keyboard. */
@@ -736,7 +734,7 @@
 	led_request.complete = 1;
 
 	mackeyb_probe();
-	
+
 	notifier_chain_register(&adb_client_list, &mackeyb_adb_notifier);
 }
 
@@ -744,11 +742,11 @@
 adb_message_handler(struct notifier_block *this, unsigned long code, void *x)
 {
 	unsigned long flags;
-	
+
 	switch (code) {
 	case ADB_MSG_PRE_RESET:
 	case ADB_MSG_POWERDOWN:
-	    	/* Stop the repeat timer. Autopoll is already off at this point */
+		/* Stop the repeat timer. Autopoll is already off at this point */
 		save_flags(flags);
 		cli();
 		del_timer(&repeat_timer);
@@ -758,7 +756,7 @@
 		while(!led_request.complete)
 			adb_poll();
 		break;
-			
+
 	case ADB_MSG_POST_RESET:
 		mackeyb_probe();
 		break;
@@ -841,7 +839,7 @@
 		    || (adb_mouse_kinds[id] == ADBMOUSE_MICROSPEED)) {
 			init_microspeed(id);
 		} else if (adb_mouse_kinds[id] == ADBMOUSE_MS_A3) {
-			init_ms_a3(id);	
+			init_ms_a3(id);
 		}  else if (adb_mouse_kinds[id] ==  ADBMOUSE_EXTENDED) {
 			/*
 			 * Register 1 is usually used for device
@@ -854,7 +852,7 @@
 
 			if ((req.reply_len) &&
 			    (req.reply[1] == 0x9a) && ((req.reply[2] == 0x21)
-			    	|| (req.reply[2] == 0x20)))
+				|| (req.reply[2] == 0x20)))
 				init_trackball(id);
 			else if ((req.reply_len >= 4) &&
 			    (req.reply[1] == 0x74) && (req.reply[2] == 0x70) &&
@@ -877,10 +875,10 @@
         }
 }
 
-static void 
+static void
 init_trackpad(int id)
 {
-	struct adb_request req;	
+	struct adb_request req;
 	unsigned char r1_buffer[8];
 
 	printk(" (trackpad)");
@@ -907,15 +905,15 @@
 
             adb_request(&req, NULL, ADBREQ_SYNC, 9,
 	        ADB_WRITEREG(id,2),
-	    	    0x99,
-	    	    0x94,
-	    	    0x19,
-	    	    0xff,
-	    	    0xb2,
-	    	    0x8a,
-	    	    0x1b,
-	    	    0x50);
-	    
+		    0x99,
+		    0x94,
+		    0x19,
+		    0xff,
+		    0xb2,
+		    0x8a,
+		    0x1b,
+		    0x50);
+
 	    adb_request(&req, NULL, ADBREQ_SYNC, 9,
 	        ADB_WRITEREG(id,1),
 	            r1_buffer[0],
@@ -929,13 +927,13 @@
         }
 }
 
-static void 
+static void
 init_trackball(int id)
 {
 	struct adb_request req;
-	
+
 	printk(" (trackman/mouseman)");
-	
+
 	adb_mouse_kinds[id] = ADBMOUSE_TRACKBALL;
 
 	adb_request(&req, NULL, ADBREQ_SYNC, 3,
@@ -971,7 +969,7 @@
         printk(" (TurboMouse 5)");
 
 	adb_mouse_kinds[id] = ADBMOUSE_TURBOMOUSE5;
-	
+
 	adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id));
 
 	adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(3));
@@ -1012,7 +1010,7 @@
 
 	/* This will initialize mice using the Microspeed, MacPoint and
 	   other compatible firmware. Bit 12 enables extended protocol.
-	   
+
 	   Register 1 Listen (4 Bytes)
             0 -  3     Button is mouse (set also for double clicking!!!)
             4 -  7     Button is locking (affects change speed also)
@@ -1027,7 +1025,7 @@
             0 -  7     Product code
             8 - 23     undefined, reserved
            24 - 31     Version number
-        
+
        Speed 0 is max. 1 to 255 set speed in increments of 1/256 of max.
  */
 	adb_request(&req, NULL, ADBREQ_SYNC, 5,
@@ -1051,7 +1049,7 @@
 	ADB_WRITEREG(id, 0x2),
 	    0x00,
 	    0x07);
- 
+
  	adb_request(&req, NULL, ADBREQ_SYNC, 1, ADB_FLUSH(id));
  }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)