* [PATCH] input: ads7846: fix gpio_pendown configuration
@ 2011-05-03 16:02 Igor Grinberg
2011-05-03 16:18 ` Dmitry Torokhov
0 siblings, 1 reply; 6+ messages in thread
From: Igor Grinberg @ 2011-05-03 16:02 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Igor Grinberg
The pendown gpio was requested but not configured for input.
Request and configure it in one shot.
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
drivers/input/touchscreen/ads7846.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index c24946f..bf067aa 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -956,7 +956,8 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
ts->get_pendown_state = pdata->get_pendown_state;
} else if (gpio_is_valid(pdata->gpio_pendown)) {
- err = gpio_request(pdata->gpio_pendown, "ads7846_pendown");
+ err = gpio_request_one(pdata->gpio_pendown, GPIOF_IN,
+ "ads7846_pendown");
if (err) {
dev_err(&spi->dev, "failed to request pendown GPIO%d\n",
pdata->gpio_pendown);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] input: ads7846: fix gpio_pendown configuration
2011-05-03 16:02 [PATCH] input: ads7846: fix gpio_pendown configuration Igor Grinberg
@ 2011-05-03 16:18 ` Dmitry Torokhov
2011-05-04 6:42 ` Igor Grinberg
0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2011-05-03 16:18 UTC (permalink / raw)
To: Igor Grinberg; +Cc: linux-input
On Tue, May 03, 2011 at 07:02:53PM +0300, Igor Grinberg wrote:
> The pendown gpio was requested but not configured for input.
> Request and configure it in one shot.
>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
There is no significant change from the previos version of the patch by
Sourav Poddar that I tried to apply and had to revert. Does it compile
if !CONFIG_GENERIC_GPIO?
> ---
> drivers/input/touchscreen/ads7846.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index c24946f..bf067aa 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -956,7 +956,8 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
> ts->get_pendown_state = pdata->get_pendown_state;
> } else if (gpio_is_valid(pdata->gpio_pendown)) {
>
> - err = gpio_request(pdata->gpio_pendown, "ads7846_pendown");
> + err = gpio_request_one(pdata->gpio_pendown, GPIOF_IN,
> + "ads7846_pendown");
> if (err) {
> dev_err(&spi->dev, "failed to request pendown GPIO%d\n",
> pdata->gpio_pendown);
> --
> 1.7.3.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] input: ads7846: fix gpio_pendown configuration
2011-05-03 16:18 ` Dmitry Torokhov
@ 2011-05-04 6:42 ` Igor Grinberg
2011-05-05 16:13 ` Dmitry Torokhov
0 siblings, 1 reply; 6+ messages in thread
From: Igor Grinberg @ 2011-05-04 6:42 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
On 05/03/11 19:18, Dmitry Torokhov wrote:
> On Tue, May 03, 2011 at 07:02:53PM +0300, Igor Grinberg wrote:
>> The pendown gpio was requested but not configured for input.
>> Request and configure it in one shot.
>>
>> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> There is no significant change from the previos version of the patch by
> Sourav Poddar that I tried to apply and had to revert. Does it compile
> if !CONFIG_GENERIC_GPIO?
shout!?!? It has been just several month we had this discussion,
but I've completely forgot it took place... shame on me...
Back to business, either way, the gpio direction must be configured
before accessing the gpio.
I can propose two solutions to this:
1) ads7846 relies on gpio subsystem, so add depend on
CONFIG_GENERIC_GPIO to Kconfig ads7846 entry.
2) just don't use gpio_request_one(),
but gpio_request() and then gpio_direction_input().
Logic behind 1 is that platforms that don't use CONFIG_GENERIC_GPIO
most likely don't use ads7846. Anybody know of such platform?
The second one is less intrusive and more local, but will do the job.
What do you think is more preferable?
>> ---
>> drivers/input/touchscreen/ads7846.c | 3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>> index c24946f..bf067aa 100644
>> --- a/drivers/input/touchscreen/ads7846.c
>> +++ b/drivers/input/touchscreen/ads7846.c
>> @@ -956,7 +956,8 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>> ts->get_pendown_state = pdata->get_pendown_state;
>> } else if (gpio_is_valid(pdata->gpio_pendown)) {
>>
>> - err = gpio_request(pdata->gpio_pendown, "ads7846_pendown");
>> + err = gpio_request_one(pdata->gpio_pendown, GPIOF_IN,
>> + "ads7846_pendown");
>> if (err) {
>> dev_err(&spi->dev, "failed to request pendown GPIO%d\n",
>> pdata->gpio_pendown);
>> --
>> 1.7.3.4
>>
--
Regards,
Igor.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] input: ads7846: fix gpio_pendown configuration
2011-05-04 6:42 ` Igor Grinberg
@ 2011-05-05 16:13 ` Dmitry Torokhov
2011-05-08 8:44 ` [PATCH v2] " Igor Grinberg
0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2011-05-05 16:13 UTC (permalink / raw)
To: Igor Grinberg; +Cc: linux-input
On Wed, May 04, 2011 at 09:42:32AM +0300, Igor Grinberg wrote:
> On 05/03/11 19:18, Dmitry Torokhov wrote:
>
> > On Tue, May 03, 2011 at 07:02:53PM +0300, Igor Grinberg wrote:
> >> The pendown gpio was requested but not configured for input.
> >> Request and configure it in one shot.
> >>
> >> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> > There is no significant change from the previos version of the patch by
> > Sourav Poddar that I tried to apply and had to revert. Does it compile
> > if !CONFIG_GENERIC_GPIO?
>
> shout!?!? It has been just several month we had this discussion,
> but I've completely forgot it took place... shame on me...
>
> Back to business, either way, the gpio direction must be configured
> before accessing the gpio.
> I can propose two solutions to this:
> 1) ads7846 relies on gpio subsystem, so add depend on
> CONFIG_GENERIC_GPIO to Kconfig ads7846 entry.
> 2) just don't use gpio_request_one(),
> but gpio_request() and then gpio_direction_input().
>
> Logic behind 1 is that platforms that don't use CONFIG_GENERIC_GPIO
> most likely don't use ads7846. Anybody know of such platform?
> The second one is less intrusive and more local, but will do the job.
>
> What do you think is more preferable?
I'd prefer adding gpio_direction_input(). While I do not know of
instances where ads7846 is used without CONFIG_GENERIC_GPIO it does not
mean they do not exist.
Thanks,
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] input: ads7846: fix gpio_pendown configuration
2011-05-05 16:13 ` Dmitry Torokhov
@ 2011-05-08 8:44 ` Igor Grinberg
2011-05-11 22:44 ` Dmitry Torokhov
0 siblings, 1 reply; 6+ messages in thread
From: Igor Grinberg @ 2011-05-08 8:44 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Igor Grinberg
The pendown gpio was requested but not configured for input.
Configure it for input.
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
v2: add a separate gpio_direction_input() call
instead of a single gpio_request_one() call
so the driver will compile with !CONFIG_GENERIC_GPIO
drivers/input/touchscreen/ads7846.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 1de1c19..886ec55 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -969,6 +969,13 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
pdata->gpio_pendown);
return err;
}
+ err = gpio_direction_input(pdata->gpio_pendown);
+ if (err) {
+ dev_err(&spi->dev, "failed to setup pendown GPIO%d\n",
+ pdata->gpio_pendown);
+ gpio_free(pdata->gpio_pendown);
+ return err;
+ }
ts->gpio_pendown = pdata->gpio_pendown;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] input: ads7846: fix gpio_pendown configuration
2011-05-08 8:44 ` [PATCH v2] " Igor Grinberg
@ 2011-05-11 22:44 ` Dmitry Torokhov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2011-05-11 22:44 UTC (permalink / raw)
To: Igor Grinberg; +Cc: linux-input
On Sun, May 08, 2011 at 11:44:50AM +0300, Igor Grinberg wrote:
> The pendown gpio was requested but not configured for input.
> Configure it for input.
>
Applied, thanks Igor.
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-11 22:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-03 16:02 [PATCH] input: ads7846: fix gpio_pendown configuration Igor Grinberg
2011-05-03 16:18 ` Dmitry Torokhov
2011-05-04 6:42 ` Igor Grinberg
2011-05-05 16:13 ` Dmitry Torokhov
2011-05-08 8:44 ` [PATCH v2] " Igor Grinberg
2011-05-11 22:44 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).