Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / media / video / pvrusb2 / pvrusb2-hdw.c
index 0c745b1..cbc3887 100644 (file)
@@ -85,8 +85,8 @@ MODULE_PARM_DESC(video_std,"specify initial video standard");
 module_param_array(tolerance,    int, NULL, 0444);
 MODULE_PARM_DESC(tolerance,"specify stream error tolerance");
 
-/* US Broadcast channel 7 (175.25 MHz) */
-static int default_tv_freq    = 175250000L;
+/* US Broadcast channel 3 (61.25 MHz), to help with testing */
+static int default_tv_freq    = 61250000L;
 /* 104.3 MHz, a usable FM station for my area */
 static int default_radio_freq = 104300000L;
 
@@ -1987,6 +1987,34 @@ static unsigned int pvr2_copy_i2c_addr_list(
 }
 
 
+static void pvr2_hdw_cx25840_vbi_hack(struct pvr2_hdw *hdw)
+{
+       /*
+         Mike Isely <isely@pobox.com> 19-Nov-2006 - This bit of nuttiness
+         for cx25840 causes that module to correctly set up its video
+         scaling.  This is really a problem in the cx25840 module itself,
+         but we work around it here.  The problem has not been seen in
+         ivtv because there VBI is supported and set up.  We don't do VBI
+         here (at least not yet) and thus we never attempted to even set
+         it up.
+       */
+       struct v4l2_format fmt;
+       if (hdw->decoder_client_id != PVR2_CLIENT_ID_CX25840) {
+               /* We're not using a cx25840 so don't enable the hack */
+               return;
+       }
+
+       pvr2_trace(PVR2_TRACE_INIT,
+                  "Module ID %u:"
+                  " Executing cx25840 VBI hack",
+                  hdw->decoder_client_id);
+       memset(&fmt, 0, sizeof(fmt));
+       fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
+       v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
+                            video, s_fmt, &fmt);
+}
+
+
 static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
                                const struct pvr2_device_client_desc *cd)
 {
@@ -2078,30 +2106,6 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
        /* client-specific setup... */
        switch (mid) {
        case PVR2_CLIENT_ID_CX25840:
-               hdw->decoder_client_id = mid;
-               {
-                       /*
-                         Mike Isely <isely@pobox.com> 19-Nov-2006 - This
-                         bit of nuttiness for cx25840 causes that module
-                         to correctly set up its video scaling.  This is
-                         really a problem in the cx25840 module itself,
-                         but we work around it here.  The problem has not
-                         been seen in ivtv because there VBI is supported
-                         and set up.  We don't do VBI here (at least not
-                         yet) and thus we never attempted to even set it
-                         up.
-                       */
-                       struct v4l2_format fmt;
-                       pvr2_trace(PVR2_TRACE_INIT,
-                                  "Module ID %u:"
-                                  " Executing cx25840 VBI hack",
-                                  mid);
-                       memset(&fmt, 0, sizeof(fmt));
-                       fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
-                       v4l2_device_call_all(&hdw->v4l2_dev, mid,
-                                            video, s_fmt, &fmt);
-               }
-               break;
        case PVR2_CLIENT_ID_SAA7115:
                hdw->decoder_client_id = mid;
                break;
@@ -2202,6 +2206,8 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
                cptr->info->set_value(cptr,~0,cptr->info->default_value);
        }
 
+       pvr2_hdw_cx25840_vbi_hack(hdw);
+
        /* Set up special default values for the television and radio
           frequencies here.  It's not really important what these defaults
           are, but I set them to something usable in the Chicago area just
@@ -2954,6 +2960,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
                        vs = hdw->std_mask_cur;
                        v4l2_device_call_all(&hdw->v4l2_dev, 0,
                                             core, s_std, vs);
+                       pvr2_hdw_cx25840_vbi_hack(hdw);
                }
                hdw->tuner_signal_stale = !0;
                hdw->cropcap_stale = !0;
@@ -4076,6 +4083,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
        if (hdw->decoder_client_id) {
                v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
                                     core, reset, 0);
+               pvr2_hdw_cx25840_vbi_hack(hdw);
                return 0;
        }
        pvr2_trace(PVR2_TRACE_INIT,