mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 09:49:58 -04:00
ASoC: sun50i-codec-analog: Add support for internal bias
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> Link: https://lore.kernel.org/r/20220621035452.60272-3-samuel@sholland.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
24e0b04dd4
commit
25ae1a04da
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user