Hi Laurent, On Mon, Nov 14, 2016 at 5:44 PM, Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> wrote: > On Monday 14 Nov 2016 14:47:00 Geert Uytterhoeven wrote: >> On Mon, Nov 14, 2016 at 2:41 PM, Laurent Pinchart wrote: >> > On Monday 14 Nov 2016 14:35:26 Geert Uytterhoeven wrote: >> >> The main reason I haven't sent out a similar series yet is because the >> >> GPIOs used for the 3 push buttons are shared with the 3 user LEDs. For >> >> each of them, you have to choose at DT time if you want to use them as >> >> buttons or as LEDs. >> >> >> >> On ULCB, the same issue is present. For those, we settled on 1 key and 2 >> >> LEDs... >> >> >> >> Looking forward to more comments... >> > >> > In theory the GPIOs could be shared by the gpio-keys and LED drivers in >> > open- drain mode. I'm not sure the GPIO subsystem supports that though. >> >> Been there, done that, cfr. "[RFD] Sharing GPIOs for input (buttons) and >> output (LEDs)". The result wasn't pretty... > > Wasn't it ? Linus basically told you to use open-drain GPIOs and fix the GPIO > driver in case it can't read the value of GPIOs configured as output in open- > drain mode. If didn't shoot the idea down. If I'm not mistaken, the R-Car GPIO block does not support open-drain GPIO. Even if it would support it, you cannot read the GPIO while actively pulling it down. Hence you have to time-multiplex the GPIO to use both LEDs and buttons, through switching between pulling down and not pulling down (or between output and input, which is what I did). Apart from that, there's also the discrepancy between hardware description (the GPIO is connected to both buttons and LEDs, hence it should be described that way in DT) and user policy (the user wants to use e.g. the first GPIO as a button, and the second GPIO as an LED). If you have ideas to solve these 2 issues, I'm happy to hear your thoughts! 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