Commit 430189da authored by Darron Broad's avatar Darron Broad Committed by Mauro Carvalho Chehab

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: default avatarDarron Broad <darron@kewl.org>
Signed-off-by: default avatarSteven Toth <stoth@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 953cafc0
...@@ -767,6 +767,14 @@ void cx88_set_tvaudio(struct cx88_core *core) ...@@ -767,6 +767,14 @@ void cx88_set_tvaudio(struct cx88_core *core)
case WW_FM: case WW_FM:
set_audio_standard_FM(core, radio_deemphasis); set_audio_standard_FM(core, radio_deemphasis);
break; break;
case WW_I2SADC:
set_audio_start(core, 0x01);
/* Slave/Philips/Autobaud */
cx_write(AUD_I2SINPUTCNTL, 0);
/* Switch to "I2S ADC mode" */
cx_write(AUD_I2SCNTL, 0x1);
set_audio_finish(core, EN_I2SIN_ENABLE);
break;
case WW_NONE: case WW_NONE:
default: default:
printk("%s/0: unknown tv audio mode [%d]\n", 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,6 +903,9 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
break; break;
} }
break; break;
case WW_I2SADC:
/* DO NOTHING */
break;
} }
if (UNSET != ctl) { if (UNSET != ctl) {
......
...@@ -426,24 +426,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input) ...@@ -426,24 +426,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
/* if there are audioroutes defined, we have an external /* if there are audioroutes defined, we have an external
ADC to deal with audio */ ADC to deal with audio */
if (INPUT(input).audioroute) { if (INPUT(input).audioroute) {
/* cx2388's C-ADC is connected to the tuner only.
When used with S-Video, that ADC is busy dealing with
chroma, so an external must be used for baseband audio */
if (INPUT(input).type != CX88_VMUX_TELEVISION &&
INPUT(input).type != CX88_RADIO) {
/* "ADC mode" */
cx_write(AUD_I2SCNTL, 0x1);
cx_set(AUD_CTL, EN_I2SIN_ENABLE);
} else {
/* Normal mode */
cx_write(AUD_I2SCNTL, 0x0);
cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
}
/* The wm8775 module has the "2" route hardwired into /* The wm8775 module has the "2" route hardwired into
the initialization. Some boards may use different the initialization. Some boards may use different
routes for different inputs. HVR-1300 surely does */ routes for different inputs. HVR-1300 surely does */
...@@ -454,9 +437,19 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input) ...@@ -454,9 +437,19 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
route.input = INPUT(input).audioroute; route.input = INPUT(input).audioroute;
cx88_call_i2c_clients(core, cx88_call_i2c_clients(core,
VIDIOC_INT_S_AUDIO_ROUTING, &route); VIDIOC_INT_S_AUDIO_ROUTING, &route);
} }
/* cx2388's C-ADC is connected to the tuner only.
When used with S-Video, that ADC is busy dealing with
chroma, so an external must be used for baseband audio */
if (INPUT(input).type != CX88_VMUX_TELEVISION ) {
/* "I2S ADC mode" */
core->tvaudio = WW_I2SADC;
cx88_set_tvaudio(core);
} else {
/* Normal mode */
cx_write(AUD_I2SCNTL, 0x0);
cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
}
} }
return 0; return 0;
...@@ -832,9 +825,24 @@ static int video_open(struct inode *inode, struct file *file) ...@@ -832,9 +825,24 @@ static int video_open(struct inode *inode, struct file *file)
cx_write(MO_GP0_IO, core->board.radio.gpio0); cx_write(MO_GP0_IO, core->board.radio.gpio0);
cx_write(MO_GP1_IO, core->board.radio.gpio1); cx_write(MO_GP1_IO, core->board.radio.gpio1);
cx_write(MO_GP2_IO, core->board.radio.gpio2); cx_write(MO_GP2_IO, core->board.radio.gpio2);
core->tvaudio = WW_FM; if (core->board.radio.audioroute) {
cx88_set_tvaudio(core); if(core->board.audio_chip &&
cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); core->board.audio_chip == V4L2_IDENT_WM8775) {
struct v4l2_routing route;
route.input = core->board.radio.audioroute;
cx88_call_i2c_clients(core,
VIDIOC_INT_S_AUDIO_ROUTING, &route);
}
/* "I2S ADC mode" */
core->tvaudio = WW_I2SADC;
cx88_set_tvaudio(core);
} else {
/* FM Mode */
core->tvaudio = WW_FM;
cx88_set_tvaudio(core);
cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1);
}
cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL); cx88_call_i2c_clients(core,AUDC_SET_RADIO,NULL);
} }
unlock_kernel(); unlock_kernel();
......
...@@ -630,6 +630,7 @@ extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl); ...@@ -630,6 +630,7 @@ extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
#define WW_EIAJ 7 #define WW_EIAJ 7
#define WW_I2SPT 8 #define WW_I2SPT 8
#define WW_FM 9 #define WW_FM 9
#define WW_I2SADC 10
void cx88_set_tvaudio(struct cx88_core *core); void cx88_set_tvaudio(struct cx88_core *core);
void cx88_newstation(struct cx88_core *core); void cx88_newstation(struct cx88_core *core);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment