From 22b9fe2c0f517b6adfe0c517f61d8c3605973cbc Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 18 Mar 2006 21:15:00 +0100 Subject: Implement V4L2_TUNER_MODE_LANG1_LANG2 audio mode From: Hans Verkuil Add a new audio mode V4L2_TUNER_MODE_LANG1_LANG2 (used by VIDIOC_G/S_TUNER). This mode allows the user to select both languages of a bilingual transmission, one language on the left, one on the right audio channel. If there is no bilingual transmission, or it is not supported, then this mode should act like V4L2_TUNER_MODE_STEREO. This mode is introduced for PVR-like drivers where it is useful to be able to record both languages of a bilingual broadcast. Signed-off-by: Hans Verkuil --- linux/drivers/media/video/pvrusb2/pvrusb2-audio.c | 2 ++ linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 1 + linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h | 3 ++- linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 6 ++++++ 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media/video/pvrusb2') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c index 7e2fab330..ac798f4e0 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c @@ -66,6 +66,8 @@ static int xlat_audiomode_to_v4l2(int id) return V4L2_TUNER_MODE_LANG1; case PVR2_CVAL_AUDIOMODE_LANG2: return V4L2_TUNER_MODE_LANG2; + case PVR2_CVAL_AUDIOMODE_LANG1_LANG2: + return V4L2_TUNER_MODE_LANG1_LANG2; } return V4L2_TUNER_MODE_STEREO; } diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index b87651e5a..539456b44 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -158,6 +158,7 @@ static const char *control_values_audiomode[] = { [PVR2_CVAL_AUDIOMODE_SAP] = "SAP", [PVR2_CVAL_AUDIOMODE_LANG1] = "Lang1", [PVR2_CVAL_AUDIOMODE_LANG2] = "Lang2", + [PVR2_CVAL_AUDIOMODE_LANG1_LANG2] = "Lang1+Lang2", }; diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 667c95a27..085afe566 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -119,8 +119,9 @@ #define PVR2_CVAL_AUDIOMODE_SAP 2 #define PVR2_CVAL_AUDIOMODE_LANG1 3 #define PVR2_CVAL_AUDIOMODE_LANG2 4 +#define PVR2_CVAL_AUDIOMODE_LANG1_LANG2 5 #define PVR2_CVAL_AUDIOMODE_MIN PVR2_CVAL_AUDIOMODE_MONO -#define PVR2_CVAL_AUDIOMODE_MAX PVR2_CVAL_AUDIOMODE_LANG2 +#define PVR2_CVAL_AUDIOMODE_MAX PVR2_CVAL_AUDIOMODE_LANG1_LANG2 /* Values that pvr2_hdw_get_signal_status() returns */ #define PVR2_SIGNAL_OK 0x0001 diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 017d30ad0..e208c4862 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -593,6 +593,9 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, case PVR2_CVAL_AUDIOMODE_LANG2: vt->audmode = V4L2_TUNER_MODE_LANG2; break; + case PVR2_CVAL_AUDIOMODE_LANG1_LANG2: + vt->audmode = V4L2_TUNER_MODE_LANG1_LANG2; + break; case PVR2_CVAL_AUDIOMODE_SAP: vt->audmode = V4L2_TUNER_MODE_SAP; break; @@ -620,6 +623,9 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, case V4L2_TUNER_MODE_LANG1: val = PVR2_CVAL_AUDIOMODE_LANG1; break; + case V4L2_TUNER_MODE_LANG1_LANG2: + val = PVR2_CVAL_AUDIOMODE_LANG1_LANG2; + break; case V4L2_TUNER_MODE_SAP: // Also LANG2 val = PVR2_CVAL_AUDIOMODE_SAP; break; -- cgit v1.2.3 From 4d93017b78b84f0e38f348ba71a4e0206d753c09 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Mar 2006 01:31:00 +0100 Subject: Cleanup audio input handling From: Hans Verkuil Cleanup audio input handling in bttv and tvaudio: - inputs were specified that were never used - mute was handled as a special input which led to confusing code - confusing naming made it difficult to see if the setting was for i2c or gpio. The old audiochip.h input names moved to tvaudio.h. Currently this is used both by tvaudio and msp3400 until the msp3400 implements the new msp3400-specific inputs. Detect in bttv the tvaudio and msp3400 i2c clients and use these client pointers to set the inputs directly instead of broadcasting the command. Removed AUDC_SET_INPUT. Now replaced by VIDIOC_S_AUDIO. This will be replaced again later by the new ROUTING commands. Removed VIDIOC_G_AUDIO implementations in i2c drivers: this command is a user level command and not to be used internally. It wasn't called at all anyway. Signed-off-by: Hans Verkuil --- linux/drivers/media/video/pvrusb2/pvrusb2-audio.c | 15 ++++++++------- linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c | 1 - 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'linux/drivers/media/video/pvrusb2') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c index 7e2fab330..0304ee1e5 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c @@ -26,7 +26,7 @@ #include "pvrusb2-debug.h" #include "msp3400.h" #include -#include +#include #include struct pvr2_msp3400_handler { @@ -75,8 +75,8 @@ static int xlat_audiomode_to_v4l2(int id) static void set_stereo(struct pvr2_msp3400_handler *ctxt) { struct pvr2_hdw *hdw = ctxt->hdw; - unsigned short sarg = 0; struct msp_matrix mspm; + struct v4l2_audio aud_input; pvr2_trace(PVR2_TRACE_CHIPS,"i2c msp3400 set_stereo"); @@ -88,22 +88,23 @@ static void set_stereo(struct pvr2_msp3400_handler *ctxt) pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_TUNER,&vt); } - sarg = AUDIO_TUNER; + memset(&aud_input,0,sizeof(aud_input)); + aud_input.index = TVAUDIO_INPUT_TUNER; switch (hdw->controls[PVR2_CID_INPUT].value) { case PVR2_CVAL_INPUT_TV: - sarg = AUDIO_TUNER; + aud_input.index = TVAUDIO_INPUT_TUNER; break; case PVR2_CVAL_INPUT_RADIO: /* Assume that msp34xx also handle FM decoding, in which case we're still using the tuner. */ - sarg = AUDIO_TUNER; + aud_input.index = TVAUDIO_INPUT_TUNER; break; case PVR2_CVAL_INPUT_SVIDEO: case PVR2_CVAL_INPUT_COMPOSITE: - sarg = AUDIO_EXTERN; + aud_input.index = TVAUDIO_INPUT_EXTERN; break; } - pvr2_i2c_client_cmd(ctxt->client,AUDC_SET_INPUT,&sarg); + pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_AUDIO,&aud_input); /* The above should have been enough to do the job, however msp3400.ko does an incomplete job of handling the scart diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c index 69864782b..7d137a25f 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c @@ -24,7 +24,6 @@ #include "pvrusb2-hdw-internal.h" #include "pvrusb2-debug.h" #include -#include static void set_standard(struct pvr2_hdw *hdw) -- cgit v1.2.3 From a54e9c36217d11493c90e0dbdef2f48625525702 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Mar 2006 12:45:38 +0100 Subject: Add new media/msp3400.h header containing the routing macros From: Hans Verkuil Moved msp3400.h to msp3400-driver.h. Created media/msp3400.h with the new routing defines and lots of comments. Signed-off-by: Hans Verkuil --- linux/drivers/media/video/pvrusb2/pvrusb2-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media/video/pvrusb2') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c index 0304ee1e5..0501851dc 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c @@ -24,8 +24,8 @@ #include "pvrusb2-audio.h" #include "pvrusb2-hdw-internal.h" #include "pvrusb2-debug.h" -#include "msp3400.h" #include +#include "msp3400-driver.h" #include #include -- cgit v1.2.3 From fde3e3b6816368fa44ece4a962fd3ef5ed664398 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 19 Mar 2006 16:35:57 +0100 Subject: Implement correct msp3400 input/output routing From: Hans Verkuil - 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 --- linux/drivers/media/video/pvrusb2/pvrusb2-audio.c | 46 ++++++----------------- 1 file changed, 12 insertions(+), 34 deletions(-) (limited to 'linux/drivers/media/video/pvrusb2') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c index 0501851dc..79e1bede4 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-audio.c @@ -25,8 +25,7 @@ #include "pvrusb2-hdw-internal.h" #include "pvrusb2-debug.h" #include -#include "msp3400-driver.h" -#include +#include #include struct pvr2_msp3400_handler { @@ -75,8 +74,7 @@ static int xlat_audiomode_to_v4l2(int id) static void set_stereo(struct pvr2_msp3400_handler *ctxt) { struct pvr2_hdw *hdw = ctxt->hdw; - struct msp_matrix mspm; - struct v4l2_audio aud_input; + struct v4l2_routing route; pvr2_trace(PVR2_TRACE_CHIPS,"i2c msp3400 set_stereo"); @@ -88,47 +86,27 @@ static void set_stereo(struct pvr2_msp3400_handler *ctxt) pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_TUNER,&vt); } - memset(&aud_input,0,sizeof(aud_input)); - aud_input.index = TVAUDIO_INPUT_TUNER; + route.input = MSP_INPUT_DEFAULT; + route.output = MSP_OUTPUT(MSP_OUT_SCART1_DA); switch (hdw->controls[PVR2_CID_INPUT].value) { case PVR2_CVAL_INPUT_TV: - aud_input.index = TVAUDIO_INPUT_TUNER; break; case PVR2_CVAL_INPUT_RADIO: /* Assume that msp34xx also handle FM decoding, in which case we're still using the tuner. */ - aud_input.index = TVAUDIO_INPUT_TUNER; + /* HV: actually it is more likely to be the SCART2 input if + the ivtv experience is any indication. */ + route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); break; case PVR2_CVAL_INPUT_SVIDEO: case PVR2_CVAL_INPUT_COMPOSITE: - aud_input.index = TVAUDIO_INPUT_EXTERN; + /* SCART 1 input */ + route.input = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); break; } - pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_AUDIO,&aud_input); - - /* The above should have been enough to do the job, however - msp3400.ko does an incomplete job of handling the scart - routing. Really. It doesn't even bother to initialize the - SC1 output at all. So we have to help it here... - Unfortunately this also means that we have include - msp3400.c's header file and it currently isn't in a public - place. Damnit! */ - - mspm.input = SCART_IN1_DA; - switch (hdw->controls[PVR2_CID_INPUT].value) { - case PVR2_CVAL_INPUT_SVIDEO: - case PVR2_CVAL_INPUT_COMPOSITE: - /* Bypass the DSP and just use IN1. In theory we - should be able to permanent just use IN1_DA, but to - do that msp3400.ko should be adjusting the DSP - input SCART routing correctly when doing video in. - Unfortunately that appears not to be the case. I - really hate that module. */ - mspm.input = SCART_IN1; - break; - } - mspm.output = 1; - pvr2_i2c_client_cmd(ctxt->client,MSP_SET_MATRIX,&mspm); + pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_S_AUDIO_ROUTING,&route); } -- cgit v1.2.3