All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>, Peng Fan <peng.fan@nxp.com>,
	"open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..."
	<linux-sound@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:GPIO
	SUBSYSTEM:Keyword:(devm_)?gpio_(request|free|direction|get|set)"
	<linux-gpio@vger.kernel.org>,
	krzk@kernel.org
Subject: Re: [PATCH]  ASoC: codec: ak5386: Convert to GPIO descriptors
Date: Fri, 28 Mar 2025 15:33:11 +0200	[thread overview]
Message-ID: <Z-alF-gK5TpGliCj@smile.fi.intel.com> (raw)
In-Reply-To: <20250328113918.1981069-1-peng.fan@oss.nxp.com>

On Fri, Mar 28, 2025 at 07:39:17PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.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



  reply	other threads:[~2025-03-28 13:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 11:39 [PATCH] ASoC: codec: ak5386: Convert to GPIO descriptors Peng Fan (OSS)
2025-03-28 13:33 ` Andy Shevchenko [this message]
2025-03-31  6:03   ` Peng Fan
2025-03-31  7:19     ` Andy Shevchenko
2025-03-31 11:54       ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-alF-gK5TpGliCj@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.