Commit e953daeb authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Mark Brown

ASoC: ak4458: correct reset polarity

Reset (aka power off) happens when the reset gpio is made active.
Change function name to ak4458_reset to match devicetree property "reset-gpios"
Signed-off-by: default avatarEliot Blennerhassett <eliot@blennerhassett.gen.nz>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/ce650f47-4ff6-e486-7846-cc3d033f3601@blennerhassett.gen.nzSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1d8fe064
...@@ -595,18 +595,10 @@ static struct snd_soc_dai_driver ak4497_dai = { ...@@ -595,18 +595,10 @@ static struct snd_soc_dai_driver ak4497_dai = {
.ops = &ak4458_dai_ops, .ops = &ak4458_dai_ops,
}; };
static void ak4458_power_off(struct ak4458_priv *ak4458) static void ak4458_reset(struct ak4458_priv *ak4458, bool active)
{ {
if (ak4458->reset_gpiod) { if (ak4458->reset_gpiod) {
gpiod_set_value_cansleep(ak4458->reset_gpiod, 0); gpiod_set_value_cansleep(ak4458->reset_gpiod, active);
usleep_range(1000, 2000);
}
}
static void ak4458_power_on(struct ak4458_priv *ak4458)
{
if (ak4458->reset_gpiod) {
gpiod_set_value_cansleep(ak4458->reset_gpiod, 1);
usleep_range(1000, 2000); usleep_range(1000, 2000);
} }
} }
...@@ -620,7 +612,7 @@ static int ak4458_init(struct snd_soc_component *component) ...@@ -620,7 +612,7 @@ static int ak4458_init(struct snd_soc_component *component)
if (ak4458->mute_gpiod) if (ak4458->mute_gpiod)
gpiod_set_value_cansleep(ak4458->mute_gpiod, 1); gpiod_set_value_cansleep(ak4458->mute_gpiod, 1);
ak4458_power_on(ak4458); ak4458_reset(ak4458, false);
ret = snd_soc_component_update_bits(component, AK4458_00_CONTROL1, ret = snd_soc_component_update_bits(component, AK4458_00_CONTROL1,
0x80, 0x80); /* ACKS bit = 1; 10000000 */ 0x80, 0x80); /* ACKS bit = 1; 10000000 */
...@@ -650,7 +642,7 @@ static void ak4458_remove(struct snd_soc_component *component) ...@@ -650,7 +642,7 @@ static void ak4458_remove(struct snd_soc_component *component)
{ {
struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
ak4458_power_off(ak4458); ak4458_reset(ak4458, true);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -660,7 +652,7 @@ static int __maybe_unused ak4458_runtime_suspend(struct device *dev) ...@@ -660,7 +652,7 @@ static int __maybe_unused ak4458_runtime_suspend(struct device *dev)
regcache_cache_only(ak4458->regmap, true); regcache_cache_only(ak4458->regmap, true);
ak4458_power_off(ak4458); ak4458_reset(ak4458, true);
if (ak4458->mute_gpiod) if (ak4458->mute_gpiod)
gpiod_set_value_cansleep(ak4458->mute_gpiod, 0); gpiod_set_value_cansleep(ak4458->mute_gpiod, 0);
...@@ -685,8 +677,8 @@ static int __maybe_unused ak4458_runtime_resume(struct device *dev) ...@@ -685,8 +677,8 @@ static int __maybe_unused ak4458_runtime_resume(struct device *dev)
if (ak4458->mute_gpiod) if (ak4458->mute_gpiod)
gpiod_set_value_cansleep(ak4458->mute_gpiod, 1); gpiod_set_value_cansleep(ak4458->mute_gpiod, 1);
ak4458_power_off(ak4458); ak4458_reset(ak4458, true);
ak4458_power_on(ak4458); ak4458_reset(ak4458, false);
regcache_cache_only(ak4458->regmap, false); regcache_cache_only(ak4458->regmap, false);
regcache_mark_dirty(ak4458->regmap); regcache_mark_dirty(ak4458->regmap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment