* [PATCH v2] ASoC: sun8i-codec-analog: Add the headphone inversion switches
@ 2026-11-27 2:00 Romain TISSERAND
2026-11-27 2:12 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Romain TISSERAND @ 2026-11-27 2:00 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-sunxi,
linux-arm-kernel, linux-kernel, sashiko-reviews
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.
Signed-off-by: Romain TISSERAND <romain.tisserand@gmail.com>
---
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/20261103133935.2892210-1-romain.tisserand@gmail.com
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(+)
diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c
index 3335855c6311..e24fd7bd0613 100644
--- a/sound/soc/sunxi/sun8i-codec-analog.c
+++ b/sound/soc/sunxi/sun8i-codec-analog.c
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ASoC: sun8i-codec-analog: Add the headphone inversion switches
2026-11-27 2:00 [PATCH v2] ASoC: sun8i-codec-analog: Add the headphone inversion switches Romain TISSERAND
@ 2026-11-27 2:12 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-11-27 2:12 UTC (permalink / raw)
To: Liam Girdwood, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Romain TISSERAND
Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-sunxi,
linux-arm-kernel, linux-kernel, sashiko-reviews
On Fri, 27 Nov 2026 03:00:29 +0100, Romain TISSERAND wrote:
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 3:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 2:00 [PATCH v2] ASoC: sun8i-codec-analog: Add the headphone inversion switches Romain TISSERAND
2026-11-27 2:12 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®