Skip to content

Commit

Permalink
arm: omap2plus: fix ads7846 pendown gpio request
Browse files Browse the repository at this point in the history
introduced by: 96974a2
(omap: consolidate touch screen initialization among different boards)

ads7846 driver can use either gpio_pendown or get_pendown_state()
callback. In case of gpio_pendown, it requests the provided gpio_pendown
thus resulting in double requesting that gpio:

ads7846 spi1.0: failed to request pendown GPIO57
ads7846: probe of spi1.0 failed with error -16

Fix this by restricting the gpio request to the case of
get_pendown_state() callback is used.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Tested-by: Thomas Weber <weber@corscience.de>
Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Igor Grinberg authored and Tony Lindgren committed Jun 1, 2011
1 parent 03b562d commit e68273b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions arch/arm/mach-omap2/common-board-devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,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;

err = gpio_request(gpio_pendown, "TS PenDown");
if (err) {
pr_err("Could not obtain gpio for TS PenDown: %d\n", err);
return;
}

gpio_direction_input(gpio_pendown);
gpio_export(gpio_pendown, 0);
if (board_pdata && board_pdata->get_pendown_state) {
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);

if (gpio_debounce)
gpio_set_debounce(gpio_pendown, gpio_debounce);
if (gpio_debounce)
gpio_set_debounce(gpio_pendown, gpio_debounce);
}

ads7846_config.gpio_pendown = gpio_pendown;

Expand Down

0 comments on commit e68273b

Please sign in to comment.