From patchwork Thu Dec 11 04:15:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Zhang X-Patchwork-Id: 5474151 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 03C9CBEEA8 for ; Thu, 11 Dec 2014 04:16:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A996201B4 for ; Thu, 11 Dec 2014 04:16:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 16A5120160 for ; Thu, 11 Dec 2014 04:16:41 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3E4B3264F39; Thu, 11 Dec 2014 05:16:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C55842608F0; Thu, 11 Dec 2014 05:16:02 +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 367C826070A; Thu, 11 Dec 2014 05:16:01 +0100 (CET) Received: from mail-yk0-f202.google.com (mail-yk0-f202.google.com [209.85.160.202]) by alsa0.perex.cz (Postfix) with ESMTP id 2A4C126070A for ; Thu, 11 Dec 2014 05:15:53 +0100 (CET) Received: by mail-yk0-f202.google.com with SMTP id 9so261512ykp.3 for ; Wed, 10 Dec 2014 20:15:52 -0800 (PST) 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:in-reply-to :references; bh=NhEUSNJVlv/9RIY53ZG3iLIpB5KZAcmcUOAdP9UMYKo=; b=b5mk5uuXR0QguG7IYRxMytFGSYfoN07duOfGFpbRtt/YoqdHEwItd2JocCi6Y++3nA pmy1huyD7QdMUMIJBqh+P2WNofTTM7HgYa+rEe0g2aWLTLYw6SzWqLi5bwOtvHvkJzFJ OsnsSJvqrug0x694X7r7QoFfmiZDsXqpJyR15UQ7pUAg5Rec3bO4cREAwIHZ3kpqjqTS VmMTjhi+RsF+/ZtGu4I9CHiB1msoc8z/ntfgVVs5aHvW0BxQ7dXhzeYQwQcygq58hYsU V69bHKU7SNHd2FAYzCOj44UnIGKrYm6Df5JEdm6EaLe/7EG/9GWQ/k9Ldq5Q/t6unMCk o+Nw== X-Gm-Message-State: ALoCoQnpwwCYrlQhtQvwI+tydrNBPG+5JJRpFodZFpNr6/IS/7En3j+eFabmsclrfBZpJCUxKyMb3N1fgop9hqLQNPCEhrLwS5EqLjetg755ThsvhJTSCv3n4Zcx6L0S7uno6sWazaPttaK4pLyo/05nxVGxuM8YzNWh2wp5h87SS0MfjMBzVQM= X-Received: by 10.236.228.6 with SMTP id e6mr7079411yhq.34.1418271352147; Wed, 10 Dec 2014 20:15:52 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id c44si197319yhc.5.2014.12.10.20.15.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Dec 2014 20:15:52 -0800 (PST) Received: from benzh.mtv.corp.google.com ([172.22.65.67]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id mZ7o2ZjC.1; Wed, 10 Dec 2014 20:15:52 -0800 Received: by benzh.mtv.corp.google.com (Postfix, from userid 215530) id 0724BE03F2; Wed, 10 Dec 2014 20:15:50 -0800 (PST) From: Ben Zhang To: Mark Brown Date: Wed, 10 Dec 2014 20:15:26 -0800 Message-Id: <1418271327-14710-2-git-send-email-benzh@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1418271327-14710-1-git-send-email-benzh@chromium.org> References: <1418271327-14710-1-git-send-email-benzh@chromium.org> Cc: Oder Chiou , alsa-devel@alsa-project.org, Ben Zhang , Liam Girdwood , linux-kernel@vger.kernel.org, Albert Chen , Anatol Pomozov , Bard Liao , Dylan Reid Subject: [alsa-devel] [PATCH 2/3] ASoC: rt5677: add a platform config option for MICBIAS voltage 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 MICBIAS voltage for IN1 can be set to 1.476V/2.970V/1.242V/2.475V Signed-off-by: Ben Zhang --- Documentation/devicetree/bindings/sound/rt5677.txt | 4 ++++ include/sound/rt5677.h | 9 +++++++++ sound/soc/codecs/rt5677.c | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/rt5677.txt b/Documentation/devicetree/bindings/sound/rt5677.txt index 740ff77..f54d0dd 100644 --- a/Documentation/devicetree/bindings/sound/rt5677.txt +++ b/Documentation/devicetree/bindings/sound/rt5677.txt @@ -19,6 +19,9 @@ Optional properties: - realtek,pow-ldo2-gpio : The GPIO that controls the CODEC's POW_LDO2 pin. +- realtek,micbias1 + Select 0/1/2/3 to set MICBIAS1 voltage to 1.476V/2.970V/1.242V/2.475V + - realtek,in1-differential - realtek,in2-differential - realtek,lout1-differential @@ -70,6 +73,7 @@ rt5677 { realtek,pow-ldo2-gpio = <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>; + realtek,micbias1 = <1> /* MICBIAS1 = 2.970V */ realtek,in1-differential = "true"; realtek,gpio-config = /bits/ 8 <0 0 0 0 0 2>; /* pull up GPIO6 */ realtek,jd2-gpio = <3>; /* Enables Jack detection for GPIO6 */ diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h index d9eb7d8..efa74bb 100644 --- a/include/sound/rt5677.h +++ b/include/sound/rt5677.h @@ -12,6 +12,13 @@ #ifndef __LINUX_SND_RT5677_H #define __LINUX_SND_RT5677_H +enum rt5677_micbias { + RT5677_MICBIAS_1_476V = 0, + RT5677_MICBIAS_2_970V = 1, + RT5677_MICBIAS_1_242V = 2, + RT5677_MICBIAS_2_475V = 3, +}; + enum rt5677_dmic2_clk { RT5677_DMIC_CLK1 = 0, RT5677_DMIC_CLK2 = 1, @@ -19,6 +26,8 @@ enum rt5677_dmic2_clk { struct rt5677_platform_data { + /* MICBIAS output voltage control */ + enum rt5677_micbias micbias1; /* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */ bool in1_diff; bool in2_diff; diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 81fe146..ac4bee8 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4551,6 +4551,7 @@ MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id); static int rt5677_parse_dt(struct rt5677_priv *rt5677, struct device_node *np) { + of_property_read_u32(np, "realtek,micbias1", &rt5677->pdata.micbias1); rt5677->pdata.in1_diff = of_property_read_bool(np, "realtek,in1-differential"); rt5677->pdata.in2_diff = of_property_read_bool(np, @@ -4722,6 +4723,11 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, if (ret != 0) dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); + regmap_update_bits(rt5677->regmap, RT5677_MICBIAS, + RT5677_MICBIAS1_OUTVOLT_MASK | + RT5677_MICBIAS1_CTRL_VDD_MASK, + rt5677->pdata.micbias1 << RT5677_MICBIAS1_CTRL_VDD_SFT); + if (rt5677->pdata.in1_diff) regmap_update_bits(rt5677->regmap, RT5677_IN1, RT5677_IN_DF1, RT5677_IN_DF1);