Re: Is a multiplexer using latches a gpio controller?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 19, 2022 at 12:11:56AM +0200, Andy Shevchenko wrote:
> On Tue, Jul 19, 2022 at 12:05 AM Andy Shevchenko
> <andy.shevchenko@xxxxxxxxx> wrote:
> >
> > On Mon, Jul 18, 2022 at 10:27 PM Uwe Kleine-König
> > <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
> > >
> > > Hello,
> > >
> > > we have a customer board here that uses two 8 port latches to drive
> > > LEDs. The setup looks as follows:
> > >
> > > CLK0 ----------------------.        ,--------.
> > > CLK1 -------------------.  `--------|>    #0 |
> > >                         |           |        |
> > > IN0 -----------------+--|-----------|D0    Q0|-----|◁
> > > IN1 ---------------+-|--|-----------|D1    Q1|-----|◁
> > > IN2 -------------+-|-|--|-----------|D2    Q2|-----|◁
> > > IN3 -----------+-|-|-|--|-----------|D3    Q3|-----|◁
> > > IN4 ---------+-|-|-|-|--|-----------|D4    Q4|-----|◁
> > > IN5 -------+-|-|-|-|-|--|-----------|D5    Q5|-----|◁
> > > IN6 -----+-|-|-|-|-|-|--|-----------|D6    Q6|-----|◁
> > > IN7 ---+-|-|-|-|-|-|-|--|-----------|D7    Q7|-----|◁
> > >        | | | | | | | |  |           `--------'
> > >        | | | | | | | |  |
> > >        | | | | | | | |  |           ,--------.
> > >        | | | | | | | |  `-----------|>    #1 |
> > >        | | | | | | | |              |        |
> > >        | | | | | | | `--------------|D0    Q0|-----|◁
> > >        | | | | | | `----------------|D1    Q1|-----|◁
> > >        | | | | | `------------------|D2    Q2|-----|◁
> > >        | | | | `--------------------|D3    Q3|-----|◁
> > >        | | | `----------------------|D4    Q4|-----|◁
> > >        | | `------------------------|D5    Q5|-----|◁
> > >        | `--------------------------|D6    Q6|-----|◁
> > >        `----------------------------|D7    Q7|-----|◁
> > >                                     `--------'
> > >
> > >
> > > 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.
> > >
> > > 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?
> >
> > Bart, what happened to the [1]? Is it abandoned, forgotten?
> >
> > Uwe, isn't it what you need?
> 
> It needs "downstream" GPIO and ->get_direction(), etc should act accordingly.

No, IIUC this is different. With a multiplexer there can always only be
a single line that is controlled (or read) and the other lines are (I
assume) high-z.

The latch approach above is about 16 outputs and at all times the state
off all 16 lines is fixed because the latches keep their state when the
clk line is kept stable.

Best regards
Uwe

> > [1]: https://lore.kernel.org/linux-gpio/20220205215918.8924-1-maukka@xxxxxxxxxxxx/

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux