aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
authorDarron Broad <darron@kewl.org>2008-10-15 13:18:42 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-17 16:29:14 -0400
commit430189da042f8cc3305b8fbbce18ea103501fb90 (patch)
treea1d42b5189b511fcd7a1788e7ac189f4368a83d5 /drivers/media/video/cx88/cx88-video.c
parent953cafc04e9ef9d2fd9f8afb3b3bbde1f8bb9317 (diff)
V4L/DVB (9269): cx88: add I2S-ADC tvaudio method
This adds I2S-ADC tvaudio mode as a formal method of audio delivery. This fixes one bug and adds fm audio via I2S-ADC on cards that support it. The bug occured before when I2S-ADC mode was initiated on composite/s-video open but was then reset within 500ms by the audio thread which used any previous audio tuning details. Signed-off-by: Darron Broad <darron@kewl.org> Signed-off-by: Steven Toth <stoth@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r--drivers/media/video/cx88/cx88-video.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index be45955dff68..3904b73f52ee 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -426,24 +426,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
426 426
427 /* if there are audioroutes defined, we have an external 427 /* if there are audioroutes defined, we have an external
428 ADC to deal with audio */ 428 ADC to deal with audio */
429
430 if (INPUT(input).audioroute) { 429 if (INPUT(input).audioroute) {
431
432 /* cx2388's C-ADC is connected to the tuner only.
433 When used with S-Video, that ADC is busy dealing with
434 chroma, so an external must be used for baseband audio */
435
436 if (INPUT(input).type != CX88_VMUX_TELEVISION &&
437 INPUT(input).type != CX88_RADIO) {
438 /* "ADC mode" */
439 cx_write(AUD_I2SCNTL, 0x1);
440 cx_set(AUD_CTL, EN_I2SIN_ENABLE);
441 } else {
442 /* Normal mode */
443 cx_write(AUD_I2SCNTL, 0x0);
444 cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
445 }
446
447 /* The wm8775 module has the "2" route hardwired into 430 /* The wm8775 module has the "2" route hardwired into
448 the initialization. Some boards may use different 431 the initialization. Some boards may use different
449 routes for different inputs. HVR-1300 surely does */ 432 routes for different inputs. HVR-1300 surely does */
@@ -454,9 +437,19 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
454 route.input = INPUT(input).audioroute; 437 route.input = INPUT(input).audioroute;
455 cx88_call_i2c_clients(core, 438 cx88_call_i2c_clients(core,
456 VIDIOC_INT_S_AUDIO_ROUTING, &route); 439 VIDIOC_INT_S_AUDIO_ROUTING, &route);
457
458 } 440 }
459 441 /* cx2388's C-ADC is connected to the tuner only.
442 When used with S-Video, that ADC is busy dealing with
443 chroma, so an external must be used for baseband audio */
444 if (INPUT(input).type != CX88_VMUX_TELEVISION ) {
445 /* "I2S ADC mode" */
446 core->tvaudio = WW_I2SADC;
447 cx88_set_tvaudio(core);
448 } else {
449 /* Normal mode */
450 cx_write(AUD_I2SCNTL, 0x0);
451 cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
452 }
460 } 453 }
461 454
462 return 0; 455 return 0;
@@ -832,9 +825,24 @@ static int video_open(struct inode *inode, struct file *file)
832 cx_write(MO_GP0_IO, core->board.radio.gpio0); 825 cx_write(MO_GP0_IO, core->board.radio.gpio0);
833 cx_write(MO_GP1_IO, core->board.radio.gpio1); 826 cx_write(MO_GP1_IO, core->board.radio.gpio1);
834 cx_write(MO_GP2_IO, core->board.radio.gpio2); 827 cx_write(MO_GP2_IO, core->board.radio.gpio2);
835 core->tvaudio = WW_FM; 828 if (core->board.radio.audioroute) {
836 cx88_set_tvaudio(core); 829 if(core->board.audio_chip &&
837 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); 830 core->board.audio_chip == V4L2_IDENT_WM8775) {
831 struct v4l2_routing route;
832
833 route.input = core->board.radio.audioroute;
834 cx88_call_i2c_clients(core,
835 VIDIOC_INT_S_AUDIO_ROUTING, &route);
836 }
837 /* "I2S ADC mode" */
838 core->tvaudio = WW_I2SADC;
839 cx88_set_tvaudio(core);
840 } else {
841 /* FM Mode */
842 core->tvaudio = WW_FM;
843 cx88_set_tvaudio(core);
844 cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
845 }
838 cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL); 846 cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL);
839 } 847 }
840 unlock_kernel(); 848 unlock_kernel();