ASoC: cs4271: Add DAPM support
authorMark Brown <broonie@linaro.org>
Sun, 11 Aug 2013 12:15:10 +0000 (13:15 +0100)
committerMark Brown <broonie@linaro.org>
Sun, 11 Aug 2013 17:40:53 +0000 (18:40 +0100)
This makes it possible to hook the device into a more complex board and
ensures it will continue to work with non-DAPM support removed from the
core.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Alexander Sverdlin <subaparts@yandex.ru>
sound/soc/codecs/cs4271.c

index 65ad56c43c133c55a8f377da374cc88b2ce639bd..a20f1bb8f0715011dad1a710cf038a80121e30b9 100644 (file)
@@ -173,6 +173,26 @@ struct cs4271_private {
        bool                            enable_soft_reset;
 };
 
+static const struct snd_soc_dapm_widget cs4271_dapm_widgets[] = {
+SND_SOC_DAPM_INPUT("AINA"),
+SND_SOC_DAPM_INPUT("AINB"),
+
+SND_SOC_DAPM_OUTPUT("AOUTA+"),
+SND_SOC_DAPM_OUTPUT("AOUTA-"),
+SND_SOC_DAPM_OUTPUT("AOUTB+"),
+SND_SOC_DAPM_OUTPUT("AOUTB-"),
+};
+
+static const struct snd_soc_dapm_route cs4271_dapm_routes[] = {
+       { "Capture", NULL, "AINA" },
+       { "Capture", NULL, "AINB" },
+
+       { "AOUTA+", NULL, "Playback" },
+       { "AOUTA-", NULL, "Playback" },
+       { "AOUTB+", NULL, "Playback" },
+       { "AOUTB-", NULL, "Playback" },
+};
+
 /*
  * @freq is the desired MCLK rate
  * MCLK rate should (c) be the sample rate, multiplied by one of the
@@ -598,6 +618,10 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
 
        .controls               = cs4271_snd_controls,
        .num_controls           = ARRAY_SIZE(cs4271_snd_controls),
+       .dapm_widgets           = cs4271_dapm_widgets,
+       .num_dapm_widgets       = ARRAY_SIZE(cs4271_dapm_widgets),
+       .dapm_routes            = cs4271_dapm_routes,
+       .num_dapm_routes        = ARRAY_SIZE(cs4271_dapm_routes),
 };
 
 #if defined(CONFIG_SPI_MASTER)