V4L/DVB (5093): Pvrusb2: Emit VIDIOC_S_TUNER correctly
authorMike Isely <isely@pobox.com>
Sat, 20 Jan 2007 04:56:04 +0000 (01:56 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 21 Feb 2007 15:34:41 +0000 (13:34 -0200)
Audio mode changes are not private to the audio chip - other I2C
modules need to see this as well.  And since the command in question
is VIDIOC_S_TUNER which is a standard v4l2 command, we really should
be broadcasting it out.  This change sets up a broadcast pathway for
VIDIOC_S_TUNER and also eliminates the now redundant code from the
audio chip handler.
This fix enables stereo reception for the FM radio

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/pvrusb2/pvrusb2-audio.c
drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.h

index a45ede0a8cf11178427abeecf70daaef1fbac120..379645e481c6ff830cab9e7dcaec13758c8131ec 100644 (file)
@@ -43,13 +43,6 @@ static void set_stereo(struct pvr2_msp3400_handler *ctxt)
 
        pvr2_trace(PVR2_TRACE_CHIPS,"i2c msp3400 v4l2 set_stereo");
 
-       if (hdw->input_val == PVR2_CVAL_INPUT_TV) {
-               struct v4l2_tuner vt;
-               memset(&vt,0,sizeof(vt));
-               vt.audmode = hdw->audiomode_val;
-               pvr2_i2c_client_cmd(ctxt->client,VIDIOC_S_TUNER,&vt);
-       }
-
        route.input = MSP_INPUT_DEFAULT;
        route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
        switch (hdw->input_val) {
@@ -77,8 +70,7 @@ static void set_stereo(struct pvr2_msp3400_handler *ctxt)
 static int check_stereo(struct pvr2_msp3400_handler *ctxt)
 {
        struct pvr2_hdw *hdw = ctxt->hdw;
-       return (hdw->input_dirty ||
-               hdw->audiomode_dirty);
+       return hdw->input_dirty;
 }
 
 
index 16fa075a1eecd230dac4aa3c9aa4b11c203099c1..49773764383b73eac164ba6e768f34405aa0d20f 100644 (file)
 #define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)
 
 #define OP_STANDARD 0
-#define OP_BCSH 1
-#define OP_VOLUME 2
-#define OP_FREQ 3
-#define OP_AUDIORATE 4
-#define OP_SIZE 5
-#define OP_LOG 6
+#define OP_AUDIOMODE 1
+#define OP_BCSH 2
+#define OP_VOLUME 3
+#define OP_FREQ 4
+#define OP_AUDIORATE 5
+#define OP_SIZE 6
+#define OP_LOG 7
 
 static const struct pvr2_i2c_op * const ops[] = {
        [OP_STANDARD] = &pvr2_i2c_op_v4l2_standard,
+       [OP_AUDIOMODE] = &pvr2_i2c_op_v4l2_audiomode,
        [OP_BCSH] = &pvr2_i2c_op_v4l2_bcsh,
        [OP_VOLUME] = &pvr2_i2c_op_v4l2_volume,
        [OP_FREQ] = &pvr2_i2c_op_v4l2_frequency,
@@ -54,6 +56,7 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
        int id;
        id = cp->client->driver->id;
        cp->ctl_mask = ((1 << OP_STANDARD) |
+                       (1 << OP_AUDIOMODE) |
                        (1 << OP_BCSH) |
                        (1 << OP_VOLUME) |
                        (1 << OP_FREQ) |
index b1f6809625e872ebcd69a3be565f18d756655b76..c650e02ccd005d13fe4f8c9debc73d07fbc374f3 100644 (file)
@@ -140,6 +140,29 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_volume = {
 };
 
 
+static void set_audiomode(struct pvr2_hdw *hdw)
+{
+       struct v4l2_tuner vt;
+       memset(&vt,0,sizeof(vt));
+       vt.audmode = hdw->audiomode_val;
+       pvr2_i2c_core_cmd(hdw,VIDIOC_S_TUNER,&vt);
+}
+
+
+static int check_audiomode(struct pvr2_hdw *hdw)
+{
+       return (hdw->input_dirty ||
+               hdw->audiomode_dirty);
+}
+
+
+const struct pvr2_i2c_op pvr2_i2c_op_v4l2_audiomode = {
+       .check = check_audiomode,
+       .update = set_audiomode,
+       .name = "v4l2_audiomode",
+};
+
+
 static void set_frequency(struct pvr2_hdw *hdw)
 {
        unsigned long fv;
index 6a9bb46d0654598d06f85908e7139eba619da503..c838df6167f96ad4f715d95fd2e8018a9d4d5447 100644 (file)
@@ -31,6 +31,7 @@ extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_bcsh;
 extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_volume;
 extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_frequency;
 extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_size;
+extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_audiomode;
 extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_log;
 
 void pvr2_v4l2_cmd_stream(struct pvr2_i2c_client *,int);