From 76ca4c23563b8eceb8c84ced2e2ea510cf685922 Mon Sep 17 00:00:00 2001 From: hhb Date: Sun, 27 May 2012 15:50:06 +0800 Subject: [PATCH] rk30 phone loauqt: add touch screen synaptics s3202 drivers --- arch/arm/configs/rk30_phone_loquat_defconfig | 9 ++ arch/arm/mach-rk30/board-rk30-phone-loquat.c | 115 +++++++++++++++---- drivers/input/touchscreen/Kconfig | 4 +- drivers/input/touchscreen/Makefile | 2 +- 4 files changed, 103 insertions(+), 27 deletions(-) diff --git a/arch/arm/configs/rk30_phone_loquat_defconfig b/arch/arm/configs/rk30_phone_loquat_defconfig index ee58a15b94a4..1886ef13d907 100755 --- a/arch/arm/configs/rk30_phone_loquat_defconfig +++ b/arch/arm/configs/rk30_phone_loquat_defconfig @@ -225,6 +225,15 @@ CONFIG_INPUT_KEYRESET=y CONFIG_INPUT_JOYSTICK=y CONFIG_INPUT_TABLET=y CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_RK=y +CONFIG_TOUCHSCREEN_SYNAPTICS_S3202=y +CONFIG_RMI4_BUS=y +CONFIG_RMI4_I2C=y +CONFIG_RMI4_I2C_SCL_RATE=400000 +CONFIG_RMI4_GENERIC=y +CONFIG_RMI4_F1A=y +CONFIG_RMI4_F11=y +CONFIG_RMI4_F34=y CONFIG_INPUT_MISC=y CONFIG_INPUT_LPSENSOR_AL3006=y CONFIG_INPUT_KEYCHORD=y diff --git a/arch/arm/mach-rk30/board-rk30-phone-loquat.c b/arch/arm/mach-rk30/board-rk30-phone-loquat.c index 4d3782441b94..15fb41da4351 100755 --- a/arch/arm/mach-rk30/board-rk30-phone-loquat.c +++ b/arch/arm/mach-rk30/board-rk30-phone-loquat.c @@ -41,6 +41,12 @@ #include #include #include + +#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_S3202 +#include +#include +#endif + #if defined(CONFIG_HDMI_RK30) #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" #endif @@ -515,21 +521,6 @@ static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] = #endif /* CONFIG_VIDEO_RK29 */ //hhb@rock-chips.com 2012-04-27 -#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S3202) -#include "../../../drivers/input/touchscreen/synaptics_i2c_rmi4.h" -struct synaptics_rmi4_platform_data synaptics_s3202_info = { - .irq_type = IRQF_TRIGGER_FALLING, - .virtual_keys = true, - .lcd_width = 640, - .lcd_height = 960, - .h_delta = 40, - .w_delta = 0, - .x_flip = false, - .y_flip = false, - .regulator_en = false, -}; -#endif - #if defined(CONFIG_TOUCHSCREEN_FT5306) @@ -596,6 +587,85 @@ struct ft5x0x_platform_data ft5306_info = { #endif +#if defined (CONFIG_TOUCHSCREEN_SYNAPTICS_S3202) + +#define TOUCH_RESET_PIN -1 +#define TOUCH_INT_PIN RK30_PIN4_PC2 +#define TOUCH_POWER_PIN -1 +#define TOUCH_IO_POWER_PIN -1 + +struct syna_gpio_data { + u16 gpio_number; + char* gpio_name; +}; + +int syna_init_platform_hw(void) +{ + return 0; +} + +static int synaptics_touchpad_gpio_setup(void *gpio_data, bool configure) +{ + int retval=0; + struct syna_gpio_data *data = gpio_data; + + if (configure) { + retval = gpio_request(data->gpio_number, "rmi4_attn"); + if (retval) { + pr_err("%s: Failed to get attn gpio %d. Code: %d.", + __func__, data->gpio_number, retval); + return retval; + } + rk30_mux_api_set(GPIO4C2_SMCDATA2_TRACEDATA2_NAME, 0); + retval = gpio_direction_input(data->gpio_number); + if (retval) { + pr_err("%s: Failed to setup attn gpio %d. Code: %d.", + __func__, data->gpio_number, retval); + gpio_free(data->gpio_number); + } + } else { + printk("%s: No way to deconfigure gpio %d.", + __func__, data->gpio_number); + } + + return retval; + +} + +static struct syna_gpio_data s3202_gpiodata = { + .gpio_number = TOUCH_INT_PIN, + .gpio_name = "GPIO4_C2", +}; +static unsigned char s3202_key_array[4]={ KEY_BACK, KEY_MENU, KEY_HOMEPAGE, KEY_SEARCH }; + +struct rmi_f1a_button_map s3202_buttons = { + .nbuttons = 4, + .map = s3202_key_array, +}; + +static struct rmi_device_platform_data s3202_platformdata = { + .sensor_name = "Espresso", + .driver_name = "rmi_generic", + .attn_gpio = TOUCH_INT_PIN, + .attn_polarity = RMI_ATTN_ACTIVE_LOW, + .level_triggered = false, /* For testing */ + .gpio_data = &s3202_gpiodata, + .gpio_config = synaptics_touchpad_gpio_setup, + .init_hw = syna_init_platform_hw, + .axis_align = { + .flip_x = 1, + .flip_y = 1, + .clip_X_low = 0, + .clip_Y_low = 0, + .clip_X_high = 0, + .clip_Y_high = 0, + }, + .f1a_button_map = &s3202_buttons, +}; + +#endif + + /*********************************************************** * rk30 backlight ************************************************************/ @@ -1677,14 +1747,15 @@ static struct i2c_board_info __initdata i2c2_info[] = { #if defined (CONFIG_TOUCHSCREEN_SYNAPTICS_S3202) { - .type = "synaptics_rmi4_i2c", - .addr = 0x20, //0x70 + .type = "rmi_i2c", + .addr = 0x20, .flags = 0, .irq = RK30_PIN4_PC2, - .platform_data = &synaptics_s3202_info, + .platform_data = &s3202_platformdata, }, #endif + #if defined (CONFIG_TOUCHSCREEN_FT5306) { .type = "ft5x0x_ts", @@ -1775,6 +1846,7 @@ static void rk30_pm_power_off(void) while (1); } +#if 0 /********************************************************************************************** * * The virtual keys for android "back", "home", "menu", "search", these four keys are touch key @@ -1835,7 +1907,7 @@ static int rk_virtual_keys_init(void) } /*************************end of virtual_keys************************/ - +#endif @@ -1851,11 +1923,6 @@ static void __init machine_rk30_board_init(void) #ifdef CONFIG_WIFI_CONTROL_FUNC rk29sdk_wifi_bt_gpio_control_init(); #endif - -#if (defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S3202)) - rk_virtual_keys_init(); -#endif - } static void __init rk30_reserve(void) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 11ca0d0ace01..7ada5dedf5f5 100755 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -980,13 +980,13 @@ config TOUCHSCREEN_PIXCIR config TOUCHSCREEN_SYNAPTICS_RMI4_I2C_RK tristate "Synaptics i2c rmi4 touchscreen" - depends on I2C2_RK30 + depends on I2C_RK30 help This enables support for Synaptics RMI over I2C based touchscreens. config TOUCHSCREEN_SYNAPTICS_S3202 tristate "SYNAPTICS S3202 touchscreen" depends on TOUCHSCREEN_SYNAPTICS_RMI4_I2C_RK - + source "drivers/input/touchscreen/rmi4/Kconfig" config D70_L3188A tristate "D70-L3188A based touchscreens" depends on I2C2_RK29 diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index c00b73cd1131..c6d1f6811931 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -85,4 +85,4 @@ obj-$(CONFIG_TOUCHSCREEN_GT819) += gt819.o obj-$(CONFIG_TOUCHSCREEN_NAS) += nas_ts.o obj-$(CONFIG_LAIBAO_TS) += ft5x0x_i2c_ts.o obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o -obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_RK) += synaptics_i2c_rmi4.o +obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C_RK) += rmi4/ -- 2.34.1