From: Samuel Holland <samuel@sholland.org>
To: Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: Arnaud Ferraris <arnaud.ferraris@collabora.com>,
Samuel Holland <samuel@sholland.org>,
Jaroslav Kysela <perex@perex.cz>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Maxime Ripard <mripard@kernel.org>,
Rob Herring <robh+dt@kernel.org>, Takashi Iwai <tiwai@suse.com>,
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 [thread overview]
Message-ID: <20220621035452.60272-3-samuel@sholland.org> (raw)
In-Reply-To: <20220621035452.60272-1-samuel@sholland.org>
From: Arnaud Ferraris <arnaud.ferraris@collabora.com>
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 <arnaud.ferraris@collabora.com>
[Samuel: split binding and implementation; move to device probe]
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
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);
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-21 3:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 3:54 [PATCH v2 0/3] ASoC: sun50i-codec-analog: Internal bias support Samuel Holland
2022-06-21 3:54 ` [PATCH v2 1/3] ASoC: dt-bindings: sun50i-codec: Add binding for internal bias Samuel Holland
2022-06-21 3:54 ` Samuel Holland [this message]
2022-06-21 3:54 ` [PATCH v2 3/3] arm64: dts: allwinner: pinephone: Enable internal HMIC bias Samuel Holland
2022-06-27 20:53 ` Jernej Škrabec
2022-07-08 16:52 ` Jernej Škrabec
2022-06-27 20:46 ` (subset) [PATCH v2 0/3] ASoC: sun50i-codec-analog: Internal bias support Mark Brown
2022-07-05 20:12 ` Jernej Škrabec
2022-07-05 20:58 ` Mark Brown
2022-07-05 21:04 ` Jernej Škrabec
2022-07-05 21:14 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220621035452.60272-3-samuel@sholland.org \
--to=samuel@sholland.org \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.ferraris@collabora.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.com \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox