aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9712.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-05-19 06:31:28 -0400
committerJaroslav Kysela <perex@perex.cz>2008-05-19 11:28:43 -0400
commit0be9898adb6f58fee44f0fec0bbc0eac997ea9eb (patch)
tree61842c7381c7dcc4060280357a9a5fc08f4db023 /sound/soc/codecs/wm9712.c
parent1ef6ab75c7deef931d6308af282ed7d8e480e77f (diff)
[ALSA] ASoC: Clarify API for bias configuration
Currently the ASoC core configures the bias levels in the system using a callback on codecs and machines called 'dapm_event', passing it PCI style power levels as SNDRV_CTL_POWER_ constants. This is more obscure than it needs to be and has caused confusion to driver authors, especially given that DAPM is also performing power management. Address this by renaming the callback function to 'set_bias_level' and using constants explicitly representing the off, standby, pre-on and on states which DAPM transitions through. Also unexport the API for setting bias level: there are currently no in-tree users of this API other than the core itself and it is likely that the core would need to be extended to cater for any users. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Jarkko Nikula <jarkko.nikula@nokia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/soc/codecs/wm9712.c')
-rw-r--r--sound/soc/codecs/wm9712.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 89efe40c7c33..e26cfcf0b4fc 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -571,23 +571,23 @@ struct snd_soc_codec_dai wm9712_dai[] = {
571}; 571};
572EXPORT_SYMBOL_GPL(wm9712_dai); 572EXPORT_SYMBOL_GPL(wm9712_dai);
573 573
574static int wm9712_dapm_event(struct snd_soc_codec *codec, int event) 574static int wm9712_set_bias_level(struct snd_soc_codec *codec,
575 enum snd_soc_bias_level level)
575{ 576{
576 switch (event) { 577 switch (level) {
577 case SNDRV_CTL_POWER_D0: /* full On */ 578 case SND_SOC_BIAS_ON:
578 case SNDRV_CTL_POWER_D1: /* partial On */ 579 case SND_SOC_BIAS_PREPARE:
579 case SNDRV_CTL_POWER_D2: /* partial On */
580 break; 580 break;
581 case SNDRV_CTL_POWER_D3hot: /* Off, with power */ 581 case SND_SOC_BIAS_STANDBY:
582 ac97_write(codec, AC97_POWERDOWN, 0x0000); 582 ac97_write(codec, AC97_POWERDOWN, 0x0000);
583 break; 583 break;
584 case SNDRV_CTL_POWER_D3cold: /* Off, without power */ 584 case SND_SOC_BIAS_OFF:
585 /* disable everything including AC link */ 585 /* disable everything including AC link */
586 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); 586 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
587 ac97_write(codec, AC97_POWERDOWN, 0xffff); 587 ac97_write(codec, AC97_POWERDOWN, 0xffff);
588 break; 588 break;
589 } 589 }
590 codec->dapm_state = event; 590 codec->bias_level = level;
591 return 0; 591 return 0;
592} 592}
593 593
@@ -615,7 +615,7 @@ static int wm9712_soc_suspend(struct platform_device *pdev,
615 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 615 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
616 struct snd_soc_codec *codec = socdev->codec; 616 struct snd_soc_codec *codec = socdev->codec;
617 617
618 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D3cold); 618 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF);
619 return 0; 619 return 0;
620} 620}
621 621
@@ -632,7 +632,7 @@ static int wm9712_soc_resume(struct platform_device *pdev)
632 return ret; 632 return ret;
633 } 633 }
634 634
635 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D3hot); 635 wm9712_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
636 636
637 if (ret == 0) { 637 if (ret == 0) {
638 /* Sync reg_cache with the hardware after cold reset */ 638 /* Sync reg_cache with the hardware after cold reset */
@@ -644,8 +644,8 @@ static int wm9712_soc_resume(struct platform_device *pdev)
644 } 644 }
645 } 645 }
646 646
647 if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) 647 if (codec->suspend_bias_level == SND_SOC_BIAS_ON)
648 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D0); 648 wm9712_set_bias_level(codec, SND_SOC_BIAS_ON);
649 649
650 return ret; 650 return ret;
651} 651}
@@ -679,7 +679,7 @@ static int wm9712_soc_probe(struct platform_device *pdev)
679 codec->num_dai = ARRAY_SIZE(wm9712_dai); 679 codec->num_dai = ARRAY_SIZE(wm9712_dai);
680 codec->write = ac97_write; 680 codec->write = ac97_write;
681 codec->read = ac97_read; 681 codec->read = ac97_read;
682 codec->dapm_event = wm9712_dapm_event; 682 codec->set_bias_level = wm9712_set_bias_level;
683 INIT_LIST_HEAD(&codec->dapm_widgets); 683 INIT_LIST_HEAD(&codec->dapm_widgets);
684 INIT_LIST_HEAD(&codec->dapm_paths); 684 INIT_LIST_HEAD(&codec->dapm_paths);
685 685
@@ -703,7 +703,7 @@ static int wm9712_soc_probe(struct platform_device *pdev)
703 /* set alc mux to none */ 703 /* set alc mux to none */
704 ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000); 704 ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000);
705 705
706 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D3hot); 706 wm9712_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
707 wm9712_add_controls(codec); 707 wm9712_add_controls(codec);
708 wm9712_add_widgets(codec); 708 wm9712_add_widgets(codec);
709 ret = snd_soc_register_card(socdev); 709 ret = snd_soc_register_card(socdev);