ASoC: codec: ak5386: Convert to GPIO descriptors
authorPeng Fan <peng.fan@nxp.com>
Sun, 6 Apr 2025 01:05:23 +0000 (09:05 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 7 Apr 2025 23:36:13 +0000 (00:36 +0100)
commit82d8d3360c16687aad3bac617601f98ae9c35147
tree344fa0e36d6fa30c8296f2b392166111aa438122
parentea61f39b38bdbb7c77ba2c70e130acdb808c8d68
ASoC: codec: ak5386: Convert to GPIO descriptors

 of_gpio.h is deprecated, update the driver to use GPIO descriptors.
 - Use devm_gpiod_get_optional to get GPIO descriptor.
 - Use gpiod_set_value to configure output value.

With legacy of_gpio API, the driver set GPIO value 1 to power up
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 bindings does not
specify polarity. Per driver and datasheet, the GPIO polarity should be
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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://patch.msgid.link/20250406010532.1212894-1-peng.fan@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/ak5386.c