diff options
author | Devin Heitmueller <dheitmueller@kernellabs.com> | 2009-06-09 22:40:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 18:07:46 -0400 |
commit | 1cdc6392b74246be333e2c88b61beedbf9991422 (patch) | |
tree | 2553f023ffb2ef4ea92155b535b092308454347a | |
parent | d7de5d8ff74efd01916b01af875a0e87419a3599 (diff) |
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: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index b7a2fedc3904..c8d7ce8fbd36 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -500,18 +500,21 @@ int em28xx_audio_setup(struct em28xx *dev) | |||
500 | 500 | ||
501 | /* See how this device is configured */ | 501 | /* See how this device is configured */ |
502 | cfg = em28xx_read_reg(dev, EM28XX_R00_CHIPCFG); | 502 | cfg = em28xx_read_reg(dev, EM28XX_R00_CHIPCFG); |
503 | if (cfg < 0) | 503 | em28xx_info("Config register raw data: 0x%02x\n", cfg); |
504 | if (cfg < 0) { | ||
505 | /* Register read error? */ | ||
504 | cfg = EM28XX_CHIPCFG_AC97; /* Be conservative */ | 506 | cfg = EM28XX_CHIPCFG_AC97; /* Be conservative */ |
505 | else | 507 | } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == 0x00) { |
506 | em28xx_info("Config register raw data: 0x%02x\n", cfg); | 508 | /* The device doesn't have vendor audio at all */ |
507 | 509 | dev->has_alsa_audio = 0; | |
508 | if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == | 510 | dev->audio_mode.has_audio = 0; |
509 | EM28XX_CHIPCFG_I2S_3_SAMPRATES) { | 511 | return 0; |
512 | } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == | ||
513 | EM28XX_CHIPCFG_I2S_3_SAMPRATES) { | ||
510 | em28xx_info("I2S Audio (3 sample rates)\n"); | 514 | em28xx_info("I2S Audio (3 sample rates)\n"); |
511 | dev->audio_mode.i2s_3rates = 1; | 515 | dev->audio_mode.i2s_3rates = 1; |
512 | } | 516 | } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == |
513 | if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == | 517 | EM28XX_CHIPCFG_I2S_5_SAMPRATES) { |
514 | EM28XX_CHIPCFG_I2S_5_SAMPRATES) { | ||
515 | em28xx_info("I2S Audio (5 sample rates)\n"); | 518 | em28xx_info("I2S Audio (5 sample rates)\n"); |
516 | dev->audio_mode.i2s_5rates = 1; | 519 | dev->audio_mode.i2s_5rates = 1; |
517 | } | 520 | } |