* Re: [PATCH] ASoC: simple-card: Add mic and hp detect gpios.
[not found] ` <20141007123856.GF4609@sirena.org.uk>
@ 2014-10-07 13:10 ` Geert Uytterhoeven
2014-10-07 16:36 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2014-10-07 13:10 UTC (permalink / raw)
To: Mark Brown, Linus Walleij, Alexandre Courbot
Cc: Dylan Reid, ALSA Development Mailing List, jay.xu,
devicetree@vger.kernel.org, sonnyrao, Kuninori Morimoto,
Linux-sh list, linux-gpio@vger.kernel.org
(re-added some context, CC Linus, Alexandre, linux-gpio)
On Tue, Oct 7, 2014 at 2:38 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Oct 07, 2014 at 02:32:57PM +0200, Geert Uytterhoeven wrote:
>> Unfortunately there's no equivalent code for platform data, and the
>> uninitialized default of 0 for gpio_hp_det and gpio_mic_det doesn't
>> play well with asm-generic's gpio_is_valid():
>>
>> static inline bool gpio_is_valid(int number)
>> {
>> return number >= 0 && number < ARCH_NR_GPIOS;
>> }
>>
>> Hence on r8a7740/armadillo-legacy, which uses platform devices instead of DT:
>
>> sh-mobile-hdmi sh-mobile-hdmi: SH Mobile HDMI Audio Codec
>> sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Headphones
>> sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Mic Jack
>
>> After that the kernel log is spammed ca. 7 times per second with:
>
>> sh-mobile-hdmi sh-mobile-hdmi: ASoC: DAPM unknown pin Headphones
>
>> Reverting commit 3fe240326cc395c66 ("ASoC: simple-card: Add mic and
>> hp detect gpios.") fixes this.
>
> The fix here is to not allow 0 as a GPIO in the core code (which
> should've been there already).
Unfortunately it's not there.
And it's not as simple as changing the definition of gpio_is_valid()
(crash in gpio_get_value()):
gpiochip_add: GPIOs 0..211 (r8a7740_pfc) failed to register
sh-pfc pfc-r8a7740: failed to init GPIO chip, ignoring...
sh-pfc pfc-r8a7740: r8a7740_pfc support registered
Unable to handle kernel NULL pointer dereference at virtual address 0000004c
Quoting Linus (https://lkml.org/lkml/2014/9/4/464):
"Fixing the old global GPIO numberspace API is a waste of time IMO".
Hence I've just sent a patch to initialize the GPIO numbers with -ENOENT.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: simple-card: Add mic and hp detect gpios.
2014-10-07 13:10 ` [PATCH] ASoC: simple-card: Add mic and hp detect gpios Geert Uytterhoeven
@ 2014-10-07 16:36 ` Mark Brown
2014-10-08 7:05 ` Alexandre Courbot
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2014-10-07 16:36 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linus Walleij, Alexandre Courbot, Dylan Reid,
ALSA Development Mailing List, jay.xu, devicetree@vger.kernel.org,
sonnyrao, Kuninori Morimoto, Linux-sh list,
linux-gpio@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
On Tue, Oct 07, 2014 at 03:10:01PM +0200, Geert Uytterhoeven wrote:
> On Tue, Oct 7, 2014 at 2:38 PM, Mark Brown <broonie@kernel.org> wrote:
> > The fix here is to not allow 0 as a GPIO in the core code (which
> > should've been there already).
> Unfortunately it's not there.
> And it's not as simple as changing the definition of gpio_is_valid()
> (crash in gpio_get_value()):
> gpiochip_add: GPIOs 0..211 (r8a7740_pfc) failed to register
> sh-pfc pfc-r8a7740: failed to init GPIO chip, ignoring...
> sh-pfc pfc-r8a7740: r8a7740_pfc support registered
> Unable to handle kernel NULL pointer dereference at virtual address 0000004c
Right, obviously it's not going to work if the platform actually uses 0
as a valid GPIO.
> Quoting Linus (https://lkml.org/lkml/2014/9/4/464):
> "Fixing the old global GPIO numberspace API is a waste of time IMO".
> Hence I've just sent a patch to initialize the GPIO numbers with -ENOENT.
I do think it's worth renumbering the platforms since it's *relatively*
little work per platform compared to completing the gpiod transition.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: simple-card: Add mic and hp detect gpios.
2014-10-07 16:36 ` Mark Brown
@ 2014-10-08 7:05 ` Alexandre Courbot
2014-10-08 8:50 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Courbot @ 2014-10-08 7:05 UTC (permalink / raw)
To: Mark Brown
Cc: Geert Uytterhoeven, Linus Walleij, Dylan Reid,
ALSA Development Mailing List, jay.xu, devicetree@vger.kernel.org,
sonnyrao, Kuninori Morimoto, Linux-sh list,
linux-gpio@vger.kernel.org
On Wed, Oct 8, 2014 at 1:36 AM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Oct 07, 2014 at 03:10:01PM +0200, Geert Uytterhoeven wrote:
>> On Tue, Oct 7, 2014 at 2:38 PM, Mark Brown <broonie@kernel.org> wrote:
>
>> > The fix here is to not allow 0 as a GPIO in the core code (which
>> > should've been there already).
>
>> Unfortunately it's not there.
>
>> And it's not as simple as changing the definition of gpio_is_valid()
>> (crash in gpio_get_value()):
>
>> gpiochip_add: GPIOs 0..211 (r8a7740_pfc) failed to register
>> sh-pfc pfc-r8a7740: failed to init GPIO chip, ignoring...
>> sh-pfc pfc-r8a7740: r8a7740_pfc support registered
>> Unable to handle kernel NULL pointer dereference at virtual address 0000004c
>
> Right, obviously it's not going to work if the platform actually uses 0
> as a valid GPIO.
>
>> Quoting Linus (https://lkml.org/lkml/2014/9/4/464):
>> "Fixing the old global GPIO numberspace API is a waste of time IMO".
>
>> Hence I've just sent a patch to initialize the GPIO numbers with -ENOENT.
>
> I do think it's worth renumbering the platforms since it's *relatively*
> little work per platform compared to completing the gpiod transition.
But transition to gpiod is the way to ultimately fix this issue, as
well as many others. Not to mention that renumbering GPIOs will
certainly make a few users of the GPIO sysfs (another abomination,
agreed) unhappy. I can only recommend switching drivers to gpiod when
such issues are spotted.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: simple-card: Add mic and hp detect gpios.
2014-10-08 7:05 ` Alexandre Courbot
@ 2014-10-08 8:50 ` Linus Walleij
2014-10-08 11:40 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2014-10-08 8:50 UTC (permalink / raw)
To: Alexandre Courbot
Cc: devicetree@vger.kernel.org, ALSA Development Mailing List,
Linux-sh list, Sonny Rao, linux-gpio@vger.kernel.org, Mark Brown,
Geert Uytterhoeven, Dylan Reid, jay.xu, Kuninori Morimoto
On Wed, Oct 8, 2014 at 9:05 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
> On Wed, Oct 8, 2014 at 1:36 AM, Mark Brown <broonie@kernel.org> wrote:
>> On Tue, Oct 07, 2014 at 03:10:01PM +0200, Geert Uytterhoeven wrote:
>> Right, obviously it's not going to work if the platform actually uses 0
>> as a valid GPIO.
>>
>>> Quoting Linus (https://lkml.org/lkml/2014/9/4/464):
>>> "Fixing the old global GPIO numberspace API is a waste of time IMO".
>>
>>> Hence I've just sent a patch to initialize the GPIO numbers with -ENOENT.
>>
>> I do think it's worth renumbering the platforms since it's *relatively*
>> little work per platform compared to completing the gpiod transition.
>
> But transition to gpiod is the way to ultimately fix this issue, as
> well as many others. Not to mention that renumbering GPIOs will
> certainly make a few users of the GPIO sysfs (another abomination,
> agreed) unhappy. I can only recommend switching drivers to gpiod when
> such issues are spotted.
Yeah that is another issue ... we end up in catch 22 situations like
that, renumber the GPIOs, OK, then we break the ABI.
Admittedly that "ABI" is something people break all the time,
/sys/*gpioN just isnt what it should be, not stable at all.
I'm not against renumbering GPIO if it's minor effort, but if it
start to consume hundreds of hours and regressions and what not,
that time is better spent focusing on the gpiod transition.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: simple-card: Add mic and hp detect gpios.
2014-10-08 8:50 ` Linus Walleij
@ 2014-10-08 11:40 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-10-08 11:40 UTC (permalink / raw)
To: Linus Walleij
Cc: Alexandre Courbot, ALSA Development Mailing List,
devicetree@vger.kernel.org, Sonny Rao, Linux-sh list,
linux-gpio@vger.kernel.org, Geert Uytterhoeven, Dylan Reid,
jay.xu, Kuninori Morimoto
[-- Attachment #1.1: Type: text/plain, Size: 1172 bytes --]
On Wed, Oct 08, 2014 at 10:50:00AM +0200, Linus Walleij wrote:
> On Wed, Oct 8, 2014 at 9:05 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
> > But transition to gpiod is the way to ultimately fix this issue, as
> > well as many others. Not to mention that renumbering GPIOs will
> > certainly make a few users of the GPIO sysfs (another abomination,
> > agreed) unhappy. I can only recommend switching drivers to gpiod when
> > such issues are spotted.
> Yeah that is another issue ... we end up in catch 22 situations like
> that, renumber the GPIOs, OK, then we break the ABI.
> Admittedly that "ABI" is something people break all the time,
> /sys/*gpioN just isnt what it should be, not stable at all.
> I'm not against renumbering GPIO if it's minor effort, but if it
> start to consume hundreds of hours and regressions and what not,
> that time is better spent focusing on the gpiod transition.
My guess is that it's relatively little work for most platforms - with
the systems I've done enough work on to notice everything is keyed off a
few defines in the header file. Things tend to be worse in out of tree
code but mainline's generally been pretty good.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-08 11:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1412198720-2326-1-git-send-email-dgreid@chromium.org>
[not found] ` <20141002155350.GU4273@sirena.org.uk>
[not found] ` <CAMuHMdWh=sXAD59T1T=gvROX+fbF6=gFo6C0nkJdfnCrdNrwYg@mail.gmail.com>
[not found] ` <20141007123856.GF4609@sirena.org.uk>
2014-10-07 13:10 ` [PATCH] ASoC: simple-card: Add mic and hp detect gpios Geert Uytterhoeven
2014-10-07 16:36 ` Mark Brown
2014-10-08 7:05 ` Alexandre Courbot
2014-10-08 8:50 ` Linus Walleij
2014-10-08 11:40 ` Mark Brown
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).