]> err.no Git - linux-2.6/commitdiff
V4L/DVB (3584): Implement V4L2_TUNER_MODE_LANG1_LANG2 audio mode
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 18 Mar 2006 20:15:00 +0000 (17:15 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 24 Mar 2006 19:26:58 +0000 (16:26 -0300)
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 <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/ttpci/av7110_v4l.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cx25840/cx25840-core.c
drivers/media/video/cx88/cx88-tvaudio.c
drivers/media/video/msp3400-kthreads.c
drivers/media/video/mxb.c
drivers/media/video/saa7134/saa7134-tvaudio.c
drivers/media/video/tvaudio.c
include/linux/videodev2.h

index 2f23ceab8d446491c73a3d832ec2c824733eb951..603a22e4bfe26a37669e784f1cd2172a02425b22 100644 (file)
@@ -369,6 +369,11 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
                        fm_matrix = 0x3001; // stereo
                        src = 0x0020;
                        break;
+               case V4L2_TUNER_MODE_LANG1_LANG2:
+                       dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n");
+                       fm_matrix = 0x3000; // bilingual
+                       src = 0x0020;
+                       break;
                case V4L2_TUNER_MODE_LANG1:
                        dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n");
                        fm_matrix = 0x3000; // mono
index 80e4a7406ac26a0d2b7a0534e57b8fb04024ea0a..74def9c2395213947e2870aae40fa2247ac11d81 100644 (file)
@@ -1878,7 +1878,8 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
                        bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va);
                        if (t->audmode == V4L2_TUNER_MODE_MONO)
                                va.mode = VIDEO_SOUND_MONO;
-                       else if (t->audmode == V4L2_TUNER_MODE_STEREO)
+                       else if (t->audmode == V4L2_TUNER_MODE_STEREO ||
+                                t->audmode == V4L2_TUNER_MODE_LANG1_LANG2)
                                va.mode = VIDEO_SOUND_STEREO;
                        else if (t->audmode == V4L2_TUNER_MODE_LANG1)
                                va.mode = VIDEO_SOUND_LANG1;
index 7aee37645d63973adaca029627d5aa21444ef1ee..a65b3cc4bf03ff00bd2cf991ccc88abc632adc88 100644 (file)
@@ -810,13 +810,14 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
                           bilingual -> lang1 */
                        cx25840_and_or(client, 0x809, ~0xf, 0x00);
                        break;
+               case V4L2_TUNER_MODE_STEREO:
                case V4L2_TUNER_MODE_LANG1:
                        /* mono      -> mono
                           stereo    -> stereo
                           bilingual -> lang1 */
                        cx25840_and_or(client, 0x809, ~0xf, 0x04);
                        break;
-               case V4L2_TUNER_MODE_STEREO:
+               case V4L2_TUNER_MODE_LANG1_LANG2:
                        /* mono      -> mono
                           stereo    -> stereo
                           bilingual -> lang1/lang2 */
@@ -824,7 +825,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
                        break;
                case V4L2_TUNER_MODE_LANG2:
                        /* mono      -> mono
-                          stereo    ->stereo
+                          stereo    -> stereo
                           bilingual -> lang2 */
                        cx25840_and_or(client, 0x809, ~0xf, 0x01);
                        break;
index da8d97ce0c4b559e22e4705b20613baa7b1bd77c..641a0c5a64907422777039dfd9f34f0d4f321828 100644 (file)
@@ -885,6 +885,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
                        set_audio_standard_BTSC(core, 1, EN_BTSC_FORCE_SAP);
                        break;
                case V4L2_TUNER_MODE_STEREO:
+               case V4L2_TUNER_MODE_LANG1_LANG2:
                        set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_STEREO);
                        break;
                }
@@ -905,6 +906,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
                                                         EN_NICAM_FORCE_MONO2);
                                break;
                        case V4L2_TUNER_MODE_STEREO:
+                       case V4L2_TUNER_MODE_LANG1_LANG2:
                                set_audio_standard_NICAM(core,
                                                         EN_NICAM_FORCE_STEREO);
                                break;
@@ -926,6 +928,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual)
                                                              EN_A2_FORCE_MONO2);
                                        break;
                                case V4L2_TUNER_MODE_STEREO:
+                               case V4L2_TUNER_MODE_LANG1_LANG2:
                                        set_audio_standard_A2(core,
                                                              EN_A2_FORCE_STEREO);
                                        break;
index 1c794c3b9f210efcb3d8702e3deb3dc3d43ad0c0..c3984ea9ca076bc5176788ebb262aa3316f8d55c 100644 (file)
@@ -223,9 +223,9 @@ void msp3400c_set_mode(struct i2c_client *client, int mode)
    nor do they support stereo BTSC. */
 static void msp3400c_set_audmode(struct i2c_client *client)
 {
-       static char *strmode[] = { "mono", "stereo", "lang2", "lang1" };
+       static char *strmode[] = { "mono", "stereo", "lang2", "lang1", "lang1+lang2" };
        struct msp_state *state = i2c_get_clientdata(client);
-       char *modestr = (state->audmode >= 0 && state->audmode < 4) ?
+       char *modestr = (state->audmode >= 0 && state->audmode < 5) ?
                strmode[state->audmode] : "unknown";
        int src = 0;    /* channel source: FM/AM, nicam or SCART */
 
@@ -250,6 +250,7 @@ static void msp3400c_set_audmode(struct i2c_client *client)
                case V4L2_TUNER_MODE_MONO:
                case V4L2_TUNER_MODE_LANG1:
                case V4L2_TUNER_MODE_LANG2:
+               case V4L2_TUNER_MODE_LANG1_LANG2:
                        msp_write_dsp(client, 0x000e, 0x3000);
                        break;
                }
@@ -261,6 +262,7 @@ static void msp3400c_set_audmode(struct i2c_client *client)
                        msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
                        break;
                case V4L2_TUNER_MODE_STEREO:
+               case V4L2_TUNER_MODE_LANG1_LANG2:
                        msp3400c_set_carrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02));
                        break;
                case V4L2_TUNER_MODE_LANG1:
@@ -296,6 +298,7 @@ static void msp3400c_set_audmode(struct i2c_client *client)
        /* switch audio */
        switch (state->audmode) {
        case V4L2_TUNER_MODE_STEREO:
+       case V4L2_TUNER_MODE_LANG1_LANG2:
                src |= 0x0020;
                break;
        case V4L2_TUNER_MODE_MONO:
@@ -835,6 +838,7 @@ static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in)
                matrix = 0x10;
                break;
        case V4L2_TUNER_MODE_STEREO:
+       case V4L2_TUNER_MODE_LANG1_LANG2:
        default:
                source = 1; /* stereo or A|B */
                matrix = 0x20;
index 14ca251787d53e7826cd8693fb87e03dd688f63e..b0aea4002d1124235922f2396553e43f0079092b 100644 (file)
@@ -790,6 +790,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
                                DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n"));
                                break;
                        }
+                       case V4L2_TUNER_MODE_LANG1_LANG2: {
+                               mxb->cur_mode = V4L2_TUNER_MODE_LANG1_LANG2;
+                               byte = TDA9840_SET_BOTH;
+                               DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n"));
+                               break;
+                       }
                        case V4L2_TUNER_MODE_LANG1: {
                                mxb->cur_mode = V4L2_TUNER_MODE_LANG1;
                                byte = TDA9840_SET_LANG1;
index 3043233a8b6e2d7e0f70cb159061e9cead7295db..0db53d192b2a2b1d40f975b63256066982ba1e3e 100644 (file)
@@ -482,12 +482,14 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
                [ V4L2_TUNER_MODE_STEREO ] = "stereo",
                [ V4L2_TUNER_MODE_LANG1  ] = "lang1",
                [ V4L2_TUNER_MODE_LANG2  ] = "lang2",
+               [ V4L2_TUNER_MODE_LANG1_LANG2  ] = "lang1+lang2",
        };
        static u32 fm[] = {
                [ V4L2_TUNER_MODE_MONO   ] = 0x00,  /* ch1  */
                [ V4L2_TUNER_MODE_STEREO ] = 0x80,  /* auto */
                [ V4L2_TUNER_MODE_LANG1  ] = 0x00,  /* ch1  */
                [ V4L2_TUNER_MODE_LANG2  ] = 0x01,  /* ch2  */
+               [ V4L2_TUNER_MODE_LANG1_LANG2 ] = 0x80,  /* auto */
        };
        u32 reg;
 
index 4e6d030d83c062f7b7199a06a58e882719c999f6..356bff455ad18109080a132937fb7e3330f07289 100644 (file)
@@ -1733,6 +1733,7 @@ static int chip_command(struct i2c_client *client,
                        mode = VIDEO_SOUND_MONO;
                        break;
                case V4L2_TUNER_MODE_STEREO:
+               case V4L2_TUNER_MODE_LANG1_LANG2:
                        mode = VIDEO_SOUND_STEREO;
                        break;
                case V4L2_TUNER_MODE_LANG1:
index 724cfbf54b8afaf34edaae5593e4d6e5091107a6..2275bfec5b687e3c7545fc848346cc14a16d2ccc 100644 (file)
@@ -883,6 +883,7 @@ struct v4l2_modulator
 #define V4L2_TUNER_MODE_LANG2          0x0002
 #define V4L2_TUNER_MODE_SAP            0x0002
 #define V4L2_TUNER_MODE_LANG1          0x0003
+#define V4L2_TUNER_MODE_LANG1_LANG2    0x0004
 
 struct v4l2_frequency
 {