All of lore.kernel.org
 help / color / mirror / Atom feed
From: d01 <d01.devel@gmail.com>
To: mchehab@kernel.org
Cc: linux-media@vger.kernel.org
Subject: [PATCH] media: em28xx: fix silent audio capture on EM2860/TVP5150 reference design
Date: Sun, 13 Sep 2026 16:23:12 -0400	[thread overview]
Message-ID: <20260913202312.1511971-1-d01.devel@gmail.com> (raw)

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] = {

             reply	other threads:[~2026-09-13 20:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13 20:23 d01 [this message]
2026-09-13 21:10 ` [PATCH] media: em28xx: fix silent audio capture on EM2860/TVP5150 reference design Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260913202312.1511971-1-d01.devel@gmail.com \
    --to=d01.devel@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.