ARM: OMAP: ads7846: fix pendown debounce setting
Subsystems (6)
cover ARM: OMAP: ads7846: fix pendown debounce setting
Commit 97ee9f01 (ARM: OMAP: fix the ads7846 init code) have enabled the pendown GPIO debounce time setting by the below sequence:
gpio_request_one()
gpio_set_debounce()
gpio_free()
It also revealed a bug in the OMAP GPIO handling code which prevented the GPIO debounce clock to be disabled and CORE transition to low power states.
Commit c9c55d9 (gpio/omap: fix off-mode bug: clear debounce settings on free/reset) fixes the OMAP GPIO handling code by making sure that the GPIO debounce clock gets disabled if no GPIO is requested from current bank.
While fixing the OMAP GPIO handling code (in the right way), the above commit makes the gpio_request->set_debounce->free sequence invalid as after freeing the GPIO, the debounce settings are lost.
This patch set:
1) Adds the pendown GPIO debounce time setting to the platform data structure of the ads7846 driver.
2) Fixes the OMAP platform code to pass the debounce time value to the driver instead of handling it by itself.
Igor Grinberg (2):
ads7846: enable pendown GPIO debounce time setting
ARM: OMAP: ads7846: fix pendown debounce setting
arch/arm/mach-omap2/common-board-devices.c | 34 ++++++++++++++++----------- drivers/input/touchscreen/ads7846.c | 6 ++++- include/linux/spi/ads7846.h | 5 ++- 3 files changed, 28 insertions(+), 17 deletions(-)
Signature · 1 line
1.7.3.4
PATCH 1/2 ads7846: enable pendown GPIO debounce time setting
Some platforms need the pendown GPIO debounce time setting programmed. Since the pendown GPIO is handled by the driver, the debounce time should also be handled along with the pendown GPIO request.
--- drivers/input/touchscreen/ads7846.c | 6 +++++- include/linux/spi/ads7846.h | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/input/touchscreen/ads7846.c +5 -1
@@ -955,7 +955,8 @@ static int ads7846_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); -static int __devinit ads7846_setup_pendown (struct spi_device *spi,struct ads7846 *ts) +static int __devinit ads7846_setup_pendown (struct spi_device *spi, +struct ads7846 *ts) {struct ads7846_platform_data *pdata = spi->dev.platform_data;int err;
@@ -981,6 +982,9 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 ts->gpio_pendown = pdata->gpio_pendown; +if (pdata->gpio_pendown_debounce) +gpio_set_debounce (pdata->gpio_pendown, + pdata->gpio_pendown_debounce); }else {dev_err (&spi->dev,"no get_pendown_state nor gpio_pendown?\n" );return -EINVAL ;
include/linux/spi/ads7846.h +3 -2
@@ -46,8 +46,9 @@ struct ads7846_platform_data {u16 debounce_rep;/* additional consecutive good readings * required after the first two */ int gpio_pendown;/* the GPIO used to decide the pendown -* state if get_pendown_state == NULL -*/ +* state if get_pendown_state == NULL */ +int gpio_pendown_debounce;/* platform specific debounce time for +the gpio_pendown */ int (*get_pendown_state)(void );int (*filter_init) (const struct ads7846_platform_data *pdata,void **filter_data);
Signature · 1 line
1.7.3.4
PATCH v2 1/2 ads7846: enable pendown GPIO debounce time setting
Some platforms need the pendown GPIO debounce time setting programmed. Since the pendown GPIO is handled by the driver, the debounce time should also be handled along with the pendown GPIO request.
---
v2: fix the comment style
drivers/input/touchscreen/ads7846.c | 6 +++++- include/linux/spi/ads7846.h | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/input/touchscreen/ads7846.c +5 -1
@@ -955,7 +955,8 @@ static int ads7846_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); -static int __devinit ads7846_setup_pendown (struct spi_device *spi,struct ads7846 *ts) +static int __devinit ads7846_setup_pendown (struct spi_device *spi, +struct ads7846 *ts) {struct ads7846_platform_data *pdata = spi->dev.platform_data;int err;
@@ -981,6 +982,9 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 ts->gpio_pendown = pdata->gpio_pendown; +if (pdata->gpio_pendown_debounce) +gpio_set_debounce (pdata->gpio_pendown, + pdata->gpio_pendown_debounce); }else {dev_err (&spi->dev,"no get_pendown_state nor gpio_pendown?\n" );return -EINVAL ;
include/linux/spi/ads7846.h +3 -2
@@ -46,8 +46,9 @@ struct ads7846_platform_data {u16 debounce_rep;/* additional consecutive good readings * required after the first two */ int gpio_pendown;/* the GPIO used to decide the pendown -* state if get_pendown_state == NULL -*/ +* state if get_pendown_state == NULL */ +int gpio_pendown_debounce;/* platform specific debounce time for +* the gpio_pendown */ int (*get_pendown_state)(void );int (*filter_init) (const struct ads7846_platform_data *pdata,void **filter_data);
Signature · 1 line
1.7.3.4
PATCH 2/2 ARM: OMAP: ads7846: fix pendown debounce setting
In reply to Igor GrinbergCommit 97ee9f01 (ARM: OMAP: fix the ads7846 init code) have enabled the pendown GPIO debounce time setting by the below sequence:
gpio_request_one()
gpio_set_debounce()
gpio_free()
It also revealed a bug in the OMAP GPIO handling code which prevented the GPIO debounce clock to be disabled and CORE transition to low power states.
Commit c9c55d9 (gpio/omap: fix off-mode bug: clear debounce settings on free/reset) fixes the OMAP GPIO handling code by making sure that the GPIO debounce clock gets disabled if no GPIO is requested from current bank.
While fixing the OMAP GPIO handling code (in the right way), the above commit makes the gpio_request->set_debounce->free sequence invalid as after freeing the GPIO, the debounce settings are lost.
Fix the debounce settings by moving the debounce initialization to the actual GPIO requesting code - the ads7846 driver.
--- arch/arm/mach-omap2/common-board-devices.c | 34 ++++++++++++++++----------- 1 files changed, 20 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/common-board-devices.c +20 -14
@@ -63,30 +63,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
Signature · 1 line
1.7.3.4
Tony Lindgren
maintainerPATCH 2/2 ARM: OMAP: ads7846: fix pendown debounce setting
Quoted 20 lines · Igor Grinberg
Commit
97ee9f01(ARM: OMAP: fix the ads7846 init code) have enabled the pendown GPIO debounce time setting by the below sequence:
gpio_request_one()
gpio_set_debounce()
gpio_free()It also revealed a bug in the OMAP GPIO handling code which prevented the GPIO debounce clock to be disabled and CORE transition to low power states.
Commit c9c55d9 (gpio/omap: fix off-mode bug: clear debounce settings on free/reset) fixes the OMAP GPIO handling code by making sure that the GPIO debounce clock gets disabled if no GPIO is requested from current bank.
While fixing the OMAP GPIO handling code (in the right way), the above commit makes the
gpio_request->set_debounce->freesequence invalid as after freeing the GPIO, the debounce settings are lost.
Quoted 6 lines
Fix the debounce settings by moving the debounce initialization to the actual GPIO requesting code - the ads7846 driver.
Signed-off-by Igor Grinberg <[email protected]>Cc Kevin Hilman <[email protected]>Cc Zumeng Chen <[email protected]>
Quoted 62 lines
--- arch/arm/mach-omap2/common-board-devices.c | 34 ++++++++++++++++----------- 1 files changed, 20 insertions(+), 14 deletions(-)arch/arm/mach-omap2/common-board-devices.c +20
-14@@ -63,30 +63,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 Signature · 1 line
1.7.3.4
Dmitry Torokhov
maintainercover ARM: OMAP: ads7846: fix pendown debounce setting
In reply to Igor GrinbergQuoted 26 lines · Igor Grinberg
Commit
97ee9f01(ARM: OMAP: fix the ads7846 init code) have enabled the pendown GPIO debounce time setting by the below sequence:
gpio_request_one()
gpio_set_debounce()
gpio_free()It also revealed a bug in the OMAP GPIO handling code which prevented the GPIO debounce clock to be disabled and CORE transition to low power states.
Commit c9c55d9 (gpio/omap: fix off-mode bug: clear debounce settings on free/reset) fixes the OMAP GPIO handling code by making sure that the GPIO debounce clock gets disabled if no GPIO is requested from current bank.
While fixing the OMAP GPIO handling code (in the right way), the above commit makes the
gpio_request->set_debounce->freesequence invalid as after freeing the GPIO, the debounce settings are lost.This patch set:
1) Adds the pendown GPIO debounce time setting to the platform data structure of the ads7846 driver.
2) Fixes the OMAP platform code to pass the debounce time value to the driver instead of handling it by itself.
Quoted 4 lines
Igor Grinberg (2):
ads7846: enable pendown GPIO debounce time setting
ARM: OMAP: ads7846: fix pendown debounce setting
Makes sense to me. Tony, I have some stuff to push for 3.7 final, mind if I pick OMAP change as well?
Thanks.
Signature · 1 line
Dmitry
Tony Lindgren
maintainercover ARM: OMAP: ads7846: fix pendown debounce setting
Quoted 27 lines · Dmitry Torokhov
Quoted 26 lines · Igor Grinberg
Commit
97ee9f01(ARM: OMAP: fix the ads7846 init code) have enabled the pendown GPIO debounce time setting by the below sequence:
gpio_request_one()
gpio_set_debounce()
gpio_free()It also revealed a bug in the OMAP GPIO handling code which prevented the GPIO debounce clock to be disabled and CORE transition to low power states.
Commit c9c55d9 (gpio/omap: fix off-mode bug: clear debounce settings on free/reset) fixes the OMAP GPIO handling code by making sure that the GPIO debounce clock gets disabled if no GPIO is requested from current bank.
While fixing the OMAP GPIO handling code (in the right way), the above commit makes the
gpio_request->set_debounce->freesequence invalid as after freeing the GPIO, the debounce settings are lost.This patch set:
1) Adds the pendown GPIO debounce time setting to the platform data structure of the ads7846 driver.
2) Fixes the OMAP platform code to pass the debounce time value to the driver instead of handling it by itself.
Quoted 7 lines
Quoted 4 lines
Igor Grinberg (2):
ads7846: enable pendown GPIO debounce time setting
ARM: OMAP: ads7846: fix pendown debounce settingMakes sense to me. Tony, I have some stuff to push for 3.7 final, mind if I pick OMAP change as well?
No please go ahead, I just acked the related patch.
Regards,
Tony
Dmitry Torokhov
maintainercover ARM: OMAP: ads7846: fix pendown debounce setting
Quoted 33 lines · Tony Lindgren
Quoted 32 lines · Dmitry Torokhov
Quoted 30 lines · Igor Grinberg
Commit
97ee9f01(ARM: OMAP: fix the ads7846 init code) have enabled the pendown GPIO debounce time setting by the below sequence:
gpio_request_one()
gpio_set_debounce()
gpio_free()It also revealed a bug in the OMAP GPIO handling code which prevented the GPIO debounce clock to be disabled and CORE transition to low power states.
Commit c9c55d9 (gpio/omap: fix off-mode bug: clear debounce settings on free/reset) fixes the OMAP GPIO handling code by making sure that the GPIO debounce clock gets disabled if no GPIO is requested from current bank.
While fixing the OMAP GPIO handling code (in the right way), the above commit makes the
gpio_request->set_debounce->freesequence invalid as after freeing the GPIO, the debounce settings are lost.This patch set:
1) Adds the pendown GPIO debounce time setting to the platform data structure of the ads7846 driver.
2) Fixes the OMAP platform code to pass the debounce time value to the driver instead of handling it by itself.Igor Grinberg (2):
ads7846: enable pendown GPIO debounce time setting
ARM: OMAP: ads7846: fix pendown debounce setting
Quoted 4 lines
Quoted 2 lines
Makes sense to me. Tony, I have some stuff to push for 3.7 final, mind if I pick OMAP change as well?
No please go ahead, I just acked the related patch.
Thanks Tony.
Signature · 1 line
Dmitry