public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Antonio Ospite <ao2@ao2.it>
Cc: Jiri Kosina <jkosina@suse.cz>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	sb@m-labs.hk, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] HID: i2c-hid: Add support for ACPI GPIO interrupts
Date: Wed, 25 Feb 2015 10:02:11 +0200	[thread overview]
Message-ID: <20150225080211.GM1758@lahna.fi.intel.com> (raw)
In-Reply-To: <20150224222705.82e955632f6677067ab1fa46@ao2.it>

On Tue, Feb 24, 2015 at 10:27:05PM +0100, Antonio Ospite wrote:
> On Mon, 23 Feb 2015 15:52:45 +0200
> Mika Westerberg <mika.westerberg@linux.intel.com> wrote:
> 
> > The HID over I2C specification allows to have the interrupt for a HID
> > device to be GPIO instead of directly connected to the IO-APIC.
> > 
> > Add support for this so that when the driver does not find proper interrupt
> > number from the I2C client structure we check if it has ACPI GpioInt()
> > resource listed in _CRS. If it is found we convert it to an interrupt
> > number and use it instead.
> > 
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> >  drivers/hid/i2c-hid/i2c-hid.c | 68 +++++++++++++++++++++++++++++++------------
> >  1 file changed, 50 insertions(+), 18 deletions(-)
> > 
> > diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
> > index 404ccde49acd..c6cad72f6296 100644
> > --- a/drivers/hid/i2c-hid/i2c-hid.c
> > +++ b/drivers/hid/i2c-hid/i2c-hid.c
> > @@ -37,6 +37,7 @@
> >  #include <linux/mutex.h>
> >  #include <linux/acpi.h>
> >  #include <linux/of.h>
> > +#include <linux/gpio/consumer.h>
> >  
> >  #include <linux/i2c/i2c-hid.h>
> >  
> > @@ -144,6 +145,8 @@ struct i2c_hid {
> >  	unsigned long		flags;		/* device flags */
> >  
> >  	wait_queue_head_t	wait;		/* For waiting the interrupt */
> > +	struct gpio_desc	*desc;
> 
> Just curious: can't the gpio_desc be local in the probe function?
> I take that the gpio descriptor needs to be alive even after the irq
> number has been derived from it in order for the gpio chip to remember
> that the gpio has been requested by someone. Is that correct?

That's right and we need to release it in remove() as well.

Someone should convert this driver to use devm_* APIs...

      reply	other threads:[~2015-02-25  8:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 13:52 [PATCH 0/3] HID: Support for Lenovo Thinkpad 10 digitizer Mika Westerberg
2015-02-23 13:52 ` [PATCH 1/3] HID: wacom: Add support for I2C connected devices Mika Westerberg
2015-02-23 15:22   ` Benjamin Tissoires
2015-02-24 10:31   ` Jiri Kosina
2015-02-23 13:52 ` [PATCH 2/3] HID: i2c-hid: Read wMaxInputLength of input report instead of bufsize Mika Westerberg
2015-02-23 15:26   ` Benjamin Tissoires
2015-02-24  7:05     ` Mika Westerberg
2015-02-23 13:52 ` [PATCH 3/3] HID: i2c-hid: Add support for ACPI GPIO interrupts Mika Westerberg
2015-02-23 15:35   ` Benjamin Tissoires
2015-02-24  7:42     ` Mika Westerberg
2015-02-24 20:02   ` Jiri Kosina
2015-02-24 21:27   ` Antonio Ospite
2015-02-25  8:02     ` Mika Westerberg [this message]

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=20150225080211.GM1758@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=ao2@ao2.it \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=sb@m-labs.hk \
    /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