|
From: <hap...@us...> - 2007-09-14 13:15:47
|
Revision: 1317
http://hackndev.svn.sourceforge.net/hackndev/?rev=1317&view=rev
Author: happy-slapin
Date: 2007-09-14 06:15:44 -0700 (Fri, 14 Sep 2007)
Log Message:
-----------
cleanup: Device cleanup
Modified Paths:
--------------
linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Kconfig
linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Makefile
linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/htcapache.c
Modified: linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Kconfig
===================================================================
--- linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Kconfig 2007-09-14 13:08:25 UTC (rev 1316)
+++ linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Kconfig 2007-09-14 13:15:44 UTC (rev 1317)
@@ -9,6 +9,8 @@
select LEDS_CLASS
select ADC
select HTC_EGPIO
+ select HTC_BBKEYS
+ select LEDS_GPIO
help
Say Y here if you intend to run this kernel on a
HTC Apache. Currently there is only basic support
Modified: linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Makefile
===================================================================
--- linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Makefile 2007-09-14 13:08:25 UTC (rev 1316)
+++ linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/Makefile 2007-09-14 13:15:44 UTC (rev 1317)
@@ -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
Modified: linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/htcapache.c
===================================================================
--- linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/htcapache.c 2007-09-14 13:08:25 UTC (rev 1316)
+++ linux4palm/linux/branches/cleanup-branch-never-commit/arch/arm/mach-pxa/htcapache/htcapache.c 2007-09-14 13:15:44 UTC (rev 1317)
@@ -8,34 +8,32 @@
*/
#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 <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.h> // struct gpio_led
+#include <linux/platform_device.h> // struct platform_device
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
+#include <asm/gpio.h> // gpio_set_value
+#include <asm/mach-types.h> // MACH_TYPE_HTCAPACHE
+#include <asm/mach/arch.h> // MACHINE_START
-#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 <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
/****************************************************************
@@ -60,20 +58,20 @@
struct htc_egpio_pinInfo pins[] = {
// Input pins with IRQs
- {.pin_nr = EGPIO_NR_HTCAPACHE_PWR_IN_PWR
+ {.gpio = EGPIO_NR_HTCAPACHE_PWR_IN_PWR
, .type = HTC_EGPIO_TYPE_INPUT
, .input_irq = EGPIO_NR_HTCAPACHE_PWR_IN_PWR+8},
- {.pin_nr = EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR
+ {.gpio = EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR
, .type = HTC_EGPIO_TYPE_INPUT
, .input_irq = EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR+8},
- {.pin_nr = EGPIO_NR_HTCAPACHE_SND_IN_JACK
+ {.gpio = EGPIO_NR_HTCAPACHE_SND_IN_JACK
, .type = HTC_EGPIO_TYPE_INPUT
, .input_irq = EGPIO_NR_HTCAPACHE_SND_IN_JACK+8},
- {.pin_nr = EGPIO_NR_HTCAPACHE_WIFI_IN_IRQ
+ {.gpio = EGPIO_NR_HTCAPACHE_WIFI_IN_IRQ
, .type = HTC_EGPIO_TYPE_INPUT
, .input_irq = EGPIO_NR_HTCAPACHE_WIFI_IN_IRQ+8},
// Output pins that default on
- {.pin_nr = EGPIO_NR_HTCAPACHE_PWR_CHARGE
+ {.gpio = EGPIO_NR_HTCAPACHE_PWR_CHARGE
, .type = HTC_EGPIO_TYPE_OUTPUT
, .output_initial = 1}, // Disable charger
};
@@ -81,7 +79,7 @@
struct htc_egpio_platform_data egpio_data = {
.invertAcks = 1,
.irq_base = IRQ_BOARD_START,
- .gpio_base = GPIO_BASE_INCREMENT,
+ .gpio_base = HTCAPACHE_EGPIO_BASE,
.nrRegs = 3,
.pins = pins,
.nr_pins = ARRAY_SIZE(pins),
@@ -98,53 +96,87 @@
};
// Compatibility wrappers
-#define IRQ_EGPIO(x) (IRQ_BOARD_START + (x) + 8)
-int htcapache_egpio_get(int bit) {
- return egpio_data.ops.get(&egpio.dev, bit);
-}
-EXPORT_SYMBOL(htcapache_egpio_get);
-void htcapache_egpio_set(int bit, int value) {
- egpio_data.ops.set(&egpio.dev, bit, value);
-}
-EXPORT_SYMBOL(htcapache_egpio_set);
-int htcapache_egpio_to_irq(int bit) {
- return egpio_data.ops.to_irq(&egpio.dev, bit);
-}
-EXPORT_SYMBOL(htcapache_egpio_to_irq);
+#define IRQ_EGPIO(x) (IRQ_BOARD_START + (x) - HTCAPACHE_EGPIO_BASE + 8)
/****************************************************************
- * LCD power
+ * Front keypad
****************************************************************/
+#define HTCAPACHE_BBKEYS_BASE (HTCAPACHE_EGPIO_BASE + GPIO_BASE_INCREMENT)
+#define BBKEYS_GPIO(reg,bit) (HTCAPACHE_BBKEYS_BASE + 8*(reg) + (bit))
+
+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,
+ .gpio_base = HTCAPACHE_BBKEYS_BASE,
+
+ .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);
+ gpio_set_value(BBKEYS_GPIO(0, 6), 1);
udelay(2000);
- htcapache_write_mc_reg(0, 0xc0);
+ gpio_set_value(BBKEYS_GPIO(0, 7), 1);
udelay(2000);
- htcapache_write_mc_reg(0, 0xd0);
+ gpio_set_value(BBKEYS_GPIO(0, 4), 1);
udelay(2000);
- htcapache_write_mc_reg(0, 0xf0);
+ gpio_set_value(BBKEYS_GPIO(0, 5), 1);
} else {
printk(KERN_DEBUG "lcd power off\n");
- htcapache_write_mc_reg(0, 0xd0);
+ gpio_set_value(BBKEYS_GPIO(0, 5), 0);
udelay(2000);
- htcapache_write_mc_reg(0, 0xc0);
+ gpio_set_value(BBKEYS_GPIO(0, 4), 0);
udelay(2000);
- htcapache_write_mc_reg(0, 0x40);
+ gpio_set_value(BBKEYS_GPIO(0, 7), 0);
udelay(2000);
- htcapache_write_mc_reg(0, 0x00);
+ gpio_set_value(BBKEYS_GPIO(0, 6), 0);
}
}
-
-/****************************************************************
- * Frame buffer
- ****************************************************************/
-
static struct pxafb_mode_info lcd_mode = {
.pixclock = 192307,
.xres = 240,
@@ -220,8 +252,8 @@
static void set_charge(int flags)
{
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_USB_PWR
- , flags == PDA_POWER_CHARGE_USB);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_USB_PWR
+ , flags == PDA_POWER_CHARGE_USB);
// XXX - enable/disable battery charger once charge complete
// detection available.
@@ -229,15 +261,15 @@
static int ac_on(void)
{
- int haspower = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
- int hashigh = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
+ int haspower = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
+ int hashigh = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
return haspower && hashigh;
}
static int usb_on(void)
{
- int haspower = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
- int hashigh = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
+ int haspower = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
+ int hashigh = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
return haspower && !hashigh;
}
@@ -301,8 +333,33 @@
* LEDS
****************************************************************/
+struct gpio_led apache_leds[] = {
+ { .name = "apache:vibra", .gpio = EGPIO_NR_HTCAPACHE_LED_VIBRA },
+ { .name = "apache:kbd_bl",
+ .gpio = EGPIO_NR_HTCAPACHE_LED_KBD_BACKLIGHT },
+ { .name = "apache:flashlight",
+ .gpio = GPIO_NR_HTCAPACHE_LED_FLASHLIGHT },
+ { .name = "apache:phone_bl", .gpio = BBKEYS_GPIO(1, 5) },
+
+ { .name = "apacheLeft:green", .gpio = BBKEYS_GPIO(2, 2) },
+ { .name = "apacheLeft:blue", .gpio = BBKEYS_GPIO(2, 3) },
+ { .name = "apacheLeft:alter", .gpio = BBKEYS_GPIO(2, 4) },
+ { .name = "apacheRight:green", .gpio = BBKEYS_GPIO(2, 5) },
+ { .name = "apacheRight:red", .gpio = BBKEYS_GPIO(2, 6) },
+ { .name = "apacheRight:alter", .gpio = BBKEYS_GPIO(2, 7) },
+};
+
+static struct gpio_led_platform_data apache_led_info = {
+ .leds = apache_leds,
+ .num_leds = ARRAY_SIZE(apache_leds),
+};
+
static struct platform_device leds = {
- .name = "htcapache-leds",
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &apache_led_info,
+ }
};
@@ -320,9 +377,9 @@
pxa_gpio_mode(GPIO44_BTCTS_MD);
pxa_gpio_mode(GPIO45_BTRTS_MD);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_POWER, 1);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_BT_POWER, 1);
mdelay(5);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_RESET, 1);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_BT_RESET, 1);
/*
* BRF6150's RTS goes low when firmware is ready
* so check for CTS=1 (nCTS=0 -> CTS=1). Typical 150ms
@@ -334,8 +391,8 @@
printk("btuart: post_startup (%d)\n", tries);
break;
case PXA_UART_CFG_PRE_SHUTDOWN:
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_POWER, 0);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_RESET, 0);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_BT_POWER, 0);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_BT_RESET, 0);
printk("btuart: pre_shutdown\n");
break;
}
@@ -370,23 +427,23 @@
static int
wlan_start(void)
{
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 1);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 1);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 1);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 1);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 1);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 1);
mdelay(250);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_RESET, 1);
- mdelay(100);
- return 0;
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_RESET, 1);
+ mdelay(100);
+ return 0;
}
static int
wlan_stop(void)
{
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 0);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 0);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 0);
- htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_RESET, 0);
- return 0;
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 0);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 0);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 0);
+ gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_RESET, 0);
+ return 0;
}
enum {
@@ -546,38 +603,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
****************************************************************/
@@ -660,6 +685,7 @@
static struct platform_device *devices[] __initdata = {
&egpio,
+ &bbkeys,
&htcapache_keyboard,
&htcapache_buttons,
&ad7877,
@@ -669,15 +695,14 @@
&htcapache_bl,
&leds,
&acx_device,
- &front_buttons,
};
void htcapache_ll_pm_init(void);
static void __init htcapache_init(void)
{
+ platform_add_devices(devices, ARRAY_SIZE(devices));
set_pxa_fb_info(&lcd);
- platform_add_devices(devices, ARRAY_SIZE(devices));
pxa_set_btuart_info(&btuart_funcs);
pxa_set_udc_info(&htcapache_udc_mach_info);
pxa_set_mci_info(&htcapache_mci_platform_data);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|