Commit 9b79b1cd authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: uniphier: move .suspend/.resume to component

There is no big difference at implementation for .suspend/.resume
between DAI driver and Component driver.
But because some driver is using DAI version, thus ALSA SoC needs
to keep supporting it, hence, framework becoming verbose.
If we can switch all DAI driver .suspend/.resume to Component driver,
we can remove verbose code from ALSA SoC.

Driver is getting its private data via dai->dev.
But dai->dev and component->dev are same dev, thus, we can convert
these. For same reason, we can convert dai->active to
component->active if necessary.

This patch moves DAI driver .suspend/.resume to Component driver
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zhejx7j4.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 78dbafbd
...@@ -420,25 +420,37 @@ int uniphier_aio_dai_remove(struct snd_soc_dai *dai) ...@@ -420,25 +420,37 @@ int uniphier_aio_dai_remove(struct snd_soc_dai *dai)
} }
EXPORT_SYMBOL_GPL(uniphier_aio_dai_remove); 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); struct uniphier_aio *aio = uniphier_priv(dai);
if (!dai->active)
return;
aio->chip->num_wup_aios--; aio->chip->num_wup_aios--;
if (!aio->chip->num_wup_aios) { if (!aio->chip->num_wup_aios) {
reset_control_assert(aio->chip->rst); reset_control_assert(aio->chip->rst);
clk_disable_unprepare(aio->chip->clk); 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; 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); struct uniphier_aio *aio = uniphier_priv(dai);
int ret, i; int ret, i;
if (!dai->active)
return 0;
if (!aio->chip->active) if (!aio->chip->active)
return 0; return 0;
...@@ -484,7 +496,16 @@ int uniphier_aio_dai_resume(struct snd_soc_dai *dai) ...@@ -484,7 +496,16 @@ int uniphier_aio_dai_resume(struct snd_soc_dai *dai)
return ret; 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, static int uniphier_aio_vol_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
...@@ -596,6 +617,8 @@ static const struct snd_soc_component_driver uniphier_aio_component = { ...@@ -596,6 +617,8 @@ static const struct snd_soc_component_driver uniphier_aio_component = {
.name = "uniphier-aio", .name = "uniphier-aio",
.controls = uniphier_aio_controls, .controls = uniphier_aio_controls,
.num_controls = ARRAY_SIZE(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) int uniphier_aio_probe(struct platform_device *pdev)
......
...@@ -218,8 +218,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -218,8 +218,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_GNAME_HDMI, .name = AUD_GNAME_HDMI,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_PCMOUT1, .stream_name = AUD_NAME_PCMOUT1,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -242,8 +240,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -242,8 +240,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_NAME_PCMIN2, .name = AUD_NAME_PCMIN2,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.capture = { .capture = {
.stream_name = AUD_NAME_PCMIN2, .stream_name = AUD_NAME_PCMIN2,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -257,8 +253,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -257,8 +253,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_GNAME_LINE, .name = AUD_GNAME_LINE,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_PCMOUT2, .stream_name = AUD_NAME_PCMOUT2,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -279,8 +273,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -279,8 +273,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_NAME_HPCMOUT1, .name = AUD_NAME_HPCMOUT1,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_HPCMOUT1, .stream_name = AUD_NAME_HPCMOUT1,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -294,8 +286,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -294,8 +286,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_NAME_PCMOUT3, .name = AUD_NAME_PCMOUT3,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_PCMOUT3, .stream_name = AUD_NAME_PCMOUT3,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -309,8 +299,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -309,8 +299,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_NAME_HIECOUT1, .name = AUD_NAME_HIECOUT1,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_HIECOUT1, .stream_name = AUD_NAME_HIECOUT1,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -324,8 +312,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -324,8 +312,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_NAME_EPCMOUT2, .name = AUD_NAME_EPCMOUT2,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_EPCMOUT2, .stream_name = AUD_NAME_EPCMOUT2,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -341,8 +327,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -341,8 +327,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_NAME_EPCMOUT3, .name = AUD_NAME_EPCMOUT3,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_EPCMOUT3, .stream_name = AUD_NAME_EPCMOUT3,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -358,8 +342,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = { ...@@ -358,8 +342,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_ld11[] = {
.name = AUD_NAME_HIECCOMPOUT1, .name = AUD_NAME_HIECCOMPOUT1,
.probe = uniphier_aio_ld11_probe, .probe = uniphier_aio_ld11_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.compress_new = snd_soc_new_compress, .compress_new = snd_soc_new_compress,
.playback = { .playback = {
.stream_name = AUD_NAME_HIECCOMPOUT1, .stream_name = AUD_NAME_HIECCOMPOUT1,
......
...@@ -171,8 +171,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { ...@@ -171,8 +171,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = {
.name = AUD_GNAME_HDMI, .name = AUD_GNAME_HDMI,
.probe = uniphier_aio_pxs2_probe, .probe = uniphier_aio_pxs2_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_HPCMOUT1, .stream_name = AUD_NAME_HPCMOUT1,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -186,8 +184,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { ...@@ -186,8 +184,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = {
.name = AUD_GNAME_LINE, .name = AUD_GNAME_LINE,
.probe = uniphier_aio_pxs2_probe, .probe = uniphier_aio_pxs2_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_PCMOUT1, .stream_name = AUD_NAME_PCMOUT1,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -208,8 +204,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { ...@@ -208,8 +204,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = {
.name = AUD_GNAME_AUX, .name = AUD_GNAME_AUX,
.probe = uniphier_aio_pxs2_probe, .probe = uniphier_aio_pxs2_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_PCMOUT2, .stream_name = AUD_NAME_PCMOUT2,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -230,8 +224,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { ...@@ -230,8 +224,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = {
.name = AUD_NAME_HIECOUT1, .name = AUD_NAME_HIECOUT1,
.probe = uniphier_aio_pxs2_probe, .probe = uniphier_aio_pxs2_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_HIECOUT1, .stream_name = AUD_NAME_HIECOUT1,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -245,8 +237,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { ...@@ -245,8 +237,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = {
.name = AUD_NAME_IECOUT1, .name = AUD_NAME_IECOUT1,
.probe = uniphier_aio_pxs2_probe, .probe = uniphier_aio_pxs2_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.playback = { .playback = {
.stream_name = AUD_NAME_IECOUT1, .stream_name = AUD_NAME_IECOUT1,
.formats = SNDRV_PCM_FMTBIT_S32_LE, .formats = SNDRV_PCM_FMTBIT_S32_LE,
...@@ -260,8 +250,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { ...@@ -260,8 +250,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = {
.name = AUD_NAME_HIECCOMPOUT1, .name = AUD_NAME_HIECCOMPOUT1,
.probe = uniphier_aio_pxs2_probe, .probe = uniphier_aio_pxs2_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.compress_new = snd_soc_new_compress, .compress_new = snd_soc_new_compress,
.playback = { .playback = {
.stream_name = AUD_NAME_HIECCOMPOUT1, .stream_name = AUD_NAME_HIECCOMPOUT1,
...@@ -274,8 +262,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = { ...@@ -274,8 +262,6 @@ static struct snd_soc_dai_driver uniphier_aio_dai_pxs2[] = {
.name = AUD_NAME_IECCOMPOUT1, .name = AUD_NAME_IECCOMPOUT1,
.probe = uniphier_aio_pxs2_probe, .probe = uniphier_aio_pxs2_probe,
.remove = uniphier_aio_dai_remove, .remove = uniphier_aio_dai_remove,
.suspend = uniphier_aio_dai_suspend,
.resume = uniphier_aio_dai_resume,
.compress_new = snd_soc_new_compress, .compress_new = snd_soc_new_compress,
.playback = { .playback = {
.stream_name = AUD_NAME_IECCOMPOUT1, .stream_name = AUD_NAME_IECCOMPOUT1,
......
...@@ -308,8 +308,6 @@ extern const struct snd_compr_ops uniphier_aio_compr_ops; ...@@ -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_probe(struct snd_soc_dai *dai);
int uniphier_aio_dai_remove(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_probe(struct platform_device *pdev);
int uniphier_aio_remove(struct platform_device *pdev); int uniphier_aio_remove(struct platform_device *pdev);
extern const struct snd_soc_dai_ops uniphier_aio_i2s_ops; extern const struct snd_soc_dai_ops uniphier_aio_i2s_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment