[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZNryYkidvdKuT57RM3fz6_X+3oOzF5xaOZd+TyScfUsw@mail.gmail.com>
Date: Wed, 4 May 2022 23:59:30 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Robert Jarzmik <robert.jarzmik@...e.fr>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Arnd Bergmann <arnd@...db.de>, Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Marek Vasut <marek.vasut@...il.com>,
Philipp Zabel <philipp.zabel@...il.com>,
Lubomir Rintel <lkundrak@...sk>,
Paul Parsons <lost.distance@...oo.com>,
Tomas Cech <sleep_walker@...e.com>,
Sergey Lapin <slapin@...fans.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Helge Deller <deller@....de>, Mark Brown <broonie@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:BROADCOM NVRAM DRIVER" <linux-mips@...r.kernel.org>,
IDE-ML <linux-ide@...r.kernel.org>,
linux-clk <linux-clk@...r.kernel.org>,
Linux PM list <linux-pm@...r.kernel.org>,
"open list:HID CORE LAYER" <linux-input@...r.kernel.org>,
patches@...nsource.cirrus.com, linux-leds@...r.kernel.org,
linux-mmc <linux-mmc@...r.kernel.org>,
linux-mtd <linux-mtd@...ts.infradead.org>,
linux-rtc@...r.kernel.org, USB list <linux-usb@...r.kernel.org>,
Linux Fbdev development list <linux-fbdev@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
ALSA Development Mailing List <alsa-devel@...a-project.org>
Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio
On Mon, May 2, 2022 at 9:08 AM Arnd Bergmann <arnd@...nel.org> wrote:
> On Sun, May 1, 2022 at 11:41 PM Linus Walleij <linus.walleij@...aro.org> wrote:
> >
> > (...)
> > > +static struct gpiod_lookup_table hx4700_audio_gpio_table = {
> > > + .dev_id = "hx4700-audio",
> > > + .table = {
> > > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET,
> > > + "earphone-ndet", GPIO_ACTIVE_HIGH),
> >
> > This looks wrong. The n in nDET in the end of the name of the GPIO line
> > means active low does it not?
> >
> > What I usually do when I see this is to properly set it to
> > GPIO_ACTIVE_LOW in the descriptor table, then invert the logic
> > where it's getting used.
> >
> > Also rename to earphone-det instead of -ndet
>
> Thanks for taking a look! I changed it now, but I don't know if
> I got the correct number of inversions in the end. How does this look?
Looks wrong, you can just invert the argument to any statement of set_value()
after tagging respective line as active low. Then gpilob will do a second
inversion.
> + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET,
> + "earphone-det", GPIO_ACTIVE_LOW),
> + GPIO_LOOKUP("gpio-pxa", GPIO107_HX4700_SPK_nSD,
> + "spk-sd", GPIO_ACTIVE_LOW),
So those two have switched polarity.
> @@ -81,14 +79,14 @@ static const struct snd_soc_ops hx4700_ops = {
> static int hx4700_spk_power(struct snd_soc_dapm_widget *w,
> struct snd_kcontrol *k, int event)
> {
> - gpio_set_value(GPIO107_HX4700_SPK_nSD, !!SND_SOC_DAPM_EVENT_ON(event));
> + gpiod_set_value(gpiod_spk_sd, !!SND_SOC_DAPM_EVENT_ON(event));
Thus drop one ! in front of the expression, just !SND_SOC_DAPM_EVENT_ON(event)
> - gpio_set_value(GPIO92_HX4700_HP_DRIVER, !!SND_SOC_DAPM_EVENT_ON(event));
> + gpiod_set_value(gpiod_hp_driver, !!SND_SOC_DAPM_EVENT_ON(event));
But not this.
> + gpiod_spk_sd = devm_gpiod_get(&pdev->dev, "spk-sd", GPIOD_OUT_LOW);
These initial values don't seem to be set in the old code you could
just use GPIOD_ASIS as flag to make sure the new code behaves
the same.
Yours,
Linus Walleij
Powered by blists - more mailing lists