[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <584172eb-4eda-40d1-9ee5-99d0ef944481@alliedtelesis.co.nz>
Date: Tue, 27 Feb 2024 00:52:30 +0000
From: Chris Packham <Chris.Packham@...iedtelesis.co.nz>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: "ojeda@...nel.org" <ojeda@...nel.org>, "robh+dt@...nel.org"
<robh+dt@...nel.org>, "krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>, "conor+dt@...nel.org"
<conor+dt@...nel.org>, "andrew@...n.ch" <andrew@...n.ch>,
"gregory.clement@...tlin.com" <gregory.clement@...tlin.com>,
"sebastian.hesselbarth@...il.com" <sebastian.hesselbarth@...il.com>,
"geert@...ux-m68k.org" <geert@...ux-m68k.org>, "pavel@....cz" <pavel@....cz>,
"lee@...nel.org" <lee@...nel.org>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-leds@...r.kernel.org"
<linux-leds@...r.kernel.org>
Subject: Re: [PATCH 0/3] auxdisplay: 7 segment LED display
On 26/02/24 15:23, Andy Shevchenko wrote:
> On Sun, Feb 25, 2024 at 11:34 PM Chris Packham
> <chris.packham@...iedtelesis.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.
Powered by blists - more mailing lists