All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
@ 2012-11-19 16:03 ` Igor Grinberg
  0 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 16:03 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov
  Cc: Kevin Hilman, linux-input, linux-omap, linux-arm-kernel, 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->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(-)

-- 
1.7.3.4


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
@ 2012-11-19 16:03 ` Igor Grinberg
  0 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

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(-)

-- 
1.7.3.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] ads7846: enable pendown GPIO debounce time setting
  2012-11-19 16:03 ` Igor Grinberg
@ 2012-11-19 16:03   ` Igor Grinberg
  -1 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 16:03 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov
  Cc: Kevin Hilman, linux-input, linux-omap, linux-arm-kernel, Igor Grinberg

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.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 drivers/input/touchscreen/ads7846.c |    6 +++++-
 include/linux/spi/ads7846.h         |    5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index f02028e..78e5d9a 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -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;
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index c64de9d..2e94187 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -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);
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 1/2] ads7846: enable pendown GPIO debounce time setting
@ 2012-11-19 16:03   ` Igor Grinberg
  0 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 drivers/input/touchscreen/ads7846.c |    6 +++++-
 include/linux/spi/ads7846.h         |    5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index f02028e..78e5d9a 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -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;
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index c64de9d..2e94187 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -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);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] ARM: OMAP: ads7846: fix pendown debounce setting
  2012-11-19 16:03 ` Igor Grinberg
@ 2012-11-19 16:03   ` Igor Grinberg
  -1 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 16:03 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov
  Cc: Kevin Hilman, linux-input, linux-omap, linux-arm-kernel,
	Igor Grinberg, Zumeng Chen

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.

Fix the debounce settings by moving the debounce initialization to the
actual GPIO requesting code - the ads7846 driver.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Zumeng Chen <zumeng.chen@windriver.com>
---
 arch/arm/mach-omap2/common-board-devices.c |   34 ++++++++++++++++-----------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index ad85609..d246efd 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -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
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] ARM: OMAP: ads7846: fix pendown debounce setting
@ 2012-11-19 16:03   ` Igor Grinberg
  0 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Fix the debounce settings by moving the debounce initialization to the
actual GPIO requesting code - the ads7846 driver.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Zumeng Chen <zumeng.chen@windriver.com>
---
 arch/arm/mach-omap2/common-board-devices.c |   34 ++++++++++++++++-----------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index ad85609..d246efd 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -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
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 1/2] ads7846: enable pendown GPIO debounce time setting
  2012-11-19 16:03   ` Igor Grinberg
@ 2012-11-19 17:01     ` Igor Grinberg
  -1 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 17:01 UTC (permalink / raw)
  To: Tony Lindgren, Dmitry Torokhov
  Cc: Kevin Hilman, linux-input, linux-omap, linux-arm-kernel, Igor Grinberg

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.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
v2: fix the comment style

 drivers/input/touchscreen/ads7846.c |    6 +++++-
 include/linux/spi/ads7846.h         |    5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index f02028e..78e5d9a 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -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;
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index c64de9d..2f694f3 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -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);
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 1/2] ads7846: enable pendown GPIO debounce time setting
@ 2012-11-19 17:01     ` Igor Grinberg
  0 siblings, 0 replies; 16+ messages in thread
From: Igor Grinberg @ 2012-11-19 17:01 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
v2: fix the comment style

 drivers/input/touchscreen/ads7846.c |    6 +++++-
 include/linux/spi/ads7846.h         |    5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index f02028e..78e5d9a 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -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;
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index c64de9d..2f694f3 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -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);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
  2012-11-19 16:03 ` Igor Grinberg
@ 2012-11-20  8:21   ` Dmitry Torokhov
  -1 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2012-11-20  8:21 UTC (permalink / raw)
  To: Igor Grinberg
  Cc: Tony Lindgren, Kevin Hilman, linux-input, linux-omap, linux-arm-kernel

On Mon, Nov 19, 2012 at 06:03:56PM +0200, Igor Grinberg wrote:
> 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
> 

Makes sense to me. Tony, I have some stuff to push for 3.7 final, mind
if I pick OMAP change as well?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
@ 2012-11-20  8:21   ` Dmitry Torokhov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2012-11-20  8:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 19, 2012 at 06:03:56PM +0200, Igor Grinberg wrote:
> 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
> 

Makes sense to me. Tony, I have some stuff to push for 3.7 final, mind
if I pick OMAP change as well?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] ARM: OMAP: ads7846: fix pendown debounce setting
  2012-11-19 16:03   ` Igor Grinberg
@ 2012-11-21 19:08     ` Tony Lindgren
  -1 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2012-11-21 19:08 UTC (permalink / raw)
  To: Igor Grinberg
  Cc: Dmitry Torokhov, Kevin Hilman, linux-input, linux-omap,
	linux-arm-kernel, Zumeng Chen

* Igor Grinberg <grinberg@compulab.co.il> [121119 08:06]:
> 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.
> 
> Fix the debounce settings by moving the debounce initialization to the
> actual GPIO requesting code - the ads7846 driver.
> 
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Zumeng Chen <zumeng.chen@windriver.com>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/mach-omap2/common-board-devices.c |   34 ++++++++++++++++-----------
>  1 files changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
> index ad85609..d246efd 100644
> --- a/arch/arm/mach-omap2/common-board-devices.c
> +++ b/arch/arm/mach-omap2/common-board-devices.c
> @@ -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
> -- 
> 1.7.3.4
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/2] ARM: OMAP: ads7846: fix pendown debounce setting
@ 2012-11-21 19:08     ` Tony Lindgren
  0 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2012-11-21 19:08 UTC (permalink / raw)
  To: linux-arm-kernel

* Igor Grinberg <grinberg@compulab.co.il> [121119 08:06]:
> 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.
> 
> Fix the debounce settings by moving the debounce initialization to the
> actual GPIO requesting code - the ads7846 driver.
> 
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> Cc: Kevin Hilman <khilman@ti.com>
> Cc: Zumeng Chen <zumeng.chen@windriver.com>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/mach-omap2/common-board-devices.c |   34 ++++++++++++++++-----------
>  1 files changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
> index ad85609..d246efd 100644
> --- a/arch/arm/mach-omap2/common-board-devices.c
> +++ b/arch/arm/mach-omap2/common-board-devices.c
> @@ -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
> -- 
> 1.7.3.4
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
  2012-11-20  8:21   ` Dmitry Torokhov
@ 2012-11-21 19:09     ` Tony Lindgren
  -1 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2012-11-21 19:09 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Igor Grinberg, Kevin Hilman, linux-input, linux-omap, linux-arm-kernel

* Dmitry Torokhov <dmitry.torokhov@gmail.com> [121120 00:23]:
> On Mon, Nov 19, 2012 at 06:03:56PM +0200, Igor Grinberg wrote:
> > 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
> > 
> 
> 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.

Regards,

Tony

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
@ 2012-11-21 19:09     ` Tony Lindgren
  0 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2012-11-21 19:09 UTC (permalink / raw)
  To: linux-arm-kernel

* Dmitry Torokhov <dmitry.torokhov@gmail.com> [121120 00:23]:
> On Mon, Nov 19, 2012 at 06:03:56PM +0200, Igor Grinberg wrote:
> > 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
> > 
> 
> 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.

Regards,

Tony

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
  2012-11-21 19:09     ` Tony Lindgren
@ 2012-11-21 20:55       ` Dmitry Torokhov
  -1 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2012-11-21 20:55 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Igor Grinberg, Kevin Hilman, linux-input, linux-omap, linux-arm-kernel

On Wed, Nov 21, 2012 at 11:09:30AM -0800, Tony Lindgren wrote:
> * Dmitry Torokhov <dmitry.torokhov@gmail.com> [121120 00:23]:
> > On Mon, Nov 19, 2012 at 06:03:56PM +0200, Igor Grinberg wrote:
> > > 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
> > > 
> > 
> > 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.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting
@ 2012-11-21 20:55       ` Dmitry Torokhov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2012-11-21 20:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 21, 2012 at 11:09:30AM -0800, Tony Lindgren wrote:
> * Dmitry Torokhov <dmitry.torokhov@gmail.com> [121120 00:23]:
> > On Mon, Nov 19, 2012 at 06:03:56PM +0200, Igor Grinberg wrote:
> > > 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
> > > 
> > 
> > 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.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-11-21 20:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-19 16:03 [PATCH 0/2] ARM: OMAP: ads7846: fix pendown debounce setting Igor Grinberg
2012-11-19 16:03 ` Igor Grinberg
2012-11-19 16:03 ` [PATCH 1/2] ads7846: enable pendown GPIO debounce time setting Igor Grinberg
2012-11-19 16:03   ` Igor Grinberg
2012-11-19 17:01   ` [PATCH v2 " Igor Grinberg
2012-11-19 17:01     ` Igor Grinberg
2012-11-19 16:03 ` [PATCH 2/2] ARM: OMAP: ads7846: fix pendown debounce setting Igor Grinberg
2012-11-19 16:03   ` Igor Grinberg
2012-11-21 19:08   ` Tony Lindgren
2012-11-21 19:08     ` Tony Lindgren
2012-11-20  8:21 ` [PATCH 0/2] " Dmitry Torokhov
2012-11-20  8:21   ` Dmitry Torokhov
2012-11-21 19:09   ` Tony Lindgren
2012-11-21 19:09     ` Tony Lindgren
2012-11-21 20:55     ` Dmitry Torokhov
2012-11-21 20:55       ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.