ASoC: Rename snd_soc_dai_driver struct ac97_control field to bus_control
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 10 Nov 2014 21:41:52 +0000 (22:41 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 18 Nov 2014 15:38:03 +0000 (15:38 +0000)
Setting the ac97_control field on a CPU DAI tells the ASoC core that this
DAI in addition to audio data also transports control data to the CODEC.
This causes the core to suspend the DAI after the CODEC and resume it before
the CODEC so communication to the CODEC is still possible. This is not
necessarily something that is specific to AC'97 and can be used by other
buses with the same requirement. This patch renames the flag from
ac97_control to bus_control to make this explicit.

While we are at it also change the type from int to bool.

The following semantich patch was used for automatic conversion of the
drivers:
// <smpl>
@@
identifier drv;
@@
struct snd_soc_dai_driver drv = {
- .ac97_control
+ .bus_control
=
- 1
+ true
};
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
15 files changed:
include/sound/soc-dai.h
sound/soc/au1x/ac97c.c
sound/soc/au1x/psc-ac97.c
sound/soc/blackfin/bf5xx-ac97.c
sound/soc/cirrus/ep93xx-ac97.c
sound/soc/fsl/fsl_ssi.c
sound/soc/fsl/imx-ssi.c
sound/soc/fsl/mpc5200_psc_ac97.c
sound/soc/nuc900/nuc900-ac97.c
sound/soc/pxa/pxa2xx-ac97.c
sound/soc/samsung/ac97.c
sound/soc/sh/hac.c
sound/soc/soc-core.c
sound/soc/tegra/tegra20_ac97.c
sound/soc/txx9/txx9aclc-ac97.c

index c0e04688c6ed3a28c81c9b10b7ae46590a191a52..a3738be45563dce10f0730bce9ee642d29d164d7 100644 (file)
@@ -206,7 +206,6 @@ struct snd_soc_dai_driver {
        /* DAI description */
        const char *name;
        unsigned int id;
-       int ac97_control;
        unsigned int base;
 
        /* DAI driver callbacks */
@@ -216,6 +215,8 @@ struct snd_soc_dai_driver {
        int (*resume)(struct snd_soc_dai *dai);
        /* compress dai */
        bool compress_dai;
+       /* DAI is also used for the control bus */
+       bool bus_control;
 
        /* ops */
        const struct snd_soc_dai_ops *ops;
index c8a2de103c5f3b6b0cb5172f858c687795154d19..5159a50a45a66834784e86b402f3ffd57936de1b 100644 (file)
@@ -205,7 +205,7 @@ static int au1xac97c_dai_probe(struct snd_soc_dai *dai)
 
 static struct snd_soc_dai_driver au1xac97c_dai_driver = {
        .name                   = "alchemy-ac97c",
-       .ac97_control           = 1,
+       .bus_control            = true,
        .probe                  = au1xac97c_dai_probe,
        .playback = {
                .rates          = AC97_RATES,
index 84f31e1f9d249c5700b6c00b01ed370a81cbcefd..c6daec98ff895cdaa0a6ceb68c0bf0b071c5aaaf 100644 (file)
@@ -343,7 +343,7 @@ static const struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = {
 };
 
 static const struct snd_soc_dai_driver au1xpsc_ac97_dai_template = {
-       .ac97_control           = 1,
+       .bus_control            = true,
        .probe                  = au1xpsc_ac97_probe,
        .playback = {
                .rates          = AC97_RATES,
index e82eb373a731402cb60699881aca15a84577f72f..6bf21a6c02e463f9b022b06fbdefc0eb86ad53df 100644 (file)
@@ -260,7 +260,7 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai)
 #endif
 
 static struct snd_soc_dai_driver bfin_ac97_dai = {
-       .ac97_control = 1,
+       .bus_control = true,
        .suspend = bf5xx_ac97_suspend,
        .resume = bf5xx_ac97_resume,
        .playback = {
index f30dadf85b9963a71629df4be96ec8f1fb05c3bb..6b8a366b0211e74880bebf61a1bf4fc7cacb1596 100644 (file)
@@ -338,7 +338,7 @@ static const struct snd_soc_dai_ops ep93xx_ac97_dai_ops = {
 static struct snd_soc_dai_driver ep93xx_ac97_dai = {
        .name           = "ep93xx-ac97",
        .id             = 0,
-       .ac97_control   = 1,
+       .bus_control    = true,
        .probe          = ep93xx_ac97_dai_probe,
        .playback       = {
                .stream_name    = "AC97 Playback",
index e6955170dc42c8b805d6aa654a5eadebc437b27e..7fd3cbcd74c07b36ee554bac105401f81326a651 100644 (file)
@@ -1099,7 +1099,7 @@ static const struct snd_soc_component_driver fsl_ssi_component = {
 };
 
 static struct snd_soc_dai_driver fsl_ssi_ac97_dai = {
-       .ac97_control = 1,
+       .bus_control = true,
        .playback = {
                .stream_name = "AC97 Playback",
                .channels_min = 2,
index ab2fdd76b693a28aacbcef5aa0edf8aded9727e5..60b0a5b1f1f1546d0b5ef438f031b58e740d7347 100644 (file)
@@ -382,7 +382,7 @@ static struct snd_soc_dai_driver imx_ssi_dai = {
 
 static struct snd_soc_dai_driver imx_ac97_dai = {
        .probe = imx_ssi_dai_probe,
-       .ac97_control = 1,
+       .bus_control = true,
        .playback = {
                .stream_name = "AC97 Playback",
                .channels_min = 2,
index 640801a60c128cacd83f8d0279e78a52492e0d45..c6ed6ba965a952cd606324d62098c9a8bab6d87a 100644 (file)
@@ -237,7 +237,7 @@ static const struct snd_soc_dai_ops psc_ac97_digital_ops = {
 static struct snd_soc_dai_driver psc_ac97_dai[] = {
 {
        .name = "mpc5200-psc-ac97.0",
-       .ac97_control = 1,
+       .bus_control = true,
        .probe  = psc_ac97_probe,
        .playback = {
                .stream_name    = "AC97 Playback",
@@ -257,7 +257,7 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {
 },
 {
        .name = "mpc5200-psc-ac97.1",
-       .ac97_control = 1,
+       .bus_control = true,
        .playback = {
                .stream_name    = "AC97 SPDIF",
                .channels_min   = 1,
index f2f67942b2294798fdcee596d5ed82142c7d09c1..dff443e4b657efbf4c2d7f487cefe3bd765f93ff 100644 (file)
@@ -298,7 +298,7 @@ static const struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
 static struct snd_soc_dai_driver nuc900_ac97_dai = {
        .probe                  = nuc900_ac97_probe,
        .remove                 = nuc900_ac97_remove,
-       .ac97_control           = 1,
+       .bus_control            = true,
        .playback = {
                .rates          = SNDRV_PCM_RATE_8000_48000,
                .formats        = SNDRV_PCM_FMTBIT_S16_LE,
index ae956e3f4b9dbfb0aea905e74b4c06cc25217291..73ca2820c08cbd0d2c8157bb135d10197ccd763c 100644 (file)
@@ -157,7 +157,7 @@ static const struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = {
 static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
 {
        .name = "pxa2xx-ac97",
-       .ac97_control = 1,
+       .bus_control = true,
        .playback = {
                .stream_name = "AC97 Playback",
                .channels_min = 2,
@@ -174,7 +174,7 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
 },
 {
        .name = "pxa2xx-ac97-aux",
-       .ac97_control = 1,
+       .bus_control = true,
        .playback = {
                .stream_name = "AC97 Aux Playback",
                .channels_min = 1,
@@ -191,7 +191,7 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
 },
 {
        .name = "pxa2xx-ac97-mic",
-       .ac97_control = 1,
+       .bus_control = true,
        .capture = {
                .stream_name = "AC97 Mic Capture",
                .channels_min = 1,
index e1615113fd84f0558e93975ed2b9933e03f40683..7952a625669d4bbd1627b525fd45c2615cced280 100644 (file)
@@ -288,7 +288,7 @@ static int s3c_ac97_mic_dai_probe(struct snd_soc_dai *dai)
 static struct snd_soc_dai_driver s3c_ac97_dai[] = {
        [S3C_AC97_DAI_PCM] = {
                .name = "samsung-ac97",
-               .ac97_control = 1,
+               .bus_control = true,
                .playback = {
                        .stream_name = "AC97 Playback",
                        .channels_min = 2,
@@ -306,7 +306,7 @@ static struct snd_soc_dai_driver s3c_ac97_dai[] = {
        },
        [S3C_AC97_DAI_MIC] = {
                .name = "samsung-ac97-mic",
-               .ac97_control = 1,
+               .bus_control = true,
                .capture = {
                        .stream_name = "AC97 Mic Capture",
                        .channels_min = 1,
index 0af2e4dfd13949a502e670846a84e098bff1719a..d5f567e085ff167a3627d3cf39bc088b82ed6a7a 100644 (file)
@@ -272,7 +272,7 @@ static const struct snd_soc_dai_ops hac_dai_ops = {
 static struct snd_soc_dai_driver sh4_hac_dai[] = {
 {
        .name                   = "hac-dai.0",
-       .ac97_control           = 1,
+       .bus_control            = true,
        .playback = {
                .rates          = AC97_RATES,
                .formats        = AC97_FMTS,
index fba6e28e18d33e863065e1dc0f5eebc2e29af17a..f5bebca84b71bcd27debc05ef3e988d3f3255ba8 100644 (file)
@@ -550,7 +550,7 @@ int snd_soc_suspend(struct device *dev)
                if (card->rtd[i].dai_link->ignore_suspend)
                        continue;
 
-               if (cpu_dai->driver->suspend && !cpu_dai->driver->ac97_control)
+               if (cpu_dai->driver->suspend && !cpu_dai->driver->bus_control)
                        cpu_dai->driver->suspend(cpu_dai);
                if (platform->driver->suspend && !platform->suspended) {
                        platform->driver->suspend(cpu_dai);
@@ -629,7 +629,7 @@ int snd_soc_suspend(struct device *dev)
                if (card->rtd[i].dai_link->ignore_suspend)
                        continue;
 
-               if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control)
+               if (cpu_dai->driver->suspend && cpu_dai->driver->bus_control)
                        cpu_dai->driver->suspend(cpu_dai);
 
                /* deactivate pins to sleep state */
@@ -665,14 +665,14 @@ static void soc_resume_deferred(struct work_struct *work)
        if (card->resume_pre)
                card->resume_pre(card);
 
-       /* resume AC97 DAIs */
+       /* resume control bus DAIs */
        for (i = 0; i < card->num_rtd; i++) {
                struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
 
                if (card->rtd[i].dai_link->ignore_suspend)
                        continue;
 
-               if (cpu_dai->driver->resume && cpu_dai->driver->ac97_control)
+               if (cpu_dai->driver->resume && cpu_dai->driver->bus_control)
                        cpu_dai->driver->resume(cpu_dai);
        }
 
@@ -733,7 +733,7 @@ static void soc_resume_deferred(struct work_struct *work)
                if (card->rtd[i].dai_link->ignore_suspend)
                        continue;
 
-               if (cpu_dai->driver->resume && !cpu_dai->driver->ac97_control)
+               if (cpu_dai->driver->resume && !cpu_dai->driver->bus_control)
                        cpu_dai->driver->resume(cpu_dai);
                if (platform->driver->resume && platform->suspended) {
                        platform->driver->resume(cpu_dai);
@@ -758,7 +758,8 @@ static void soc_resume_deferred(struct work_struct *work)
 int snd_soc_resume(struct device *dev)
 {
        struct snd_soc_card *card = dev_get_drvdata(dev);
-       int i, ac97_control = 0;
+       bool bus_control = false;
+       int i;
 
        /* If the card is not initialized yet there is nothing to do */
        if (!card->instantiated)
@@ -781,17 +782,18 @@ int snd_soc_resume(struct device *dev)
                }
        }
 
-       /* AC97 devices might have other drivers hanging off them so
-        * need to resume immediately.  Other drivers don't have that
-        * problem and may take a substantial amount of time to resume
+       /*
+        * DAIs that also act as the control bus master might have other drivers
+        * hanging off them so need to resume immediately. Other drivers don't
+        * have that problem and may take a substantial amount of time to resume
         * due to I/O costs and anti-pop so handle them out of line.
         */
        for (i = 0; i < card->num_rtd; i++) {
                struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
-               ac97_control |= cpu_dai->driver->ac97_control;
+               bus_control |= cpu_dai->driver->bus_control;
        }
-       if (ac97_control) {
-               dev_dbg(dev, "ASoC: Resuming AC97 immediately\n");
+       if (bus_control) {
+               dev_dbg(dev, "ASoC: Resuming control bus master immediately\n");
                soc_resume_deferred(&card->deferred_resume_work);
        } else {
                dev_dbg(dev, "ASoC: Scheduling resume work\n");
index 3b0fa12dbff7ea743b045cffb965f36621865112..29a9957d335a1f11a46581d5710f10a1ddf7d206 100644 (file)
@@ -228,7 +228,7 @@ static int tegra20_ac97_probe(struct snd_soc_dai *dai)
 
 static struct snd_soc_dai_driver tegra20_ac97_dai = {
        .name = "tegra-ac97-pcm",
-       .ac97_control = 1,
+       .bus_control = true,
        .probe = tegra20_ac97_probe,
        .playback = {
                .stream_name = "PCM Playback",
index 9edd68db9f482e618e4e245a40dfbd0c94711e5d..f7135cdaa2cac9581ed0df11be7a23bc198adfc9 100644 (file)
@@ -152,7 +152,7 @@ static int txx9aclc_ac97_remove(struct snd_soc_dai *dai)
 }
 
 static struct snd_soc_dai_driver txx9aclc_ac97_dai = {
-       .ac97_control           = 1,
+       .bus_control            = true,
        .probe                  = txx9aclc_ac97_probe,
        .remove                 = txx9aclc_ac97_remove,
        .playback = {