Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cdc6392 authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (11979): em28xx: don't create audio device if not supported



In cases where the device does not actually provide a USB audio class *or*
vendor audio, do not load the driver that provides vendor audio support (such
as the KWorld 2800d).  Otherwise, the /dev/audio1 device file gets created and
users get confused.

Also, reworks the logic a bit so that we don't try to inspect the register
content if the register read failed entirely.

Signed-off-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d7de5d8f
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -500,17 +500,20 @@ int em28xx_audio_setup(struct em28xx *dev)

	/* See how this device is configured */
	cfg = em28xx_read_reg(dev, EM28XX_R00_CHIPCFG);
	if (cfg < 0)
		cfg = EM28XX_CHIPCFG_AC97; /* Be conservative */
	else
	em28xx_info("Config register raw data: 0x%02x\n", cfg);

	if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) ==
	if (cfg < 0) {
		/* Register read error?  */
		cfg = EM28XX_CHIPCFG_AC97; /* Be conservative */
	} else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == 0x00) {
		/* The device doesn't have vendor audio at all */
		dev->has_alsa_audio = 0;
		dev->audio_mode.has_audio = 0;
		return 0;
	} else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) ==
		   EM28XX_CHIPCFG_I2S_3_SAMPRATES) {
		em28xx_info("I2S Audio (3 sample rates)\n");
		dev->audio_mode.i2s_3rates = 1;
	}
	if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) ==
	} else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) ==
		   EM28XX_CHIPCFG_I2S_5_SAMPRATES) {
		em28xx_info("I2S Audio (5 sample rates)\n");
		dev->audio_mode.i2s_5rates = 1;