summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/max9877.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-08-13 13:32:03 +0100
committerMark Brown <broonie@linaro.org>2013-08-13 13:40:35 +0100
commit5cf9da8aacbfaed72ada8c195859f49d5d7f5f6c (patch)
tree9b5b8050eeff7c14f9166f597b8d2cc1016308cc /sound/soc/codecs/max9877.c
parentd76a96174b31bd916c1dfaa81a3db82fc8c54b91 (diff)
downloadlinux-stable-5cf9da8aacbfaed72ada8c195859f49d5d7f5f6c.tar.gz
linux-stable-5cf9da8aacbfaed72ada8c195859f49d5d7f5f6c.tar.bz2
linux-stable-5cf9da8aacbfaed72ada8c195859f49d5d7f5f6c.zip
ASoC: max9877: Add basic DAPM support
This does not fully map the power control available within the device but it provides the hooks for routing signals through the device and allows automatic management of the device low power mode. Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/max9877.c')
-rw-r--r--sound/soc/codecs/max9877.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c
index 8505b401d3c4..29549cdbf4c1 100644
--- a/sound/soc/codecs/max9877.c
+++ b/sound/soc/codecs/max9877.c
@@ -87,15 +87,50 @@ static const struct snd_kcontrol_new max9877_controls[] = {
MAX9877_INPUT_MODE, 6, 1, 0),
SOC_SINGLE("MAX9877 Bypass Mode Switch",
MAX9877_OUTPUT_MODE, 6, 1, 0),
- SOC_SINGLE("MAX9877 Shutdown Mode Switch",
- MAX9877_OUTPUT_MODE, 7, 1, 1),
SOC_ENUM("MAX9877 Output Mode", max9877_enum[0]),
SOC_ENUM("MAX9877 Oscillator Mode", max9877_enum[1]),
};
+static const struct snd_soc_dapm_widget max9877_dapm_widgets[] = {
+SND_SOC_DAPM_INPUT("INA1"),
+SND_SOC_DAPM_INPUT("INA2"),
+SND_SOC_DAPM_INPUT("INB1"),
+SND_SOC_DAPM_INPUT("INB2"),
+SND_SOC_DAPM_INPUT("RXIN+"),
+SND_SOC_DAPM_INPUT("RXIN-"),
+
+SND_SOC_DAPM_PGA("SHDN", MAX9877_OUTPUT_MODE, 7, 1, NULL, 0),
+
+SND_SOC_DAPM_OUTPUT("OUT+"),
+SND_SOC_DAPM_OUTPUT("OUT-"),
+SND_SOC_DAPM_OUTPUT("HPL"),
+SND_SOC_DAPM_OUTPUT("HPR"),
+};
+
+static const struct snd_soc_dapm_route max9877_dapm_routes[] = {
+ { "SHDN", NULL, "INA1" },
+ { "SHDN", NULL, "INA2" },
+ { "SHDN", NULL, "INB1" },
+ { "SHDN", NULL, "INB2" },
+
+ { "OUT+", NULL, "RXIN+" },
+ { "OUT+", NULL, "SHDN" },
+
+ { "OUT-", NULL, "SHDN" },
+ { "OUT-", NULL, "RXIN-" },
+
+ { "HPL", NULL, "SHDN" },
+ { "HPR", NULL, "SHDN" },
+};
+
static const struct snd_soc_codec_driver max9877_codec = {
.controls = max9877_controls,
.num_controls = ARRAY_SIZE(max9877_controls),
+
+ .dapm_widgets = max9877_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(max9877_dapm_widgets),
+ .dapm_routes = max9877_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(max9877_dapm_routes),
};
static const struct regmap_config max9877_regmap = {