diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-05-19 06:31:28 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-05-19 11:28:43 -0400 |
commit | 0be9898adb6f58fee44f0fec0bbc0eac997ea9eb (patch) | |
tree | 61842c7381c7dcc4060280357a9a5fc08f4db023 /sound/soc | |
parent | 1ef6ab75c7deef931d6308af282ed7d8e480e77f (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')
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 26 | ||||
-rw-r--r-- | sound/soc/codecs/wm8731.c | 28 | ||||
-rw-r--r-- | sound/soc/codecs/wm8750.c | 36 | ||||
-rw-r--r-- | sound/soc/codecs/wm8753.c | 36 | ||||
-rw-r--r-- | sound/soc/codecs/wm9712.c | 28 | ||||
-rw-r--r-- | sound/soc/codecs/wm9713.c | 26 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 25 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 44 |
8 files changed, 124 insertions, 125 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index cb8365ac0c02..dc8a38d9e53a 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -847,13 +847,14 @@ static int aic3x_set_dai_fmt(struct snd_soc_codec_dai *codec_dai, | |||
847 | return 0; | 847 | return 0; |
848 | } | 848 | } |
849 | 849 | ||
850 | static int aic3x_dapm_event(struct snd_soc_codec *codec, int event) | 850 | static int aic3x_set_bias_level(struct snd_soc_codec *codec, |
851 | enum snd_soc_bias_level level) | ||
851 | { | 852 | { |
852 | struct aic3x_priv *aic3x = codec->private_data; | 853 | struct aic3x_priv *aic3x = codec->private_data; |
853 | u8 reg; | 854 | u8 reg; |
854 | 855 | ||
855 | switch (event) { | 856 | switch (level) { |
856 | case SNDRV_CTL_POWER_D0: | 857 | case SND_SOC_BIAS_ON: |
857 | /* all power is driven by DAPM system */ | 858 | /* all power is driven by DAPM system */ |
858 | if (aic3x->master) { | 859 | if (aic3x->master) { |
859 | /* enable pll */ | 860 | /* enable pll */ |
@@ -862,10 +863,9 @@ static int aic3x_dapm_event(struct snd_soc_codec *codec, int event) | |||
862 | reg | PLL_ENABLE); | 863 | reg | PLL_ENABLE); |
863 | } | 864 | } |
864 | break; | 865 | break; |
865 | case SNDRV_CTL_POWER_D1: | 866 | case SND_SOC_BIAS_PREPARE: |
866 | case SNDRV_CTL_POWER_D2: | ||
867 | break; | 867 | break; |
868 | case SNDRV_CTL_POWER_D3hot: | 868 | case SND_SOC_BIAS_STANDBY: |
869 | /* | 869 | /* |
870 | * all power is driven by DAPM system, | 870 | * all power is driven by DAPM system, |
871 | * so output power is safe if bypass was set | 871 | * so output power is safe if bypass was set |
@@ -877,7 +877,7 @@ static int aic3x_dapm_event(struct snd_soc_codec *codec, int event) | |||
877 | reg & ~PLL_ENABLE); | 877 | reg & ~PLL_ENABLE); |
878 | } | 878 | } |
879 | break; | 879 | break; |
880 | case SNDRV_CTL_POWER_D3cold: | 880 | case SND_SOC_BIAS_OFF: |
881 | /* force all power off */ | 881 | /* force all power off */ |
882 | reg = aic3x_read_reg_cache(codec, LINE1L_2_LADC_CTRL); | 882 | reg = aic3x_read_reg_cache(codec, LINE1L_2_LADC_CTRL); |
883 | aic3x_write(codec, LINE1L_2_LADC_CTRL, reg & ~LADC_PWR_ON); | 883 | aic3x_write(codec, LINE1L_2_LADC_CTRL, reg & ~LADC_PWR_ON); |
@@ -913,7 +913,7 @@ static int aic3x_dapm_event(struct snd_soc_codec *codec, int event) | |||
913 | } | 913 | } |
914 | break; | 914 | break; |
915 | } | 915 | } |
916 | codec->dapm_state = event; | 916 | codec->bias_level = level; |
917 | 917 | ||
918 | return 0; | 918 | return 0; |
919 | } | 919 | } |
@@ -979,7 +979,7 @@ static int aic3x_suspend(struct platform_device *pdev, pm_message_t state) | |||
979 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 979 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
980 | struct snd_soc_codec *codec = socdev->codec; | 980 | struct snd_soc_codec *codec = socdev->codec; |
981 | 981 | ||
982 | aic3x_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 982 | aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); |
983 | 983 | ||
984 | return 0; | 984 | return 0; |
985 | } | 985 | } |
@@ -999,7 +999,7 @@ static int aic3x_resume(struct platform_device *pdev) | |||
999 | codec->hw_write(codec->control_data, data, 2); | 999 | codec->hw_write(codec->control_data, data, 2); |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | aic3x_dapm_event(codec, codec->suspend_dapm_state); | 1002 | aic3x_set_bias_level(codec, codec->suspend_bias_level); |
1003 | 1003 | ||
1004 | return 0; | 1004 | return 0; |
1005 | } | 1005 | } |
@@ -1018,7 +1018,7 @@ static int aic3x_init(struct snd_soc_device *socdev) | |||
1018 | codec->owner = THIS_MODULE; | 1018 | codec->owner = THIS_MODULE; |
1019 | codec->read = aic3x_read_reg_cache; | 1019 | codec->read = aic3x_read_reg_cache; |
1020 | codec->write = aic3x_write; | 1020 | codec->write = aic3x_write; |
1021 | codec->dapm_event = aic3x_dapm_event; | 1021 | codec->set_bias_level = aic3x_set_bias_level; |
1022 | codec->dai = &aic3x_dai; | 1022 | codec->dai = &aic3x_dai; |
1023 | codec->num_dai = 1; | 1023 | codec->num_dai = 1; |
1024 | codec->reg_cache_size = sizeof(aic3x_reg); | 1024 | codec->reg_cache_size = sizeof(aic3x_reg); |
@@ -1100,7 +1100,7 @@ static int aic3x_init(struct snd_soc_device *socdev) | |||
1100 | aic3x_write(codec, LINE2R_2_MONOLOPM_VOL, DEFAULT_VOL); | 1100 | aic3x_write(codec, LINE2R_2_MONOLOPM_VOL, DEFAULT_VOL); |
1101 | 1101 | ||
1102 | /* off, with power on */ | 1102 | /* off, with power on */ |
1103 | aic3x_dapm_event(codec, SNDRV_CTL_POWER_D3hot); | 1103 | aic3x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1104 | 1104 | ||
1105 | /* setup GPIO functions */ | 1105 | /* setup GPIO functions */ |
1106 | aic3x_write(codec, AIC3X_GPIO1_REG, (setup->gpio_func[0] & 0xf) << 4); | 1106 | aic3x_write(codec, AIC3X_GPIO1_REG, (setup->gpio_func[0] & 0xf) << 4); |
@@ -1271,7 +1271,7 @@ static int aic3x_remove(struct platform_device *pdev) | |||
1271 | 1271 | ||
1272 | /* power down chip */ | 1272 | /* power down chip */ |
1273 | if (codec->control_data) | 1273 | if (codec->control_data) |
1274 | aic3x_dapm_event(codec, SNDRV_CTL_POWER_D3); | 1274 | aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1275 | 1275 | ||
1276 | snd_soc_free_pcms(socdev); | 1276 | snd_soc_free_pcms(socdev); |
1277 | snd_soc_dapm_free(socdev); | 1277 | snd_soc_dapm_free(socdev); |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 0cf9265fca8f..0f28aa4bcccb 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -435,29 +435,29 @@ static int wm8731_set_dai_fmt(struct snd_soc_codec_dai *codec_dai, | |||
435 | return 0; | 435 | return 0; |
436 | } | 436 | } |
437 | 437 | ||
438 | static int wm8731_dapm_event(struct snd_soc_codec *codec, int event) | 438 | static int wm8731_set_bias_level(struct snd_soc_codec *codec, |
439 | enum snd_soc_bias_level level) | ||
439 | { | 440 | { |
440 | u16 reg = wm8731_read_reg_cache(codec, WM8731_PWR) & 0xff7f; | 441 | u16 reg = wm8731_read_reg_cache(codec, WM8731_PWR) & 0xff7f; |
441 | 442 | ||
442 | switch (event) { | 443 | switch (level) { |
443 | case SNDRV_CTL_POWER_D0: /* full On */ | 444 | case SND_SOC_BIAS_ON: |
444 | /* vref/mid, osc on, dac unmute */ | 445 | /* vref/mid, osc on, dac unmute */ |
445 | wm8731_write(codec, WM8731_PWR, reg); | 446 | wm8731_write(codec, WM8731_PWR, reg); |
446 | break; | 447 | break; |
447 | case SNDRV_CTL_POWER_D1: /* partial On */ | 448 | case SND_SOC_BIAS_PREPARE: |
448 | case SNDRV_CTL_POWER_D2: /* partial On */ | ||
449 | break; | 449 | break; |
450 | case SNDRV_CTL_POWER_D3hot: /* Off, with power */ | 450 | case SND_SOC_BIAS_STANDBY: |
451 | /* everything off except vref/vmid, */ | 451 | /* everything off except vref/vmid, */ |
452 | wm8731_write(codec, WM8731_PWR, reg | 0x0040); | 452 | wm8731_write(codec, WM8731_PWR, reg | 0x0040); |
453 | break; | 453 | break; |
454 | case SNDRV_CTL_POWER_D3cold: /* Off, without power */ | 454 | case SND_SOC_BIAS_OFF: |
455 | /* everything off, dac mute, inactive */ | 455 | /* everything off, dac mute, inactive */ |
456 | wm8731_write(codec, WM8731_ACTIVE, 0x0); | 456 | wm8731_write(codec, WM8731_ACTIVE, 0x0); |
457 | wm8731_write(codec, WM8731_PWR, 0xffff); | 457 | wm8731_write(codec, WM8731_PWR, 0xffff); |
458 | break; | 458 | break; |
459 | } | 459 | } |
460 | codec->dapm_state = event; | 460 | codec->bias_level = level; |
461 | return 0; | 461 | return 0; |
462 | } | 462 | } |
463 | 463 | ||
@@ -503,7 +503,7 @@ static int wm8731_suspend(struct platform_device *pdev, pm_message_t state) | |||
503 | struct snd_soc_codec *codec = socdev->codec; | 503 | struct snd_soc_codec *codec = socdev->codec; |
504 | 504 | ||
505 | wm8731_write(codec, WM8731_ACTIVE, 0x0); | 505 | wm8731_write(codec, WM8731_ACTIVE, 0x0); |
506 | wm8731_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 506 | wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); |
507 | return 0; | 507 | return 0; |
508 | } | 508 | } |
509 | 509 | ||
@@ -521,8 +521,8 @@ static int wm8731_resume(struct platform_device *pdev) | |||
521 | data[1] = cache[i] & 0x00ff; | 521 | data[1] = cache[i] & 0x00ff; |
522 | codec->hw_write(codec->control_data, data, 2); | 522 | codec->hw_write(codec->control_data, data, 2); |
523 | } | 523 | } |
524 | wm8731_dapm_event(codec, SNDRV_CTL_POWER_D3hot); | 524 | wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
525 | wm8731_dapm_event(codec, codec->suspend_dapm_state); | 525 | wm8731_set_bias_level(codec, codec->suspend_bias_level); |
526 | return 0; | 526 | return 0; |
527 | } | 527 | } |
528 | 528 | ||
@@ -539,7 +539,7 @@ static int wm8731_init(struct snd_soc_device *socdev) | |||
539 | codec->owner = THIS_MODULE; | 539 | codec->owner = THIS_MODULE; |
540 | codec->read = wm8731_read_reg_cache; | 540 | codec->read = wm8731_read_reg_cache; |
541 | codec->write = wm8731_write; | 541 | codec->write = wm8731_write; |
542 | codec->dapm_event = wm8731_dapm_event; | 542 | codec->set_bias_level = wm8731_set_bias_level; |
543 | codec->dai = &wm8731_dai; | 543 | codec->dai = &wm8731_dai; |
544 | codec->num_dai = 1; | 544 | codec->num_dai = 1; |
545 | codec->reg_cache_size = sizeof(wm8731_reg); | 545 | codec->reg_cache_size = sizeof(wm8731_reg); |
@@ -557,7 +557,7 @@ static int wm8731_init(struct snd_soc_device *socdev) | |||
557 | } | 557 | } |
558 | 558 | ||
559 | /* power on device */ | 559 | /* power on device */ |
560 | wm8731_dapm_event(codec, SNDRV_CTL_POWER_D3hot); | 560 | wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
561 | 561 | ||
562 | /* set the update bits */ | 562 | /* set the update bits */ |
563 | reg = wm8731_read_reg_cache(codec, WM8731_LOUT1V); | 563 | reg = wm8731_read_reg_cache(codec, WM8731_LOUT1V); |
@@ -730,7 +730,7 @@ static int wm8731_remove(struct platform_device *pdev) | |||
730 | struct snd_soc_codec *codec = socdev->codec; | 730 | struct snd_soc_codec *codec = socdev->codec; |
731 | 731 | ||
732 | if (codec->control_data) | 732 | if (codec->control_data) |
733 | wm8731_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 733 | wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); |
734 | 734 | ||
735 | snd_soc_free_pcms(socdev); | 735 | snd_soc_free_pcms(socdev); |
736 | snd_soc_dapm_free(socdev); | 736 | snd_soc_dapm_free(socdev); |
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 16cd5d4d5ad9..62423f4493b0 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -686,29 +686,29 @@ static int wm8750_mute(struct snd_soc_codec_dai *dai, int mute) | |||
686 | return 0; | 686 | return 0; |
687 | } | 687 | } |
688 | 688 | ||
689 | static int wm8750_dapm_event(struct snd_soc_codec *codec, int event) | 689 | static int wm8750_set_bias_level(struct snd_soc_codec *codec, |
690 | enum snd_soc_bias_level level) | ||
690 | { | 691 | { |
691 | u16 pwr_reg = wm8750_read_reg_cache(codec, WM8750_PWR1) & 0xfe3e; | 692 | u16 pwr_reg = wm8750_read_reg_cache(codec, WM8750_PWR1) & 0xfe3e; |
692 | 693 | ||
693 | switch (event) { | 694 | switch (level) { |
694 | case SNDRV_CTL_POWER_D0: /* full On */ | 695 | case SND_SOC_BIAS_ON: |
695 | /* set vmid to 50k and unmute dac */ | 696 | /* set vmid to 50k and unmute dac */ |
696 | wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x00c0); | 697 | wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x00c0); |
697 | break; | 698 | break; |
698 | case SNDRV_CTL_POWER_D1: /* partial On */ | 699 | case SND_SOC_BIAS_PREPARE: |
699 | case SNDRV_CTL_POWER_D2: /* partial On */ | ||
700 | /* set vmid to 5k for quick power up */ | 700 | /* set vmid to 5k for quick power up */ |
701 | wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x01c1); | 701 | wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x01c1); |
702 | break; | 702 | break; |
703 | case SNDRV_CTL_POWER_D3hot: /* Off, with power */ | 703 | case SND_SOC_BIAS_STANDBY: |
704 | /* mute dac and set vmid to 500k, enable VREF */ | 704 | /* mute dac and set vmid to 500k, enable VREF */ |
705 | wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x0141); | 705 | wm8750_write(codec, WM8750_PWR1, pwr_reg | 0x0141); |
706 | break; | 706 | break; |
707 | case SNDRV_CTL_POWER_D3cold: /* Off, without power */ | 707 | case SND_SOC_BIAS_OFF: |
708 | wm8750_write(codec, WM8750_PWR1, 0x0001); | 708 | wm8750_write(codec, WM8750_PWR1, 0x0001); |
709 | break; | 709 | break; |
710 | } | 710 | } |
711 | codec->dapm_state = event; | 711 | codec->bias_level = level; |
712 | return 0; | 712 | return 0; |
713 | } | 713 | } |
714 | 714 | ||
@@ -748,7 +748,7 @@ static void wm8750_work(struct work_struct *work) | |||
748 | { | 748 | { |
749 | struct snd_soc_codec *codec = | 749 | struct snd_soc_codec *codec = |
750 | container_of(work, struct snd_soc_codec, delayed_work.work); | 750 | container_of(work, struct snd_soc_codec, delayed_work.work); |
751 | wm8750_dapm_event(codec, codec->dapm_state); | 751 | wm8750_set_bias_level(codec, codec->bias_level); |
752 | } | 752 | } |
753 | 753 | ||
754 | static int wm8750_suspend(struct platform_device *pdev, pm_message_t state) | 754 | static int wm8750_suspend(struct platform_device *pdev, pm_message_t state) |
@@ -756,7 +756,7 @@ static int wm8750_suspend(struct platform_device *pdev, pm_message_t state) | |||
756 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 756 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
757 | struct snd_soc_codec *codec = socdev->codec; | 757 | struct snd_soc_codec *codec = socdev->codec; |
758 | 758 | ||
759 | wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 759 | wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); |
760 | return 0; | 760 | return 0; |
761 | } | 761 | } |
762 | 762 | ||
@@ -777,12 +777,12 @@ static int wm8750_resume(struct platform_device *pdev) | |||
777 | codec->hw_write(codec->control_data, data, 2); | 777 | codec->hw_write(codec->control_data, data, 2); |
778 | } | 778 | } |
779 | 779 | ||
780 | wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3hot); | 780 | wm8750_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
781 | 781 | ||
782 | /* charge wm8750 caps */ | 782 | /* charge wm8750 caps */ |
783 | if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) { | 783 | if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { |
784 | wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2); | 784 | wm8750_set_bias_level(codec, SND_SOC_BIAS_PREPARE); |
785 | codec->dapm_state = SNDRV_CTL_POWER_D0; | 785 | codec->bias_level = SND_SOC_BIAS_ON; |
786 | schedule_delayed_work(&codec->delayed_work, | 786 | schedule_delayed_work(&codec->delayed_work, |
787 | msecs_to_jiffies(1000)); | 787 | msecs_to_jiffies(1000)); |
788 | } | 788 | } |
@@ -803,7 +803,7 @@ static int wm8750_init(struct snd_soc_device *socdev) | |||
803 | codec->owner = THIS_MODULE; | 803 | codec->owner = THIS_MODULE; |
804 | codec->read = wm8750_read_reg_cache; | 804 | codec->read = wm8750_read_reg_cache; |
805 | codec->write = wm8750_write; | 805 | codec->write = wm8750_write; |
806 | codec->dapm_event = wm8750_dapm_event; | 806 | codec->set_bias_level = wm8750_set_bias_level; |
807 | codec->dai = &wm8750_dai; | 807 | codec->dai = &wm8750_dai; |
808 | codec->num_dai = 1; | 808 | codec->num_dai = 1; |
809 | codec->reg_cache_size = sizeof(wm8750_reg); | 809 | codec->reg_cache_size = sizeof(wm8750_reg); |
@@ -821,8 +821,8 @@ static int wm8750_init(struct snd_soc_device *socdev) | |||
821 | } | 821 | } |
822 | 822 | ||
823 | /* charge output caps */ | 823 | /* charge output caps */ |
824 | wm8750_dapm_event(codec, SNDRV_CTL_POWER_D2); | 824 | wm8750_set_bias_level(codec, SND_SOC_BIAS_PREPARE); |
825 | codec->dapm_state = SNDRV_CTL_POWER_D3hot; | 825 | codec->bias_level = SND_SOC_BIAS_STANDBY; |
826 | schedule_delayed_work(&codec->delayed_work, msecs_to_jiffies(1000)); | 826 | schedule_delayed_work(&codec->delayed_work, msecs_to_jiffies(1000)); |
827 | 827 | ||
828 | /* set the update bits */ | 828 | /* set the update bits */ |
@@ -1021,7 +1021,7 @@ static int wm8750_remove(struct platform_device *pdev) | |||
1021 | struct snd_soc_codec *codec = socdev->codec; | 1021 | struct snd_soc_codec *codec = socdev->codec; |
1022 | 1022 | ||
1023 | if (codec->control_data) | 1023 | if (codec->control_data) |
1024 | wm8750_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 1024 | wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1025 | run_delayed_work(&codec->delayed_work); | 1025 | run_delayed_work(&codec->delayed_work); |
1026 | snd_soc_free_pcms(socdev); | 1026 | snd_soc_free_pcms(socdev); |
1027 | snd_soc_dapm_free(socdev); | 1027 | snd_soc_dapm_free(socdev); |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index fb41826c4c4c..9032b0c07c86 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -1274,29 +1274,29 @@ static int wm8753_mute(struct snd_soc_codec_dai *dai, int mute) | |||
1274 | return 0; | 1274 | return 0; |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | static int wm8753_dapm_event(struct snd_soc_codec *codec, int event) | 1277 | static int wm8753_set_bias_level(struct snd_soc_codec *codec, |
1278 | enum snd_soc_bias_level level) | ||
1278 | { | 1279 | { |
1279 | u16 pwr_reg = wm8753_read_reg_cache(codec, WM8753_PWR1) & 0xfe3e; | 1280 | u16 pwr_reg = wm8753_read_reg_cache(codec, WM8753_PWR1) & 0xfe3e; |
1280 | 1281 | ||
1281 | switch (event) { | 1282 | switch (level) { |
1282 | case SNDRV_CTL_POWER_D0: /* full On */ | 1283 | case SND_SOC_BIAS_ON: |
1283 | /* set vmid to 50k and unmute dac */ | 1284 | /* set vmid to 50k and unmute dac */ |
1284 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); | 1285 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); |
1285 | break; | 1286 | break; |
1286 | case SNDRV_CTL_POWER_D1: /* partial On */ | 1287 | case SND_SOC_BIAS_PREPARE: |
1287 | case SNDRV_CTL_POWER_D2: /* partial On */ | ||
1288 | /* set vmid to 5k for quick power up */ | 1288 | /* set vmid to 5k for quick power up */ |
1289 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); | 1289 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); |
1290 | break; | 1290 | break; |
1291 | case SNDRV_CTL_POWER_D3hot: /* Off, with power */ | 1291 | case SND_SOC_BIAS_STANDBY: |
1292 | /* mute dac and set vmid to 500k, enable VREF */ | 1292 | /* mute dac and set vmid to 500k, enable VREF */ |
1293 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x0141); | 1293 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x0141); |
1294 | break; | 1294 | break; |
1295 | case SNDRV_CTL_POWER_D3cold: /* Off, without power */ | 1295 | case SND_SOC_BIAS_OFF: |
1296 | wm8753_write(codec, WM8753_PWR1, 0x0001); | 1296 | wm8753_write(codec, WM8753_PWR1, 0x0001); |
1297 | break; | 1297 | break; |
1298 | } | 1298 | } |
1299 | codec->dapm_state = event; | 1299 | codec->bias_level = level; |
1300 | return 0; | 1300 | return 0; |
1301 | } | 1301 | } |
1302 | 1302 | ||
@@ -1500,7 +1500,7 @@ static void wm8753_work(struct work_struct *work) | |||
1500 | { | 1500 | { |
1501 | struct snd_soc_codec *codec = | 1501 | struct snd_soc_codec *codec = |
1502 | container_of(work, struct snd_soc_codec, delayed_work.work); | 1502 | container_of(work, struct snd_soc_codec, delayed_work.work); |
1503 | wm8753_dapm_event(codec, codec->dapm_state); | 1503 | wm8753_set_bias_level(codec, codec->bias_level); |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | static int wm8753_suspend(struct platform_device *pdev, pm_message_t state) | 1506 | static int wm8753_suspend(struct platform_device *pdev, pm_message_t state) |
@@ -1512,7 +1512,7 @@ static int wm8753_suspend(struct platform_device *pdev, pm_message_t state) | |||
1512 | if (!codec->card) | 1512 | if (!codec->card) |
1513 | return 0; | 1513 | return 0; |
1514 | 1514 | ||
1515 | wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 1515 | wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1516 | return 0; | 1516 | return 0; |
1517 | } | 1517 | } |
1518 | 1518 | ||
@@ -1537,12 +1537,12 @@ static int wm8753_resume(struct platform_device *pdev) | |||
1537 | codec->hw_write(codec->control_data, data, 2); | 1537 | codec->hw_write(codec->control_data, data, 2); |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3hot); | 1540 | wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1541 | 1541 | ||
1542 | /* charge wm8753 caps */ | 1542 | /* charge wm8753 caps */ |
1543 | if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) { | 1543 | if (codec->suspend_bias_level == SND_SOC_BIAS_ON) { |
1544 | wm8753_dapm_event(codec, SNDRV_CTL_POWER_D2); | 1544 | wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE); |
1545 | codec->dapm_state = SNDRV_CTL_POWER_D0; | 1545 | codec->bias_level = SND_SOC_BIAS_ON; |
1546 | schedule_delayed_work(&codec->delayed_work, | 1546 | schedule_delayed_work(&codec->delayed_work, |
1547 | msecs_to_jiffies(caps_charge)); | 1547 | msecs_to_jiffies(caps_charge)); |
1548 | } | 1548 | } |
@@ -1563,7 +1563,7 @@ static int wm8753_init(struct snd_soc_device *socdev) | |||
1563 | codec->owner = THIS_MODULE; | 1563 | codec->owner = THIS_MODULE; |
1564 | codec->read = wm8753_read_reg_cache; | 1564 | codec->read = wm8753_read_reg_cache; |
1565 | codec->write = wm8753_write; | 1565 | codec->write = wm8753_write; |
1566 | codec->dapm_event = wm8753_dapm_event; | 1566 | codec->set_bias_level = wm8753_set_bias_level; |
1567 | codec->dai = wm8753_dai; | 1567 | codec->dai = wm8753_dai; |
1568 | codec->num_dai = 2; | 1568 | codec->num_dai = 2; |
1569 | codec->reg_cache_size = sizeof(wm8753_reg); | 1569 | codec->reg_cache_size = sizeof(wm8753_reg); |
@@ -1584,8 +1584,8 @@ static int wm8753_init(struct snd_soc_device *socdev) | |||
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | /* charge output caps */ | 1586 | /* charge output caps */ |
1587 | wm8753_dapm_event(codec, SNDRV_CTL_POWER_D2); | 1587 | wm8753_set_bias_level(codec, SND_SOC_BIAS_PREPARE); |
1588 | codec->dapm_state = SNDRV_CTL_POWER_D3hot; | 1588 | codec->bias_level = SND_SOC_BIAS_STANDBY; |
1589 | schedule_delayed_work(&codec->delayed_work, | 1589 | schedule_delayed_work(&codec->delayed_work, |
1590 | msecs_to_jiffies(caps_charge)); | 1590 | msecs_to_jiffies(caps_charge)); |
1591 | 1591 | ||
@@ -1792,7 +1792,7 @@ static int wm8753_remove(struct platform_device *pdev) | |||
1792 | struct snd_soc_codec *codec = socdev->codec; | 1792 | struct snd_soc_codec *codec = socdev->codec; |
1793 | 1793 | ||
1794 | if (codec->control_data) | 1794 | if (codec->control_data) |
1795 | wm8753_dapm_event(codec, SNDRV_CTL_POWER_D3cold); | 1795 | wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1796 | run_delayed_work(&codec->delayed_work); | 1796 | run_delayed_work(&codec->delayed_work); |
1797 | snd_soc_free_pcms(socdev); | 1797 | snd_soc_free_pcms(socdev); |
1798 | snd_soc_dapm_free(socdev); | 1798 | snd_soc_dapm_free(socdev); |
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 | }; |
572 | EXPORT_SYMBOL_GPL(wm9712_dai); | 572 | EXPORT_SYMBOL_GPL(wm9712_dai); |
573 | 573 | ||
574 | static int wm9712_dapm_event(struct snd_soc_codec *codec, int event) | 574 | static 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); |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 9e6b2fd7262b..4863636e9d56 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -1094,33 +1094,33 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm) | |||
1094 | } | 1094 | } |
1095 | EXPORT_SYMBOL_GPL(wm9713_reset); | 1095 | EXPORT_SYMBOL_GPL(wm9713_reset); |
1096 | 1096 | ||
1097 | static int wm9713_dapm_event(struct snd_soc_codec *codec, int event) | 1097 | static int wm9713_set_bias_level(struct snd_soc_codec *codec, |
1098 | enum snd_soc_bias_level level) | ||
1098 | { | 1099 | { |
1099 | u16 reg; | 1100 | u16 reg; |
1100 | 1101 | ||
1101 | switch (event) { | 1102 | switch (level) { |
1102 | case SNDRV_CTL_POWER_D0: /* full On */ | 1103 | case SND_SOC_BIAS_ON: |
1103 | /* enable thermal shutdown */ | 1104 | /* enable thermal shutdown */ |
1104 | reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x1bff; | 1105 | reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x1bff; |
1105 | ac97_write(codec, AC97_EXTENDED_MID, reg); | 1106 | ac97_write(codec, AC97_EXTENDED_MID, reg); |
1106 | break; | 1107 | break; |
1107 | case SNDRV_CTL_POWER_D1: /* partial On */ | 1108 | case SND_SOC_BIAS_PREPARE: |
1108 | case SNDRV_CTL_POWER_D2: /* partial On */ | ||
1109 | break; | 1109 | break; |
1110 | case SNDRV_CTL_POWER_D3hot: /* Off, with power */ | 1110 | case SND_SOC_BIAS_STANDBY: |
1111 | /* enable master bias and vmid */ | 1111 | /* enable master bias and vmid */ |
1112 | reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x3bff; | 1112 | reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x3bff; |
1113 | ac97_write(codec, AC97_EXTENDED_MID, reg); | 1113 | ac97_write(codec, AC97_EXTENDED_MID, reg); |
1114 | ac97_write(codec, AC97_POWERDOWN, 0x0000); | 1114 | ac97_write(codec, AC97_POWERDOWN, 0x0000); |
1115 | break; | 1115 | break; |
1116 | case SNDRV_CTL_POWER_D3cold: /* Off, without power */ | 1116 | case SND_SOC_BIAS_OFF: |
1117 | /* disable everything including AC link */ | 1117 | /* disable everything including AC link */ |
1118 | ac97_write(codec, AC97_EXTENDED_MID, 0xffff); | 1118 | ac97_write(codec, AC97_EXTENDED_MID, 0xffff); |
1119 | ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); | 1119 | ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); |
1120 | ac97_write(codec, AC97_POWERDOWN, 0xffff); | 1120 | ac97_write(codec, AC97_POWERDOWN, 0xffff); |
1121 | break; | 1121 | break; |
1122 | } | 1122 | } |
1123 | codec->dapm_state = event; | 1123 | codec->bias_level = level; |
1124 | return 0; | 1124 | return 0; |
1125 | } | 1125 | } |
1126 | 1126 | ||
@@ -1157,7 +1157,7 @@ static int wm9713_soc_resume(struct platform_device *pdev) | |||
1157 | return ret; | 1157 | return ret; |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | wm9713_dapm_event(codec, SNDRV_CTL_POWER_D3hot); | 1160 | wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1161 | 1161 | ||
1162 | /* do we need to re-start the PLL ? */ | 1162 | /* do we need to re-start the PLL ? */ |
1163 | if (wm9713->pll_out) | 1163 | if (wm9713->pll_out) |
@@ -1173,8 +1173,8 @@ static int wm9713_soc_resume(struct platform_device *pdev) | |||
1173 | } | 1173 | } |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) | 1176 | if (codec->suspend_bias_level == SND_SOC_BIAS_ON) |
1177 | wm9713_dapm_event(codec, SNDRV_CTL_POWER_D0); | 1177 | wm9713_set_bias_level(codec, SND_SOC_BIAS_ON); |
1178 | 1178 | ||
1179 | return ret; | 1179 | return ret; |
1180 | } | 1180 | } |
@@ -1213,7 +1213,7 @@ static int wm9713_soc_probe(struct platform_device *pdev) | |||
1213 | codec->num_dai = ARRAY_SIZE(wm9713_dai); | 1213 | codec->num_dai = ARRAY_SIZE(wm9713_dai); |
1214 | codec->write = ac97_write; | 1214 | codec->write = ac97_write; |
1215 | codec->read = ac97_read; | 1215 | codec->read = ac97_read; |
1216 | codec->dapm_event = wm9713_dapm_event; | 1216 | codec->set_bias_level = wm9713_set_bias_level; |
1217 | INIT_LIST_HEAD(&codec->dapm_widgets); | 1217 | INIT_LIST_HEAD(&codec->dapm_widgets); |
1218 | INIT_LIST_HEAD(&codec->dapm_paths); | 1218 | INIT_LIST_HEAD(&codec->dapm_paths); |
1219 | 1219 | ||
@@ -1235,7 +1235,7 @@ static int wm9713_soc_probe(struct platform_device *pdev) | |||
1235 | goto reset_err; | 1235 | goto reset_err; |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | wm9713_dapm_event(codec, SNDRV_CTL_POWER_D3hot); | 1238 | wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1239 | 1239 | ||
1240 | /* unmute the adc - move to kcontrol */ | 1240 | /* unmute the adc - move to kcontrol */ |
1241 | reg = ac97_read(codec, AC97_CD) & 0x7fff; | 1241 | reg = ac97_read(codec, AC97_CD) & 0x7fff; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0318d8abe3e8..a05b3450aee8 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -283,12 +283,12 @@ static void close_delayed_work(struct work_struct *work) | |||
283 | /* are we waiting on this codec DAI stream */ | 283 | /* are we waiting on this codec DAI stream */ |
284 | if (codec_dai->pop_wait == 1) { | 284 | if (codec_dai->pop_wait == 1) { |
285 | 285 | ||
286 | /* power down the codec to D1 if no longer active */ | 286 | /* Reduce power if no longer active */ |
287 | if (codec->active == 0) { | 287 | if (codec->active == 0) { |
288 | dbg("pop wq D1 %s %s\n", codec->name, | 288 | dbg("pop wq D1 %s %s\n", codec->name, |
289 | codec_dai->playback.stream_name); | 289 | codec_dai->playback.stream_name); |
290 | snd_soc_dapm_device_event(socdev, | 290 | snd_soc_dapm_set_bias_level(socdev, |
291 | SNDRV_CTL_POWER_D1); | 291 | SND_SOC_BIAS_PREPARE); |
292 | } | 292 | } |
293 | 293 | ||
294 | codec_dai->pop_wait = 0; | 294 | codec_dai->pop_wait = 0; |
@@ -296,12 +296,12 @@ static void close_delayed_work(struct work_struct *work) | |||
296 | codec_dai->playback.stream_name, | 296 | codec_dai->playback.stream_name, |
297 | SND_SOC_DAPM_STREAM_STOP); | 297 | SND_SOC_DAPM_STREAM_STOP); |
298 | 298 | ||
299 | /* power down the codec power domain if no longer active */ | 299 | /* Fall into standby if no longer active */ |
300 | if (codec->active == 0) { | 300 | if (codec->active == 0) { |
301 | dbg("pop wq D3 %s %s\n", codec->name, | 301 | dbg("pop wq D3 %s %s\n", codec->name, |
302 | codec_dai->playback.stream_name); | 302 | codec_dai->playback.stream_name); |
303 | snd_soc_dapm_device_event(socdev, | 303 | snd_soc_dapm_set_bias_level(socdev, |
304 | SNDRV_CTL_POWER_D3hot); | 304 | SND_SOC_BIAS_STANDBY); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | } | 307 | } |
@@ -361,8 +361,8 @@ static int soc_codec_close(struct snd_pcm_substream *substream) | |||
361 | SND_SOC_DAPM_STREAM_STOP); | 361 | SND_SOC_DAPM_STREAM_STOP); |
362 | 362 | ||
363 | if (codec->active == 0 && codec_dai->pop_wait == 0) | 363 | if (codec->active == 0 && codec_dai->pop_wait == 0) |
364 | snd_soc_dapm_device_event(socdev, | 364 | snd_soc_dapm_set_bias_level(socdev, |
365 | SNDRV_CTL_POWER_D3hot); | 365 | SND_SOC_BIAS_STANDBY); |
366 | } | 366 | } |
367 | 367 | ||
368 | mutex_unlock(&pcm_mutex); | 368 | mutex_unlock(&pcm_mutex); |
@@ -435,9 +435,10 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
435 | } | 435 | } |
436 | } else { | 436 | } else { |
437 | /* no delayed work - do we need to power up codec */ | 437 | /* no delayed work - do we need to power up codec */ |
438 | if (codec->dapm_state != SNDRV_CTL_POWER_D0) { | 438 | if (codec->bias_level != SND_SOC_BIAS_ON) { |
439 | 439 | ||
440 | snd_soc_dapm_device_event(socdev, SNDRV_CTL_POWER_D1); | 440 | snd_soc_dapm_set_bias_level(socdev, |
441 | SND_SOC_BIAS_PREPARE); | ||
441 | 442 | ||
442 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 443 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
443 | snd_soc_dapm_stream_event(codec, | 444 | snd_soc_dapm_stream_event(codec, |
@@ -448,7 +449,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
448 | codec_dai->capture.stream_name, | 449 | codec_dai->capture.stream_name, |
449 | SND_SOC_DAPM_STREAM_START); | 450 | SND_SOC_DAPM_STREAM_START); |
450 | 451 | ||
451 | snd_soc_dapm_device_event(socdev, SNDRV_CTL_POWER_D0); | 452 | snd_soc_dapm_set_bias_level(socdev, SND_SOC_BIAS_ON); |
452 | if (codec_dai->dai_ops.digital_mute) | 453 | if (codec_dai->dai_ops.digital_mute) |
453 | codec_dai->dai_ops.digital_mute(codec_dai, 0); | 454 | codec_dai->dai_ops.digital_mute(codec_dai, 0); |
454 | 455 | ||
@@ -658,7 +659,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) | |||
658 | 659 | ||
659 | /* close any waiting streams and save state */ | 660 | /* close any waiting streams and save state */ |
660 | run_delayed_work(&socdev->delayed_work); | 661 | run_delayed_work(&socdev->delayed_work); |
661 | codec->suspend_dapm_state = codec->dapm_state; | 662 | codec->suspend_bias_level = codec->bias_level; |
662 | 663 | ||
663 | for(i = 0; i < codec->num_dai; i++) { | 664 | for(i = 0; i < codec->num_dai; i++) { |
664 | char *stream = codec->dai[i].playback.stream_name; | 665 | char *stream = codec->dai[i].playback.stream_name; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8a3192bcee78..728f3ac2f304 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -763,21 +763,18 @@ static ssize_t dapm_widget_show(struct device *dev, | |||
763 | } | 763 | } |
764 | } | 764 | } |
765 | 765 | ||
766 | switch(codec->dapm_state){ | 766 | switch (codec->bias_level) { |
767 | case SNDRV_CTL_POWER_D0: | 767 | case SND_SOC_BIAS_ON: |
768 | state = "D0"; | 768 | state = "On"; |
769 | break; | 769 | break; |
770 | case SNDRV_CTL_POWER_D1: | 770 | case SND_SOC_BIAS_PREPARE: |
771 | state = "D1"; | 771 | state = "Prepare"; |
772 | break; | 772 | break; |
773 | case SNDRV_CTL_POWER_D2: | 773 | case SND_SOC_BIAS_STANDBY: |
774 | state = "D2"; | 774 | state = "Standby"; |
775 | break; | 775 | break; |
776 | case SNDRV_CTL_POWER_D3hot: | 776 | case SND_SOC_BIAS_OFF: |
777 | state = "D3hot"; | 777 | state = "Off"; |
778 | break; | ||
779 | case SNDRV_CTL_POWER_D3cold: | ||
780 | state = "D3cold"; | ||
781 | break; | 778 | break; |
782 | } | 779 | } |
783 | count += sprintf(buf + count, "PM State: %s\n", state); | 780 | count += sprintf(buf + count, "PM State: %s\n", state); |
@@ -1358,27 +1355,28 @@ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, | |||
1358 | EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_event); | 1355 | EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_event); |
1359 | 1356 | ||
1360 | /** | 1357 | /** |
1361 | * snd_soc_dapm_device_event - send a device event to the dapm core | 1358 | * snd_soc_dapm_set_bias_level - set the bias level for the system |
1362 | * @socdev: audio device | 1359 | * @socdev: audio device |
1363 | * @event: device event | 1360 | * @level: level to configure |
1364 | * | 1361 | * |
1365 | * Sends a device event to the dapm core. The core then makes any | 1362 | * Configure the bias (power) levels for the SoC audio device. |
1366 | * necessary machine or codec power changes.. | ||
1367 | * | 1363 | * |
1368 | * Returns 0 for success else error. | 1364 | * Returns 0 for success else error. |
1369 | */ | 1365 | */ |
1370 | int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event) | 1366 | int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, |
1367 | enum snd_soc_bias_level level) | ||
1371 | { | 1368 | { |
1372 | struct snd_soc_codec *codec = socdev->codec; | 1369 | struct snd_soc_codec *codec = socdev->codec; |
1373 | struct snd_soc_machine *machine = socdev->machine; | 1370 | struct snd_soc_machine *machine = socdev->machine; |
1371 | int ret = 0; | ||
1374 | 1372 | ||
1375 | if (machine->dapm_event) | 1373 | if (machine->set_bias_level) |
1376 | machine->dapm_event(machine, event); | 1374 | ret = machine->set_bias_level(machine, level); |
1377 | if (codec->dapm_event) | 1375 | if (ret == 0 && codec->set_bias_level) |
1378 | codec->dapm_event(codec, event); | 1376 | ret = codec->set_bias_level(codec, level); |
1379 | return 0; | 1377 | |
1378 | return ret; | ||
1380 | } | 1379 | } |
1381 | EXPORT_SYMBOL_GPL(snd_soc_dapm_device_event); | ||
1382 | 1380 | ||
1383 | /** | 1381 | /** |
1384 | * snd_soc_dapm_set_endpoint - set audio endpoint status | 1382 | * snd_soc_dapm_set_endpoint - set audio endpoint status |