Commit 0b0171e3 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown
Browse files

ASoC: ak4641: Cleanup manual bias level transitions



Set the CODEC driver's suspend_bias_off flag rather than manually going to
SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes
the code a bit shorter and cleaner.

Since the ASoC core now takes care of setting the bias level to
SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually
anymore either.

The manual transition to SND_SOC_BIAS_STANDBY at the end of CODEC probe()
can also be removed as the core will automatically do this after the CODEC
has been probed.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f114040e
Loading
Loading
Loading
Loading
+1 −32
Original line number Diff line number Diff line
@@ -505,39 +505,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = {
},
};

static int ak4641_suspend(struct snd_soc_codec *codec)
{
	ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF);
	return 0;
}

static int ak4641_resume(struct snd_soc_codec *codec)
{
	ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
	return 0;
}

static int ak4641_probe(struct snd_soc_codec *codec)
{
	/* power on device */
	ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	return 0;
}

static int ak4641_remove(struct snd_soc_codec *codec)
{
	ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF);

	return 0;
}


static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
	.probe			= ak4641_probe,
	.remove			= ak4641_remove,
	.suspend		= ak4641_suspend,
	.resume			= ak4641_resume,
	.controls		= ak4641_snd_controls,
	.num_controls		= ARRAY_SIZE(ak4641_snd_controls),
	.dapm_widgets		= ak4641_dapm_widgets,
@@ -545,6 +513,7 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
	.dapm_routes		= ak4641_audio_map,
	.num_dapm_routes	= ARRAY_SIZE(ak4641_audio_map),
	.set_bias_level		= ak4641_set_bias_level,
	.suspend_bias_off	= true,
};

static const struct regmap_config ak4641_regmap = {