On Tue, Feb 27, 2024 at 2:52 AM Chris Packham <Chris.Packham@xxxxxxxxxxxxxxxxxxx> wrote: > On 26/02/24 15:23, Andy Shevchenko wrote: > > On Sun, Feb 25, 2024 at 11:34 PM Chris Packham > > <chris.packham@xxxxxxxxxxxxxxxxxxx> 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 see what you meant earlier. This should be devm_fwnode_gpiod_get_index(), but we lack the _array variant of it... Dunno what to do, maybe adding the _array variant is the good move, maybe something else. > } > > I haven't used the child. The devm_gpiod_get_array() will be looking at > the fwnode of the parent. -- With Best Regards, Andy Shevchenko