ASoC: Remove DAI type information
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 24 Nov 2008 18:01:05 +0000 (18:01 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 24 Nov 2008 18:01:31 +0000 (18:01 +0000)
DAI type information is only ever used within ASoC in order to special
case AC97 and for diagnostic purposes. Since modern CPUs and codecs
support multi function DAIs which can be configured for several modes
it is more trouble than it's worth to maintain anything other than a
flag identifying AC97 DAIs so remove the type field and replace it with
an ac97_control flag.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
24 files changed:
include/sound/soc-dai.h
include/sound/soc.h
sound/soc/atmel/atmel_ssc_dai.c
sound/soc/au1x/psc-ac97.c
sound/soc/au1x/psc-i2s.c
sound/soc/blackfin/bf5xx-ac97.c
sound/soc/blackfin/bf5xx-i2s.c
sound/soc/codecs/ac97.c
sound/soc/codecs/pcm3008.c
sound/soc/codecs/wm9712.c
sound/soc/codecs/wm9713.c
sound/soc/davinci/davinci-i2s.c
sound/soc/fsl/mpc5200_psc_i2s.c
sound/soc/omap/omap-mcbsp.c
sound/soc/pxa/pxa-ssp.c
sound/soc/pxa/pxa2xx-ac97.c
sound/soc/pxa/pxa2xx-i2s.c
sound/soc/s3c24xx/neo1973_wm8753.c
sound/soc/s3c24xx/s3c2412-i2s.c
sound/soc/s3c24xx/s3c2443-ac97.c
sound/soc/s3c24xx/s3c24xx-i2s.c
sound/soc/sh/hac.c
sound/soc/sh/ssi.c
sound/soc/soc-core.c

index f51cb55902f7324ab05c273793977b972893353a..a01a24b101969663b141bca22c88df257e8ecde0 100644 (file)
@@ -184,7 +184,7 @@ struct snd_soc_dai {
        /* DAI description */
        char *name;
        unsigned int id;
-       unsigned char type;
+       int ac97_control;
 
        /* DAI callbacks */
        int (*probe)(struct platform_device *pdev,
index e4465f73aa46d60e0e4e409c9e9f05b802afda06..444f9c211379d726a761015ff69494f0026c2f70 100644 (file)
@@ -143,14 +143,6 @@ enum snd_soc_bias_level {
        SND_SOC_BIAS_OFF,
 };
 
-/*
- * Digital Audio Interface (DAI) types
- */
-#define SND_SOC_DAI_AC97       0x1
-#define SND_SOC_DAI_I2S                0x2
-#define SND_SOC_DAI_PCM                0x4
-#define SND_SOC_DAI_AC97_BUS   0x8     /* for custom i.e. non ac97_codec.c */
-
 struct snd_soc_device;
 struct snd_soc_pcm_stream;
 struct snd_soc_ops;
index 916f73b9a18f364d9bf2300d4c224c2455e0d6b1..0bb18dfa949570975ae370eb99b6cc42afc4c7f9 100644 (file)
@@ -702,7 +702,6 @@ static int atmel_ssc_resume(struct platform_device *pdev,
 struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
        {       .name = "atmel-ssc0",
                .id = 0,
-               .type = SND_SOC_DAI_PCM,
                .suspend = atmel_ssc_suspend,
                .resume = atmel_ssc_resume,
                .playback = {
@@ -727,7 +726,6 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
 #if NUM_SSC_DEVICES == 3
        {       .name = "atmel-ssc1",
                .id = 1,
-               .type = SND_SOC_DAI_PCM,
                .suspend = atmel_ssc_suspend,
                .resume = atmel_ssc_resume,
                .playback = {
@@ -751,7 +749,6 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
        },
        {       .name = "atmel-ssc2",
                .id = 2,
-               .type = SND_SOC_DAI_PCM,
                .suspend = atmel_ssc_suspend,
                .resume = atmel_ssc_resume,
                .playback = {
index ad60a6042cad413b22ca5e05ba3fd9c27c02619e..a0bcfeaf5f868e1fc582a13a940f3a82004f76cb 100644 (file)
@@ -346,7 +346,7 @@ static int au1xpsc_ac97_resume(struct platform_device *pdev,
 
 struct snd_soc_dai au1xpsc_ac97_dai = {
        .name                   = "au1xpsc_ac97",
-       .type                   = SND_SOC_DAI_AC97,
+       .ac97_control           = 1,
        .probe                  = au1xpsc_ac97_probe,
        .remove                 = au1xpsc_ac97_remove,
        .suspend                = au1xpsc_ac97_suspend,
index 05a5acbb16ae93b9a5333b01cc9866a39e20697b..f4217e70a7871b41328d88ee6a1814cd1189f3c1 100644 (file)
@@ -371,7 +371,6 @@ static int au1xpsc_i2s_resume(struct platform_device *pdev,
 
 struct snd_soc_dai au1xpsc_i2s_dai = {
        .name                   = "au1xpsc_i2s",
-       .type                   = SND_SOC_DAI_I2S,
        .probe                  = au1xpsc_i2s_probe,
        .remove                 = au1xpsc_i2s_remove,
        .suspend                = au1xpsc_i2s_suspend,
index 5dcd3f665ab1bfb152f5feecc1bb4a8ced0a559a..709bdf08e398f2fa57c6147f7323acc036fb0e09 100644 (file)
@@ -409,7 +409,7 @@ static void bf5xx_ac97_remove(struct platform_device *pdev,
 struct snd_soc_dai bfin_ac97_dai = {
        .name = "bf5xx-ac97",
        .id = 0,
-       .type = SND_SOC_DAI_AC97,
+       .ac97_control = 1,
        .probe = bf5xx_ac97_probe,
        .remove = bf5xx_ac97_remove,
        .suspend = bf5xx_ac97_suspend,
index 4e675b55b1829a55811843ce95b5abefa087533a..6e5036bf9245ddb68fc20aff961dc9a293aea1af 100644 (file)
@@ -292,7 +292,6 @@ static int bf5xx_i2s_resume(struct platform_device *pdev,
 struct snd_soc_dai bf5xx_i2s_dai = {
        .name = "bf5xx-i2s",
        .id = 0,
-       .type = SND_SOC_DAI_I2S,
        .probe = bf5xx_i2s_probe,
        .remove = bf5xx_i2s_remove,
        .suspend = bf5xx_i2s_suspend,
index 8a93aff359d071830bbe419025bd5d37d2892c88..c4208c8210c8734cf589d73058ca6b48ecb2713c 100644 (file)
@@ -43,7 +43,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
 
 struct snd_soc_dai ac97_dai = {
        .name = "AC97 HiFi",
-       .type = SND_SOC_DAI_AC97,
+       .ac97_control = 1,
        .playback = {
                .stream_name = "AC97 Playback",
                .channels_min = 1,
index 2b26e1d80c8d4392cefdabd23ef07474639ce095..651a15eb8c2c87058928919bc82c8d244213db0b 100644 (file)
@@ -33,7 +33,6 @@
 
 struct snd_soc_dai pcm3008_dai = {
        .name = "PCM3008 HiFi",
-       .type = SND_SOC_DAI_I2S,
        .playback = {
                .stream_name = "PCM3008 Playback",
                .channels_min = 1,
index 6e3e0f340179dc3b19b2f0bc724060fd415582ca..40f14061fb72cc2273d42c6987f3212aca1cccfb 100644 (file)
@@ -535,7 +535,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
 struct snd_soc_dai wm9712_dai[] = {
 {
        .name = "AC97 HiFi",
-       .type = SND_SOC_DAI_AC97_BUS,
+       .ac97_control = 1,
        .playback = {
                .stream_name = "HiFi Playback",
                .channels_min = 1,
index a502667fca7a094ff339e4221108fc6ae2e6ef42..9dad0bffcb0589d993c56b742ad582a59b46ffcd 100644 (file)
@@ -1024,7 +1024,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
 struct snd_soc_dai wm9713_dai[] = {
 {
        .name = "AC97 HiFi",
-       .type = SND_SOC_DAI_AC97_BUS,
+       .ac97_control = 1,
        .playback = {
                .stream_name = "HiFi Playback",
                .channels_min = 1,
index 7a17cd0ecf64ef8a364db1264db7524b8f47f451..cf31b3bb96cf500f859778e2127b737e0ba76910 100644 (file)
@@ -460,7 +460,6 @@ static void davinci_i2s_remove(struct platform_device *pdev,
 struct snd_soc_dai davinci_i2s_dai = {
        .name = "davinci-i2s",
        .id = 0,
-       .type = SND_SOC_DAI_I2S,
        .probe = davinci_i2s_probe,
        .remove = davinci_i2s_remove,
        .playback = {
index e2c172f389793d0fa26668b6d7b1816899f14be8..9ad8f9a2d8e90fba88875b169f33078bc7e20755 100644 (file)
@@ -469,7 +469,6 @@ static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int format)
  * psc_i2s_dai_template: template CPU Digital Audio Interface
  */
 static struct snd_soc_dai psc_i2s_dai_template = {
-       .type = SND_SOC_DAI_I2S,
        .playback = {
                .channels_min = 2,
                .channels_max = 2,
index 2eeb135c1e4bb6ccf5bcf47467d27d7dbae753f5..252bc7ebb194db6a27abd4a56ca5ef09ff5f81e0 100644 (file)
@@ -456,7 +456,6 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 {                                                              \
        .name = "omap-mcbsp-dai-"#link_id,                      \
        .id = (link_id),                                        \
-       .type = SND_SOC_DAI_I2S,                                \
        .playback = {                                           \
                .channels_min = 2,                              \
                .channels_max = 2,                              \
index d0dd6245a20a6cf940056ece103315867026d1e3..402fc5ba65e72e95fd5a98a5c93228e525026f99 100644 (file)
@@ -788,7 +788,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
        {
                .name = "pxa2xx-ssp1",
                .id = 0,
-               .type = SND_SOC_DAI_PCM,
                .probe = pxa_ssp_probe,
                .remove = pxa_ssp_remove,
                .suspend = pxa_ssp_suspend,
@@ -820,7 +819,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
        },
        {       .name = "pxa2xx-ssp2",
                .id = 1,
-               .type = SND_SOC_DAI_PCM,
                .probe = pxa_ssp_probe,
                .remove = pxa_ssp_remove,
                .suspend = pxa_ssp_suspend,
@@ -853,7 +851,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
        {
                .name = "pxa2xx-ssp3",
                .id = 2,
-               .type = SND_SOC_DAI_PCM,
                .probe = pxa_ssp_probe,
                .remove = pxa_ssp_remove,
                .suspend = pxa_ssp_suspend,
@@ -886,7 +883,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
        {
                .name = "pxa2xx-ssp4",
                .id = 3,
-               .type = SND_SOC_DAI_PCM,
                .probe = pxa_ssp_probe,
                .remove = pxa_ssp_remove,
                .suspend = pxa_ssp_suspend,
index 86667d2f1b7530e282a701e52c6f67e22dce24b7..bffbe288634cc28667e516b4127dc786cac46f5f 100644 (file)
@@ -173,7 +173,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
 {
        .name = "pxa2xx-ac97",
        .id = 0,
-       .type = SND_SOC_DAI_AC97,
+       .ac97_control = 1,
        .probe = pxa2xx_ac97_probe,
        .remove = pxa2xx_ac97_remove,
        .suspend = pxa2xx_ac97_suspend,
@@ -196,7 +196,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
 {
        .name = "pxa2xx-ac97-aux",
        .id = 1,
-       .type = SND_SOC_DAI_AC97,
+       .ac97_control = 1,
        .playback = {
                .stream_name = "AC97 Aux Playback",
                .channels_min = 1,
@@ -215,7 +215,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
 {
        .name = "pxa2xx-ac97-mic",
        .id = 2,
-       .type = SND_SOC_DAI_AC97,
+       .ac97_control = 1,
        .capture = {
                .stream_name = "AC97 Mic Capture",
                .channels_min = 1,
index 9a3e55b48129dfc1e150e6c94566db937448d7f2..f9a9e2ebafa1e0440439462cd3f43c80d1205914 100644 (file)
@@ -340,7 +340,6 @@ static int pxa2xx_i2s_resume(struct platform_device *pdev,
 struct snd_soc_dai pxa_i2s_dai = {
        .name = "pxa2xx-i2s",
        .id = 0,
-       .type = SND_SOC_DAI_I2S,
        .suspend = pxa2xx_i2s_suspend,
        .resume = pxa2xx_i2s_resume,
        .playback = {
index 528fc3f1b45bd0fb187bfff676c93759b9568236..3df2224a67238195cf46bb1638a875044d03fb63 100644 (file)
@@ -548,7 +548,6 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
 static struct snd_soc_dai bt_dai = {
        .name = "Bluetooth",
        .id = 0,
-       .type = SND_SOC_DAI_PCM,
        .playback = {
                .channels_min = 1,
                .channels_max = 1,
index 360cc2a49d9d709d5525e224d3bf7109641c1582..1c741047ae35546765ae96e18aa78091cf768aaa 100644 (file)
@@ -713,7 +713,6 @@ static int s3c2412_i2s_resume(struct platform_device *pdev,
 struct snd_soc_dai s3c2412_i2s_dai = {
        .name   = "s3c2412-i2s",
        .id     = 0,
-       .type   = SND_SOC_DAI_I2S,
        .probe  = s3c2412_i2s_probe,
        .suspend = s3c2412_i2s_suspend,
        .resume = s3c2412_i2s_resume,
index 31377821b2c5886205c5f06aaa654a0992509999..41bde6a3883ba7af25db08353865f3988c8c40a2 100644 (file)
@@ -358,7 +358,7 @@ struct snd_soc_dai s3c2443_ac97_dai[] = {
 {
        .name = "s3c2443-ac97",
        .id = 0,
-       .type = SND_SOC_DAI_AC97,
+       .ac97_control = 1,
        .probe = s3c2443_ac97_probe,
        .remove = s3c2443_ac97_remove,
        .playback = {
@@ -380,7 +380,7 @@ struct snd_soc_dai s3c2443_ac97_dai[] = {
 {
        .name = "pxa2xx-ac97-mic",
        .id = 1,
-       .type = SND_SOC_DAI_AC97,
+       .ac97_control = 1,
        .capture = {
                .stream_name = "AC97 Mic Capture",
                .channels_min = 1,
index 1bac9dd3dbd4b8239975880581a9dc0e56a6dc9a..8d9135f41bc9e4c7d7f7ef15aec57c4e3532ef2b 100644 (file)
@@ -461,7 +461,6 @@ static int s3c24xx_i2s_resume(struct platform_device *pdev,
 struct snd_soc_dai s3c24xx_i2s_dai = {
        .name = "s3c24xx-i2s",
        .id = 0,
-       .type = SND_SOC_DAI_I2S,
        .probe = s3c24xx_i2s_probe,
        .suspend = s3c24xx_i2s_suspend,
        .resume = s3c24xx_i2s_resume,
index 3318071dc80f25c2d04893618c91047352e10870..c435913c60ebc7a0b37e6d2f7384f3186e549bca 100644 (file)
@@ -271,7 +271,7 @@ struct snd_soc_dai sh4_hac_dai[] = {
 {
        .name                   = "HAC0",
        .id                     = 0,
-       .type                   = SND_SOC_DAI_AC97,
+       .ac97_control           = 1,
        .playback = {
                .rates          = AC97_RATES,
                .formats        = AC97_FMTS,
@@ -291,8 +291,8 @@ struct snd_soc_dai sh4_hac_dai[] = {
 #ifdef CONFIG_CPU_SUBTYPE_SH7760
 {
        .name                   = "HAC1",
+       .ac97_control           = 1,
        .id                     = 1,
-       .type                   = SND_SOC_DAI_AC97,
        .playback = {
                .rates          = AC97_RATES,
                .formats        = AC97_FMTS,
index 52a233840d273a3eca22d7fe6131ff710162c7f6..fed544a3deff0da0afdde389e94777f9e6c3ebb3 100644 (file)
@@ -340,7 +340,6 @@ struct snd_soc_dai sh4_ssi_dai[] = {
 {
        .name                   = "SSI0",
        .id                     = 0,
-       .type                   = SND_SOC_DAI_I2S,
        .playback = {
                .rates          = SSI_RATES,
                .formats        = SSI_FMTS,
@@ -367,7 +366,6 @@ struct snd_soc_dai sh4_ssi_dai[] = {
 {
        .name                   = "SSI1",
        .id                     = 1,
-       .type                   = SND_SOC_DAI_I2S,
        .playback = {
                .rates          = SSI_RATES,
                .formats        = SSI_FMTS,
index 43f4060dbe755fe6031310a3c7bb5b430a332e2f..0d47696ccd07b616b6842e8bb3b1f6d781c77678 100644 (file)
@@ -100,20 +100,6 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
 }
 #endif
 
-static inline const char *get_dai_name(int type)
-{
-       switch (type) {
-       case SND_SOC_DAI_AC97_BUS:
-       case SND_SOC_DAI_AC97:
-               return "AC97";
-       case SND_SOC_DAI_I2S:
-               return "I2S";
-       case SND_SOC_DAI_PCM:
-               return "PCM";
-       }
-       return NULL;
-}
-
 /*
  * Called by ALSA when a PCM substream is opened, the runtime->hw record is
  * then initialized and any private data can be allocated. This also calls
@@ -652,7 +638,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
 
        for (i = 0; i < card->num_links; i++) {
                struct snd_soc_dai  *cpu_dai = card->dai_link[i].cpu_dai;
-               if (cpu_dai->suspend && cpu_dai->type != SND_SOC_DAI_AC97)
+               if (cpu_dai->suspend && !cpu_dai->ac97_control)
                        cpu_dai->suspend(pdev, cpu_dai);
                if (platform->suspend)
                        platform->suspend(pdev, cpu_dai);
@@ -678,7 +664,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
 
        for (i = 0; i < card->num_links; i++) {
                struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
-               if (cpu_dai->suspend && cpu_dai->type == SND_SOC_DAI_AC97)
+               if (cpu_dai->suspend && cpu_dai->ac97_control)
                        cpu_dai->suspend(pdev, cpu_dai);
        }
 
@@ -714,7 +700,7 @@ static void soc_resume_deferred(struct work_struct *work)
 
        for (i = 0; i < card->num_links; i++) {
                struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
-               if (cpu_dai->resume && cpu_dai->type == SND_SOC_DAI_AC97)
+               if (cpu_dai->resume && cpu_dai->ac97_control)
                        cpu_dai->resume(pdev, cpu_dai);
        }
 
@@ -741,7 +727,7 @@ static void soc_resume_deferred(struct work_struct *work)
 
        for (i = 0; i < card->num_links; i++) {
                struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
-               if (cpu_dai->resume && cpu_dai->type != SND_SOC_DAI_AC97)
+               if (cpu_dai->resume && !cpu_dai->ac97_control)
                        cpu_dai->resume(pdev, cpu_dai);
                if (platform->resume)
                        platform->resume(pdev, cpu_dai);
@@ -898,8 +884,8 @@ static int soc_new_pcm(struct snd_soc_device *socdev,
        codec_dai->codec = socdev->codec;
 
        /* check client and interface hw capabilities */
-       sprintf(new_name, "%s %s-%s-%d", dai_link->stream_name, codec_dai->name,
-               get_dai_name(cpu_dai->type), num);
+       sprintf(new_name, "%s %s-%d", dai_link->stream_name, codec_dai->name,
+               num);
 
        if (codec_dai->playback.channels_min)
                playback = 1;
@@ -1270,8 +1256,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
                                continue;
                        }
                }
-               if (card->dai_link[i].codec_dai->type ==
-                       SND_SOC_DAI_AC97_BUS)
+               if (card->dai_link[i].codec_dai->ac97_control)
                        ac97 = 1;
        }
        snprintf(codec->card->shortname, sizeof(codec->card->shortname),
@@ -1335,7 +1320,7 @@ void snd_soc_free_pcms(struct snd_soc_device *socdev)
 #ifdef CONFIG_SND_SOC_AC97_BUS
        for (i = 0; i < codec->num_dai; i++) {
                codec_dai = &codec->dai[i];
-               if (codec_dai->type == SND_SOC_DAI_AC97_BUS && codec->ac97) {
+               if (codec_dai->ac97_control && codec->ac97) {
                        soc_ac97_dev_unregister(codec);
                        goto free_card;
                }