[PATCH v2 0/3] ASoC: sun50i-codec-analog: Internal bias support
This series adds support for enabling the codec's internal microphone bias, which is needed on at least some versions of the PinePhone.
Changes in v2: - Move register update from component probe to device probe
Arnaud Ferraris (2): ASoC: dt-bindings: sun50i-codec: Add binding for internal bias ASoC: sun50i-codec-analog: Add support for internal bias
Samuel Holland (1): arm64: dts: allwinner: pinephone: Enable internal HMIC bias
.../bindings/sound/allwinner,sun50i-a64-codec-analog.yaml | 5 +++++ .../arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts | 4 ++++ .../arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts | 4 ++++ sound/soc/sunxi/sun50i-codec-analog.c | 8 ++++++++ 4 files changed, 21 insertions(+)
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 adds a device-tree property to the sun50i-codec-analog driver to take advantage of this feature.
Signed-off-by: Arnaud Ferraris arnaud.ferraris@collabora.com [Samuel: split binding and implementation patches] Signed-off-by: Samuel Holland samuel@sholland.org ---
(no changes since v1)
.../bindings/sound/allwinner,sun50i-a64-codec-analog.yaml | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml b/Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml index 3b764415c9ab..66859eb8f79a 100644 --- a/Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml +++ b/Documentation/devicetree/bindings/sound/allwinner,sun50i-a64-codec-analog.yaml @@ -21,6 +21,11 @@ properties: description: Regulator for the headphone amplifier
+ allwinner,internal-bias-resistor: + description: + Enable the internal 2.2K bias resistor between HBIAS and MICDET pins + type: boolean + required: - compatible - reg
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);
Revisions 1.0 and 1.1 of the PinePhone mainboard do not have an external resistor connecting HBIAS to MIC2P. Enable the internal resistor to provide the necessary headeset microphone bias.
Signed-off-by: Samuel Holland samuel@sholland.org ---
(no changes since v1)
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts | 4 ++++ arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts | 4 ++++ 2 files changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts index fb65319a3bd3..219f720b8b7d 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts @@ -10,6 +10,10 @@ / { compatible = "pine64,pinephone-1.0", "pine64,pinephone", "allwinner,sun50i-a64"; };
+&codec_analog { + allwinner,internal-bias-resistor; +}; + &sgm3140 { enable-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */ flash-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts index 5e59d3752178..723af64a9cee 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts @@ -29,6 +29,10 @@ &backlight { default-brightness-level = <400>; };
+&codec_analog { + allwinner,internal-bias-resistor; +}; + &sgm3140 { enable-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
On Mon, 20 Jun 2022 22:54:49 -0500, Samuel Holland wrote:
This series adds support for enabling the codec's internal microphone bias, which is needed on at least some versions of the PinePhone.
Changes in v2:
- Move register update from component probe to device probe
Arnaud Ferraris (2): ASoC: dt-bindings: sun50i-codec: Add binding for internal bias ASoC: sun50i-codec-analog: Add support for internal bias
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: dt-bindings: sun50i-codec: Add binding for internal bias commit: 24e0b04dd42be34ec4b18dc1a1e139d66eb572a3 [2/3] ASoC: sun50i-codec-analog: Add support for internal bias commit: 25ae1a04da0d32c22db0b018e5668129b91fa104
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
Dne torek, 21. junij 2022 ob 05:54:52 CEST je Samuel Holland napisal(a):
Revisions 1.0 and 1.1 of the PinePhone mainboard do not have an external resistor connecting HBIAS to MIC2P. Enable the internal resistor to provide the necessary headeset microphone bias.
Signed-off-by: Samuel Holland samuel@sholland.org
Reviewed-by: Jernej Skrabec jernej.skrabec@gmail.com
Best regards, Jernej
Hi Mark!
Dne ponedeljek, 27. junij 2022 ob 22:46:30 CEST je Mark Brown napisal(a):
On Mon, 20 Jun 2022 22:54:49 -0500, Samuel Holland wrote:
This series adds support for enabling the codec's internal microphone bias, which is needed on at least some versions of the PinePhone.
Changes in v2:
- Move register update from component probe to device probe
Arnaud Ferraris (2): ASoC: dt-bindings: sun50i-codec: Add binding for internal bias ASoC: sun50i-codec-analog: Add support for internal bias
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: dt-bindings: sun50i-codec: Add binding for internal bias commit: 24e0b04dd42be34ec4b18dc1a1e139d66eb572a3 [2/3] ASoC: sun50i-codec-analog: Add support for internal bias commit: 25ae1a04da0d32c22db0b018e5668129b91fa104
Can you also take patch 3? You picked bindings change, so it's easiest if DT change goes through your tree too.
Best regards, Jernej
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
On Tue, Jul 05, 2022 at 10:12:56PM +0200, Jernej Škrabec wrote:
Dne ponedeljek, 27. junij 2022 ob 22:46:30 CEST je Mark Brown napisal(a):
On Mon, 20 Jun 2022 22:54:49 -0500, Samuel Holland wrote:
[1/3] ASoC: dt-bindings: sun50i-codec: Add binding for internal bias commit: 24e0b04dd42be34ec4b18dc1a1e139d66eb572a3 [2/3] ASoC: sun50i-codec-analog: Add support for internal bias commit: 25ae1a04da0d32c22db0b018e5668129b91fa104
Can you also take patch 3? You picked bindings change, so it's easiest if DT change goes through your tree too.
I can if the sunxi maintainers like, but normally changes to the DTs go via the platform tree.
Dne torek, 05. julij 2022 ob 22:58:32 CEST je Mark Brown napisal(a):
On Tue, Jul 05, 2022 at 10:12:56PM +0200, Jernej Škrabec wrote:
Dne ponedeljek, 27. junij 2022 ob 22:46:30 CEST je Mark Brown napisal(a):
On Mon, 20 Jun 2022 22:54:49 -0500, Samuel Holland wrote:
[1/3] ASoC: dt-bindings: sun50i-codec: Add binding for internal bias
commit: 24e0b04dd42be34ec4b18dc1a1e139d66eb572a3
[2/3] ASoC: sun50i-codec-analog: Add support for internal bias
commit: 25ae1a04da0d32c22db0b018e5668129b91fa104
Can you also take patch 3? You picked bindings change, so it's easiest if DT change goes through your tree too.
I can if the sunxi maintainers like, but normally changes to the DTs go via the platform tree.
I am sunxi maintainer. Wouldn't my branch generate warnings, if I have only DT changes but not bindings?
Best regards, Jernej
On Tue, Jul 05, 2022 at 11:04:54PM +0200, Jernej Škrabec wrote:
Dne torek, 05. julij 2022 ob 22:58:32 CEST je Mark Brown napisal(a):
I can if the sunxi maintainers like, but normally changes to the DTs go via the platform tree.
I am sunxi maintainer. Wouldn't my branch generate warnings, if I have only DT changes but not bindings?
I guess, I think people tend not to worry about it so long as -next is OK. The issue with merging things through subsystem trees is that it's very easy to generate lots of conflicts which tends to cause more issues overall.
Dne ponedeljek, 27. junij 2022 ob 22:53:05 CEST je Jernej Škrabec napisal(a):
Dne torek, 21. junij 2022 ob 05:54:52 CEST je Samuel Holland napisal(a):
Revisions 1.0 and 1.1 of the PinePhone mainboard do not have an external resistor connecting HBIAS to MIC2P. Enable the internal resistor to provide the necessary headeset microphone bias.
Signed-off-by: Samuel Holland samuel@sholland.org
Reviewed-by: Jernej Skrabec jernej.skrabec@gmail.com
Applied, thanks!
Best regards, Jernej
participants (3)
-
Jernej Škrabec
-
Mark Brown
-
Samuel Holland