aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c11
-rw-r--r--drivers/media/video/cx88/cx88-video.c52
-rw-r--r--drivers/media/video/cx88/cx88.h1
3 files changed, 42 insertions, 22 deletions
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 3a1977f41e27..7dd506b987fe 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -767,6 +767,14 @@ void cx88_set_tvaudio(struct cx88_core *core)
767 case WW_FM: 767 case WW_FM:
768 set_audio_standard_FM(core, radio_deemphasis); 768 set_audio_standard_FM(core, radio_deemphasis);
769 break; 769 break;
770 case WW_I2SADC:
771 set_audio_start(core, 0x01);
772 /* Slave/Philips/Autobaud */
773 cx_write(AUD_I2SINPUTCNTL, 0);
774 /* Switch to "I2S ADC mode" */
775 cx_write(AUD_I2SCNTL, 0x1);
776 set_audio_finish(core, EN_I2SIN_ENABLE);
777 break;
770 case WW_NONE: 778 case WW_NONE:
771 default: 779 default:
772 printk("%s/0: unknown tv audio mode [%d]\n", 780 printk("%s/0: unknown tv audio mode [%d]\n",
@@ -895,6 +903,9 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
895 break; 903 break;
896 } 904 }
897 break; 905 break;
906 case WW_I2SADC:
907 /* DO NOTHING */
908 break;
898 } 909 }
899 910
900 if (UNSET != ctl) { 911 if (UNSET != ctl) {
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();
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 100ffc4b5d90..76207c2856b7 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -630,6 +630,7 @@ extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
630#define WW_EIAJ 7 630#define WW_EIAJ 7
631#define WW_I2SPT 8 631#define WW_I2SPT 8
632#define WW_FM 9 632#define WW_FM 9
633#define WW_I2SADC 10
633 634
634void cx88_set_tvaudio(struct cx88_core *core); 635void cx88_set_tvaudio(struct cx88_core *core);
635void cx88_newstation(struct cx88_core *core); 636void cx88_newstation(struct cx88_core *core);