From patchwork Tue Dec 13 06:12:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Zhang X-Patchwork-Id: 9471821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65B1D60760 for ; Tue, 13 Dec 2016 06:16:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 569BE284F9 for ; Tue, 13 Dec 2016 06:16:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AACB28528; Tue, 13 Dec 2016 06:16:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0980B284F9 for ; Tue, 13 Dec 2016 06:16:42 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 04812266D8E; Tue, 13 Dec 2016 07:16:41 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A9A86266D53; Tue, 13 Dec 2016 07:14:19 +0100 (CET) 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 C9ACA266D86; Tue, 13 Dec 2016 07:14:09 +0100 (CET) Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by alsa0.perex.cz (Postfix) with ESMTP id 16B3A266D53 for ; Tue, 13 Dec 2016 07:14:05 +0100 (CET) Received: by mail-pf0-f182.google.com with SMTP id c4so16913625pfb.1 for ; Mon, 12 Dec 2016 22:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=5jsDoARfMUUAOuADGby3C0KW26DuuvLl3qmvomBCTlA=; b=E/B19tpigYJkdx3PpE7qk22FuXKraSiny+bEBe/OZ2sMB6j+gUE3/dOXdFsy7EATRo XwDZMdHg6FOrT1Bk/SJMi7XYttGppnGU2hHoxE5DI4kFQEWJJ6SCKd2EGCgTM97OpcjT pKXM+TThEt89uwh34BHNyq9ny9Btpqpn62SwU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5jsDoARfMUUAOuADGby3C0KW26DuuvLl3qmvomBCTlA=; b=XAuj2hcDRrHaUv9IsozODK4bFhpXyiv9FORmALYEQk9mWhYK253bC6CPif6AaFjCHZ BW969rw/uDc5IAcutYVzSuDcusYrqJ9zHeL/L0hh/e64V9D6BW6uFxVgl4AqhvX9DPI/ M1GtKopF1OzCraQvaY28qQvwQ7ztztvL9EXhoELZgPy4lYyf4CQHm2hm8zOalzpWhyHE GM9UtgTYnnjmApVlAuI4RB+Q72G8PZqtYYU0/hNAQyG5FdLqlqRbia8qeunH7fl69B5I 0B9yrFAkWSSuiSNyfm39bgu1EsYku/9FlpoGjM/8qdkx0gHo+7Z1rYp47wPRP7JaU8Fv 7GRg== X-Gm-Message-State: AKaTC01mM/b2U7h1xOkcQRyOE0fY6N0tqkHUE2hOPCHQ+vwSNvjBGSOkEvz2tesR4GO/PKK7 X-Received: by 10.84.211.7 with SMTP id b7mr45902457pli.83.1481609644476; Mon, 12 Dec 2016 22:14:04 -0800 (PST) Received: from benzh.mtv.corp.google.com ([172.22.65.67]) by smtp.gmail.com with ESMTPSA id b126sm18500354pfg.52.2016.12.12.22.14.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 22:14:04 -0800 (PST) From: Ben Zhang To: Mark Brown Date: Mon, 12 Dec 2016 22:12:06 -0800 Message-Id: <1481609526-21933-1-git-send-email-benzh@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Cc: alsa-devel@alsa-project.org, Ben Zhang , John Hsu , Liam Girdwood , YHCHuang@nuvoton.com, Anatol Pomozov , CTLIN0@nuvoton.com, Dylan Reid , yong.zhi@intel.com, mhkuo@nuvoton.com Subject: [alsa-devel] [PATCH] ASoC: nau8825: Add Class G function options 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 Add a DAPM_MUX for userspace to control the Class G function: "Switching": Use +-1.8V or +-0.9V supply, based on signal amplitude. "1.8V": Always use +-1.8V. The default is "Switching" which is the existing behavior without this patch, so no effect on current users. On some devices, the switching may cause a clicking noise at low volume. "1.8V" eliminates the noise at the expense of a few additional mW. Signed-off-by: Ben Zhang --- sound/soc/codecs/nau8825.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index efe3a44..ddd15a0 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -1062,6 +1062,10 @@ static const char * const nau8825_dac_src[] = { "DACL", "DACR", }; +static const char * const nau8825_class_g_src[] = { + "Switching", "1.8V" +}; + static SOC_ENUM_SINGLE_DECL( nau8825_dacl_enum, NAU8825_REG_DACL_CTRL, NAU8825_DACL_CH_SEL_SFT, nau8825_dac_src); @@ -1070,12 +1074,17 @@ static SOC_ENUM_SINGLE_DECL( nau8825_dacr_enum, NAU8825_REG_DACR_CTRL, NAU8825_DACR_CH_SEL_SFT, nau8825_dac_src); +static SOC_ENUM_SINGLE_DECL( + nau8825_class_g_enum, SND_SOC_NOPM, 0, nau8825_class_g_src); + static const struct snd_kcontrol_new nau8825_dacl_mux = SOC_DAPM_ENUM("DACL Source", nau8825_dacl_enum); static const struct snd_kcontrol_new nau8825_dacr_mux = SOC_DAPM_ENUM("DACR Source", nau8825_dacr_enum); +static const struct snd_kcontrol_new nau8825_class_g_mux = + SOC_DAPM_ENUM("Class G Source", nau8825_class_g_enum); static const struct snd_soc_dapm_widget nau8825_dapm_widgets[] = { SND_SOC_DAPM_AIF_OUT("AIFTX", "Capture", 0, NAU8825_REG_I2S_PCM_CTRL2, @@ -1154,9 +1163,16 @@ static const struct snd_soc_dapm_widget nau8825_dapm_widgets[] = { SND_SOC_DAPM_PGA_S("HP Boost Driver", 9, NAU8825_REG_BOOST, 9, 1, NULL, 0), - /* Class G operation control*/ - SND_SOC_DAPM_PGA_S("Class G", 10, + /* Class G operation control. "Class G" MUX options: + * "Switching": Use +-1.8V or +-0.9V supply, based on signal amplitude. + * "1.8V": Always use +-1.8V. + * The PGA_S widget is used to ensure the Class G control bit is set at + * the correct time w.r.t the other widgets. + */ + SND_SOC_DAPM_PGA_S("Class G Driver", 10, NAU8825_REG_CLASSG_CTRL, 0, 0, NULL, 0), + SND_SOC_DAPM_MUX("Class G", SND_SOC_NOPM, 0, 0, + &nau8825_class_g_mux), SND_SOC_DAPM_OUTPUT("HPOL"), SND_SOC_DAPM_OUTPUT("HPOR"), @@ -1197,7 +1213,9 @@ static const struct snd_soc_dapm_route nau8825_dapm_routes[] = { {"HPOR Pulldown", NULL, "Output DACR"}, {"HP Boost Driver", NULL, "HPOL Pulldown"}, {"HP Boost Driver", NULL, "HPOR Pulldown"}, - {"Class G", NULL, "HP Boost Driver"}, + {"Class G Driver", NULL, "HP Boost Driver"}, + {"Class G", "1.8V", "HP Boost Driver"}, + {"Class G", "Switching", "Class G Driver"}, {"HPOL", NULL, "Class G"}, {"HPOR", NULL, "Class G"}, };