diff options
Diffstat (limited to 'sound/soc/uniphier')
-rw-r--r-- | sound/soc/uniphier/aio-cpu.c | 31 | ||||
-rw-r--r-- | sound/soc/uniphier/aio-dma.c | 31 | ||||
-rw-r--r-- | sound/soc/uniphier/aio-ld11.c | 18 | ||||
-rw-r--r-- | sound/soc/uniphier/aio-pxs2.c | 14 | ||||
-rw-r--r-- | sound/soc/uniphier/aio.h | 2 |
5 files changed, 28 insertions, 68 deletions
diff --git a/sound/soc/uniphier/aio-cpu.c b/sound/soc/uniphier/aio-cpu.c index 2ae582a99b63..fdaa6522720f 100644 --- a/sound/soc/uniphier/aio-cpu.c +++ b/sound/soc/uniphier/aio-cpu.c @@ -420,25 +420,37 @@ int uniphier_aio_dai_remove(struct snd_soc_dai *dai) } EXPORT_SYMBOL_GPL(uniphier_aio_dai_remove); -int uniphier_aio_dai_suspend(struct snd_soc_dai *dai) +static void uniphier_aio_dai_suspend(struct snd_soc_dai *dai) { struct uniphier_aio *aio = uniphier_priv(dai); + if (!dai->active) + return; + aio->chip->num_wup_aios--; if (!aio->chip->num_wup_aios) { reset_control_assert(aio->chip->rst); clk_disable_unprepare(aio->chip->clk); } +} + +static int uniphier_aio_suspend(struct snd_soc_component *component) +{ + struct snd_soc_dai *dai; + for_each_component_dais(component, dai) + uniphier_aio_dai_suspend(dai); return 0; } -EXPORT_SYMBOL_GPL(uniphier_aio_dai_suspend); -int uniphier_aio_dai_resume(struct snd_soc_dai *dai) +static int uniphier_aio_dai_resume(struct snd_soc_dai *dai) { struct uniphier_aio *aio = uniphier_priv(dai); int ret, i; + if (!dai->active) + return 0; + if (!aio->chip->active) return 0; @@ -484,7 +496,16 @@ err_out_clock: return ret; } -EXPORT_SYMBOL_GPL(uniphier_aio_dai_resume); + +static int uniphier_aio_resume(struct snd_soc_component *component) +{ + struct snd_soc_dai *dai; + int ret = 0; + + for_each_component_dais(component, dai) + ret |= uniphier_aio_dai_resume(dai); + return ret; +} static int uniphier_aio_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) @@ -596,6 +617,8 @@ static const struct snd_soc_component_driver uniphier_aio_component = { .name = "uniphier-aio", .controls = uniphier_aio_controls, .num_controls = ARRAY_SIZE(uniphier_aio_controls), + .suspend = uniphier_aio_suspend, + .resume = uniphier_aio_resume, }; int uniphier_aio_probe(struct platform_device *pdev) diff --git a/sound/soc/uniphier/aio-dma.c b/sound/soc/uniphier/aio-dma.c index 700d936ed94e..da83423c52e2 100644 --- a/sound/soc/uniphier/aio-dma.c +++ b/sound/soc/uniphier/aio-dma.c @@ -104,25 +104,6 @@ static int uniphier_aiodma_open(struct snd_soc_component *component, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256); } -static int uniphier_aiodma_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); - substream->runtime->dma_bytes = params_buffer_bytes(params); - - return 0; -} - -static int uniphier_aiodma_hw_free(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - snd_pcm_set_runtime_buffer(substream, NULL); - substream->runtime->dma_bytes = 0; - - return 0; -} - static int uniphier_aiodma_prepare(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -232,30 +213,20 @@ static int uniphier_aiodma_new(struct snd_soc_component *component, if (ret) return ret; - snd_pcm_lib_preallocate_pages_for_all(pcm, + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, dev, uniphier_aiodma_hw.buffer_bytes_max, uniphier_aiodma_hw.buffer_bytes_max); return 0; } -static void uniphier_aiodma_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - snd_pcm_lib_preallocate_free_for_all(pcm); -} - static const struct snd_soc_component_driver uniphier_soc_platform = { .open = uniphier_aiodma_open, - .ioctl = snd_soc_pcm_lib_ioctl, - .hw_params = uniphier_aiodma_hw_params, - .hw_free = uniphier_aiodma_hw_free, .prepare = uniphier_aiodma_prepare, .trigger = uniphier_aiodma_trigger, .pointer = uniphier_aiodma_pointer, .mmap = uniphier_aiodma_mmap, .pcm_construct = uniphier_aiodma_new, - .pcm_destruct = uniphier_aiodma_free, .compr_ops = &uniphier_aio_compr_ops, }; diff --git a/sound/soc/uniphier/aio-ld11.c b/sound/soc/uniphier/aio-ld11.c index de962df245ba..8b44f8dc4970 100644 --- a/sound/soc/uniphier/aio-ld11.c +++ b/sound/soc/uniphier/aio-ld11.c @@ -218,8 +218,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_GNAME_HDMI, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_PCMOUT1, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -242,8 +240,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_NAME_PCMIN2, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .capture = { .stream_name = AUD_NAME_PCMIN2, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -257,8 +253,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_GNAME_LINE, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_PCMOUT2, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -279,8 +273,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_NAME_HPCMOUT1, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_HPCMOUT1, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -294,8 +286,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_NAME_PCMOUT3, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_PCMOUT3, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -309,8 +299,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_NAME_HIECOUT1, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_HIECOUT1, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -324,8 +312,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_NAME_EPCMOUT2, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_EPCMOUT2, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -341,8 +327,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_NAME_EPCMOUT3, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_EPCMOUT3, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -358,8 +342,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { .name = AUD_NAME_HIECCOMPOUT1, .probe = uniphier_aio_ld11_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .compress_new = snd_soc_new_compress, .playback = { .stream_name = AUD_NAME_HIECCOMPOUT1, diff --git a/sound/soc/uniphier/aio-pxs2.c b/sound/soc/uniphier/aio-pxs2.c index 69cd5b0af948..a1d05fe9d3c2 100644 --- a/sound/soc/uniphier/aio-pxs2.c +++ b/sound/soc/uniphier/aio-pxs2.c @@ -171,8 +171,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { .name = AUD_GNAME_HDMI, .probe = uniphier_aio_pxs2_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_HPCMOUT1, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -186,8 +184,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { .name = AUD_GNAME_LINE, .probe = uniphier_aio_pxs2_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_PCMOUT1, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -208,8 +204,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { .name = AUD_GNAME_AUX, .probe = uniphier_aio_pxs2_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_PCMOUT2, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -230,8 +224,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { .name = AUD_NAME_HIECOUT1, .probe = uniphier_aio_pxs2_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_HIECOUT1, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -245,8 +237,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { .name = AUD_NAME_IECOUT1, .probe = uniphier_aio_pxs2_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .playback = { .stream_name = AUD_NAME_IECOUT1, .formats = SNDRV_PCM_FMTBIT_S32_LE, @@ -260,8 +250,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { .name = AUD_NAME_HIECCOMPOUT1, .probe = uniphier_aio_pxs2_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .compress_new = snd_soc_new_compress, .playback = { .stream_name = AUD_NAME_HIECCOMPOUT1, @@ -274,8 +262,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { .name = AUD_NAME_IECCOMPOUT1, .probe = uniphier_aio_pxs2_probe, .remove = uniphier_aio_dai_remove, - .suspend = uniphier_aio_dai_suspend, - .resume = uniphier_aio_dai_resume, .compress_new = snd_soc_new_compress, .playback = { .stream_name = AUD_NAME_IECCOMPOUT1, diff --git a/sound/soc/uniphier/aio.h b/sound/soc/uniphier/aio.h index a7ff7e556429..694ac030950e 100644 --- a/sound/soc/uniphier/aio.h +++ b/sound/soc/uniphier/aio.h @@ -308,8 +308,6 @@ extern const struct snd_compr_ops uniphier_aio_compr_ops; int uniphier_aio_dai_probe(struct snd_soc_dai *dai); int uniphier_aio_dai_remove(struct snd_soc_dai *dai); -int uniphier_aio_dai_suspend(struct snd_soc_dai *dai); -int uniphier_aio_dai_resume(struct snd_soc_dai *dai); int uniphier_aio_probe(struct platform_device *pdev); int uniphier_aio_remove(struct platform_device *pdev); extern const struct snd_soc_dai_ops uniphier_aio_i2s_ops; |