ASoC: cirrus: ep93xx-i2s: move .suspend/.resume to component
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 20 Jan 2020 01:03:50 +0000 (10:03 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 21 Jan 2020 17:03:24 +0000 (17:03 +0000)
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a76jym4p.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/cirrus/ep93xx-i2s.c

index 7d9cf67129d49d426e2fb641053835357c77992f..723f4cf194673516a22ba0bba70c7354450ebbfb 100644 (file)
@@ -364,11 +364,11 @@ static int ep93xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
 }
 
 #ifdef CONFIG_PM
-static int ep93xx_i2s_suspend(struct snd_soc_dai *dai)
+static int ep93xx_i2s_suspend(struct snd_soc_component *component)
 {
-       struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
+       struct ep93xx_i2s_info *info = snd_soc_component_get_drvdata(component);
 
-       if (!dai->active)
+       if (!component->active)
                return 0;
 
        ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK);
@@ -377,11 +377,11 @@ static int ep93xx_i2s_suspend(struct snd_soc_dai *dai)
        return 0;
 }
 
-static int ep93xx_i2s_resume(struct snd_soc_dai *dai)
+static int ep93xx_i2s_resume(struct snd_soc_component *component)
 {
-       struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai);
+       struct ep93xx_i2s_info *info = snd_soc_component_get_drvdata(component);
 
-       if (!dai->active)
+       if (!component->active)
                return 0;
 
        ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK);
@@ -406,8 +406,6 @@ static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
 static struct snd_soc_dai_driver ep93xx_i2s_dai = {
        .symmetric_rates= 1,
        .probe          = ep93xx_i2s_dai_probe,
-       .suspend        = ep93xx_i2s_suspend,
-       .resume         = ep93xx_i2s_resume,
        .playback       = {
                .channels_min   = 2,
                .channels_max   = 2,
@@ -425,6 +423,8 @@ static struct snd_soc_dai_driver ep93xx_i2s_dai = {
 
 static const struct snd_soc_component_driver ep93xx_i2s_component = {
        .name           = "ep93xx-i2s",
+       .suspend        = ep93xx_i2s_suspend,
+       .resume         = ep93xx_i2s_resume,
 };
 
 static int ep93xx_i2s_probe(struct platform_device *pdev)