]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ASoC: ssm4567: Add sense support
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 12 Aug 2015 11:58:38 +0000 (13:58 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 14 Aug 2015 16:29:15 +0000 (17:29 +0100)
The ssm4567 has sensing circuitry that can be used to monitor the current
and voltage on the speaker amplifier output has well as the VBAT input.
This data can be output over the I2S interface so it can be processed by a
DSP or similar.

This patch adds the sense capture output stream to the CODEC DAI as well as
DAPM widgets that ensure that the sensing circuitry is powered up when the
capture stream is active.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/ssm4567.c

index ac242b2ebdea00a10bf69367d0fca6f6e17b4029..e619d5651b09bbd6401cdea6734acf0a4a6f17dc 100644 (file)
@@ -174,6 +174,12 @@ static const struct snd_soc_dapm_widget ssm4567_dapm_widgets[] = {
        SND_SOC_DAPM_SWITCH("Amplifier Boost", SSM4567_REG_POWER_CTRL, 3, 1,
                &ssm4567_amplifier_boost_control),
 
+       SND_SOC_DAPM_SIGGEN("Sense"),
+
+       SND_SOC_DAPM_PGA("Current Sense", SSM4567_REG_POWER_CTRL, 4, 1, NULL, 0),
+       SND_SOC_DAPM_PGA("Voltage Sense", SSM4567_REG_POWER_CTRL, 5, 1, NULL, 0),
+       SND_SOC_DAPM_PGA("VBAT Sense", SSM4567_REG_POWER_CTRL, 6, 1, NULL, 0),
+
        SND_SOC_DAPM_OUTPUT("OUT"),
 };
 
@@ -181,6 +187,13 @@ static const struct snd_soc_dapm_route ssm4567_routes[] = {
        { "OUT", NULL, "Amplifier Boost" },
        { "Amplifier Boost", "Switch", "DAC" },
        { "OUT", NULL, "DAC" },
+
+       { "Current Sense", NULL, "Sense" },
+       { "Voltage Sense", NULL, "Sense" },
+       { "VBAT Sense", NULL, "Sense" },
+       { "Capture Sense", NULL, "Current Sense" },
+       { "Capture Sense", NULL, "Voltage Sense" },
+       { "Capture Sense", NULL, "VBAT Sense" },
 };
 
 static int ssm4567_hw_params(struct snd_pcm_substream *substream,
@@ -388,6 +401,14 @@ static struct snd_soc_dai_driver ssm4567_dai = {
                .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
                        SNDRV_PCM_FMTBIT_S32,
        },
+       .capture = {
+               .stream_name = "Capture Sense",
+               .channels_min = 1,
+               .channels_max = 1,
+               .rates = SNDRV_PCM_RATE_8000_192000,
+               .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+                       SNDRV_PCM_FMTBIT_S32,
+       },
        .ops = &ssm4567_dai_ops,
 };