linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: zonque@gmail.com (Daniel Mack)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] ARM: pxa remove irq_to_gpio from eeti_ts driver
Date: Wed, 08 Aug 2012 16:22:13 +0200	[thread overview]
Message-ID: <50227615.1090907@gmail.com> (raw)
In-Reply-To: <201208081419.17181.arnd@arndb.de>

On 08.08.2012 16:19, Arnd Bergmann wrote:
> On Wednesday 08 August 2012, Daniel Mack wrote:
>> On 08.08.2012 14:54, Arnd Bergmann wrote:
>>> The irq_to_gpio function was removed from the pxa platform
>>> in linux-3.2, and this driver has been broken since.
>>>
>>> Without this patch, building raumfeld_defconfig results in:
>>>
>>> drivers/input/touchscreen/eeti_ts.c: In function 'eeti_ts_irq_active':
>>> drivers/input/touchscreen/eeti_ts.c:65:2: error: implicit declaration of function 'irq_to_gpio' [-Werror=implicit-function-declaration]
>>
>> I've sent out a slightly different version of such a patch just
>> yesterday. It deferres mainly in the fact that it uses gpio_to_irq() and
>> ignores the i2c_client's irq line. That way, there can't be any
>> inconsitency.
>>
>> I've appended the patch again - I haven't heard back from Dmitry yet.
>>
> 
> I've taken your patch instead now, 

Will that go to some other tree than linux-input now?

> because contains the gpio_request_one
> call that I was missing and you sent it before me, but I also noticed
> that you forgot to change arch/arm/mach-pxa/raumfeld.c along with the
> driver. I've put that in there as well now. If Dmitry wants to take this
> patch, I'll drop it from my tree, otherwise I'll send it myself.

Forget about that raumfeld.c part for now. I'm in the process of
replacing all that code with DT bindings and wanted to avoid updates to
that code :)

Btw - I have a patch ready that adds eeti_ts DT bindings. I would submit
that once Dmitry (or you) has taken the other one.



Daniel


> 8<-----
> From a919cfbeb9441f5058feec8f790ef90d9299a448 Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Mon, 30 Apr 2012 16:21:37 +0000
> Subject: [PATCH] Input: eeti_ts: pass gpio value instead of IRQ
> 
> The EETI touchscreen asserts its IRQ line as soon as it has data in its
> internal buffers. The line is automatically deasserted once all data has
> been read via I2C. Hence, the driver has to monitor the GPIO line and
> cannot simply rely on the interrupt handler reception.
> 
> In the current implementation of the driver, irq_to_gpio() is used to
> determine the GPIO number from the i2c_client's IRQ value.
> 
> As irq_to_gpio() is not available on all platforms, this patch changes
> this and makes the driver ignore the passed in IRQ. Instead, a GPIO is
> added to the platform_data struct and gpio_to_irq is used to derive the
> IRQ from that GPIO. If this fails, bail out. The driver is only able to
> work in environments where the touchscreen GPIO can be mapped to an
> IRQ.
> 
> Without this patch, building raumfeld_defconfig results in:
> 
> drivers/input/touchscreen/eeti_ts.c: In function 'eeti_ts_irq_active':
> drivers/input/touchscreen/eeti_ts.c:65:2: error: implicit declaration of function 'irq_to_gpio' [-Werror=implicit-function-declaration]
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: stable at vger.kernel.org (v3.2+)
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Sven Neumann <s.neumann@raumfeld.com>
> Cc: linux-input at vger.kernel.org
> Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
> 
> diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
> index 5905ed1..d89d87ae 100644
> --- a/arch/arm/mach-pxa/raumfeld.c
> +++ b/arch/arm/mach-pxa/raumfeld.c
> @@ -953,12 +953,12 @@ static struct i2c_board_info raumfeld_connector_i2c_board_info __initdata = {
>  
>  static struct eeti_ts_platform_data eeti_ts_pdata = {
>  	.irq_active_high = 1,
> +	.irq_gpio = GPIO_TOUCH_IRQ,
>  };
>  
>  static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
>  	.type	= "eeti_ts",
>  	.addr	= 0x0a,
> -	.irq	= PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ),
>  	.platform_data = &eeti_ts_pdata,
>  };
>  
> diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
> index 503c709..908407e 100644
> --- a/drivers/input/touchscreen/eeti_ts.c
> +++ b/drivers/input/touchscreen/eeti_ts.c
> @@ -48,7 +48,7 @@ struct eeti_ts_priv {
>  	struct input_dev *input;
>  	struct work_struct work;
>  	struct mutex mutex;
> -	int irq, irq_active_high;
> +	int irq_gpio, irq, irq_active_high;
>  };
>  
>  #define EETI_TS_BITDEPTH	(11)
> @@ -62,7 +62,7 @@ struct eeti_ts_priv {
>  
>  static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv)
>  {
> -	return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high;
> +	return gpio_get_value(priv->irq_gpio) == priv->irq_active_high;
>  }
>  
>  static void eeti_ts_read(struct work_struct *work)
> @@ -157,7 +157,7 @@ static void eeti_ts_close(struct input_dev *dev)
>  static int __devinit eeti_ts_probe(struct i2c_client *client,
>  				   const struct i2c_device_id *idp)
>  {
> -	struct eeti_ts_platform_data *pdata;
> +	struct eeti_ts_platform_data *pdata = client->dev.platform_data;
>  	struct eeti_ts_priv *priv;
>  	struct input_dev *input;
>  	unsigned int irq_flags;
> @@ -199,9 +199,12 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
>  
>  	priv->client = client;
>  	priv->input = input;
> -	priv->irq = client->irq;
> +	priv->irq_gpio = pdata->irq_gpio;
> +	priv->irq = gpio_to_irq(pdata->irq_gpio);
>  
> -	pdata = client->dev.platform_data;
> +	err = gpio_request_one(pdata->irq_gpio, GPIOF_IN, client->name);
> +	if (err < 0)
> +		goto err1;
>  
>  	if (pdata)
>  		priv->irq_active_high = pdata->irq_active_high;
> @@ -215,13 +218,13 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
>  
>  	err = input_register_device(input);
>  	if (err)
> -		goto err1;
> +		goto err2;
>  
>  	err = request_irq(priv->irq, eeti_ts_isr, irq_flags,
>  			  client->name, priv);
>  	if (err) {
>  		dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
> -		goto err2;
> +		goto err3;
>  	}
>  
>  	/*
> @@ -233,9 +236,11 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
>  	device_init_wakeup(&client->dev, 0);
>  	return 0;
>  
> -err2:
> +err3:
>  	input_unregister_device(input);
>  	input = NULL; /* so we dont try to free it below */
> +err2:
> +	gpio_free(pdata->irq_gpio);
>  err1:
>  	input_free_device(input);
>  	kfree(priv);
> diff --git a/include/linux/input/eeti_ts.h b/include/linux/input/eeti_ts.h
> index f875b31..16625d7 100644
> --- a/include/linux/input/eeti_ts.h
> +++ b/include/linux/input/eeti_ts.h
> @@ -2,6 +2,7 @@
>  #define LINUX_INPUT_EETI_TS_H
>  
>  struct eeti_ts_platform_data {
> +	int irq_gpio;
>  	unsigned int irq_active_high;
>  };
>  
> 

  reply	other threads:[~2012-08-08 14:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08 12:54 [PATCH 0/6] ARM: defconfig build errors Arnd Bergmann
2012-08-08 12:54 ` [PATCH 1/6] ARM: pxa: remove irq_to_gpio from ezx-pcap driver Arnd Bergmann
2012-08-08 15:27   ` Haojian Zhuang
2012-08-08 12:54 ` [PATCH 2/6] ARM: pxa remove irq_to_gpio from eeti_ts driver Arnd Bergmann
2012-08-08 13:23   ` Daniel Mack
2012-08-08 14:19     ` Arnd Bergmann
2012-08-08 14:22       ` Daniel Mack [this message]
2012-08-08 14:38         ` Arnd Bergmann
2012-08-08 15:24   ` Haojian Zhuang
2012-08-08 12:54 ` [PATCH 3/6] ARM: sa1100: include asm/io.h in hackkit leds code Arnd Bergmann
2012-08-08 15:36   ` Russell King - ARM Linux
2012-08-08 17:17     ` Arnd Bergmann
2012-08-08 12:54 ` [PATCH 4/6] ARM: s3c24xx: use new PWM driver Arnd Bergmann
2012-08-08 13:10   ` Kukjin Kim
2012-08-08 14:34     ` Arnd Bergmann
2012-08-09  5:31       ` Kukjin Kim
2012-08-08 12:54 ` [PATCH 5/6] ARM: integrator: include <linux/export.h Arnd Bergmann
2012-08-08 13:24   ` Linus Walleij
2012-08-08 14:01     ` Arnd Bergmann
2012-08-08 12:54 ` [PATCH 6/6] ARM: imx: gpmi-nand depends on mxs-dma Arnd Bergmann
2012-08-08 13:00   ` Dirk Behme
2012-08-08 13:01   ` Fabio Estevam
2012-08-08 13:05     ` Dirk Behme
2012-08-08 13:18       ` Fabio Estevam
2012-08-13 10:22         ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50227615.1090907@gmail.com \
    --to=zonque@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).