On Mon, Jul 18, 2022 at 10:22 PM Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> wrote: > we have a customer board here that uses two 8 port latches to drive > LEDs. The setup looks as follows: Very nice drawing! > So to change output 2 of latch #1 you have to apply the changed level on > IN2, apply the previous level on the other inputs (to keep the other > outputs constant) and toggle CLK1 once. > > This way you can drive 16 LEDs (or in general outputs) using only 10 > GPIOs. (And with a higher number of latches the proportion becomes a bit > more useful.) > > Actually this construct is a general GPO (no input :-) controller, and I > wonder if you would accept a driver that models it as a gpio controller. In my opinion, yes. > The dt binding could look as follows: > > latch-gpo { > compatible = "latch-gpo"; > pinctrl-0 = <...>; > pinctrl-names = <...>; > > clk-gpios = /* CLK0 */ <...>, /* CLK1 */ <...>; > data-gpios = /* IN0 */ <...>, /* IN1 */ <...>, ...; > }; > > What do you think? I would use the actual 74xx numbers for the TTL circuits in the compatible. I have actually merged this placeholder (without bindings nor driver): /* * 74HC4094 which is used as a rudimentary GPIO expander * FIXME: * - Create device tree bindings for this as GPIO expander * - Write a pure DT GPIO driver using these bindings * - Support cascading in the style of gpio-74x164.c (cannot be reused, very different) */ gpio_74: gpio-74hc4094 { compatible = "nxp,74hc4094"; cp-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; d-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; str-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; /* oe-gpios is optional */ gpio-controller; #gpio-cells = <2>; /* We are not cascaded */ registers-number = <1>; gpio-line-names = "CONTROL_HSS0_CLK_INT", "CONTROL_HSS1_CLK_INT", "CONTROL_HSS0_DTR_N", "CONTROL_HSS1_DTR_N", "CONTROL_EXT", "CONTROL_AUTO_RESET", "CONTROL_PCI_RESET_N", "CONTROL_EEPROM_WC_N"; }; What's nice with 74HC4094 is that it has a strobe (str) signal so you can send out all the values and then strobe them out in one go. But your construction makes sense too! Yours, Linus Walleij