X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Farm%2Fmach-omap1%2Fboard-h6300.c;h=888e654549dac68ebdcbb53260fae154eca568aa;hb=c872ebcdd22885f52cb1123472b0a7335f872785;hp=14173037593b9699b5ffa40d3196d97e69769a8e;hpb=2518079baa078336146768ba15351c04a4b36803;p=linux-2.6-omap-h63xx.git diff --git a/arch/arm/mach-omap1/board-h6300.c b/arch/arm/mach-omap1/board-h6300.c index 14173037593..888e654549d 100644 --- a/arch/arm/mach-omap1/board-h6300.c +++ b/arch/arm/mach-omap1/board-h6300.c @@ -27,15 +27,140 @@ #include #include #include +#include #include +#include +#include +#include + +#define _h6300_KEY_CALENDAR 67 // xmodmap 75 aka F9 +#define _H6300_KEY_TELEPHONE 68 // xmodmap 76 aka F10 +#define _H6300_KEY_HOMEPAGE 87 // xmodmap 87 aka Num_Lock +#define _H6300_KEY_MAIL 88 // xmodmap 88 aka Scroll_Lock + +/* + * When joypad is pressed on h63xx to up, right, down or left direction, + * it does not send keypress events directly from those directions. + * Instead we receive multiple events from the keypresses on directions + * up_right, down_right, down_left, up_left and ok. + * Therefore we are summing those events in kernel level and then + * making a decision which event is send to userspace. (up, right, down or left) + */ +#define _H6300_JOYPAD_UP_RIGHT 1 // 00001 +#define _H6300_JOYPAD_DOWN_RIGHT 2 // 00010 +#define _h6300_JOYPAD_DOWN_LEFT 4 // 00100 +#define _h6300_JOYPAD_UP_LEFT 8 // 01000 +#define _H6300_JOYPAD_KEY_OK 16 // 10000 + +static int h6300_keymap[] = { + KEY(2, 0, _h6300_KEY_CALENDAR), // address button in the bottom left of iPAQ keypad + KEY(2, 3, _H6300_KEY_TELEPHONE), // start call button in the bottom of iPAQ keypad + KEY(3, 1, _H6300_KEY_HOMEPAGE), // stop call button in the bottom of iPAQ keypad + KEY(3, 4, _H6300_KEY_MAIL), // messaging button in the bottom right of iPAQ keypad + + KEY(0, 0, KEY_VOLUMEUP), // volume up button in the right side of iPAQ keypad + KEY(0, 1, KEY_VOLUMEDOWN), // volume down button in the right side of iPAQ keypad + KEY(3, 2, KEY_RECORD), // record button in the left side of iPAQ keypad + + KEY(1, 0, _h6300_JOYPAD_UP_LEFT), + KEY(1, 1, _h6300_JOYPAD_DOWN_LEFT), + KEY(1, 2, _H6300_JOYPAD_KEY_OK), + KEY(1, 3, _H6300_JOYPAD_DOWN_RIGHT), + KEY(1, 4, _H6300_JOYPAD_UP_RIGHT), + + KEY(4, 0, KEY_RIGHT), + KEY(4, 1, KEY_DOWN), + KEY(4, 2, KEY_LEFT), + KEY(4, 3, KEY_UP), + KEY(4, 4, KEY_ENTER), + + 0 +}; static struct platform_device h6300_lcd_device = { .name = "lcd_h6300", .id = -1, }; +static struct resource h6300_kp_resources[] = { + [0] = { + .start = INT_KEYBOARD, + .end = INT_KEYBOARD, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct omap_kp_platform_data h6300_kp_data = { + .rows = 8, + .cols = 8, + .keymap = h6300_keymap, + .rep = 1, // turns repeat bit on +}; + +static struct platform_device h6300_kp_device = { + .name = "omap-keypad", + .id = -1, + .dev = { + .platform_data = &h6300_kp_data, + }, + .num_resources = ARRAY_SIZE(h6300_kp_resources), + .resource = h6300_kp_resources, +}; + +/* + * Bluetooth - Relies on h6300_bt module, + * so make the calls indirectly through pointers. Requires that the + * h6300_bt bluetooth module be loaded before any attempt to use + * bluetooth (obviously). + */ +static struct platform_omap_serial_funcs h6300_omap_platform__uart_bt_funcs = { + .configure = NULL, + .set_txrx = NULL, + .get_txrx = NULL, +}; + +struct platform_device h63xx_uart_bt_device = { + .name = "h6300_bt", + .id = 1, +}; +EXPORT_SYMBOL(h63xx_uart_bt_device); + +static struct omap_mcbsp_reg_cfg mcbsp_regs = { + .spcr2 = 0x0000, + .spcr1 = 0x0000, + .rcr2 = 0x8041, + .rcr1 = 0x0040, + .xcr2 = 0x00a1, + .xcr1 = 0x00a0, + .srgr2 = 0xb000, + .srgr1 = 0x0000, + .pcr0 = 0x0081, +}; + +static struct omap_alsa_codec_config alsa_config = { + .name = "iPAQ h6300 TSC2101", + .mcbsp_regs_alsa = &mcbsp_regs, + .codec_configure_dev = NULL, //tsc2101_configure, + .codec_set_samplerate = NULL, //tsc2101_set_samplerate, + .codec_clock_setup = NULL, //tsc2101_clock_setup, + .codec_clock_on = NULL, //tsc2101_clock_on, + .codec_clock_off = NULL, //tsc2101_clock_off, + .get_default_samplerate = NULL, //tsc2101_get_default_samplerate, +}; + +static struct platform_device h6300_mcbsp1_sound_device = { + .name = "omap_alsa_mcbsp", + .id = 1, + .dev = { + .platform_data = &alsa_config, + }, +}; + static struct platform_device *h6300_devices[] __initdata = { &h6300_lcd_device, + &h6300_kp_device, + &h63xx_uart_bt_device, + &h6300_mcbsp1_sound_device, }; static struct omap_lcd_config h6300_lcd_config __initdata = { @@ -53,10 +178,21 @@ static struct omap_usb_config h6300_usb_config __initdata = { .pins[0] = 0, }; +static struct omap_mmc_config h6300_mmc_config __initdata = { + .mmc [0] = { + .enabled = 1, + .wire4 = 1, + .wp_pin = OMAP_GPIO_IRQ(13), + .power_pin = -1, // tps65010 ? + .switch_pin = -1, // OMAP_MPUIO(1), // = -1, // ARMIO2? + }, +}; + static struct omap_board_config_kernel h6300_config[] = { { OMAP_TAG_LCD, &h6300_lcd_config }, { OMAP_TAG_UART, &h6300_uart_config }, { OMAP_TAG_USB, &h6300_usb_config }, + { OMAP_TAG_MMC, &h6300_mmc_config }, }; static void __init h6300_init_irq(void) @@ -64,6 +200,11 @@ static void __init h6300_init_irq(void) omap1_init_common_hw(); omap_init_irq(); omap_gpio_init(); +/* touchscreen gpio setup is now done in the drivers/input/touschreen/omap/ts_hx.c + omap_request_gpio(2); + omap_set_gpio_direction(2, 0); + omap_set_gpio_dataout(2, 1); +*/ } static void __init h6300_init(void) @@ -82,6 +223,8 @@ static void __init h6300_init(void) static void __init h6300_map_io(void) { omap1_map_common_io(); + + h63xx_uart_bt_device.dev.platform_data = &h6300_omap_platform__uart_bt_funcs; } MACHINE_START(OMAP_H6300, "HP iPAQ h6300")