Re: [PATCH v3 1/2] gpio: Add gpio latch driver
From: Sascha Hauer
Date: Thu Sep 22 2022 - 09:31:22 EST
On Wed, Sep 14, 2022 at 05:03:10PM +0300, Serge Semin wrote:
> > + unsigned int offset, bool val)
> > +{
> > + int latch = offset / priv->n_latched_gpios;
> > + int i;
> > +
> > + assign_bit(offset, priv->shadow, val);
> > +
>
> > + for (i = 0; i < priv->n_latched_gpios; i++)
> > + set(priv->latched_gpios->desc[i],
> > + test_bit(latch * priv->n_latched_gpios + i, priv->shadow));
>
> -> duration?
>
> > +
> > + set(priv->clk_gpios->desc[latch], 1);
>
> -> duration?
>
> > + set(priv->clk_gpios->desc[latch], 0);
>
> I am pretty much sure there must be some duration between the actions
> above *. See for instance the tw and (tsu + th) timing requirements in
> the next edge-triggered flip-flops:
> https://www.ti.com/lit/ds/symlink/sn74lv74a.pdf?ts=1663163389954&ref_url=https%253A%252F%252Fwww.google.com%252F
>
> The durations are normally small (ns or a bit smaller) but still need
> to be added anyway.
>
> Note since the durations are device-specific an additional DT-property array
> with durations should be added too.
Do you think a fixed udelay(1) would be enough for now? Bigger delays
shouldn't be needed and smaller delays expand to udelay(1) anyway on
architectures not providing an architecture specific ndelay().
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |