[<prev] [next>] [day] [month] [year] [list]
Message-ID: <00e9b968-814e-d7e8-9d8e-1983090df4b0@pobox.com>
Date: Mon, 29 Oct 2018 21:46:37 -0500
From: Daniel Santos <daniel.santos@...ox.com>
To: LKML <linux-kernel@...r.kernel.org>,
linux-devicetree <devicetree@...r.kernel.org>
Cc: John Crispin <blogic@...nwrt.org>
Subject: How to implement "#interrupt-cells = <2>" for a gpiochip?
Hello,
I'm trying to use a GPIO as an interrupt on an mt7620 (using OpenWRT
drivers) and I can't seem to figure out how to glue my two-celled
interrupt description (including the trigger) to the device tree code.
This is the gpio driver I'm using:
https://github.com/openwrt/openwrt/blob/master/target/linux/ramips/patches-4.14/0027-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
And this is the gpio chip in the device tree:
gpio0: gpio@600 {
compatible = "ralink,mt7620a-gpio", "ralink,rt2880-gpio";
reg = <0x600 0x34>;
resets = <&rstctrl 13>;
reset-names = "pio";
interrupt-parent = <&intc>;
interrupts = <6>;
interrupt-controller;
#interrupt-cells = <2>;
gpio-controller;
#gpio-cells = <2>;
ralink,gpio-base = <0>;
ralink,num-gpios = <24>;
ralink,register-map = [ 00 04 08 0c
20 24 28 2c
30 34 ];
};
I've added the "interrupt-controller;" and "#interrupt-cells" myself.
This is my i2c device:
&i2c {
status = "okay";
imu: lsm6ds3@6b {
compatible = "st,lsm6ds3";
reg = <0x6b>;
interrupt-parent = <&gpio0>;
interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
};
};
The problem is that when the driver probes and asks what the trigger for
the irq is, it returns zero instead of 2 (IRQ_TYPE_EDGE_FALLING). I
presume this is because the two-celled interrupts aren't implemented by
the gpio driver?
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt says:
A device is marked as an interrupt controller with the
"interrupt-controller"
property. This is a empty, boolean property. An additional
"#interrupt-cells"
property defines the number of cells needed to specify a single interrupt.
It is the responsibility of the interrupt controller's binding to define the
length and format of the interrupt specifier. The following two variants are
commonly used:
...
However, I'm having great trouble finding documentation on how to write
these bindings. Can anybody give me a pointer please?
Thanks,
Daniel
Powered by blists - more mailing lists