From patchwork Tue Jun 21 03:54:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 12888664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F292FC43334 for ; Tue, 21 Jun 2022 03:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZeN9W6zZkiEQVZD27BG9dogov2QNlkWLKVnBScHanng=; b=RR13xkemvsn0gi imAwYMS5PpTBCcXB13JyPWGWYeao4MkKjxHilGbpXfEl23jvH2hY8lguOI93EfHqpya/zj0M1CGVn IJTxGWAkri75Z4ifIPjhdx/oST/S44G9Qr6s+f+gooYLyG9223Gzw3OC4377+J80JTTA+DJ7dMyEN FMBPr/9z22cyQZRMXmlHk7Uvn+lBvoi89QCWNqCxEkVfvvC/YnIjXrPKiVLvzZXktR4jhe1T0rWQF FxdYuJUwBvvWVT9aRjBcqRMZMqIegOAcX7X7fCxqUIvKKufi5NCQ8a7QUHlsT21SGdsxTMsm3B2NG Jot9aCRnwHoMki6dj2HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3Uz7-003TAA-Ft; Tue, 21 Jun 2022 03:55:25 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3Uyl-003T32-Fs for linux-arm-kernel@lists.infradead.org; Tue, 21 Jun 2022 03:55:05 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 72A8132009A3; Mon, 20 Jun 2022 23:55:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 20 Jun 2022 23:55:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1655783700; x=1655870100; bh=IV XbiXdpdoC7yhelNdR2IcucO5Ao9MT/MrT0BNZ4coY=; b=DD3jZqrlCGUciy45F2 3LWHvr7jNU6Jafrt6YnTQMVnVHGZbkq0EsgeAs4u/7Z6byMvZ8RDj5BtJfS9uEjN H9222HyVP9Z6+ptqh0FbAaVGkegjpEqgp1TmBviKg+KA9/aIYFktNud8I7zSpFKB z800FXyNwzcPGFDNRG337ZccouDbbMW398ok8o5KENVvmUSy4IlT3N8JTSQIWiWx A8JkT9cPYj5a7LywTSeDMkW3AVafq6nOkZDsu3gh/oXsupnloKo5KoWyOkdg+uSF cA4UaqVFwAR4R/tWFanMaGkb/RTvtPVLrSPwTWgULGkEYoY72KLYJao+2V73nSEV gDrA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655783700; x=1655870100; bh=IVXbiXdpdoC7y helNdR2IcucO5Ao9MT/MrT0BNZ4coY=; b=j6cr3/rM/fHch/9aHx6h+vlBZanNb /2/fNyCNM/fdGRkMk3M+6uavJtfqT/4GaL+WnNqfHdAS4QxBmnUjEmXf2uA3K3aI yHWDznXp1OU1s5R92VR2+9rfb1SczsWZ6U7iMNaWttUg/nkbHdTynX5jRwtEmFEz HcFMO1BEY64GnfkOCAjoof+Y1K9NYVocjPphjcMaK4B3zC5Aea3mrr6ORt5d3yy7 SpShFSu638iiG5YWX0Lahn3/PZ5ijF0cHXnSgIkfDmbaptN6KTcSCzU5aCKOnqfx BS/5AGf1p3Tjq3dnfolRw3ADMVJDljMoOWxYpcQUwB0TBJLIHMnTNTibw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudefvddgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Jun 2022 23:55:00 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Liam Girdwood , Mark Brown Cc: Arnaud Ferraris , Samuel Holland , Jaroslav Kysela , Krzysztof Kozlowski , Maxime Ripard , Rob Herring , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 2/3] ASoC: sun50i-codec-analog: Add support for internal bias Date: Mon, 20 Jun 2022 22:54:51 -0500 Message-Id: <20220621035452.60272-3-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220621035452.60272-1-samuel@sholland.org> References: <20220621035452.60272-1-samuel@sholland.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220620_205503_689452_47B52ADF X-CRM114-Status: GOOD ( 13.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnaud Ferraris In order to properly bias headset microphones, there should be a pull-up resistor between pins HBIAS and MIC2P. This can be an external resistor, but the codec also provides an internal 2.2K resistor which is enabled by a register. This patch enables or disables the internal bias resistor based on a device tree property. Signed-off-by: Arnaud Ferraris [Samuel: split binding and implementation; move to device probe] Signed-off-by: Samuel Holland --- Changes in v2: - Move register update from component probe to device probe sound/soc/sunxi/sun50i-codec-analog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/sunxi/sun50i-codec-analog.c b/sound/soc/sunxi/sun50i-codec-analog.c index a41e25ad0aaf..e1e5e8de0130 100644 --- a/sound/soc/sunxi/sun50i-codec-analog.c +++ b/sound/soc/sunxi/sun50i-codec-analog.c @@ -117,6 +117,7 @@ #define SUN50I_ADDA_HS_MBIAS_CTRL_MMICBIASEN 7 #define SUN50I_ADDA_JACK_MIC_CTRL 0x1d +#define SUN50I_ADDA_JACK_MIC_CTRL_INNERRESEN 6 #define SUN50I_ADDA_JACK_MIC_CTRL_HMICBIASEN 5 /* mixer controls */ @@ -507,6 +508,7 @@ static int sun50i_codec_analog_probe(struct platform_device *pdev) { struct regmap *regmap; void __iomem *base; + bool enable; base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) { @@ -520,6 +522,12 @@ static int sun50i_codec_analog_probe(struct platform_device *pdev) return PTR_ERR(regmap); } + enable = device_property_read_bool(&pdev->dev, + "allwinner,internal-bias-resistor"); + regmap_update_bits(regmap, SUN50I_ADDA_JACK_MIC_CTRL, + BIT(SUN50I_ADDA_JACK_MIC_CTRL_INNERRESEN), + enable << SUN50I_ADDA_JACK_MIC_CTRL_INNERRESEN); + return devm_snd_soc_register_component(&pdev->dev, &sun50i_codec_analog_cmpnt_drv, NULL, 0);