diff options
author | Devin Heitmueller <devin.heitmueller@gmail.com> | 2008-11-19 08:22:28 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-29 17:53:35 -0200 |
commit | 5c2231c84304563fd5d28e8bbb72e09e882a8e32 (patch) | |
tree | 7cb20b4e39b1c9f4c41141a33e485e06651117a6 /drivers/media/video/em28xx/em28xx-video.c | |
parent | 67c96f67060abfe595974a77aeb4ce7815893648 (diff) | |
download | op-kernel-dev-5c2231c84304563fd5d28e8bbb72e09e882a8e32.zip op-kernel-dev-5c2231c84304563fd5d28e8bbb72e09e882a8e32.tar.gz |
V4L/DVB (9648): em28xx: get audio config from em28xx register
Make use of the em28xx chip configuration register to determine whether
we have AC97 audio, I2S audio, or no audio support at all.
Thanks for Ray Lu from Empia for providing the em2860/em2880 datasheet.
Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 154a99c..1e26061 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1933,16 +1933,49 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, int em28xx_supports_audio_extension(struct em28xx *dev) { + int rc; + /* The chip dictates whether we support the Empia analog audio extension */ switch (dev->chip_id) { case CHIP_ID_EM2874: - /* Either a digital-only device or provides AC97 audio */ + /* Digital only device - no analog support */ + dev->audio_mode = EM28XX_NO_AUDIO; return 0; + case CHIP_ID_EM2860: case CHIP_ID_EM2883: default: + /* See how this device is configured */ + rc = em28xx_read_reg(dev, EM28XX_R00_CHIPCFG); + if (rc & EM28XX_CHIPCFG_VENDOR_AUDIO) { + switch(rc & EM28XX_CHIPCFG_AUDIOMASK) { + case EM28XX_CHIPCFG_AC97: + em28xx_info("AC97 audio (5 sample rates)\n"); + dev->audio_mode = EM28XX_AC97; + break; + case EM28XX_CHIPCFG_I2S_3_SAMPRATES: + em28xx_info("I2S Audio (3 sample rates)\n"); + dev->audio_mode = EM28XX_I2S_3_SAMPLE_RATES; + break; + case EM28XX_CHIPCFG_I2S_5_SAMPRATES: + em28xx_info("I2S Audio (5 sample rates)\n"); + dev->audio_mode = EM28XX_I2S_5_SAMPLE_RATES; + break; + default: + em28xx_info("No audio support detected\n"); + dev->audio_mode = EM28XX_NO_AUDIO; + return 0; + } + } else { + em28xx_info("USB Audio class device\n"); + return 0; + } + /* The em28xx audio extension needs to be loaded */ return 1; } + + /* We should never reach this point */ + return 0; } static int register_analog_devices(struct em28xx *dev) |