Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 335909
b: refs/heads/master
c: 0a0d628
h: refs/heads/master
i:
  335907: 48dc184
v: v3
  • Loading branch information
Igor Grinberg authored and Dmitry Torokhov committed Nov 21, 2012
1 parent ff2a37a commit 1f629ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c4f4925439f13a243aecfb36c693613603c0bfbd
refs/heads/master: 0a0d62857366d8a6531e7fed1c3ccdd9a2b5b40b
34 changes: 20 additions & 14 deletions trunk/arch/arm/mach-omap2/common-board-devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,36 @@ 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_one(gpio_pendown, GPIOF_IN, "TSPenDown");
if (err) {
pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
return;
}
/*
* If a board defines get_pendown_state() function, request the pendown
* GPIO and set the GPIO debounce time.
* If a board does not define the get_pendown_state() function, then
* the ads7846 driver will setup the pendown GPIO itself.
*/
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;
}

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

gpio_export(gpio_pendown, 0);
}

spi_bi->bus_num = bus_num;
spi_bi->irq = gpio_to_irq(gpio_pendown);

ads7846_config.gpio_pendown = gpio_pendown;

if (board_pdata) {
board_pdata->gpio_pendown = gpio_pendown;
board_pdata->gpio_pendown_debounce = gpio_debounce;
spi_bi->platform_data = board_pdata;
if (board_pdata->get_pendown_state)
gpio_export(gpio_pendown, 0);
} else {
ads7846_config.gpio_pendown = gpio_pendown;
}

if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
gpio_free(gpio_pendown);

spi_register_board_info(&ads7846_spi_board_info, 1);
}
#else
Expand Down

0 comments on commit 1f629ca

Please sign in to comment.