diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-core.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 235503230fe7..dfc03c0bacb6 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -619,8 +619,9 @@ static struct snd_pcm_ops soc_pcm_ops = { | |||
619 | 619 | ||
620 | #ifdef CONFIG_PM | 620 | #ifdef CONFIG_PM |
621 | /* powers down audio subsystem for suspend */ | 621 | /* powers down audio subsystem for suspend */ |
622 | static int soc_suspend(struct platform_device *pdev, pm_message_t state) | 622 | static int soc_suspend(struct device *dev) |
623 | { | 623 | { |
624 | struct platform_device *pdev = to_platform_device(dev); | ||
624 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 625 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
625 | struct snd_soc_card *card = socdev->card; | 626 | struct snd_soc_card *card = socdev->card; |
626 | struct snd_soc_platform *platform = card->platform; | 627 | struct snd_soc_platform *platform = card->platform; |
@@ -656,7 +657,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) | |||
656 | snd_pcm_suspend_all(card->dai_link[i].pcm); | 657 | snd_pcm_suspend_all(card->dai_link[i].pcm); |
657 | 658 | ||
658 | if (card->suspend_pre) | 659 | if (card->suspend_pre) |
659 | card->suspend_pre(pdev, state); | 660 | card->suspend_pre(pdev, PMSG_SUSPEND); |
660 | 661 | ||
661 | for (i = 0; i < card->num_links; i++) { | 662 | for (i = 0; i < card->num_links; i++) { |
662 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; | 663 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; |
@@ -682,7 +683,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) | |||
682 | } | 683 | } |
683 | 684 | ||
684 | if (codec_dev->suspend) | 685 | if (codec_dev->suspend) |
685 | codec_dev->suspend(pdev, state); | 686 | codec_dev->suspend(pdev, PMSG_SUSPEND); |
686 | 687 | ||
687 | for (i = 0; i < card->num_links; i++) { | 688 | for (i = 0; i < card->num_links; i++) { |
688 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; | 689 | struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai; |
@@ -691,7 +692,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) | |||
691 | } | 692 | } |
692 | 693 | ||
693 | if (card->suspend_post) | 694 | if (card->suspend_post) |
694 | card->suspend_post(pdev, state); | 695 | card->suspend_post(pdev, PMSG_SUSPEND); |
695 | 696 | ||
696 | return 0; | 697 | return 0; |
697 | } | 698 | } |
@@ -765,8 +766,9 @@ static void soc_resume_deferred(struct work_struct *work) | |||
765 | } | 766 | } |
766 | 767 | ||
767 | /* powers up audio subsystem after a suspend */ | 768 | /* powers up audio subsystem after a suspend */ |
768 | static int soc_resume(struct platform_device *pdev) | 769 | static int soc_resume(struct device *dev) |
769 | { | 770 | { |
771 | struct platform_device *pdev = to_platform_device(dev); | ||
770 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 772 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
771 | struct snd_soc_card *card = socdev->card; | 773 | struct snd_soc_card *card = socdev->card; |
772 | struct snd_soc_dai *cpu_dai = card->dai_link[0].cpu_dai; | 774 | struct snd_soc_dai *cpu_dai = card->dai_link[0].cpu_dai; |
@@ -826,7 +828,6 @@ int snd_soc_resume_device(struct device *dev) | |||
826 | return 0; | 828 | return 0; |
827 | } | 829 | } |
828 | EXPORT_SYMBOL_GPL(snd_soc_resume_device); | 830 | EXPORT_SYMBOL_GPL(snd_soc_resume_device); |
829 | |||
830 | #else | 831 | #else |
831 | #define soc_suspend NULL | 832 | #define soc_suspend NULL |
832 | #define soc_resume NULL | 833 | #define soc_resume NULL |
@@ -1020,32 +1021,39 @@ static int soc_remove(struct platform_device *pdev) | |||
1020 | return 0; | 1021 | return 0; |
1021 | } | 1022 | } |
1022 | 1023 | ||
1023 | static void soc_shutdown(struct platform_device *pdev) | 1024 | static int soc_poweroff(struct device *dev) |
1024 | { | 1025 | { |
1026 | struct platform_device *pdev = to_platform_device(dev); | ||
1025 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1027 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
1026 | struct snd_soc_card *card = socdev->card; | 1028 | struct snd_soc_card *card = socdev->card; |
1027 | 1029 | ||
1028 | if (!card->instantiated) | 1030 | if (!card->instantiated) |
1029 | return; | 1031 | return 0; |
1030 | 1032 | ||
1031 | /* Flush out pmdown_time work - we actually do want to run it | 1033 | /* Flush out pmdown_time work - we actually do want to run it |
1032 | * now, we're shutting down so no imminent restart. */ | 1034 | * now, we're shutting down so no imminent restart. */ |
1033 | run_delayed_work(&card->delayed_work); | 1035 | run_delayed_work(&card->delayed_work); |
1034 | 1036 | ||
1035 | snd_soc_dapm_shutdown(socdev); | 1037 | snd_soc_dapm_shutdown(socdev); |
1038 | |||
1039 | return 0; | ||
1036 | } | 1040 | } |
1037 | 1041 | ||
1042 | static struct dev_pm_ops soc_pm_ops = { | ||
1043 | .suspend = soc_suspend, | ||
1044 | .resume = soc_resume, | ||
1045 | .poweroff = soc_poweroff, | ||
1046 | }; | ||
1047 | |||
1038 | /* ASoC platform driver */ | 1048 | /* ASoC platform driver */ |
1039 | static struct platform_driver soc_driver = { | 1049 | static struct platform_driver soc_driver = { |
1040 | .driver = { | 1050 | .driver = { |
1041 | .name = "soc-audio", | 1051 | .name = "soc-audio", |
1042 | .owner = THIS_MODULE, | 1052 | .owner = THIS_MODULE, |
1053 | .pm = &soc_pm_ops, | ||
1043 | }, | 1054 | }, |
1044 | .probe = soc_probe, | 1055 | .probe = soc_probe, |
1045 | .remove = soc_remove, | 1056 | .remove = soc_remove, |
1046 | .suspend = soc_suspend, | ||
1047 | .resume = soc_resume, | ||
1048 | .shutdown = soc_shutdown, | ||
1049 | }; | 1057 | }; |
1050 | 1058 | ||
1051 | /* create a new pcm */ | 1059 | /* create a new pcm */ |