From 6fb8b02b4be5fa41e39a26fc11b8093518713e30 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Thu, 8 May 2014 16:07:27 +0300 Subject: ASoC: Intel: Allow byt-5640 machine driver and SST core go to suspend Since there is no support for compressed audio in Baytrail ADSP firmware there is no need to leave it on during suspend since ALSA PCM buffers are too small for leaving ADSP on for playing or recording. Implement PM callbacks to Baytrail byt-rt5640.c machine driver that call snd_soc_suspend and snd_soc_resume functions and unset the ignore_suspend fields in DAI links. This makes soc-core and ALSA core gracefully suspend and resume active stream and call sst_byt_pcm_trigger() during suspend-resume cycle. Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- sound/soc/intel/byt-rt5640.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'sound/soc/intel/byt-rt5640.c') diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index eff97c8e5218..9061616f0f45 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -124,7 +124,6 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .init = byt_rt5640_init, - .ignore_suspend = 1, .ops = &byt_rt5640_ops, }, { @@ -137,7 +136,6 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .init = NULL, - .ignore_suspend = 1, .ops = &byt_rt5640_ops, }, }; @@ -152,6 +150,17 @@ static struct snd_soc_card byt_rt5640_card = { .num_dapm_routes = ARRAY_SIZE(byt_rt5640_audio_map), }; +#ifdef CONFIG_PM_SLEEP +static const struct dev_pm_ops byt_rt5640_pm_ops = { + .suspend = snd_soc_suspend, + .resume = snd_soc_resume, +}; + +#define BYT_RT5640_PM_OPS (&byt_rt5640_pm_ops) +#else +#define BYT_RT5640_PM_OPS NULL +#endif + static int byt_rt5640_probe(struct platform_device *pdev) { struct snd_soc_card *card = &byt_rt5640_card; @@ -177,6 +186,7 @@ static struct platform_driver byt_rt5640_audio = { .driver = { .name = "byt-rt5640", .owner = THIS_MODULE, + .pm = BYT_RT5640_PM_OPS, }, }; module_platform_driver(byt_rt5640_audio) -- cgit v1.2.3 From 49fee17816347c401be0dfcf98ee9fc131f25f10 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 14 May 2014 17:20:54 +0300 Subject: ASoC: Intel: Only export one Baytrail DAI We don't need more than one DAI for Baytrail SST. Usage becomes also more straightforward by grouping playback and capture streams under the same PCM device. [Jarkko: I made Liam's sst-baytrail-pcm.c change a few lines smaller and squashed together with my byt-rt5640.c change] Signed-off-by: Liam Girdwood Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- sound/soc/intel/byt-rt5640.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'sound/soc/intel/byt-rt5640.c') diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index 9061616f0f45..dbc63d09f424 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -117,7 +117,7 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { { .name = "Baytrail Audio", .stream_name = "Audio", - .cpu_dai_name = "Front-cpu-dai", + .cpu_dai_name = "baytrail-pcm-audio", .codec_dai_name = "rt5640-aif1", .codec_name = "i2c-10EC5640:00", .platform_name = "baytrail-pcm-audio", @@ -126,18 +126,6 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { .init = byt_rt5640_init, .ops = &byt_rt5640_ops, }, - { - .name = "Baytrail Voice", - .stream_name = "Voice", - .cpu_dai_name = "Mic1-cpu-dai", - .codec_dai_name = "rt5640-aif1", - .codec_name = "i2c-10EC5640:00", - .platform_name = "baytrail-pcm-audio", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_CBS_CFS, - .init = NULL, - .ops = &byt_rt5640_ops, - }, }; static struct snd_soc_card byt_rt5640_card = { -- cgit v1.2.3 From 831ffa45e7465e45ab2244da6bbed6bead47b6bc Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Mon, 19 May 2014 16:17:26 +0300 Subject: ASoC: Remove needless snd_soc_dapm_sync() from machine driver inits ALSA SoC core takes care of calling snd_soc_dapm_sync() at the end snd_soc_instantiate_card() so there is no need to call it from machine driver init functions. Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- sound/soc/intel/byt-rt5640.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound/soc/intel/byt-rt5640.c') diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index eff97c8e5218..b3195bb24b72 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -105,7 +105,6 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime) snd_soc_dapm_enable_pin(dapm, "Speaker"); snd_soc_dapm_enable_pin(dapm, "Internal Mic"); - snd_soc_dapm_sync(dapm); return ret; } -- cgit v1.2.3 From d77a14b579f6bfe2d149d3bcc5bd306e20d2d652 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Mon, 19 May 2014 16:17:27 +0300 Subject: ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits ALSA SoC core marks widgets as connected by default when they are initialized in snd_soc_dapm_new_control() so there is no need to call snd_soc_dapm_enable_pin() from machine driver init functions. Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- sound/soc/intel/byt-rt5640.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'sound/soc/intel/byt-rt5640.c') diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index b3195bb24b72..10df4c8d78e6 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -100,11 +100,6 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime) snd_soc_dapm_ignore_suspend(dapm, "SPORP"); snd_soc_dapm_ignore_suspend(dapm, "SPORN"); - snd_soc_dapm_enable_pin(dapm, "Headset Mic"); - snd_soc_dapm_enable_pin(dapm, "Headphone"); - snd_soc_dapm_enable_pin(dapm, "Speaker"); - snd_soc_dapm_enable_pin(dapm, "Internal Mic"); - return ret; } -- cgit v1.2.3 From 8eb776ab17232b02d915b90f5dd14c45af86c3a0 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Wed, 28 May 2014 12:35:39 +0300 Subject: ASoC: Intel: Use devm_snd_soc_register_card Simplify byt-rt5640.c and haswell.c machine drivers by using devm_snd_soc_register_card(). Remove also needless dev_set_drvdata() from byt_rt5640_probe() since snd_soc_register_card() does it too. Signed-off-by: Jarkko Nikula Cc: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/intel/byt-rt5640.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'sound/soc/intel/byt-rt5640.c') diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index dbc63d09f424..eac6566f42e6 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -152,25 +152,13 @@ static const struct dev_pm_ops byt_rt5640_pm_ops = { static int byt_rt5640_probe(struct platform_device *pdev) { struct snd_soc_card *card = &byt_rt5640_card; - struct device *dev = &pdev->dev; card->dev = &pdev->dev; - dev_set_drvdata(dev, card); - return snd_soc_register_card(card); -} - -static int byt_rt5640_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - - snd_soc_unregister_card(card); - - return 0; + return devm_snd_soc_register_card(&pdev->dev, card); } static struct platform_driver byt_rt5640_audio = { .probe = byt_rt5640_probe, - .remove = byt_rt5640_remove, .driver = { .name = "byt-rt5640", .owner = THIS_MODULE, -- cgit v1.2.3 From 4af72f4e6911a0bfd51c5a806c3a8642a9c4665e Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Mon, 26 May 2014 16:56:33 +0300 Subject: ASoC: Intel: byt-rt5640: Use card PM ops from core Use card PM ops from ASoC core instead of defining custom PM ops here since we are calling anyway common suspend/resume callbacks. Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown --- sound/soc/intel/byt-rt5640.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sound/soc/intel/byt-rt5640.c') diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index eac6566f42e6..ac52c77721b1 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -138,17 +138,6 @@ static struct snd_soc_card byt_rt5640_card = { .num_dapm_routes = ARRAY_SIZE(byt_rt5640_audio_map), }; -#ifdef CONFIG_PM_SLEEP -static const struct dev_pm_ops byt_rt5640_pm_ops = { - .suspend = snd_soc_suspend, - .resume = snd_soc_resume, -}; - -#define BYT_RT5640_PM_OPS (&byt_rt5640_pm_ops) -#else -#define BYT_RT5640_PM_OPS NULL -#endif - static int byt_rt5640_probe(struct platform_device *pdev) { struct snd_soc_card *card = &byt_rt5640_card; @@ -162,7 +151,7 @@ static struct platform_driver byt_rt5640_audio = { .driver = { .name = "byt-rt5640", .owner = THIS_MODULE, - .pm = BYT_RT5640_PM_OPS, + .pm = &snd_soc_pm_ops, }, }; module_platform_driver(byt_rt5640_audio) -- cgit v1.2.3