1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 15:54:04 +02:00

omap24xx: Add n800 touchscreen and keypad drivers.

Thanks to Marat Radchenko.


git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28673 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
mb 2011-10-29 20:35:36 +00:00
parent d63172b5b3
commit 80b92379ed
6 changed files with 3043 additions and 12 deletions

View File

@ -351,6 +351,7 @@ CONFIG_KEXEC=y
# CONFIG_KEYBOARD_GPIO is not set
CONFIG_KEYBOARD_LM8323=y
# CONFIG_KEYBOARD_OMAP is not set
CONFIG_KEYBOARD_TSC2301=y
CONFIG_KEYS=y
# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
CONFIG_KTIME_SCALAR=y
@ -587,6 +588,8 @@ CONFIG_SPI=y
# CONFIG_SPI_GPIO is not set
CONFIG_SPI_MASTER=y
CONFIG_SPI_OMAP24XX=y
CONFIG_SPI_TSC2301=y
# CONFIG_SPI_TSC2301_AUDIO is not set
CONFIG_STP=m
# CONFIG_STRIP_ASM_SYMS is not set
CONFIG_SUNRPC=m
@ -614,6 +617,7 @@ CONFIG_TMPFS_POSIX_ACL=y
# CONFIG_TOUCHSCREEN_MAX11801 is not set
# CONFIG_TOUCHSCREEN_ST1232 is not set
CONFIG_TOUCHSCREEN_TSC2005=y
CONFIG_TOUCHSCREEN_TSC2301=y
# CONFIG_TSL2583 is not set
CONFIG_TUN=m
CONFIG_UACCESS_WITH_MEMCPY=y

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,214 @@
From f0bb9e67f0f13021e5033fed3dfe8ef78fe6a538 Mon Sep 17 00:00:00 2001
From: Marat Radchenko <marat@slonopotamus.org>
Date: Tue, 18 Oct 2011 21:52:56 +0400
Subject: [PATCH 2/2] N800: add TSC2301 board info
This patch adds TSC2301 init logic to N800 board file
---
arch/arm/mach-omap2/board-n8x0.c | 141 ++++++++++++++++++++++++++++++++++++--
1 files changed, 135 insertions(+), 6 deletions(-)
Index: linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c
===================================================================
--- linux-3.1-rc4.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 22:14:18.752777837 +0200
+++ linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 22:16:59.040112725 +0200
@@ -26,6 +26,7 @@
#include <linux/spi/tsc2005.h>
#include <linux/input.h>
#include <linux/i2c/lm8323.h>
+#include <linux/spi/tsc2301.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
@@ -63,7 +64,75 @@ static struct omap2_mcspi_device_config
};
#endif
-static void __init tsc2005_set_config(void)
+#ifdef CONFIG_TOUCHSCREEN_TSC2301
+
+#define N800_KEYB_IRQ_GPIO 109
+
+static struct tsc2301_platform_data tsc2301_config = {
+ .reset_gpio = 118,
+ .keymap = {
+ -1, /* Event for bit 0 */
+ KEY_UP, /* Event for bit 1 (up) */
+ KEY_F5, /* Event for bit 2 (home) */
+ -1, /* Event for bit 3 */
+ KEY_LEFT, /* Event for bit 4 (left) */
+ KEY_ENTER, /* Event for bit 5 (enter) */
+ KEY_RIGHT, /* Event for bit 6 (right) */
+ -1, /* Event for bit 7 */
+ KEY_ESC, /* Event for bit 8 (cycle) */
+ KEY_DOWN, /* Event for bit 9 (down) */
+ KEY_F4, /* Event for bit 10 (menu) */
+ -1, /* Event for bit 11 */
+ KEY_F8, /* Event for bit 12 (Zoom-) */
+ KEY_F6, /* Event for bit 13 (FS) */
+ KEY_F7, /* Event for bit 14 (Zoom+) */
+ -1, /* Event for bit 15 */
+ },
+ .kp_rep = 0,
+ .keyb_name = "Internal keypad",
+};
+
+static struct omap2_mcspi_device_config tsc2301_mcspi_config = {
+ .turbo_mode = 0,
+ .single_channel = 1,
+};
+
+/*
+ TODO(Marat Radchenko): better pass GPIO to tsc2301 driver and let it
+ allocate irq itself (as it is already done for touchscreen)
+ */
+static void tsc2301_dev_init(void)
+{
+ int r;
+ int gpio = N800_KEYB_IRQ_GPIO;
+
+ r = gpio_request(gpio, "tsc2301 KBD IRQ");
+ if (r >= 0) {
+ gpio_direction_input(gpio);
+ tsc2301_config.keyb_int = gpio_to_irq(gpio);
+ } else {
+ printk(KERN_ERR "unable to get KBD GPIO");
+ }
+
+ gpio = 103;
+ r = gpio_request(gpio, "tsc2301 DAV IRQ");
+ if (r >= 0) {
+ gpio_direction_input(gpio);
+ tsc2301_config.dav_int = gpio_to_irq(gpio);
+ } else {
+ printk(KERN_ERR "unable to get DAV GPIO");
+ }
+}
+
+#else
+
+static void __init tsc2301_dev_init(void)
+{
+}
+
+#endif
+
+static void __init n8x0_ts_set_config(void)
{
const struct omap_lcd_config *conf;
@@ -94,6 +163,37 @@ static void __init tsc2005_set_config(vo
tsc2005_config.ts_x_plate_ohm = 200;
}
#endif
+
+#ifdef CONFIG_TOUCHSCREEN_TSC2301
+ if (strcmp(conf->panel_name, "lph8923") == 0) {
+ tsc2301_config.ts_x_plate_ohm = 180;
+ tsc2301_config.ts_hw_avg = 8;
+ tsc2301_config.ts_max_pressure = 2048;
+ tsc2301_config.ts_touch_pressure = 400;
+ tsc2301_config.ts_stab_time = 100;
+ tsc2301_config.ts_pressure_fudge = 2;
+ tsc2301_config.ts_x_max = 4096;
+ tsc2301_config.ts_x_fudge = 4;
+ tsc2301_config.ts_y_max = 4096;
+ tsc2301_config.ts_y_fudge = 7;
+ } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
+ tsc2301_config.ts_x_plate_ohm = 280;
+ tsc2301_config.ts_hw_avg = 8;
+ tsc2301_config.ts_touch_pressure = 400;
+ tsc2301_config.ts_max_pressure = 2048;
+ tsc2301_config.ts_stab_time = 1000;
+ tsc2301_config.ts_pressure_fudge = 2;
+ tsc2301_config.ts_x_max = 4096;
+ tsc2301_config.ts_x_fudge = 4;
+ tsc2301_config.ts_y_max = 4096;
+ tsc2301_config.ts_y_fudge = 7;
+ } else {
+ printk(KERN_ERR "Unknown panel type, set default "
+ "touchscreen configuration\n");
+ tsc2301_config.ts_x_plate_ohm = 200;
+ tsc2301_config.ts_stab_time = 100;
+ }
+#endif
}
}
@@ -347,13 +447,12 @@ static void __init n8x0_usb_init(void) {
#endif /*CONFIG_USB_MUSB_TUSB6010 */
-
static struct omap2_mcspi_device_config p54spi_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
};
-static struct spi_board_info n800_spi_board_info[] __initdata = {
+static struct spi_board_info n8x0_common_spi_board_info[] __initdata = {
{
.modalias = "lcd_mipid",
.bus_num = 1,
@@ -369,6 +468,10 @@ static struct spi_board_info n800_spi_bo
.max_speed_hz = 48000000,
.controller_data = &p54spi_mcspi_config,
},
+};
+
+static struct spi_board_info n810_spi_board_info[] __initdata = {
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
{
.modalias = "tsc2005",
.bus_num = 1,
@@ -378,6 +481,20 @@ static struct spi_board_info n800_spi_bo
.controller_data = &tsc2005_mcspi_config,
.platform_data = &tsc2005_config,
},
+#endif
+};
+
+static struct spi_board_info n800_spi_board_info[] __initdata = {
+#if defined(CONFIG_TOUCHSCREEN_TSC2301)
+ {
+ .modalias = "tsc2301",
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 6000000,
+ .controller_data = &tsc2301_mcspi_config,
+ .platform_data = &tsc2301_config,
+ },
+#endif
};
#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
@@ -1027,9 +1144,17 @@ static void __init n8x0_init_machine(voi
n8x0_bt_init();
/* FIXME: add n810 spi devices */
- tsc2005_set_config();
- spi_register_board_info(n800_spi_board_info,
- ARRAY_SIZE(n800_spi_board_info));
+ n8x0_ts_set_config();
+
+ spi_register_board_info(n8x0_common_spi_board_info,
+ ARRAY_SIZE(n8x0_common_spi_board_info));
+ if (machine_is_nokia_n800())
+ spi_register_board_info(n800_spi_board_info,
+ ARRAY_SIZE(n800_spi_board_info));
+ else
+ spi_register_board_info(n810_spi_board_info,
+ ARRAY_SIZE(n810_spi_board_info));
+
omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
ARRAY_SIZE(n8x0_i2c_board_info_1));
omap_register_i2c_bus(2, 400, NULL, 0);
@@ -1039,6 +1164,8 @@ static void __init n8x0_init_machine(voi
board_serial_init();
n8x0_mipid_init();
n8x0_blizzard_init();
+ if (machine_is_nokia_n800())
+ tsc2301_dev_init();
gpmc_onenand_init(board_onenand_data);
n8x0_mmc_init();
n8x0_usb_init();

View File

@ -4,9 +4,9 @@
Index: linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c
===================================================================
--- linux-3.1-rc4.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 20:35:58.476842416 +0200
+++ linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 20:36:02.012833998 +0200
@@ -216,6 +216,77 @@ void __init n8x0_bt_init(void)
--- linux-3.1-rc4.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 22:14:20.380771042 +0200
+++ linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 22:14:21.212767573 +0200
@@ -316,6 +316,77 @@ void __init n8x0_bt_init(void)
BUG();
}
@ -84,7 +84,7 @@ Index: linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c
static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
{
.name = "headphone",
@@ -237,11 +308,13 @@ static struct omap_gpio_switch n8x0_gpio
@@ -337,11 +408,13 @@ static struct omap_gpio_switch n8x0_gpio
.gpio = -1,
.debounce_rising = 200,
.debounce_falling = 200,

View File

@ -1,8 +1,8 @@
Index: linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c
===================================================================
--- linux-3.1-rc4.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 20:11:19.364504806 +0200
+++ linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 20:12:11.508370280 +0200
@@ -38,6 +38,7 @@
--- linux-3.1-rc4.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 22:14:21.212767573 +0200
+++ linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c 2011-10-29 22:14:26.076747281 +0200
@@ -41,6 +41,7 @@
#include <plat/serial.h>
#include <plat/cbus.h>
#include <plat/gpio-switch.h>
@ -10,7 +10,7 @@ Index: linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c
#include "mux.h"
@@ -384,6 +385,14 @@ static struct musb_hdrc_platform_data tu
@@ -486,6 +487,14 @@ static struct musb_hdrc_platform_data tu
.config = &musb_config,
};
@ -25,7 +25,7 @@ Index: linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0.c
static void __init n8x0_usb_init(void)
{
int ret = 0;
@@ -405,6 +414,8 @@ static void __init n8x0_usb_init(void)
@@ -507,6 +516,8 @@ static void __init n8x0_usb_init(void)
if (ret != 0)
goto err;

View File

@ -4,9 +4,9 @@
Index: linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0-lcd.c
===================================================================
--- linux-3.1-rc4.orig/arch/arm/mach-omap2/board-n8x0-lcd.c 2011-10-28 00:24:34.306789772 +0200
+++ linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0-lcd.c 2011-10-28 00:25:32.314559457 +0200
@@ -34,8 +34,28 @@ static void mipid_shutdown(struct mipid_
--- linux-3.1-rc4.orig/arch/arm/mach-omap2/board-n8x0-lcd.c 2011-10-29 22:14:15.792790191 +0200
+++ linux-3.1-rc4/arch/arm/mach-omap2/board-n8x0-lcd.c 2011-10-29 22:14:29.864731483 +0200
@@ -33,8 +33,28 @@ static void mipid_shutdown(struct mipid_
}
}