diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2013-12-22 09:17:46 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-07 05:33:29 -0500 |
commit | 687ff8b0c489e8bb3a4a3da291e830fa7cfafe22 (patch) | |
tree | 19e8e4617297a95aed5a90fe7a15bed12cd0aed9 | |
parent | 2a9ecc17ed9f076ff199a4bf4ebd22b41badb505 (diff) |
[media] em28xx: fix I2S audio sample rate definitions and info output
The audio configuration in chip config register 0x00 and eeprom are always
consistent. But currently the audio configuration #defines for the chip config
register say 0x20 means 3 sample rates and 0x30 5 sample rates, while the eeprom
info output says 0x20 means 1 sample rate and 0x30 3 sample rates.
I've checked the datasheet excerpts I have and it seems that the meaning of
these bits is different for em2820/40 (1 and 3 sample rates) and em2860+
(3 and 5 smaple rates).
I have also checked my Hauppauge WinTV USB 2 (em2840) and the chip/eeprom
audio config 0x20 matches the sample rates reproted by the USB device
descriptor (32k only).
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-core.c | 24 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-i2c.c | 10 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-reg.h | 10 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx.h | 3 |
4 files changed, 28 insertions, 19 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index cef3fd4d441c..b5f49703f7ce 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c | |||
@@ -517,17 +517,19 @@ int em28xx_audio_setup(struct em28xx *dev) | |||
517 | dev->has_alsa_audio = false; | 517 | dev->has_alsa_audio = false; |
518 | dev->audio_mode.has_audio = false; | 518 | dev->audio_mode.has_audio = false; |
519 | return 0; | 519 | return 0; |
520 | } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == | 520 | } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) != EM28XX_CHIPCFG_AC97) { |
521 | EM28XX_CHIPCFG_I2S_3_SAMPRATES) { | 521 | if (dev->chip_id < CHIP_ID_EM2860 && |
522 | em28xx_info("I2S Audio (3 sample rates)\n"); | 522 | (cfg & EM28XX_CHIPCFG_AUDIOMASK) == |
523 | dev->audio_mode.i2s_3rates = 1; | 523 | EM2820_CHIPCFG_I2S_1_SAMPRATE) |
524 | } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) == | 524 | dev->audio_mode.i2s_samplerates = 1; |
525 | EM28XX_CHIPCFG_I2S_5_SAMPRATES) { | 525 | else if (dev->chip_id >= CHIP_ID_EM2860 && |
526 | em28xx_info("I2S Audio (5 sample rates)\n"); | 526 | (cfg & EM28XX_CHIPCFG_AUDIOMASK) == |
527 | dev->audio_mode.i2s_5rates = 1; | 527 | EM2860_CHIPCFG_I2S_5_SAMPRATES) |
528 | } | 528 | dev->audio_mode.i2s_samplerates = 5; |
529 | 529 | else | |
530 | if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) != EM28XX_CHIPCFG_AC97) { | 530 | dev->audio_mode.i2s_samplerates = 3; |
531 | em28xx_info("I2S Audio (%d sample rate(s))\n", | ||
532 | dev->audio_mode.i2s_samplerates); | ||
531 | /* Skip the code that does AC97 vendor detection */ | 533 | /* Skip the code that does AC97 vendor detection */ |
532 | dev->audio_mode.ac97 = EM28XX_NO_AC97; | 534 | dev->audio_mode.ac97 = EM28XX_NO_AC97; |
533 | goto init_audio; | 535 | goto init_audio; |
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index c4ff9739a7ae..f2d5f8a7175b 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
@@ -736,10 +736,16 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
736 | em28xx_info("\tAC97 audio (5 sample rates)\n"); | 736 | em28xx_info("\tAC97 audio (5 sample rates)\n"); |
737 | break; | 737 | break; |
738 | case 2: | 738 | case 2: |
739 | em28xx_info("\tI2S audio, sample rate=32k\n"); | 739 | if (dev->chip_id < CHIP_ID_EM2860) |
740 | em28xx_info("\tI2S audio, sample rate=32k\n"); | ||
741 | else | ||
742 | em28xx_info("\tI2S audio, 3 sample rates\n"); | ||
740 | break; | 743 | break; |
741 | case 3: | 744 | case 3: |
742 | em28xx_info("\tI2S audio, 3 sample rates\n"); | 745 | if (dev->chip_id < CHIP_ID_EM2860) |
746 | em28xx_info("\tI2S audio, 3 sample rates\n"); | ||
747 | else | ||
748 | em28xx_info("\tI2S audio, 5 sample rates\n"); | ||
743 | break; | 749 | break; |
744 | } | 750 | } |
745 | 751 | ||
diff --git a/drivers/media/usb/em28xx/em28xx-reg.h b/drivers/media/usb/em28xx/em28xx-reg.h index b769ceb9026c..311fb349dafa 100644 --- a/drivers/media/usb/em28xx/em28xx-reg.h +++ b/drivers/media/usb/em28xx/em28xx-reg.h | |||
@@ -25,10 +25,12 @@ | |||
25 | #define EM28XX_R00_CHIPCFG 0x00 | 25 | #define EM28XX_R00_CHIPCFG 0x00 |
26 | 26 | ||
27 | /* em28xx Chip Configuration 0x00 */ | 27 | /* em28xx Chip Configuration 0x00 */ |
28 | #define EM28XX_CHIPCFG_VENDOR_AUDIO 0x80 | 28 | #define EM2860_CHIPCFG_VENDOR_AUDIO 0x80 |
29 | #define EM28XX_CHIPCFG_I2S_VOLUME_CAPABLE 0x40 | 29 | #define EM2860_CHIPCFG_I2S_VOLUME_CAPABLE 0x40 |
30 | #define EM28XX_CHIPCFG_I2S_5_SAMPRATES 0x30 | 30 | #define EM2820_CHIPCFG_I2S_3_SAMPRATES 0x30 |
31 | #define EM28XX_CHIPCFG_I2S_3_SAMPRATES 0x20 | 31 | #define EM2860_CHIPCFG_I2S_5_SAMPRATES 0x30 |
32 | #define EM2820_CHIPCFG_I2S_1_SAMPRATE 0x20 | ||
33 | #define EM2860_CHIPCFG_I2S_3_SAMPRATES 0x20 | ||
32 | #define EM28XX_CHIPCFG_AC97 0x10 | 34 | #define EM28XX_CHIPCFG_AC97 0x10 |
33 | #define EM28XX_CHIPCFG_AUDIOMASK 0x30 | 35 | #define EM28XX_CHIPCFG_AUDIOMASK 0x30 |
34 | 36 | ||
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index e0369fb7cdd5..b792f2225abd 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h | |||
@@ -295,8 +295,7 @@ struct em28xx_audio_mode { | |||
295 | 295 | ||
296 | unsigned int has_audio:1; | 296 | unsigned int has_audio:1; |
297 | 297 | ||
298 | unsigned int i2s_3rates:1; | 298 | u8 i2s_samplerates; |
299 | unsigned int i2s_5rates:1; | ||
300 | }; | 299 | }; |
301 | 300 | ||
302 | /* em28xx has two audio inputs: tuner and line in. | 301 | /* em28xx has two audio inputs: tuner and line in. |