Skip to contentSkip to conversation

arm: omap2plus: fix ads7846 pendown gpio request

PATCH New Igor Grinberg 3 participants 5 messages May 4, 2011 – May 31, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 arch/arm/mach-omap2/common-board-devices.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/common-board-devices.c +10 -10
index d57c71d..61fee80 100644
@@ -83,17 +83,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;
 
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 arm: omap2plus: fix ads7846 pendown gpio request

Am 04.05.2011 17:04, schrieb Igor Grinberg:

Quoted 40 lines

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.

---
  arch/arm/mach-omap2/common-board-devices.c |   20 ++++++++++----------
  1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/common-board-devices.c +6 -8
index d57c71d..61fee80 100644
@@ -83,17 +83,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;
+		}

arch/arm/mach-omap2/common-board-devices.c void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, · line 99

Quoted 10 lines
arch/arm/mach-omap2/common-board-devices.c +4 -2
+		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;
 

On Devkit8000.

Thanks.

Thomas

#2 lore raw

PATCH 1/1 arm: omap2plus: fix ads7846 pendown gpio request

Tony,

You can fold this one to the original patch from Mike as well,

or do you want it into the rc1?

Quoted 55 lines · Thomas Weber

Am 04.05.2011 17:04, schrieb Igor Grinberg:

Quoted 40 lines

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.

---
  arch/arm/mach-omap2/common-board-devices.c |   20 ++++++++++----------
  1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/common-board-devices.c +6 -8
index d57c71d..61fee80 100644
@@ -83,17 +83,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;
+        }

arch/arm/mach-omap2/common-board-devices.c void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, · line 99

Quoted 10 lines
arch/arm/mach-omap2/common-board-devices.c +4 -2
+        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;
 

On Devkit8000.

Signature · 2 lines
Regards,
Igor.
#3 lore raw

PATCH 1/1 arm: omap2plus: fix ads7846 pendown gpio request

ping

Quoted 66 lines · Igor Grinberg

Tony,

You can fold this one to the original patch from Mike as well,

or do you want it into the rc1?

Quoted 55 lines · Thomas Weber

Am 04.05.2011 17:04, schrieb Igor Grinberg:

Quoted 40 lines

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.

---
  arch/arm/mach-omap2/common-board-devices.c |   20 ++++++++++----------
  1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/common-board-devices.c +6 -8
index d57c71d..61fee80 100644
@@ -83,17 +83,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;
+        }

arch/arm/mach-omap2/common-board-devices.c void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, · line 99

Quoted 10 lines
arch/arm/mach-omap2/common-board-devices.c +4 -2
+        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;
 

On Devkit8000.

Signature · 2 lines
Regards,
Igor.
maintainer
#4 lore raw

PATCH 1/1 arm: omap2plus: fix ads7846 pendown gpio request

Quoted 10 lines · Igor Grinberg

ping

Quoted 6 lines · Igor Grinberg

Tony,

You can fold this one to the original patch from Mike as well,

or do you want it into the rc1?

Thanks adding to fixes.

Tony

Quoted 65 lines
Quoted 60 lines · Thomas Weber
Quoted 56 lines

Am 04.05.2011 17:04, schrieb Igor Grinberg:

Quoted 40 lines

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.

---
  arch/arm/mach-omap2/common-board-devices.c |   20 ++++++++++----------
  1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/common-board-devices.c +6 -8
index d57c71d..61fee80 100644
@@ -83,17 +83,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;
+        }

arch/arm/mach-omap2/common-board-devices.c void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, · line 99

Quoted 10 lines
arch/arm/mach-omap2/common-board-devices.c +4 -2
+        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;
 

On Devkit8000.

Signature · 2 lines
Regards,
Igor.