Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: em28xx: fix silent audio capture on EM2860/TVP5150 reference design
@ 2026-09-13 20:23 d01
  2026-09-13 21:10 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: d01 @ 2026-09-13 20:23 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media

The EM2860/TVP5150 reference design (eb1a:5051, "USB 2861 Device",
card=29) captures no analog audio. The ALSA device yields a flat noise
floor of about -85 dBFS, identical with the audio cable plugged or
unplugged and regardless of mixer settings, while video capture works
normally.

Audio on this board is not on the em28xx vendor path. Chip config
register 0x00 reads 0x50 -- bit 0x80 (vendor audio) is clear -- so the
board exposes a USB Audio Class interface claimed by snd-usb-audio, fed
by the EMP202 codec's ADC. Which input that ADC listens to is set by
AC97_REC_SEL (0x1a).

em28xx_audio_analog_set() does program AC97_REC_SEL, but only under:

	if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN)

ctl_aoutput comes from the board's per-input .aout field, falling back
to EM28XX_AOUT_MASTER when it is unset (em28xx-video.c). This board's
entry sets .amux but no .aout, so EM28XX_AOUT_PCM_IN is never set, the
AC97_REC_SEL write is skipped, and the mux stays at its reset default
of 0x0000 (Mic, which is not connected on these boards). Nothing is
captured.

Set .aout on both inputs to select the PCM record path from Line In,
matching the .amux already declared. ac97_return_record_select() maps
EM28XX_AOUT_PCM_LINE to 4, which em28xx_audio_analog_set() mirrors into
both channels as 0x0404.

EM28XX_AOUT_MASTER is included so the master volume continues to track
the V4L2 volume control exactly as it did via the old fallback, keeping
the change additive. It is not required for capture -- muting
AC97_MASTER by hand while leaving everything else in place does not
affect the recorded signal.

Diagnosed on eb1a:5051 by writing AC97_REC_SEL directly over usbfs with
everything else held constant:

  AC97_REC_SEL = 0x0404 (Line In) -> -21.8 dBFS, line-level audio
  AC97_REC_SEL = 0x0000 (Mic)     -> -85.4 dBFS, silence

Then verified with this patch applied and the rebuilt module loaded, with
no userspace register writes at all: the driver programs AC97_REC_SEL to
0x0404 on its own at probe, and capture yields -25.0 dBFS of line-level
audio once the mute control is cleared.

AC97_POWERDOWN (0x26) reads 0x420d throughout -- status bits ADC, ANL
and REF all set -- so this is not an analog-power or GPIO problem. The
codec is powered and simply listening to the wrong input.

Note that the V4L2 mute control defaults to 1, which gates the bridge
audio path via EM28XX_XCLK_AUDIO_UNMUTE in R0F. That is a separate
issue and is unchanged by this patch, so "v4l2-ctl -d /dev/videoN -c
mute=0" is still required to hear anything.

Signed-off-by: d01 <d01.devel@gmail.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -1148,10 +1148,14 @@
 			.type     = EM28XX_VMUX_COMPOSITE,
 			.vmux     = TVP5150_COMPOSITE1,
 			.amux     = EM28XX_AMUX_LINE_IN,
+			.aout     = EM28XX_AOUT_MASTER | EM28XX_AOUT_PCM_IN |
+				    EM28XX_AOUT_PCM_LINE,
 		}, {
 			.type     = EM28XX_VMUX_SVIDEO,
 			.vmux     = TVP5150_SVIDEO,
 			.amux     = EM28XX_AMUX_LINE_IN,
+			.aout     = EM28XX_AOUT_MASTER | EM28XX_AOUT_PCM_IN |
+				    EM28XX_AOUT_PCM_LINE,
 		} },
 	},
 	[EM2861_BOARD_PLEXTOR_PX_TV100U] = {

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-18 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-13 20:23 [PATCH] media: em28xx: fix silent audio capture on EM2860/TVP5150 reference design d01
2026-09-13 21:10 ` Mauro Carvalho Chehab
2026-09-18 22:07   ` David Wood
2026-09-18 22:07   ` [PATCH v2] media: em28xx: add StarTech.com SVID2USB23 with working audio capture David Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox