* [PATCH] ASoC: ak5558: correct reset polarity
@ 2021-04-13 6:06 Shengjiu Wang
2021-04-13 11:17 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Shengjiu Wang @ 2021-04-13 6:06 UTC (permalink / raw)
To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel
Reset (aka power off) happens when the reset gpio is made active.
Change function name to ak5558_reset to match devicetree property
"reset-gpios".
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
sound/soc/codecs/ak5558.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c
index 8e4dca753f0b..5c3f15827423 100644
--- a/sound/soc/codecs/ak5558.c
+++ b/sound/soc/codecs/ak5558.c
@@ -318,29 +318,19 @@ static struct snd_soc_dai_driver ak5552_dai = {
.ops = &ak5558_dai_ops,
};
-static void ak5558_power_off(struct ak5558_priv *ak5558)
+static void ak5558_reset(struct ak5558_priv *ak5558, bool active)
{
- if (!ak5558->reset_gpiod)
- return;
-
- gpiod_set_value_cansleep(ak5558->reset_gpiod, 0);
- usleep_range(1000, 2000);
-}
-
-static void ak5558_power_on(struct ak5558_priv *ak5558)
-{
- if (!ak5558->reset_gpiod)
- return;
-
- gpiod_set_value_cansleep(ak5558->reset_gpiod, 1);
- usleep_range(1000, 2000);
+ if (ak5558->reset_gpiod) {
+ gpiod_set_value_cansleep(ak5558->reset_gpiod, active);
+ usleep_range(1000, 2000);
+ }
}
static int ak5558_probe(struct snd_soc_component *component)
{
struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component);
- ak5558_power_on(ak5558);
+ ak5558_reset(ak5558, false);
return ak5558_set_mcki(component);
}
@@ -348,7 +338,7 @@ static void ak5558_remove(struct snd_soc_component *component)
{
struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component);
- ak5558_power_off(ak5558);
+ ak5558_reset(ak5558, true);
}
static int __maybe_unused ak5558_runtime_suspend(struct device *dev)
@@ -356,7 +346,7 @@ static int __maybe_unused ak5558_runtime_suspend(struct device *dev)
struct ak5558_priv *ak5558 = dev_get_drvdata(dev);
regcache_cache_only(ak5558->regmap, true);
- ak5558_power_off(ak5558);
+ ak5558_reset(ak5558, true);
regulator_bulk_disable(ARRAY_SIZE(ak5558->supplies),
ak5558->supplies);
@@ -375,8 +365,8 @@ static int __maybe_unused ak5558_runtime_resume(struct device *dev)
return ret;
}
- ak5558_power_off(ak5558);
- ak5558_power_on(ak5558);
+ ak5558_reset(ak5558, true);
+ ak5558_reset(ak5558, false);
regcache_cache_only(ak5558->regmap, false);
regcache_mark_dirty(ak5558->regmap);
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: ak5558: correct reset polarity
2021-04-13 6:06 [PATCH] ASoC: ak5558: correct reset polarity Shengjiu Wang
@ 2021-04-13 11:17 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-04-13 11:17 UTC (permalink / raw)
To: Shengjiu Wang; +Cc: lgirdwood, perex, tiwai, alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
On Tue, Apr 13, 2021 at 02:06:31PM +0800, Shengjiu Wang wrote:
> Reset (aka power off) happens when the reset gpio is made active.
> Change function name to ak5558_reset to match devicetree property
> "reset-gpios".
Please split the fix to polarity out from the refactoring, the
refactoring completely dominates this patch so it's very hard to review.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: ak5558: correct reset polarity
@ 2021-04-13 11:17 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-04-13 11:17 UTC (permalink / raw)
To: Shengjiu Wang; +Cc: linux-kernel, alsa-devel, tiwai, lgirdwood
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
On Tue, Apr 13, 2021 at 02:06:31PM +0800, Shengjiu Wang wrote:
> Reset (aka power off) happens when the reset gpio is made active.
> Change function name to ak5558_reset to match devicetree property
> "reset-gpios".
Please split the fix to polarity out from the refactoring, the
refactoring completely dominates this patch so it's very hard to review.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-13 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 6:06 [PATCH] ASoC: ak5558: correct reset polarity Shengjiu Wang
2021-04-13 11:17 ` Mark Brown
2021-04-13 11:17 ` Mark Brown
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.