From patchwork Wed Aug 9 16:49:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 109744 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1131388qge; Wed, 9 Aug 2017 09:50:18 -0700 (PDT) X-Received: by 10.28.234.145 with SMTP id g17mr5287209wmi.144.1502297417847; Wed, 09 Aug 2017 09:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502297417; cv=none; d=google.com; s=arc-20160816; b=vcYdK3y01D4RBuM0/P0t75F3gh52jdEsoMZScyEw1hBe4CBKjQ5vDQryTOcKTAI1cr 0ZI+HbBNlhHaA/FjhTn8wAOifhVrEUc5IyMwoeqSbcRY9r2pmCPfLNNZ1S9mPFFj4fHj hDLSzcWScB2XBTq4204PSMKs/SCX/9wW2w3NBKGi9eKVGDrJN3YEK1MzmaqrbN6RYkH0 1+0KtwzRJfvY9vSp5Xbse1V/XyFf9lzgUqYDxVmNEGfei/p2iXIBcgZAcct7BdflcDEi L1mtGUEmnssggOJ0v4ZDAYQrh7JPagReLo7Y7Ke/IYee2vyukn+ihSUvlcUUOAGoVbcR 1jBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to:arc-authentication-results; bh=QskVgwq40Os5V+kw8iazniU8q1KykDId31n4rM0fRqY=; b=sktJqTAySddNEAU39EAXIVWzyVao1Hon4rkrjvLruFFKK/7LGdUt34uoBqtVyPV7EF wuEJR/OTOIemyP+DaZVtR3CG52Cx/XP8RxT3yIkwVpLKzPoOwQ09hvjybhZ8h5gux5Cy Vggshr6baAMnwrj+zcDz1tAKbUfcdUaND7KCgucroJPaF62XQWf66361XdVN7ZtopMnp zxwapCMiIXR3lPac/TGXQFBivPjF3e9bimgIJOKkzGzgwyvZM0sSwU5DsX4aUdGv6JeD dhEfmPvz5ymeXOawAJXMqYU1+ZwhkLYE0eeIGdFDb5WzrH3mpdDGarTqrBle0Sqj6xP8 SAqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cbtuZ/ev; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id w3si3337051wma.109.2017.08.09.09.50.16; Wed, 09 Aug 2017 09:50:17 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cbtuZ/ev; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1C637267411; Wed, 9 Aug 2017 18:49:46 +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 B4007267414; Wed, 9 Aug 2017 18:49:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) by alsa0.perex.cz (Postfix) with ESMTP id BB932267409 for ; Wed, 9 Aug 2017 18:49:38 +0200 (CEST) Received: by mail-it0-f53.google.com with SMTP id 76so733552ith.0 for ; Wed, 09 Aug 2017 09:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UQB+Cy5g9aBZGzJ9kp9BfeAQ44W2u0sbiFvEfGtsPo8=; b=cbtuZ/evwMaEHeVhvCbsAHDFmE8RM9aNqZqySPtavkAJfbtSjFgoAIQv44yp/Uoc2W CpfBU74pqM14I3eVx3D+g10wCdUnB2JKG7LDtOqSiUH0q92ZZdK/LESDizmXq2FtGVCI qIqDGe4oUOOtyA1/4G+75kJ0AJ8rS4dkWI4A8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UQB+Cy5g9aBZGzJ9kp9BfeAQ44W2u0sbiFvEfGtsPo8=; b=DuDPAqJlwOkmBrsQl2p87LAhlmtEqJPB1ec7zeNG7S2x8bj8h7irGTFHmWRRyCq8du 7i6c5e8fUw1LP/Dmw7hZuVUWGkMiGgARr02PpdGIe4t8JH/ZePcow9mT5JjWDfwylmYA WZNmAiRWAzoV6TOyeS84MzuCkEkv57QGun1AmXntJDoELiKIWbCDWO2uddbL8anWaz9Z Ypv5j9Ifd/7expYaqXoZDjMyDAILkfou8o2TJylX/J0Uy+hAIj0iRWLSfkVTnkeSXceE a1EPDyFTTsATAxXo4NJ2hN5/bialPbyiTiR+vhwS9AoEu3m7/ywsKNKzwVoGCP173YHF Jwwg== X-Gm-Message-State: AIVw110ljZlkvHe/LqI/7Z1/RsoKQsNlWZMATmvwATAcGo6C/GnNY+hM T7KVE+5kvMPy+fJ8 X-Received: by 10.36.30.10 with SMTP id 10mr7259334itt.8.1502297376807; Wed, 09 Aug 2017 09:49:36 -0700 (PDT) Received: from localhost.localdomain (static.8.26.4.46.clients.your-server.de. [46.4.26.8]) by smtp.gmail.com with ESMTPSA id r20sm2246012itb.19.2017.08.09.09.49.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Aug 2017 09:49:36 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: Mark Brown , Banajit Goswami , alsa-devel@alsa-project.org Date: Wed, 9 Aug 2017 18:49:24 +0200 Message-Id: <20170809164927.19663-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170809164927.19663-1-srinivas.kandagatla@linaro.org> References: <20170809164927.19663-1-srinivas.kandagatla@linaro.org> Cc: damien.riegel@savoirfairelinux.com, Patrick Lai , linux-kernel@vger.kernel.org, Takashi Iwai , Srinivas Kandagatla Subject: [alsa-devel] [PATCH v3 2/5] ASoC: codecs: msm8916-wcd-analog: get micbias voltage from dt 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 From: Srinivas Kandagatla This patch adds bindings in DT to provide required micbias voltage which could be specific to board. With this new binding, now the mic bias voltage is left at hardware default value if the device tree does not specify any mic bias voltage value. Correct micbias value is required for mbhc buttons to work. Signed-off-by: Srinivas Kandagatla --- .../bindings/sound/qcom,msm8916-wcd-analog.txt | 1 + sound/soc/codecs/msm8916-wcd-analog.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) -- 2.9.3 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/Documentation/devicetree/bindings/sound/qcom,msm8916-wcd-analog.txt b/Documentation/devicetree/bindings/sound/qcom,msm8916-wcd-analog.txt index ccb401c..05b67a1 100644 --- a/Documentation/devicetree/bindings/sound/qcom,msm8916-wcd-analog.txt +++ b/Documentation/devicetree/bindings/sound/qcom,msm8916-wcd-analog.txt @@ -33,6 +33,7 @@ Required properties - vdd-micbias-supply: phandle of VDD_MICBIAS supply's regulator DT node. Optional Properties: +- qcom,micbias-lvl: Voltage (mV) for Mic Bias - qcom,micbias1-ext-cap: boolean, present if micbias1 has external capacitor connected. - qcom,micbias2-ext-cap: boolean, present if micbias2 has external capacitor diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 6606954..dec4978 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -93,8 +93,12 @@ #define MICB_1_EN_TX3_GND_SEL_TX_GND 0 #define CDC_A_MICB_1_VAL (0xf141) +#define MICB_MIN_VAL 1600 +#define MICB_STEP_SIZE 50 +#define MICB_VOLTAGE_REGVAL(v) ((v - MICB_MIN_VAL)/MICB_STEP_SIZE) #define MICB_1_VAL_MICB_OUT_VAL_MASK GENMASK(7, 3) #define MICB_1_VAL_MICB_OUT_VAL_V2P70V ((0x16) << 3) +#define MICB_1_VAL_MICB_OUT_VAL_V1P80V ((0x4) << 3) #define CDC_A_MICB_1_CTL (0xf142) #define MICB_1_CTL_CFILT_REF_SEL_MASK BIT(1) @@ -225,6 +229,7 @@ struct pm8916_wcd_analog_priv { struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; unsigned int micbias1_cap_mode; unsigned int micbias2_cap_mode; + unsigned int micbias_mv; }; static const char *const adc2_mux_text[] = { "ZERO", "INP2", "INP3" }; @@ -265,18 +270,18 @@ static const struct snd_kcontrol_new pm8916_wcd_analog_snd_controls[] = { static void pm8916_wcd_analog_micbias_enable(struct snd_soc_codec *codec) { + struct pm8916_wcd_analog_priv *wcd = snd_soc_codec_get_drvdata(codec); + snd_soc_update_bits(codec, CDC_A_MICB_1_CTL, MICB_1_CTL_EXT_PRECHARG_EN_MASK | MICB_1_CTL_INT_PRECHARG_BYP_MASK, MICB_1_CTL_INT_PRECHARG_BYP_EXT_PRECHRG_SEL | MICB_1_CTL_EXT_PRECHARG_EN_ENABLE); - snd_soc_write(codec, CDC_A_MICB_1_VAL, MICB_1_VAL_MICB_OUT_VAL_V2P70V); - /* - * Special headset needs MICBIAS as 2.7V so wait for - * 50 msec for the MICBIAS to reach 2.7 volts. - */ - msleep(50); + if (wcd->micbias_mv) + snd_soc_write(codec, CDC_A_MICB_1_VAL, + MICB_VOLTAGE_REGVAL(wcd->micbias_mv)); + snd_soc_update_bits(codec, CDC_A_MICB_1_CTL, MICB_1_CTL_EXT_PRECHARG_EN_MASK | MICB_1_CTL_INT_PRECHARG_BYP_MASK, 0); @@ -795,6 +800,9 @@ static int pm8916_wcd_analog_parse_dt(struct device *dev, else priv->micbias2_cap_mode = MICB_1_EN_NO_EXT_BYP_CAP; + of_property_read_u32(dev->of_node, "qcom,micbias-lvl", + &priv->micbias_mv); + return 0; }