From patchwork Wed Aug 12 11:58:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 7000861 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6EA979F358 for ; Wed, 12 Aug 2015 11:59:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AC482065B for ; Wed, 12 Aug 2015 11:59:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6CB3C20652 for ; Wed, 12 Aug 2015 11:59:04 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0A3C8260474; Wed, 12 Aug 2015 13:59:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 7BD76260453; Wed, 12 Aug 2015 13:58:55 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id CFECD260459; Wed, 12 Aug 2015 13:58:53 +0200 (CEST) Received: from smtp-out-194.synserver.de (smtp-out-194.synserver.de [212.40.185.194]) by alsa0.perex.cz (Postfix) with ESMTP id B095226044E for ; Wed, 12 Aug 2015 13:58:46 +0200 (CEST) Received: (qmail 5913 invoked by uid 0); 12 Aug 2015 11:58:45 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 5820 Received: from p4fde74db.dip0.t-ipconnect.de (HELO lars-laptop.ad.analog.com) [79.222.116.219] by 217.119.54.73 with SMTP; 12 Aug 2015 11:58:43 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Wed, 12 Aug 2015 13:58:38 +0200 Message-Id: <1439380718-12503-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 Cc: Vinod Koul , alsa-devel@alsa-project.org, Lars-Peter Clausen , Omair M Abdullah Subject: [alsa-devel] [PATCH] ASoC: ssm4567: Add sense support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- sound/soc/codecs/ssm4567.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c index ac242b2..e619d56 100644 --- a/sound/soc/codecs/ssm4567.c +++ b/sound/soc/codecs/ssm4567.c @@ -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, };