lkml.org 
[lkml]   [2015]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] HID: i2c-hid: Add support for GPIO interrupts
On Mon, Jan 26, 2015 at 04:39:30PM +0000, Mark Rutland wrote:
> What I don't follow is why GpioInt seems to be translated as a GPIO
> rather than as an interrupt which happens to be backed by a GPIO. Were
> it not for that, the DT and ACPI cases would align better.

Because it *is* a GPIO.

In my experience we have had two kinds of interrupts that the devices
are connected to: pins connected directly to the interrupt controller
(IO-APIC or whatever), and pins connected to the GPIO controller. This
is the later.

Now, the device in question has following resources:

Name (_CRS, ResourceTemplate () {
I2cSerialBus (0x004C, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C6",
0x00, ResourceConsumer,,)
GpioInt (Level, ActiveLow, Shared, PullDefault, 0x0000,
"\\_SB.GPO0", 0x00, ResourceConsumer,,)
{
0x004C
}
})

The GpioInt() above refers to GPIO controller ("\_SB.GPO0") and its pin
number 0x4c.

Normally I would do this in the driver regardless of where it is
described (DT, ACPI, whatnot):

desc = gpiod_get(dev, NULL);
gpiod_direction_input(desc);
irq = gpiod_to_irq(desc);

Then the "irq" can be used for request_irq() and friends.

Note how both DT and ACPI cases align just fine.

If the above is not the right way to use GPIOs as interrupt, can you
please tell me how it is done then?

BTW, passing NULL to gpiod_get() implies property named "gpios" in DT
(which is why I added it to the documentation).


\
 
 \ /
  Last update: 2015-01-27 11:21    [W:1.148 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site