Hi Chris, On Wed, Mar 20, 2019 at 9:41 PM Chris Brandt <Chris.Brandt@xxxxxxxxxxx> wrote: > On Wed, Mar 20, 2019, Geert Uytterhoeven wrote: > > This patch series adds support for devices on the I2C bus on the RSKRZA1 > > board, including the GPIO expander that drives 3 LEDs. > > Very cool. > > I figured there was a more graceful way of turning on/off those LEDs > than what I was doing...which was just writing to the I2C bus in my LED > heartbeat kernel thread. > https://github.com/renesas-rz/rza_linux-4.19/blob/master/arch/arm/mach-shmobile/board-rskrza1.c#L145 Yeah, I've seen that code. Not fit for upstream ;-) I also wanted to add support for the switches, as I prefer to have a remote wake-up source before I move a board to my board farm (sh_eth in RZ/A1 does not seem to support wake-on-LAN). However, that doesn't work yet. The usual approach would be: #include <dt-bindings/input/input.h> keyboard { compatible = "gpio-keys"; key-1 { gpios = <&port1 9 GPIO_ACTIVE_LOW>; linux,code = <KEY_1>; label = "SW1"; wakeup-source; }; }; But that doesn't work, as RZ/A1 GPIO does not support interrupts. The GPIOs connected to the switches can also be used as IRQ lines with (pseudo patch) keyboard { + pinctrl-names = "default"; + pinctrl-0 = <&keyboard_pins>; key-1 { - gpios = <&port1 9 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gic>; + interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_BOTH>; } } + keyboard_pins: keyboard { + pinmux = <RZA1_PINMUX(1, 9, 3)>; /* IRQ3 */ + }; However, that also doesn't work, as the PL390 GIC supports rising edge and high-level interrupts only. Falling edge and low-level interrupts on the IRQ pins seem to be an RZ/A1-specific GIC extension, which requires programming the non-standard registers (ICR0, ICR1, IRQRR). Nevertheless, even with the plain supported interrupt modes I didn't receive interrupts when using the switches. I've just discovered commit 207c10b54ca81129 ("irq-gic: add support for pins IRQ0-IRQ7") in rza_linux-4.14, but when using that, the system locks up when pressing a switch :-( Finally, I tried using the pin interrupts, which are the closest to GPIO interrupts we seem to have. As these support high-level and rising-edge interrupts only, while the switches are active-low, this means only key-up events are detected: interrupt-parent = <&gic>; interrupts = <GIC_SPI 401 IRQ_TYPE_EDGE_RISING>; What am I doing wrong? Do you have a better solution? The IRQx support looks most promising, but needs some work (separate compatible value, small driver with a custom .irq_set_type, deferring the rest to the normal GIC driver). Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds