[PATCH 1/2] gpio: dwapb: Use human understandable gpio numbering.

Michael van der Westhuizen michael at smart-africa.com
Fri Jul 3 06:30:12 PDT 2015


> On 02 Jul 2015, at 5:02 PM, Michael van der Westhuizen <michael at smart-africa.com> wrote:
> 
> 
>> On 02 Jul 2015, at 4:54 PM, Sebastian Andrzej Siewior <bigeasy at linutronix.de> wrote:
>> 
>> On 07/02/2015 05:21 PM, Richard Cochran wrote:
>>> On Thu, Jul 02, 2015 at 04:30:47PM +0200, Sebastian Andrzej Siewior wrote:
>>>> On 07/02/2015 04:26 PM, Richard Cochran wrote:
>>>>> On Thu, Jul 02, 2015 at 09:36:22AM +0200, Sebastian Andrzej Siewior wrote:
>>>>>> If you are in a specific SoC you could do
>>>>>> 	base = of_alias_get_id(np, "gpio") * num_of_gpio_per_chip
>>>>>> and get consistent numbers / sane.
>>>>> 
>>>>> And what about /sys/class/gpio ?
>>>> 
>>>> What about it?
>>> 
>>> The poor users of that interface cannot use "of_alias_get_id" as you suggest.
>> 
>> You do that in the driver. The only problem with that is that the
>> synopsys controller can have between one and four banks and a bank can
>> have 1-32 GPIOs if I remember correctly. That means you can't have a
>> static number of GPIOs like others do.
> 
> This is correct.
> 
>> Therefore I think a starting property is the only way and I would
>> prefer a generic one.
> 
> I would prefer a generic property too.  I was rather surprised that one did not exist.

… looking into this more closely, by the time we get into gpiochip_add there’s no notion
of the DT node that is associated to the gpiochip being added (and the gpiochip->dev
points to the parent device, which is the generally the parent DT node), so this can’t be
done generically without at least some churn in the individual drivers.

Michael


More information about the linux-arm-kernel mailing list