? arch/arm/mach-pxa/htcapache/.built-in.o.cmd
? arch/arm/mach-pxa/htcapache/.htcapache-bl.o.cmd
? arch/arm/mach-pxa/htcapache/.htcapache-egpio.o.cmd
? arch/arm/mach-pxa/htcapache/.htcapache-frontkeys.o.cmd
? arch/arm/mach-pxa/htcapache/.htcapache-leds.o.cmd
? arch/arm/mach-pxa/htcapache/.htcapache-mc.o.cmd
? arch/arm/mach-pxa/htcapache/.htcapache-pm.o.cmd
? arch/arm/mach-pxa/htcapache/.htcapache-power.o.d
? arch/arm/mach-pxa/htcapache/.htcapache.o.cmd
Index: arch/arm/mach-pxa/htcapache/Kconfig
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/htcapache/Kconfig,v
retrieving revision 1.10
diff -u -r1.10 Kconfig
--- arch/arm/mach-pxa/htcapache/Kconfig	17 Jun 2007 09:52:33 -0000	1.10
+++ arch/arm/mach-pxa/htcapache/Kconfig	30 Jun 2007 15:03:47 -0000
@@ -9,6 +9,8 @@
         select LEDS_CLASS
         select ADC
         select HTC_EGPIO
+        select HTC_BBKEYS
+        select LEDS_GPIODEV
 	help
 		Say Y here if you intend to run this kernel on a
 		HTC Apache. Currently there is only basic support
Index: arch/arm/mach-pxa/htcapache/Makefile
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/htcapache/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- arch/arm/mach-pxa/htcapache/Makefile	17 Jun 2007 09:52:33 -0000	1.12
+++ arch/arm/mach-pxa/htcapache/Makefile	30 Jun 2007 15:03:47 -0000
@@ -4,7 +4,4 @@
 
 obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache.o
 obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-bl.o
-obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-mc.o
-obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-leds.o
-obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-frontkeys.o
 obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-pm.o
Index: arch/arm/mach-pxa/htcapache/htcapache.c
===================================================================
RCS file: /cvs/linux/kernel26/arch/arm/mach-pxa/htcapache/htcapache.c,v
retrieving revision 1.22
diff -u -r1.22 htcapache.c
--- arch/arm/mach-pxa/htcapache/htcapache.c	17 Jun 2007 09:52:33 -0000	1.22
+++ arch/arm/mach-pxa/htcapache/htcapache.c	30 Jun 2007 15:03:47 -0000
@@ -8,34 +8,30 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/fb.h>
-#include <linux/platform_device.h>
 #include <linux/delay.h> // mdelay
-#include <linux/input.h>
-#include <linux/ad7877.h>
-#include <linux/touchscreen-adc.h>
-#include <linux/gpio_keys.h>
-#include <linux/adc_battery.h>
-#include <linux/pda_power.h>
-#include <linux/mfd/htc-egpio.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-#include <asm/arch/hardware.h>
-#include <asm/arch/pxafb.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/udc.h>
-#include <asm/arch/htcapache-gpio.h>
-#include <asm/arch/mmc.h>
-#include <asm/arch/serial.h>
-#include <asm/arch/pxa27x_keyboard.h>
+#include <linux/input.h> // KEY_*
+#include <linux/ad7877.h> // struct ad7877_data
+#include <linux/touchscreen-adc.h> // struct tsadc
+#include <linux/gpio_keys.h> // struct gpio_keys_button
+#include <linux/adc_battery.h> // struct battery_info
+#include <linux/pda_power.h> // struct pda_power_pdata
+#include <linux/mfd/htc-egpio.h> // struct htc_egpio_platform_data
+#include <linux/mfd/htc-bbkeys.h> // struct htc_bbkeys_platform_data
+#include <linux/leds-gpiodev.h> // struct leds_gpiodev_platform_data
+
+#include <asm/mach-types.h> // MACH_TYPE_HTCAPACHE
+#include <asm/mach/arch.h> // MACHINE_START
+
+#include <asm/arch/pxafb.h> // struct pxafb_mach_info
+#include <asm/arch/udc.h> // PXA2XX_UDC_CMD_DISCONNECT
+#include <asm/arch/htcapache-gpio.h> // GPIO_NR_HTCAPACHE_*
+#include <asm/arch/mmc.h> // MMC_VDD_32_33
+#include <asm/arch/serial.h> // PXA_UART_CFG_POST_STARTUP
+#include <asm/arch/pxa27x_keyboard.h> // struct pxa27x_keyboard_platform_data
 #include <asm/arch/irda.h> // struct pxaficp_platform_data
 
-#include "../generic.h"
-#include "../../../../drivers/net/wireless/acx/acx_hw.h"
+#include "../generic.h" // pxa_map_io
+#include "../../../../drivers/net/wireless/acx/acx_hw.h" // acx_hardware_data
 
 
 /****************************************************************
@@ -113,37 +109,79 @@
 
 
 /****************************************************************
- * LCD power
+ * Front keypad
+ ****************************************************************/
+
+static struct resource bbkeys_resources[] = {
+	[0] = {
+		.start  = IRQ_GPIO(GPIO_NR_HTCAPACHE_MC_IRQ),
+		.end    = IRQ_GPIO(GPIO_NR_HTCAPACHE_MC_IRQ),
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static struct htc_bbkeys_platform_data bbkeys_data = {
+	.sda_gpio = GPIO_NR_HTCAPACHE_MC_SDA,
+	.scl_gpio = GPIO_NR_HTCAPACHE_MC_SCL,
+
+	.ackreg = 3,
+	.key1reg = 4,
+	.key2reg = 5,
+	.buttons = {
+		-1, -1, -1,
+		KEY_ENTER,     // Joystick press
+		KEY_DOWN,      // Joystick down
+		KEY_LEFT,      // Joystick left
+		KEY_UP,        // Joystick up
+		KEY_RIGHT,     // Joystick right
+		-1, -1,
+		KEY_LEFTMETA,  // Windows key
+		KEY_OK,        // Ok
+		KEY_RIGHTCTRL, // Right menu
+		KEY_ESC,       // Hangup
+		KEY_LEFTCTRL,  // Left menu
+		KEY_PHONE,     // Call button
+	}
+};
+
+static struct platform_device bbkeys = {
+	.name   = "htc-bbkeys",
+	.id     = -1,
+	.resource = bbkeys_resources,
+	.num_resources = ARRAY_SIZE(bbkeys_resources),
+	.dev	=  {
+		.platform_data	= &bbkeys_data,
+	},
+};
+
+
+/****************************************************************
+ * LCD
  ****************************************************************/
 
 static void lcd_power(int on, struct fb_var_screeninfo *si)
 {
 	if (on) {
 		printk(KERN_DEBUG "lcd power on\n");
-		htcapache_write_mc_reg(0, 0x40);
+		bbkeys_data.ops.set(&bbkeys.dev, 6, 1);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xc0);
+		bbkeys_data.ops.set(&bbkeys.dev, 7, 1);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xd0);
+		bbkeys_data.ops.set(&bbkeys.dev, 4, 1);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xf0);
+		bbkeys_data.ops.set(&bbkeys.dev, 5, 1);
 	} else {
 		printk(KERN_DEBUG "lcd power off\n");
-		htcapache_write_mc_reg(0, 0xd0);
+		bbkeys_data.ops.set(&bbkeys.dev, 5, 0);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xc0);
+		bbkeys_data.ops.set(&bbkeys.dev, 4, 0);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0x40);
+		bbkeys_data.ops.set(&bbkeys.dev, 7, 0);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0x00);
+		bbkeys_data.ops.set(&bbkeys.dev, 6, 0);
 	}
 }
 
-
-/****************************************************************
- * Frame buffer
- ****************************************************************/
-
 static struct pxafb_mode_info lcd_mode = {
 	.pixclock		= 192307,
 	.xres			= 240,
@@ -298,8 +336,34 @@
  * LEDS
  ****************************************************************/
 
+struct leds_gpiodev_info apache_leds[] = {
+	{ "apache:vibra",
+	  { &egpio.dev, EGPIO_NR_HTCAPACHE_LED_VIBRA} },
+	{ "apache:kbd_bl",
+	  { &egpio.dev, EGPIO_NR_HTCAPACHE_LED_KBD_BACKLIGHT} },
+	{ "apache:flashlight",
+	  { &pxagpio_device.dev, GPIO_NR_HTCAPACHE_LED_FLASHLIGHT} },
+	{ "apache:phone_bl", { &bbkeys.dev, 13 }},
+
+	{ "apacheRight:green", { &bbkeys.dev, 21 }},
+	{ "apacheRight:red", { &bbkeys.dev, 22 }},
+	{ "apacheRight:alter", { &bbkeys.dev, 23 }},
+	{ "apacheLeft:green", { &bbkeys.dev, 18 }},
+	{ "apacheLeft:blue", { &bbkeys.dev, 19 }},
+	{ "apacheLeft:alter", { &bbkeys.dev, 20 }},
+};
+
+static struct leds_gpiodev_platform_data apache_led_info = {
+	.leds = apache_leds,
+	.nr_leds = ARRAY_SIZE(apache_leds),
+};
+
 static struct platform_device leds = {
-	.name = "htcapache-leds",
+	.name = "leds-gpiodev",
+	.id = -1,
+	.dev = {
+		.platform_data = &apache_led_info,
+	}
 };
 
 
@@ -543,38 +607,6 @@
 
 
 /****************************************************************
- * Buttons on front
- ****************************************************************/
-
-static struct gpio_keys_button front_button_list[] = {
-	{ .gpio = 15, .keycode = KEY_PHONE},     // Call button
-	{ .gpio = 14, .keycode = KEY_LEFTCTRL},  // Left menu
-	{ .gpio = 13, .keycode = KEY_ESC},       // Hangup
-	{ .gpio = 12, .keycode = KEY_RIGHTCTRL}, // Right menu
-	{ .gpio = 11, .keycode = KEY_OK},        // Ok
-	{ .gpio = 10, .keycode = KEY_LEFTMETA},  // Windows key
-	{ .gpio = 7,  .keycode = KEY_RIGHT},     // Joystick right
-	{ .gpio = 6,  .keycode = KEY_UP},        // Joystick up
-	{ .gpio = 5,  .keycode = KEY_LEFT},      // Joystick left
-	{ .gpio = 4,  .keycode = KEY_DOWN},      // Joystick down
-	{ .gpio = 3,  .keycode = KEY_ENTER},     // Joystick press
-};
-
-static struct gpio_keys_platform_data front_buttons_data = {
-	.buttons = front_button_list,
-	.nbuttons = ARRAY_SIZE(front_button_list),
-};
-
-static struct platform_device front_buttons = {
-	.name   = "htcapache-frontkeys",
-	.id     = -1,
-	.dev	=  {
-		.platform_data	= &front_buttons_data,
-	},
-};
-
-
-/****************************************************************
  * USB client controller
  ****************************************************************/
 
@@ -657,6 +689,7 @@
 
 static struct platform_device *devices[] __initdata = {
 	&egpio,
+	&bbkeys,
 	&htcapache_keyboard,
 	&htcapache_buttons,
 	&ad7877,
@@ -666,15 +699,14 @@
 	&htcapache_bl,
 	&leds,
 	&acx_device,
-	&front_buttons,
 };
 
 void htcapache_ll_pm_init(void);
 
 static void __init htcapache_init(void)
 {
-	set_pxa_fb_info(&lcd);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
+	set_pxa_fb_info(&lcd);
 	pxa_set_btuart_info(&btuart_funcs);
 	pxa_set_udc_info(&htcapache_udc_mach_info);
 	pxa_set_mci_info(&htcapache_mci_platform_data);
Index: include/asm-arm/arch-pxa/htcapache-gpio.h
===================================================================
RCS file: /cvs/linux/kernel26/include/asm-arm/arch-pxa/htcapache-gpio.h,v
retrieving revision 1.8
diff -u -r1.8 htcapache-gpio.h
--- include/asm-arm/arch-pxa/htcapache-gpio.h	17 Jun 2007 09:52:34 -0000	1.8
+++ include/asm-arm/arch-pxa/htcapache-gpio.h	30 Jun 2007 15:25:43 -0000
@@ -7,10 +7,9 @@
  * Micro-controller interface
  ****************************************************************/
 
-u32 htcapache_read_mc_reg(u32 reg);
-void htcapache_write_mc_reg(u32 reg, u32 data);
 #define GPIO_NR_HTCAPACHE_MC_SDA	56
 #define GPIO_NR_HTCAPACHE_MC_SCL	57
+#define GPIO_NR_HTCAPACHE_MC_IRQ	14
 
 
 /****************************************************************
@@ -63,15 +62,6 @@
 
 
 /****************************************************************
- * LEDS
- ****************************************************************/
-
-#define GPIO_NR_HTCAPACHE_LED_FLASHLIGHT	87
-#define EGPIO_NR_HTCAPACHE_LED_VIBRA	 	35
-#define EGPIO_NR_HTCAPACHE_LED_KBD_BACKLIGHT	34
-
-
-/****************************************************************
  * BlueTooth
  ****************************************************************/
 
@@ -107,20 +97,6 @@
 
 
 /****************************************************************
- * Front buttons
- ****************************************************************/
-
-#define GPIO_NR_HTCAPACHE_FKEY_IRQ	14
-
-
-/****************************************************************
- * Front buttons
- ****************************************************************/
-
-#define GPIO_NR_HTCAPACHE_FKEY_IRQ	14
-
-
-/****************************************************************
  * Buttons on side
  ****************************************************************/
 

