Re: [PATCH 1/2] dt-bindings: GPIO: Add generic serializer binding

From: Andrew F. Davis
Date: Wed Dec 30 2015 - 12:00:02 EST


On 12/16/2015 10:29 AM, Rob Herring wrote:
On Mon, Dec 14, 2015 at 5:19 PM, Andrew F. Davis <afd@xxxxxx> wrote:
On 12/14/2015 04:36 PM, Rob Herring wrote:

On Mon, Dec 14, 2015 at 10:41 AM, Andrew F. Davis <afd@xxxxxx> wrote:

On 12/11/2015 03:48 PM, Linus Walleij wrote:


On Fri, Dec 11, 2015 at 8:46 PM, Andrew F. Davis <afd@xxxxxx> wrote:

[...]

+ - compatible : Should be "pisosr-gpio".



I think it should also define compatible strings on the "vendor,device"
format apart from the generic compatible. Sooner or later we may need
to differentiate them and then that comes in handy.


Would it be better to wait until/if this issue arises? This driver
targets the generic features, as these parts are very generic and
have been produced by many companies since the 70s I'm not sure
if privileging any of them makes much sense.

What I'm worried about looks to have happened with the gpio-74x164
driver, this is kind of the companion device to mine (74164 / 74165)
and should work with any 74164 compatible shift register (possibly 100s
of versions of them), but the compatible string that was added is
"fairchild,74hc595", a relatively new device by a single manufacturer.
The problem this has is then that boards will use this compatible string
even if the parts are not actually the Fairchild version, just to get
the match, when they should be using a generic string.


I agree the generic version is fine (or find who made the first part
;)). What "pisosr" is is not very obvious though. Having 74165 in the
compatible would make it somewhat more obvious it is a standard logic
part.


A quick search shows shift-registers being made from vacuum tubes for
the Colossus! Those might work with this driver if you could match the
voltage to an SPI bus... :)

I agree about the name not being very good, but I'm not sure about
74165 ether as it is also just a single part number. The idea was to
have a non-part number compatible string for any shift-register you
can hook to the SPI line. That way when we have boards with a sn65x882
or something we wont have to call it a 74165. But I guess that's why
it's a "compatible:" string, and not "is-a:" string.

If there are a couple then I think it is okay. If there are 10s then
maybe not. Perhaps logic-pisosr or discrete-pisosr?


My concern as well, there are a lot of them, and every device doesn't
need its own string, so why privilege the name of any that don't have
anything different.

I'd like to leave the named ones for odd cases that needs special
handling.

+Optional properties:
+ - ngpios : Number of GPIO lines, default is 8.



If you didn't do "pisosr-gpio" but instead "foo,sn74165", maybe you
don't need to have this in the device tree but instead it can be
determined from the compatible string?

In that case do that.


These devices can be daisy-chained together, so three 8bit registers
look exactly like one 24bit register. The only way to know this is
from the physical wiring of the board, not from the part number.


Then you should say it must be multiple of 8 (or are there other
lengths?).


Some are 4bit, you can even just hook a single flip-flop to the SPI bus for
a single bit (or multiples) of input.

One would hope you would just connect the CS signal directly to that
input for 1-bit... I guess you could be out of GPIOs and only have a
free output only CS signal.


Interesting use-case idea :), I'm more worried about a device with any
prime number of pins where multiples will fail, not that I have ever
seen one.

Andrew

Rob

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/