Commit e68273baf30390e9c907831b47384085c7f664d5
Committed by
Tony Lindgren
1 parent
03b562d785
Exists in
master
and in
4 other branches
arm: omap2plus: fix ads7846 pendown gpio request
introduced by: 96974a24 (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>
Showing 1 changed file with 10 additions and 10 deletions Side-by-side Diff
arch/arm/mach-omap2/common-board-devices.c
| ... | ... | @@ -85,17 +85,17 @@ |
| 85 | 85 | struct spi_board_info *spi_bi = &ads7846_spi_board_info; |
| 86 | 86 | int err; |
| 87 | 87 | |
| 88 | - err = gpio_request(gpio_pendown, "TS PenDown"); | |
| 89 | - if (err) { | |
| 90 | - pr_err("Could not obtain gpio for TS PenDown: %d\n", err); | |
| 91 | - return; | |
| 92 | - } | |
| 88 | + if (board_pdata && board_pdata->get_pendown_state) { | |
| 89 | + err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); | |
| 90 | + if (err) { | |
| 91 | + pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); | |
| 92 | + return; | |
| 93 | + } | |
| 94 | + gpio_export(gpio_pendown, 0); | |
| 93 | 95 | |
| 94 | - gpio_direction_input(gpio_pendown); | |
| 95 | - gpio_export(gpio_pendown, 0); | |
| 96 | - | |
| 97 | - if (gpio_debounce) | |
| 98 | - gpio_set_debounce(gpio_pendown, gpio_debounce); | |
| 96 | + if (gpio_debounce) | |
| 97 | + gpio_set_debounce(gpio_pendown, gpio_debounce); | |
| 98 | + } | |
| 99 | 99 | |
| 100 | 100 | ads7846_config.gpio_pendown = gpio_pendown; |
| 101 | 101 |