[PATCH 0/3] auxdisplay: 7 segment LED display

Chris Packham Chris.Packham at alliedtelesis.co.nz
Mon Feb 26 16:52:30 PST 2024


On 26/02/24 15:23, Andy Shevchenko wrote:
> On Sun, Feb 25, 2024 at 11:34 PM Chris Packham
> <chris.packham at alliedtelesis.co.nz> wrote:
>> This series adds a driver for a 7 segment LED display.
>>
>> I'd like to get some feedback on how this could be extended to support >1
>> character. The driver as presented is sufficient for my hardware which only has
>> a single character display but I can see that for this to be generically useful
>> supporting more characters would be desireable.
>>
>> Earlier I posted an idea that the characters could be represended by
>> sub-nodes[1] but there doesn't seem to be a way of having that and keeping the
>> convenience of using devm_gpiod_get_array() (unless I've missed something).
> It seems you didn't know that the tree for auxdisplay has been changed.
> Can you rebase your stuff on top of
> https://scanmail.trustwave.com/?c=20988&d=vfbb5fnU59kvIREfdD-21Pab30bpMpuTM2Ipv28now&u=https%3a%2f%2fgit%2ekernel%2eorg%2fpub%2fscm%2flinux%2fkernel%2fgit%2fandy%2flinux-auxdisplay%2egit%2flog%2f%3fh%3dfor-next%3f
> It will reduce your code base by ~50%.
>
> WRT subnodes, you can go with device_for_each_child_node() and
> retrieve gpio array per digit. It means you will have an array of
> arrays of GPIOs.

So would the following work?

     count = device_get_child_node_count(dev);
     struct gpio_descs **chars  = devm_kzalloc(dev, sizeof(*chars) * 
count, GFP_KERNEL);

     i = 0;
     device_for_each_child_node(dev, child) {
         chars[i] = devm_gpiod_get_array(dev, "segment", GPIOD_OUT_LOW);
     }

I haven't used the child. The devm_gpiod_get_array() will be looking at 
the fwnode of the parent.



More information about the linux-arm-kernel mailing list