Thread (101 messages) 101 messages, 7 authors, 2022-05-07

Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio

From: Arnd Bergmann <arnd@kernel.org>
Date: 2022-05-05 06:04:42
Also in: dri-devel, linux-arm-kernel, linux-clk, linux-ide, linux-input, linux-leds, linux-mips, linux-mmc, linux-pm, linux-rtc, linux-usb, lkml

On Wed, May 4, 2022 at 11:59 PM Linus Walleij [off-list ref] wrote:
On Mon, May 2, 2022 at 9:08 AM Arnd Bergmann [off-list ref] wrote:
quoted
On Sun, May 1, 2022 at 11:41 PM Linus Walleij [off-list ref] wrote:
quoted
(...)
quoted
+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.
quoted
+               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.
quoted
@@ -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)
Ok, done. But I still leave the extra 'invert=1' in hs_jack_pin[], right?

/* Headphones jack detection DAPM pin */
static struct snd_soc_jack_pin hs_jack_pin[] = {
        {
                .pin    = "Headphone Jack",
                .mask   = SND_JACK_HEADPHONE,
        },
        {
                .pin    = "Speaker",
                /* disable speaker when hp jack is inserted */
                .mask   = SND_JACK_HEADPHONE,
                .invert = 1,
        },
};
quoted
+       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.
Ok.

        Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help