[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB8459F7BE5AD43E0685C74A6C88A42@PAXPR04MB8459.eurprd04.prod.outlook.com>
Date: Mon, 24 Mar 2025 08:34:57 +0000
From: Peng Fan <peng.fan@....com>
To: Linus Walleij <linus.walleij@...aro.org>
CC: Johan Hovold <johan@...nel.org>, Steev Klimaszewski <steev@...i.org>,
"Peng Fan (OSS)" <peng.fan@....nxp.com>, Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>, Takashi
Iwai <tiwai@...e.com>, Bartosz Golaszewski <brgl@...ev.pl>, Srinivas
Kandagatla <srinivas.kandagatla@...aro.org>, "linux-sound@...r.kernel.org"
<linux-sound@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-gpio@...r.kernel.org"
<linux-gpio@...r.kernel.org>, "linux-arm-msm@...r.kernel.org"
<linux-arm-msm@...r.kernel.org>
Subject: RE: [PATCH 2/3] ASoC: codec: wcd938x: Convert to GPIO descriptors
> Subject: Re: [PATCH 2/3] ASoC: codec: wcd938x: Convert to GPIO
> descriptors
>
> On Mon, Mar 24, 2025 at 9:09 AM Peng Fan <peng.fan@....com>
> wrote:
>
> > ok, then the only suspecting point is
> > wcd938x->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_ASIS);
> >
> > I may need to use GPIOD_OUT_LOW to configure it to output as set
> raw
> > set value as 1.
>
> I think there may be a bug in gpiod_configure_flags() in gpiolib.c:
>
> /* Process flags */
> if (dflags & GPIOD_FLAGS_BIT_DIR_OUT)
> ret = gpiod_direction_output_nonotify(desc,
> !!(dflags & GPIOD_FLAGS_BIT_DIR_VAL));
> else
> ret = gpiod_direction_input_nonotify(desc);
>
> Shouldn't this be:
>
> if (dflags & GPIOD_FLAGS_BIT_DIR_OUT)
> ret = gpiod_direction_output_nonotify(desc,
> !!(dflags & GPIOD_FLAGS_BIT_DIR_VAL));
> else if (dflags & GPIOD_FLAGS_BIT_DIR_SET)
> ret = gpiod_direction_input_nonotify(desc);
Using GPIO_ASIS should not change direction.
This change makes sense.
>
> ?
>
> As it looks, the line will be set into input mode unless explicitly
> requested as output...
>
> However this means the patch also has another bug: you need to either:
>
> 1. Specify GPIO_OUT_LOW when requesting it or 2. Explicitly call
> gpiod_direction_out() before setting the value.
1 is better before the gpiolib bug got fixed. Then no need change
direction twice.
2 is better aligned with current driver.
There is no rush, so I could use 2 if you'd fix the gpiolib.
BTW, could I still keep your R-b in my V2?
Thanks,
Peng.
>
> Yours,
> Linus Walleij
Powered by blists - more mailing lists