Skip to contentSkip to conversation

Input: ads7846 - configure pendown gpio as input

PATCH New Sourav Poddar 4 participants 7 messages Feb 3, 2011

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

PATCH v2 2/2 Input: ads7846 - configure pendown gpio as input

The ads7846 driver requests a gpio to detect pendown events, but does not configure its direction. Configure this gpio as an input after requesting it.

---
changes between v2 and v1: Added return error support in v2.

drivers/input/touchscreen/ads7846.c | 7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ads7846.c +7 -0
index 036f245..f30768b 100644
@@ -962,6 +962,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 		return err;
 	}
 
+	err = gpio_direction_input(pdata->gpio_pendown);
+	if (err) {
+		dev_err(&spi->dev, "failed to configure pendown GPIO input direction %d\n",
+			pdata->gpio_pendown);
+		return err;
+        }
+
 	ts->gpio_pendown = pdata->gpio_pendown;
 
 	return 0;
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 2/2 Input: ads7846 - configure pendown gpio as input

Quoted 16 lines · Sourav Poddar

The ads7846 driver requests a gpio to detect pendown events, but does not configure its direction. Configure this gpio as an input after requesting it.

---
changes between v2 and v1: Added return error support in v2.

drivers/input/touchscreen/ads7846.c | 7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ads7846.c +0 -0
index 036f245..f30768b 100644

drivers/input/touchscreen/ads7846.c static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 · line 969

Quoted 8 lines
drivers/input/touchscreen/ads7846.c +5 -0
@@ -962,6 +962,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 		return err;
 	}
 
+	err = gpio_direction_input(pdata->gpio_pendown);
+	if (err) {
+		dev_err(&spi->dev, "failed to configure pendown GPIO input direction %d\n",
+			pdata->gpio_pendown);
+		return err;

and now you miss a gpio_free().

Signature · 1 line
balbi
#2 lore raw

PATCH v2 2/2 Input: ads7846 - configure pendown gpio as input

Sourav,

Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Sourav Poddar

The ads7846 driver requests a gpio to detect pendown events, but does not configure its direction. Configure this gpio as an input after requesting it.

---
changes between v2 and v1: Added return error support in v2.

drivers/input/touchscreen/ads7846.c | ? ?7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ads7846.c +0 -0
index 036f245..f30768b 100644
@@ -962,6 +962,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 ? ? ? ? ? ? ? return err;
 ? ? ? }
 
Quoted 7 lines

drivers/input/touchscreen/ads7846.c static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 · line 969

Quoted 5 lines
drivers/input/touchscreen/ads7846.c +5 -0
+ ? ? err = gpio_direction_input(pdata->gpio_pendown);
+ ? ? if (err) {
+ ? ? ? ? ? ? dev_err(&spi->dev, "failed to configure pendown GPIO input direction %d\n",
+ ? ? ? ? ? ? ? ? ? ? pdata->gpio_pendown);
+ ? ? ? ? ? ? return err;

and now you miss a gpio_free().

My question to your previous version is still unanswered. Would it be relevant to add gpio_set_debounce() for this gpio?

#3 lore raw

PATCH v2 2/2 Input: ads7846 - configure pendown gpio as input

Quoted 31 lines · Charulatha

Sourav,

Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Sourav Poddar

The ads7846 driver requests a gpio to detect pendown events, but does not configure its direction. Configure this gpio as an input after requesting it.

---
changes between v2 and v1: Added return error support in v2.

drivers/input/touchscreen/ads7846.c | ? ?7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ads7846.c +0 -0
index 036f245..f30768b 100644
@@ -962,6 +962,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 ? ? ? ? ? ? ? return err;
 ? ? ? }
 
Quoted 7 lines

drivers/input/touchscreen/ads7846.c static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 · line 969

Quoted 5 lines
drivers/input/touchscreen/ads7846.c +5 -0
+ ? ? err = gpio_direction_input(pdata->gpio_pendown);
+ ? ? if (err) {
+ ? ? ? ? ? ? dev_err(&spi->dev, "failed to configure pendown GPIO input direction %d\n",
+ ? ? ? ? ? ? ? ? ? ? pdata->gpio_pendown);
+ ? ? ? ? ? ? return err;

and now you miss a gpio_free().

Quoted 4 lines

My question to your previous version is still unanswered. Would it be relevant to add gpio_set_debounce() for this gpio?

I was also wondering that.I too think that just a request and then an configuring direction would do.But,I am not so sure about this one.

#4 lore raw

PATCH v2 2/2 Input: ads7846 - configure pendown gpio as input

In reply to Felipe Balbi
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Sourav Poddar

The ads7846 driver requests a gpio to detect pendown events, but does not configure its direction. Configure this gpio as an input after requesting it.

---
changes between v2 and v1: Added return error support in v2.

drivers/input/touchscreen/ads7846.c | 7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ads7846.c +0 -0
index 036f245..f30768b 100644
@@ -962,6 +962,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 		return err;
 	}
 
Quoted 7 lines

drivers/input/touchscreen/ads7846.c static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 · line 969

Quoted 5 lines
drivers/input/touchscreen/ads7846.c +5 -0
+	err = gpio_direction_input(pdata->gpio_pendown);
+	if (err) {
+		dev_err(&spi->dev, "failed to configure pendown GPIO input direction %d\n",
+			pdata->gpio_pendown);
+		return err;

and now you miss a gpio_free().

Better use gpio_request_one()?

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110203/1d4304b4/attachment.sig>
#5 lore raw

PATCH v2 2/2 Input: ads7846 - configure pendown gpio as input

Quoted 29 lines · Wolfram Sang
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Sourav Poddar

The ads7846 driver requests a gpio to detect pendown events, but does not configure its direction. Configure this gpio as an input after requesting it.

---
changes between v2 and v1: Added return error support in v2.

drivers/input/touchscreen/ads7846.c | 7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ads7846.c +0 -0
index 036f245..f30768b 100644
@@ -962,6 +962,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 		return err;
 	}
 
Quoted 7 lines

drivers/input/touchscreen/ads7846.c static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 · line 969

Quoted 5 lines
drivers/input/touchscreen/ads7846.c +5 -0
+	err = gpio_direction_input(pdata->gpio_pendown);
+	if (err) {
+		dev_err(&spi->dev, "failed to configure pendown GPIO input direction %d\n",
+			pdata->gpio_pendown);
+		return err;

and now you miss a gpio_free().

Quoted 1 line

Better use gpio_request_one()?

Why not ?!? I'm not sure if $SUBJECT is the best for that though.

Signature · 1 line
balbi
#6 lore raw

PATCH v2 2/2 Input: ads7846 - configure pendown gpio as input

In reply to Wolfram Sang
Quoted 29 lines · Wolfram Sang
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Sourav Poddar

The ads7846 driver requests a gpio to detect pendown events, but does not configure its direction. Configure this gpio as an input after requesting it.

---
changes between v2 and v1: Added return error support in v2.

drivers/input/touchscreen/ads7846.c | ? ?7 +++++++

1 files changed, 7 insertions(+), 0 deletions(-)
drivers/input/touchscreen/ads7846.c +0 -0
index 036f245..f30768b 100644
@@ -962,6 +962,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 ? ? ? ? ? ? return err;
 ? ? }
 
Quoted 7 lines

drivers/input/touchscreen/ads7846.c static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784 · line 969

Quoted 5 lines
drivers/input/touchscreen/ads7846.c +5 -0
+ ? err = gpio_direction_input(pdata->gpio_pendown);
+ ? if (err) {
+ ? ? ? ? ? dev_err(&spi->dev, "failed to configure pendown GPIO input direction %d\n",
+ ? ? ? ? ? ? ? ? ? pdata->gpio_pendown);
+ ? ? ? ? ? return err;

and now you miss a gpio_free().

Quoted 1 line

Better use gpio_request_one()?

Totally agreed,using gpio_request_one seems to be the better option. Will post a patch for it.