ASoC: sun8i-codec-analog: Add the headphone inversion switches
Subsystems (3)
PATCH v2 1/1 ASoC: sun8i-codec-analog: Add the headphone inversion switches
Bits 1 and 0 of PAEN_HP_CTRL (analog register 0x07; LTRNMUTE, RTLNMUTE) are "Left HPOUT Negative To Right HPOUT Mute" and "Right HPOUT Negative To Left HPOUT Mute" in the A23 and A33 user manuals and the V3s datasheet (0 = mute, the reset value). The driver defines them, but nothing can set them.
The PocketGo S30 (A33) has a mono speaker amplifier bridged across HPL and HPR. With the same signal on both outputs it gets very little; setting bit 1 makes it clearly louder, which is what the board needs.
Expose each bit as its own switch, "Headphone L to R Inversion Playback Switch" and "Headphone R to L Inversion Playback Switch". Both default to off (the reset value), so nothing changes for existing boards.
---
Changes in v2:
- Two independent switches instead of one enum that kept both bits from being set together (Mark Brown). With both bits set the S30 speaker
goes silent (results below), which does no harm, so there is no reason
to forbid it in the driver.
- Commit message: describe the bits by their manual names and what the
S30 needs, without a signal model I cannot back up.
- Link to v1: https://lore.kernel.org/r/[email protected]
Notes:
- Testing: built with W=1 for arm (multi_v7_defconfig) and arm64 (defconfig), SND_SUN8I_CODEC_ANALOG=m, and =y in the A33 kernel below, no warnings. On a PocketGo S30 (A33, mono speaker amplifier bridged across HPL and HPR) on 7.3.1, stereo path (AIF1 DA0 "Stereo", headphone source DAC), 440 Hz tone on both channels, listening to the speaker:
both switches off (PAEN_HP_CTRL 0xf4): quiet; "L to R" on (0xf6):
clearly louder; both on (0xf7): silent apart from a few clicks. (The test kernel had longer control names, which ALSA truncated; this version only shortens them.)
Before this version, the same bits written by hand while playing, with a second tone on the left channel only:
bits 1:0 both channels left channel only
00 normal normal
10 louder silent
01 loud loud
11 silent silent- The A23 shares this code path; its user manual (v1.0, PAEN_HP_CTRL) documents the same two bits, with the same names and reset value.
- Tool disclosure: this patch was prepared with Claude Opus 5.5 (Anthropic) as a coding assistant, in an interactive session where I asked it to get the PocketGo S30 speaker working. It ran the register tests above while I listened, found the two unused bits in the A33 manual and drafted the change and the message. I reviewed and understand the change and tested it as described above.
sound/soc/sunxi/sun8i-codec-analog.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/sunxi/sun8i-codec-analog.c +7 -0
@@ -323,6 +323,13 @@ static const struct snd_kcontrol_new sun8i_codec_headphone_controls[] = { SUN8I_ADDA_DAC_PA_SRC, SUN8I_ADDA_DAC_PA_SRC_LHPPAMUTE, SUN8I_ADDA_DAC_PA_SRC_RHPPAMUTE, 1, 0), +/* inverted left to the right output, and the reverse */ +SOC_SINGLE ("Headphone L to R Inversion Playback Switch" , +SUN8I_ADDA_PAEN_HP_CTRL , +SUN8I_ADDA_PAEN_HP_CTRL_LTRNMUTE ,1 ,0 ), +SOC_SINGLE ("Headphone R to L Inversion Playback Switch" , +SUN8I_ADDA_PAEN_HP_CTRL , + SUN8I_ADDA_PAEN_HP_CTRL_RTLNMUTE, 1, 0), }; static const char * const sun8i_codec_hp_src_enum_text[] = {
base-commit: 9f961caa18fc4678067232f8f021a23cb1588de4
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 1 line · Romain TISSERAND
ASoC: sun8i-codec-analog: Add the headphone inversion switches
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5
Thanks!
[1/1] ASoC: sun8i-codec-analog: Add the headphone inversion switches
https://git.kernel.org/broonie/sound/c/f8c89079cd90
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