From patchwork Sat Jan 11 16:40:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11328929 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5245109A for ; Sat, 11 Jan 2020 16:41:49 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46D0E2146E for ; Sat, 11 Jan 2020 16:41:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="NLQlmrvm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="QOvoEQgj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46D0E2146E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 32D6216A4; Sat, 11 Jan 2020 17:40:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 32D6216A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578760907; bh=NLGY+3zk8F5ivKaScWM1d/0kLoo3ghrxEXzvd437iUU=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NLQlmrvmatGMUVgGbbNUgzGCe7YDOSA7LsLsCcL47kB6/zP4AVt/hOknQL47+dOdw KqXkHfd2PckIpszTmwPPhsEIoFgP2QyhKXWO/Mkb+LpvZgmG5ARrSsawqFRB69YrH9 gtq2KkdLhmMCjNoyrNa/CO6ysd3kW1aMDwlBKONU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8F72FF801F5; Sat, 11 Jan 2020 17:40:56 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 79328F80214; Sat, 11 Jan 2020 17:40:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_PASS,SPF_NONE autolearn=disabled version=3.4.0 Received: from mo6-p01-ob.smtp.rzone.de (mo6-p01-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5301::4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0B20BF800B9 for ; Sat, 11 Jan 2020 17:40:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0B20BF800B9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="QOvoEQgj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1578760850; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=JbtMA7M+1Pr79NFgEOqzzOkHqAQ9r23m/hFlkn4N/Qg=; b=QOvoEQgjy1FnB4LlgkPZGBBXsaU/PmaFkWT/dBN9JDwYbCqc47bJhBS/ms7Bx9HsQ4 DUFH4gH+RBSR65i1gL54zT4+aeg4+H+Gy6NsI1bbKCIm0XEaTCaBG3Xkb6KVxSxsB2AA pWrbuxBgsCufHqhJtqpMwy3almwncOf6B+Pbh8taGmowBvVSO7V4yUnUwyQPN705/+g2 OfOtkWNL3wVWOp/DlypbNUzkSEKpfIDlBmIITYjGVUMLghvuKOa9humv/TDKIDwBEjQQ RpRhMxj1KogVSLOmwQUYvTU5eK3En6cq184baPrClH/Hemtql5ogIgAEW+ogntAea0+W 3uQQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQrEOHTIXsMv5qxJRCe0=" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.1.4 AUTH) with ESMTPSA id h048a6w0BGemFq8 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 11 Jan 2020 17:40:48 +0100 (CET) From: Stephan Gerhold To: Mark Brown Date: Sat, 11 Jan 2020 17:40:03 +0100 Message-Id: <20200111164006.43074-2-stephan@gerhold.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111164006.43074-1-stephan@gerhold.net> References: <20200111164006.43074-1-stephan@gerhold.net> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Stephan Gerhold , Takashi Iwai , Liam Girdwood , Srinivas Kandagatla , ~postmarketos/upstreaming@lists.sr.ht Subject: [alsa-devel] [PATCH 1/4] ASoC: msm8916-wcd-analog: Fix selected events for MIC BIAS External1 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" MIC BIAS External1 sets pm8916_wcd_analog_enable_micbias_ext1() as event handler, which ends up in pm8916_wcd_analog_enable_micbias_ext(). But pm8916_wcd_analog_enable_micbias_ext() only handles the POST_PMU event, which is not specified in the event flags for MIC BIAS External1. This means that the code in the event handler is never actually run. Set SND_SOC_DAPM_POST_PMU as the only event for the handler to fix this. Fixes: 585e881e5b9e ("ASoC: codecs: Add msm8916-wcd analog codec") Cc: Srinivas Kandagatla Signed-off-by: Stephan Gerhold Reviewed-by: Srinivas Kandagatla --- sound/soc/codecs/msm8916-wcd-analog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index f53235be77d9..30b19f12fabc 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -938,10 +938,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("MIC BIAS External1", CDC_A_MICB_1_EN, 7, 0, pm8916_wcd_analog_enable_micbias_ext1, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_POST_PMU), SND_SOC_DAPM_SUPPLY("MIC BIAS External2", CDC_A_MICB_2_EN, 7, 0, pm8916_wcd_analog_enable_micbias_ext2, - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_POST_PMU), SND_SOC_DAPM_ADC_E("ADC1", NULL, CDC_A_TX_1_EN, 7, 0, pm8916_wcd_analog_enable_adc, From patchwork Sat Jan 11 16:40:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11328933 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB77314B4 for ; Sat, 11 Jan 2020 16:43:32 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6320E20866 for ; Sat, 11 Jan 2020 16:43:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="lsFGVUph"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="PIKddwFj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6320E20866 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A079416C0; Sat, 11 Jan 2020 17:42:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A079416C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578761010; bh=1F8CnGGVaMRAM14xSbDRDIchCMX/vTlyp8+BL5NeCFo=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lsFGVUphwVc1vVlTMiA70q34P0gR/ylR1XTZBaKsMSua/iv8sfSbPn/BVYJ8l8wUG MgxJ2pu/ezjuHKG1loT0nYGnHmOy/y1bHERYfFRld1OXxHAQGzYL+PGcF608bZEFTi W3wB5ls57viWpT+UpVTa4vphbYnhCvDQMsnO7dmE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 160ACF80271; Sat, 11 Jan 2020 17:41:01 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 352D2F80214; Sat, 11 Jan 2020 17:40:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_PASS,SPF_NONE,SURBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mo6-p02-ob.smtp.rzone.de (mo6-p02-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5302::7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4B062F80172 for ; Sat, 11 Jan 2020 17:40:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4B062F80172 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="PIKddwFj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1578760852; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=Bv0UwbPPX3PdL2BbwUM1WioaUUkX2TTCKG3AOyhSfXQ=; b=PIKddwFjC5laVF6s09EGPZ51TgzQAKfBJ7WdvwXs+jT/zf0aLh+5AfwcVyAbNKnkv+ Jtut9A5xm+13fQJDWTtqq2R18k50YXc9saT8NVvjxpc4SzKRMQuhmCGz19DTL+gpxnli rLWsyIHrHjFD27VCN7HQYCJCYAN9vhHHMf5L9Z/ME9Irq0CgeKgiGL1ET6xb2lg/H+zj lZcMfFzab30osOcKTvoXi0HNYCsZzGzQFxDH1n/1KBpNpcEzIKzPWusFCY2yZ00cEQ/G 900rpoOGY5rXsYTv5+ebX0QF2nW3No0HZHDdo1Zowkgy5QYSDEOIE32dH5AOi9WyVHtm duRg== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQrEOHTIXsMv5qxJRCe0=" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.1.4 AUTH) with ESMTPSA id h048a6w0BGeoFq9 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 11 Jan 2020 17:40:50 +0100 (CET) From: Stephan Gerhold To: Mark Brown Date: Sat, 11 Jan 2020 17:40:04 +0100 Message-Id: <20200111164006.43074-3-stephan@gerhold.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111164006.43074-1-stephan@gerhold.net> References: <20200111164006.43074-1-stephan@gerhold.net> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Stephan Gerhold , Takashi Iwai , Liam Girdwood , Srinivas Kandagatla , ~postmarketos/upstreaming@lists.sr.ht Subject: [alsa-devel] [PATCH 2/4] ASoC: msm8916-wcd-analog: Fix MIC BIAS Internal1 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" MIC BIAS Internal1 is broken at the moment because we always enable the internal rbias resistor to the TX2 line (connected to the headset microphone), rather than enabling the resistor connected to TX1. Move the RBIAS code to pm8916_wcd_analog_enable_micbias_int1/2() to fix this. Fixes: 585e881e5b9e ("ASoC: codecs: Add msm8916-wcd analog codec") Cc: Srinivas Kandagatla Signed-off-by: Stephan Gerhold Reviewed-by: Srinivas Kandagatla --- sound/soc/codecs/msm8916-wcd-analog.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 30b19f12fabc..1f7964beb20c 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -396,9 +396,6 @@ static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_component switch (event) { case SND_SOC_DAPM_PRE_PMU: - snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, - MICB_1_INT_TX2_INT_RBIAS_EN_MASK, - MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE); snd_soc_component_update_bits(component, reg, MICB_1_EN_PULL_DOWN_EN_MASK, 0); snd_soc_component_update_bits(component, CDC_A_MICB_1_EN, MICB_1_EN_OPA_STG2_TAIL_CURR_MASK, @@ -448,6 +445,14 @@ static int pm8916_wcd_analog_enable_micbias_int1(struct struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component); + switch (event) { + case SND_SOC_DAPM_PRE_PMU: + snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, + MICB_1_INT_TX1_INT_RBIAS_EN_MASK, + MICB_1_INT_TX1_INT_RBIAS_EN_ENABLE); + break; + } + return pm8916_wcd_analog_enable_micbias_int(component, event, w->reg, wcd->micbias1_cap_mode); } @@ -558,6 +563,11 @@ static int pm8916_wcd_analog_enable_micbias_int2(struct struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component); switch (event) { + case SND_SOC_DAPM_PRE_PMU: + snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, + MICB_1_INT_TX2_INT_RBIAS_EN_MASK, + MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE); + break; case SND_SOC_DAPM_POST_PMU: pm8916_mbhc_configure_bias(wcd, true); break; From patchwork Sat Jan 11 16:40:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11328937 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB29014B4 for ; Sat, 11 Jan 2020 16:45:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F5C420866 for ; Sat, 11 Jan 2020 16:45:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="YZVh6Sz5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="hBQ1uSQj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F5C420866 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D578E16BD; Sat, 11 Jan 2020 17:44:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D578E16BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578761102; bh=2QHzc3s0m4aJMtS0YAnzwqld8hfjDzGiIInz+4sEETo=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YZVh6Sz5sVJAyBIHc7P9VXat54M11/cWdqtVTqLP4OwpPB7jsls1makxeTS5gXQSg 2Iuk08Px88EKIFrTu+GiHmpbV0ygq5X0RCzkzBeY/La8tnRNQ2RDG1/gvPkyNis4lm R0+XhHRP7MH76kYMCDhyAz6X2cLI/i0XUYuVlcoc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E4BCFF8028A; Sat, 11 Jan 2020 17:41:03 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 69F7FF801F4; Sat, 11 Jan 2020 17:40:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_PASS,SPF_NONE,SURBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mo6-p02-ob.smtp.rzone.de (mo6-p02-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5302::11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 809FFF800B9 for ; Sat, 11 Jan 2020 17:40:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 809FFF800B9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="hBQ1uSQj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1578760852; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=5jjHfnxrRJDesj6I56ZBVBKDQExEgqr2NC9/ksJgp3I=; b=hBQ1uSQjfm70sPk7mcUB0NHneewBEtHohwtjq/kPNRxKOkEGsrAJp3newcOeYglsQV 1rGupRYWrEK9qEWTRoq5NSxBnYyz9VvaQLGn5gy8X5lTDM8oOR7ISqkx2kbNEo2MRLP6 Sh+bD2fJBm/dli5O9IHiXgpb9KQl/jFaqoEfsoyLgQaS/zNNmnwCDDLkI5zSzJrkLev5 s2GPneN0fhZQCDKQxRwXWRzwKEMLONDUyj9z/m8Gzet+akNfB20cNmbPkpiBaIZRaoaP Lsc435vC2IplGbGRaVQN+ahhaHjFML+CAyRvbGipjLfRYr3lg/xk63aG1DAOdNOQNekF ce4w== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQrEOHTIXsMv5qxJRCe0=" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.1.4 AUTH) with ESMTPSA id h048a6w0BGeoFqA (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 11 Jan 2020 17:40:50 +0100 (CET) From: Stephan Gerhold To: Mark Brown Date: Sat, 11 Jan 2020 17:40:05 +0100 Message-Id: <20200111164006.43074-4-stephan@gerhold.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111164006.43074-1-stephan@gerhold.net> References: <20200111164006.43074-1-stephan@gerhold.net> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Stephan Gerhold , Takashi Iwai , Liam Girdwood , Srinivas Kandagatla , ~postmarketos/upstreaming@lists.sr.ht, Nikita Travkin Subject: [alsa-devel] [PATCH 3/4] ASoC: msm8916-wcd-analog: Simplify MIC BIAS Internal X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" At the moment, MIC BIAS Internal* and MIC BIAS External* both reference the same register, and have a part of their initialization sequence duplicated. In general, the sequence for enabling MIC BIAS InternalX seems to be: 1. Enable MIC BIAS ExternalX 2. Enable internal RBIAS resistor This means that we can simplify the code by modelling MIC BIAS InternalX as supply connected to MIC BIAS ExternalX. MIC BIAS InternalX is only responsible for enabling the internal RBIAS resistor (2). The DAPM enable sequence will automatically enable MIC BIAS ExternalX (1). This makes it much easier to add support for MIC BIAS Internal3 as a next step. Tested-by: Nikita Travkin # longcheer-l8150 Cc: Srinivas Kandagatla Signed-off-by: Stephan Gerhold --- sound/soc/codecs/msm8916-wcd-analog.c | 57 ++++++--------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 1f7964beb20c..930baae6eff5 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -389,23 +389,17 @@ static int pm8916_wcd_analog_enable_micbias_ext(struct snd_soc_component return 0; } -static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_component - *component, int event, - int reg, u32 cap_mode) +static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, + int event) { + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); switch (event) { case SND_SOC_DAPM_PRE_PMU: - snd_soc_component_update_bits(component, reg, MICB_1_EN_PULL_DOWN_EN_MASK, 0); snd_soc_component_update_bits(component, CDC_A_MICB_1_EN, MICB_1_EN_OPA_STG2_TAIL_CURR_MASK, MICB_1_EN_OPA_STG2_TAIL_CURR_1_60UA); - - break; - case SND_SOC_DAPM_POST_PMU: - pm8916_wcd_analog_micbias_enable(component); - snd_soc_component_update_bits(component, CDC_A_MICB_1_EN, - MICB_1_EN_BYP_CAP_MASK, cap_mode); break; } @@ -437,26 +431,6 @@ static int pm8916_wcd_analog_enable_micbias_ext2(struct } -static int pm8916_wcd_analog_enable_micbias_int1(struct - snd_soc_dapm_widget - *w, struct snd_kcontrol - *kcontrol, int event) -{ - struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component); - - switch (event) { - case SND_SOC_DAPM_PRE_PMU: - snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, - MICB_1_INT_TX1_INT_RBIAS_EN_MASK, - MICB_1_INT_TX1_INT_RBIAS_EN_ENABLE); - break; - } - - return pm8916_wcd_analog_enable_micbias_int(component, event, w->reg, - wcd->micbias1_cap_mode); -} - static int pm8916_mbhc_configure_bias(struct pm8916_wcd_analog_priv *priv, bool micbias2_enabled) { @@ -564,9 +538,8 @@ static int pm8916_wcd_analog_enable_micbias_int2(struct switch (event) { case SND_SOC_DAPM_PRE_PMU: - snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, - MICB_1_INT_TX2_INT_RBIAS_EN_MASK, - MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE); + snd_soc_component_update_bits(component, CDC_A_MICB_2_EN, + CDC_A_MICB_2_PULL_DOWN_EN_MASK, 0); break; case SND_SOC_DAPM_POST_PMU: pm8916_mbhc_configure_bias(wcd, true); @@ -576,8 +549,7 @@ static int pm8916_wcd_analog_enable_micbias_int2(struct break; } - return pm8916_wcd_analog_enable_micbias_int(component, event, w->reg, - wcd->micbias2_cap_mode); + return pm8916_wcd_analog_enable_micbias_int(w, kcontrol, event); } static int pm8916_wcd_analog_enable_adc(struct snd_soc_dapm_widget *w, @@ -878,12 +850,10 @@ static const struct snd_soc_dapm_route pm8916_wcd_analog_audio_map[] = { {"SPK PA", NULL, "SPK DAC"}, {"SPK DAC", "Switch", "PDM_RX3"}, - {"MIC BIAS Internal1", NULL, "INT_LDO_H"}, - {"MIC BIAS Internal2", NULL, "INT_LDO_H"}, + {"MIC BIAS Internal1", NULL, "MIC BIAS External1"}, + {"MIC BIAS Internal2", NULL, "MIC BIAS External2"}, {"MIC BIAS External1", NULL, "INT_LDO_H"}, {"MIC BIAS External2", NULL, "INT_LDO_H"}, - {"MIC BIAS Internal1", NULL, "vdd-micbias"}, - {"MIC BIAS Internal2", NULL, "vdd-micbias"}, {"MIC BIAS External1", NULL, "vdd-micbias"}, {"MIC BIAS External2", NULL, "vdd-micbias"}, }; @@ -937,11 +907,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("RX_BIAS", CDC_A_RX_COM_BIAS_DAC, 7, 0, NULL, 0), /* TX */ - SND_SOC_DAPM_SUPPLY("MIC BIAS Internal1", CDC_A_MICB_1_EN, 7, 0, - pm8916_wcd_analog_enable_micbias_int1, - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | - SND_SOC_DAPM_POST_PMD), - SND_SOC_DAPM_SUPPLY("MIC BIAS Internal2", CDC_A_MICB_2_EN, 7, 0, + SND_SOC_DAPM_SUPPLY("MIC BIAS Internal1", CDC_A_MICB_1_INT_RBIAS, 7, 0, + pm8916_wcd_analog_enable_micbias_int, + SND_SOC_DAPM_PRE_PMU), + SND_SOC_DAPM_SUPPLY("MIC BIAS Internal2", CDC_A_MICB_1_INT_RBIAS, 4, 0, pm8916_wcd_analog_enable_micbias_int2, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), From patchwork Sat Jan 11 16:40:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 11328935 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1AAB109A for ; Sat, 11 Jan 2020 16:44:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 672A520882 for ; Sat, 11 Jan 2020 16:44:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="QpnHMu2Q"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="XFde+TPy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 672A520882 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BB09A16BB; Sat, 11 Jan 2020 17:43:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BB09A16BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578761058; bh=3aTTo1HQEXuIE5VfKGuqtyelaM7nKlndZEbSyZjoXAw=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QpnHMu2QXfpP6/KQrVZzzAZCXyOJJzQlZj6YHH8lmn/2MVmPnZ9ID8QIaNec+AuKB mpeUsF3bB4MKZetC2xFteyQkdRU9yzsUWeIUnBf0viQGh0nmNKhWC1mEh871mRm2/o +jxBGXYHT0lz/neNgwgJJGUxZpBC9+xBlkst8Cls= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8FF28F80277; Sat, 11 Jan 2020 17:41:02 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9CCC3F8024A; Sat, 11 Jan 2020 17:40:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_PASS,SPF_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mo6-p02-ob.smtp.rzone.de (mo6-p02-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5302::5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CBF84F801F4 for ; Sat, 11 Jan 2020 17:40:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CBF84F801F4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="XFde+TPy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1578760853; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=xH96kE6CwyN0d8hXUq28tZUl/whMxiw0O/Lxh4Ihb0M=; b=XFde+TPyCi7rtxaS2FhoUl4MB6YUMETxf2RQAZmap7SgTshRAeBMa2GF8OMXr04R74 jGThGhq3FnlvsxPelsZxPNNSik64yZz0x653W/yPJNe1ml/oB3JuQjIDc23Z/S63N0Vd 2M50oNh3onK3ROFb4IMlD0kZ6gtDIOyObj55qQqy83WZ7jjU0Mlbg9qM/ymSl+5e/dsj un0ApBLdv/P0D7AfiIZkPX3UuTbW077pOmVUe902/GEMiThSINVl6Z3SqbZn+dBtjtXP leAuEc3FsGyYfIlpI9erddFltktTKvfP/Qv3T5i3l4GSq1yNBAdKWheHILtDuEKuakli lZBQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXQrEOHTIXsMv5qxJRCe0=" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 46.1.4 AUTH) with ESMTPSA id h048a6w0BGepFqB (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 11 Jan 2020 17:40:51 +0100 (CET) From: Stephan Gerhold To: Mark Brown Date: Sat, 11 Jan 2020 17:40:06 +0100 Message-Id: <20200111164006.43074-5-stephan@gerhold.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111164006.43074-1-stephan@gerhold.net> References: <20200111164006.43074-1-stephan@gerhold.net> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Stephan Gerhold , Takashi Iwai , Liam Girdwood , Srinivas Kandagatla , ~postmarketos/upstreaming@lists.sr.ht, Nikita Travkin Subject: [alsa-devel] [PATCH 4/4] ASoC: msm8916-wcd-analog: Add MIC BIAS Internal3 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" PM8916 has three TX inputs that each have an (optional) internal RBIAS resistor. MIC BIAS Internal1/2 (for TX1/2) are already supported. TX3 does not have its own MIC BIAS supply, instead it is also supplied from MIC BIAS1. Now that we have simplified the MIC BIAS Internal* implementation we can easily add support for it: Add a MIC BIAS Internal3 supply that enables the internal RBIAS resistor on TX3, and make sure to enable MIC BIAS External1. Tested-by: Nikita Travkin # longcheer-l8150 Cc: Srinivas Kandagatla Signed-off-by: Stephan Gerhold --- sound/soc/codecs/msm8916-wcd-analog.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 930baae6eff5..5e452b2457b2 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -852,6 +852,7 @@ static const struct snd_soc_dapm_route pm8916_wcd_analog_audio_map[] = { {"MIC BIAS Internal1", NULL, "MIC BIAS External1"}, {"MIC BIAS Internal2", NULL, "MIC BIAS External2"}, + {"MIC BIAS Internal3", NULL, "MIC BIAS External1"}, {"MIC BIAS External1", NULL, "INT_LDO_H"}, {"MIC BIAS External2", NULL, "INT_LDO_H"}, {"MIC BIAS External1", NULL, "vdd-micbias"}, @@ -914,6 +915,9 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { pm8916_wcd_analog_enable_micbias_int2, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), + SND_SOC_DAPM_SUPPLY("MIC BIAS Internal3", CDC_A_MICB_1_INT_RBIAS, 1, 0, + pm8916_wcd_analog_enable_micbias_int, + SND_SOC_DAPM_PRE_PMU), SND_SOC_DAPM_SUPPLY("MIC BIAS External1", CDC_A_MICB_1_EN, 7, 0, pm8916_wcd_analog_enable_micbias_ext1,