From 2474ed444b475614ef795523076be7cc8437ae00 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Mar 2006 12:35:57 -0300 Subject: V4L/DVB (3582): Implement correct msp3400 input/output routing - implement VIDIOC_INT_S_AUDIO_ROUTING for msp3400 and tvaudio - use the new command in bttv, pvrusb2 and em28xx. - remove the now obsolete MSP_SET_MATRIX from msp3400 (yeah!) - remove the obsolete VIDIOC_S_AUDIO from msp3400. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/bt8xx/bttv-driver.c | 52 +++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 9 deletions(-) (limited to 'drivers/media/video/bt8xx') diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index be567ec..80e4a74 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -37,6 +37,7 @@ #include "bttvp.h" #include #include +#include #include @@ -934,11 +935,9 @@ static int audio_mux(struct bttv *btv, int input, int mute) { int gpio_val, signal; - struct v4l2_audio aud_input; struct v4l2_control ctrl; struct i2c_client *c; - memset(&aud_input, 0, sizeof(aud_input)); gpio_inout(bttv_tvcards[btv->c.type].gpiomask, bttv_tvcards[btv->c.type].gpiomask); signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC; @@ -953,7 +952,6 @@ audio_mux(struct bttv *btv, int input, int mute) gpio_val = bttv_tvcards[btv->c.type].gpiomute; else gpio_val = bttv_tvcards[btv->c.type].gpiomux[input]; - aud_input.index = btv->audio; gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpio_val); if (bttv_gpio) @@ -962,15 +960,51 @@ audio_mux(struct bttv *btv, int input, int mute) return 0; ctrl.id = V4L2_CID_AUDIO_MUTE; - /* take automute into account, just btv->mute is not enough */ - ctrl.value = mute; + ctrl.value = btv->mute; bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, &ctrl); c = btv->i2c_msp34xx_client; - if (c) - c->driver->command(c, VIDIOC_S_AUDIO, &aud_input); + if (c) { + struct v4l2_routing route; + + /* Note: the inputs tuner/radio/extern/intern are translated + to msp routings. This assumes common behavior for all msp3400 + based TV cards. When this assumption fails, then the + specific MSP routing must be added to the card table. + For now this is sufficient. */ + switch (input) { + case TVAUDIO_INPUT_RADIO: + route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); + break; + case TVAUDIO_INPUT_EXTERN: + route.input = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); + break; + case TVAUDIO_INPUT_INTERN: + /* Yes, this is the same input as for RADIO. I doubt + if this is ever used. The only board with an INTERN + input is the BTTV_BOARD_AVERMEDIA98. I wonder how + that was tested. My guess is that the whole INTERN + input does not work. */ + route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); + break; + case TVAUDIO_INPUT_TUNER: + default: + route.input = MSP_INPUT_DEFAULT; + break; + } + route.output = MSP_OUTPUT_DEFAULT; + c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); + } c = btv->i2c_tvaudio_client; - if (c) - c->driver->command(c, VIDIOC_S_AUDIO, &aud_input); + if (c) { + struct v4l2_routing route; + + route.input = input; + route.output = 0; + c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); + } return 0; } -- cgit v1.1