[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-alF-gK5TpGliCj@smile.fi.intel.com>
Date: Fri, 28 Mar 2025 15:33:11 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>
Cc: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, Peng Fan <peng.fan@....com>,
"open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." <linux-sound@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:GPIO SUBSYSTEM:Keyword:(devm_)?gpio_(request|free|direction|get|set)" <linux-gpio@...r.kernel.org>,
krzk@...nel.org
Subject: Re: [PATCH] ASoC: codec: ak5386: Convert to GPIO descriptors
On Fri, Mar 28, 2025 at 07:39:17PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@....com>
>
> of_gpio.h is deprecated, update the driver to use GPIO descriptors.
> - Use dev_gpiod_get_optional to get GPIO descriptor.
devm
> - Use gpiod_set_value to configure output value.
>
> With legacy of_gpio API, the driver set gpio value 1 to power up
sets GPIO
> AK5386, and set value 0 to power down.
> Per datasheet for PDN(reset_gpio in the driver):
> Power Down & Reset Mode Pin
> “H”: Power up, “L”: Power down & Reset
> The AK5386 must be reset once upon power-up.
>
> There is no in-tree DTS using this codec, and the dt-bindings not
bindings does not
> specify polarity. Per driver and datasheet, the gpio polarity should be
GPIO
> active-high which is to power up the codec. So using GPIOD_OUT_LOW
> when get the GPIO descriptor matches GPIOF_OUT_INIT_LOW when using
> of_gpio API.
...
> The Documentation/devicetree/bindings/sound/ak5386.txt not specify
> polarity(this seems bug), so per code and datasheet, I think it
> should be active-high. I could add a quirk in gpiolib-of to force
> active-high or acitive-low if you think needed.
I don't think we need a quirk as long as the default is the same,
I mean if the DTS is written without setting polarity, would it be
active-high or active-low?
...
> + if (priv->reset_gpio)
Redundant as it duplicates the one in the below call.
> + gpiod_set_value(priv->reset_gpio, 1);
...
> + if (priv->reset_gpio)
Ditto.
> + gpiod_set_value(priv->reset_gpio, 0);
...
> + priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR(priv->reset_gpio))
> + return dev_err_probe(dev, PTR_ERR(priv->reset_gpio),
+ dev_printk.h // or even device.h, depending on the current code base
+ err.h
> + "Failed to get AK5386 reset GPIO\n");
> + gpiod_set_consumer_name(priv->reset_gpio, "AK5386 Reset");
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists