linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* label string for kirkwood gpiochip
@ 2011-12-15 13:54 Holger Brunck
  2011-12-15 14:22 ` Nicolas Pitre
  0 siblings, 1 reply; 4+ messages in thread
From: Holger Brunck @ 2011-12-15 13:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,
we recently switched with our kirkwood based board to a newer kernel version.
Our application code is written in that way if someone request an gpio in
userspace that he do search the gpiochip via the gpio label.

The newer kernel version handles the gpiochip on kirkwood in a different way.
The orion_gpio_init function in arch/arm/mach-kirkwood/irq.c was called twice.
Once for first 32 gpios and a second time for the remaining 18 gpios. This
causes that the gpio framework shows two gpiochips in the sysfs with the same
label (orion_gpio).

[@km_kirkwood /]# cat /sys/class/gpio/gpiochip0/label
orion_gpio
[@km_kirkwood /]# cat /sys/class/gpio/gpiochip32/label
orion_gpio

So my question is simply, shouldn't be the string for a gpiochip unique in the
system and therefore this should be fixed or was this intended?

Best regards
Holger Brunck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* label string for kirkwood gpiochip
  2011-12-15 13:54 label string for kirkwood gpiochip Holger Brunck
@ 2011-12-15 14:22 ` Nicolas Pitre
  2011-12-15 14:40   ` Holger Brunck
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Pitre @ 2011-12-15 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 15 Dec 2011, Holger Brunck wrote:

> Hi,
> we recently switched with our kirkwood based board to a newer kernel version.
> Our application code is written in that way if someone request an gpio in
> userspace that he do search the gpiochip via the gpio label.
> 
> The newer kernel version handles the gpiochip on kirkwood in a different way.
> The orion_gpio_init function in arch/arm/mach-kirkwood/irq.c was called twice.
> Once for first 32 gpios and a second time for the remaining 18 gpios. This
> causes that the gpio framework shows two gpiochips in the sysfs with the same
> label (orion_gpio).
> 
> [@km_kirkwood /]# cat /sys/class/gpio/gpiochip0/label
> orion_gpio
> [@km_kirkwood /]# cat /sys/class/gpio/gpiochip32/label
> orion_gpio
> 
> So my question is simply, shouldn't be the string for a gpiochip unique in the
> system and therefore this should be fixed or was this intended?

I don't think that was intended.


Nicolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* label string for kirkwood gpiochip
  2011-12-15 14:22 ` Nicolas Pitre
@ 2011-12-15 14:40   ` Holger Brunck
  2011-12-17 16:44     ` Nicolas Pitre
  0 siblings, 1 reply; 4+ messages in thread
From: Holger Brunck @ 2011-12-15 14:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/15/2011 03:22 PM, Nicolas Pitre wrote:
>>
>> The newer kernel version handles the gpiochip on kirkwood in a different way.
>> The orion_gpio_init function in arch/arm/mach-kirkwood/irq.c was called twice.
>> Once for first 32 gpios and a second time for the remaining 18 gpios. This
>> causes that the gpio framework shows two gpiochips in the sysfs with the same
>> label (orion_gpio).
>>
>> [@km_kirkwood /]# cat /sys/class/gpio/gpiochip0/label
>> orion_gpio
>> [@km_kirkwood /]# cat /sys/class/gpio/gpiochip32/label
>> orion_gpio
>>
>> So my question is simply, shouldn't be the string for a gpiochip unique in the
>> system and therefore this should be fixed or was this intended?
> 
> I don't think that was intended.
> 

Ok, how should this be done? We could add an additional  param chip_label to

void __init orion_gpio_init(int gpio_base, int ngpio,
                            u32 base, int mask_offset, int secondary_irq_base);

and fix the callers accordingly or we could add a simple static counter in
orion_gpio_init and add a suffix _0, _1, _2 to the label to make it unique
without touching the clients...

Best regards
Holger

^ permalink raw reply	[flat|nested] 4+ messages in thread

* label string for kirkwood gpiochip
  2011-12-15 14:40   ` Holger Brunck
@ 2011-12-17 16:44     ` Nicolas Pitre
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Pitre @ 2011-12-17 16:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 15 Dec 2011, Holger Brunck wrote:

> On 12/15/2011 03:22 PM, Nicolas Pitre wrote:
> >>
> >> The newer kernel version handles the gpiochip on kirkwood in a different way.
> >> The orion_gpio_init function in arch/arm/mach-kirkwood/irq.c was called twice.
> >> Once for first 32 gpios and a second time for the remaining 18 gpios. This
> >> causes that the gpio framework shows two gpiochips in the sysfs with the same
> >> label (orion_gpio).
> >>
> >> [@km_kirkwood /]# cat /sys/class/gpio/gpiochip0/label
> >> orion_gpio
> >> [@km_kirkwood /]# cat /sys/class/gpio/gpiochip32/label
> >> orion_gpio
> >>
> >> So my question is simply, shouldn't be the string for a gpiochip unique in the
> >> system and therefore this should be fixed or was this intended?
> > 
> > I don't think that was intended.
> > 
> 
> Ok, how should this be done? We could add an additional  param chip_label to
> 
> void __init orion_gpio_init(int gpio_base, int ngpio,
>                             u32 base, int mask_offset, int secondary_irq_base);
> 
> and fix the callers accordingly or we could add a simple static counter in
> orion_gpio_init and add a suffix _0, _1, _2 to the label to make it unique
> without touching the clients...

The later would be less intrusive at this point.

Eventually this should be hooked into the pinctrl subsystem.


Nicolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-17 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15 13:54 label string for kirkwood gpiochip Holger Brunck
2011-12-15 14:22 ` Nicolas Pitre
2011-12-15 14:40   ` Holger Brunck
2011-12-17 16:44     ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).