ASoC: Convert SMDK WM8580 to table based DAPM init
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 8 Oct 2011 12:31:18 +0000 (13:31 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 10 Oct 2011 10:07:36 +0000 (11:07 +0100)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
sound/soc/samsung/smdk_wm8580.c

index 54c4cce..8f92ffc 100644 (file)
@@ -119,30 +119,24 @@ static struct snd_soc_ops smdk_ops = {
 };
 
 /* SMDK Playback widgets */
-static const struct snd_soc_dapm_widget wm8580_dapm_widgets_pbk[] = {
+static const struct snd_soc_dapm_widget smdk_wm8580_dapm_widgets[] = {
        SND_SOC_DAPM_HP("Front", NULL),
        SND_SOC_DAPM_HP("Center+Sub", NULL),
        SND_SOC_DAPM_HP("Rear", NULL),
-};
 
-/* SMDK Capture widgets */
-static const struct snd_soc_dapm_widget wm8580_dapm_widgets_cpt[] = {
        SND_SOC_DAPM_MIC("MicIn", NULL),
        SND_SOC_DAPM_LINE("LineIn", NULL),
 };
 
 /* SMDK-PAIFTX connections */
-static const struct snd_soc_dapm_route audio_map_tx[] = {
+static const struct snd_soc_dapm_route smdk_wm8580_audio_map[] = {
        /* MicIn feeds AINL */
        {"AINL", NULL, "MicIn"},
 
        /* LineIn feeds AINL/R */
        {"AINL", NULL, "LineIn"},
        {"AINR", NULL, "LineIn"},
-};
 
-/* SMDK-PAIFRX connections */
-static const struct snd_soc_dapm_route audio_map_rx[] = {
        /* Front Left/Right are fed VOUT1L/R */
        {"Front", NULL, "VOUT1L"},
        {"Front", NULL, "VOUT1R"},
@@ -161,13 +155,6 @@ static int smdk_wm8580_init_paiftx(struct snd_soc_pcm_runtime *rtd)
        struct snd_soc_codec *codec = rtd->codec;
        struct snd_soc_dapm_context *dapm = &codec->dapm;
 
-       /* Add smdk specific Capture widgets */
-       snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets_cpt,
-                                 ARRAY_SIZE(wm8580_dapm_widgets_cpt));
-
-       /* Set up PAIFTX audio path */
-       snd_soc_dapm_add_routes(dapm, audio_map_tx, ARRAY_SIZE(audio_map_tx));
-
        /* Enabling the microphone requires the fitting of a 0R
         * resistor to connect the line from the microphone jack.
         */
@@ -176,21 +163,6 @@ static int smdk_wm8580_init_paiftx(struct snd_soc_pcm_runtime *rtd)
        return 0;
 }
 
-static int smdk_wm8580_init_paifrx(struct snd_soc_pcm_runtime *rtd)
-{
-       struct snd_soc_codec *codec = rtd->codec;
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
-
-       /* Add smdk specific Playback widgets */
-       snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets_pbk,
-                                 ARRAY_SIZE(wm8580_dapm_widgets_pbk));
-
-       /* Set up PAIFRX audio path */
-       snd_soc_dapm_add_routes(dapm, audio_map_rx, ARRAY_SIZE(audio_map_rx));
-
-       return 0;
-}
-
 enum {
        PRI_PLAYBACK = 0,
        PRI_CAPTURE,
@@ -205,7 +177,6 @@ static struct snd_soc_dai_link smdk_dai[] = {
                .codec_dai_name = "wm8580-hifi-playback",
                .platform_name = "samsung-audio",
                .codec_name = "wm8580.0-001b",
-               .init = smdk_wm8580_init_paifrx,
                .ops = &smdk_ops,
        },
        [PRI_CAPTURE] = { /* Primary Capture i/f */
@@ -225,7 +196,6 @@ static struct snd_soc_dai_link smdk_dai[] = {
                .codec_dai_name = "wm8580-hifi-playback",
                .platform_name = "samsung-audio",
                .codec_name = "wm8580.0-001b",
-               .init = smdk_wm8580_init_paifrx,
                .ops = &smdk_ops,
        },
 };
@@ -234,6 +204,11 @@ static struct snd_soc_card smdk = {
        .name = "SMDK-I2S",
        .dai_link = smdk_dai,
        .num_links = 2,
+
+       .dapm_widgets = smdk_wm8580_dapm_widgets,
+       .num_dapm_widgets = ARRAY_SIZE(smdk_wm8580_dapm_widgets),
+       .dapm_routes = smdk_wm8580_audio_map,
+       .num_dapm_routes = ARRAY_SIZE(smdk_wm8580_audio_map),
 };
 
 static struct platform_device *smdk_snd_device;