diff options
author | Zumeng Chen <zumeng.chen@windriver.com> | 2012-06-20 17:14:53 +0800 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-07-06 01:37:25 -0700 |
commit | 16aced80f6739beb2a6ff7b6f96c83ba80d331e8 (patch) | |
tree | 50e83b4139384aa0622f3b1b90bca221ab3476d4 /arch/arm/mach-omap2/common-board-devices.c | |
parent | cb8ca5897b58f1820f44ac365c9740ba9986701b (diff) | |
download | blackbird-op-linux-16aced80f6739beb2a6ff7b6f96c83ba80d331e8.tar.gz blackbird-op-linux-16aced80f6739beb2a6ff7b6f96c83ba80d331e8.zip |
ARM: OMAP3530evm: set pendown_state and debounce time for ads7846
Currently most ads7846 config definitions for OMAP3 series boards have
been moved to common-board-devices.c, and it is transparent for init.
And it's no very proper to do gpio_request based on get_pendown_state
since omap_ads7846_init knows everything about ads7846_config.
So it's more fit to request gpio according to the right gpio_pendown
and set debounce time conditionally. If we don't set proper debouce
time, there are flooded interrupt counters of ads7846 responding to
one time touch on screen, then the driver couldn't work very well.
This patch has been validated on 3530evm.
Signed-off-by: Zumeng Chen <zumeng.chen@windriver.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/common-board-devices.c')
-rw-r--r-- | arch/arm/mach-omap2/common-board-devices.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c index 1706ebcec08d..4ba070e1288c 100644 --- a/arch/arm/mach-omap2/common-board-devices.c +++ b/arch/arm/mach-omap2/common-board-devices.c @@ -35,6 +35,16 @@ static struct omap2_mcspi_device_config ads7846_mcspi_config = { .turbo_mode = 0, }; +/* + * ADS7846 driver maybe request a gpio according to the value + * of pdata->get_pendown_state, but we have done this. So set + * get_pendown_state to avoid twice gpio requesting. + */ +static int omap3_get_pendown_state(void) +{ + return !gpio_get_value(OMAP3_EVM_TS_GPIO); +} + static struct ads7846_platform_data ads7846_config = { .x_max = 0x0fff, .y_max = 0x0fff, @@ -45,6 +55,7 @@ static struct ads7846_platform_data ads7846_config = { .debounce_rep = 1, .gpio_pendown = -EINVAL, .keep_vref_on = 1, + .get_pendown_state = &omap3_get_pendown_state, }; static struct spi_board_info ads7846_spi_board_info __initdata = { @@ -63,14 +74,17 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, struct spi_board_info *spi_bi = &ads7846_spi_board_info; int err; - if (board_pdata && board_pdata->get_pendown_state) { + if (gpio_pendown) { err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); if (err) { pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); return; } - gpio_export(gpio_pendown, 0); + /* TS GPIOPendown doesn't allow user to change the direction */ + gpio_export(gpio_pendown, false); + + /* Set proper debouce time for ads7846. */ if (gpio_debounce) gpio_set_debounce(gpio_pendown, gpio_debounce); } |