Skip to content

Commit

Permalink
ASoC: uda1380: Cleanup manual bias level transitions
Browse files Browse the repository at this point in the history
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 24, 2014
1 parent f114040 commit e8125f0
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions sound/soc/codecs/uda1380.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,18 +693,6 @@ static struct snd_soc_dai_driver uda1380_dai[] = {
},
};

static int uda1380_suspend(struct snd_soc_codec *codec)
{
uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}

static int uda1380_resume(struct snd_soc_codec *codec)
{
uda1380_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}

static int uda1380_probe(struct snd_soc_codec *codec)
{
struct uda1380_platform_data *pdata =codec->dev->platform_data;
Expand Down Expand Up @@ -739,8 +727,6 @@ static int uda1380_probe(struct snd_soc_codec *codec)

INIT_WORK(&uda1380->work, uda1380_flush_work);

/* power on device */
uda1380_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
/* set clock input */
switch (pdata->dac_clk) {
case UDA1380_DAC_CLK_SYSCLK:
Expand All @@ -766,8 +752,6 @@ static int uda1380_remove(struct snd_soc_codec *codec)
{
struct uda1380_platform_data *pdata =codec->dev->platform_data;

uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF);

gpio_free(pdata->gpio_reset);
gpio_free(pdata->gpio_power);

Expand All @@ -777,11 +761,11 @@ static int uda1380_remove(struct snd_soc_codec *codec)
static struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
.probe = uda1380_probe,
.remove = uda1380_remove,
.suspend = uda1380_suspend,
.resume = uda1380_resume,
.read = uda1380_read_reg_cache,
.write = uda1380_write,
.set_bias_level = uda1380_set_bias_level,
.suspend_bias_off = true,

.reg_cache_size = ARRAY_SIZE(uda1380_reg),
.reg_word_size = sizeof(u16),
.reg_cache_default = uda1380_reg,
Expand Down

0 comments on commit e8125f0

Please sign in to comment.