[media] b2c2: Add option to skip the first 6 pid filters
authorJemma Denson <jdenson@gmail.com>
Sat, 30 May 2015 18:10:06 +0000 (15:10 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 9 Jun 2015 23:57:56 +0000 (20:57 -0300)
The flexcop bridge chip has two banks of hardware pid filters -
an initial 6, and on some chip revisions an additional bank of 32.

A bug is present on the initial 6 - when changing transponders
one of two PAT packets from the old transponder would be included
in the initial packets from the new transponder. This usually
transpired with userspace programs complaining about services
missing, because they are seeing a PAT that they would not be
expecting. Running in full TS mode does not exhibit this problem,
neither does using just the additional 32.

This patch adds in an option to not use the inital 6 and solely use
just the additional 32, and enables this option for the SkystarS2
card. Other cards can be added as required if they also have
this bug.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/common/b2c2/flexcop-common.h
drivers/media/common/b2c2/flexcop-fe-tuner.c
drivers/media/common/b2c2/flexcop-hw-filter.c

index 437912e49824a5be554ad0bc262e3b057f339b41..2b2460e9e6b4fcd9538653f7adf46c69d79539ae 100644 (file)
@@ -91,6 +91,7 @@ struct flexcop_device {
        int feedcount;
        int pid_filtering;
        int fullts_streaming_state;
+       int skip_6_hw_pid_filter;
 
        /* bus specific callbacks */
        flexcop_ibi_value(*read_ibi_reg) (struct flexcop_device *,
index b4e545956c2d8ab33701e75f369b2123cbaceef0..9c59f4306883a6de666052c613896b850313b8d0 100644 (file)
@@ -652,6 +652,9 @@ static int skystarS2_rev33_attach(struct flexcop_device *fc,
        }
        info("ISL6421 successfully attached.");
 
+       if (fc->has_32_hw_pid_filter)
+               fc->skip_6_hw_pid_filter = 1;
+
        return 1;
 }
 #else
index 77e45475f4c7d1be3d9f2bbf38a87e27a8d5e440..8220257903ef5f7ebb19408488f320e9e62fe664 100644 (file)
@@ -117,6 +117,10 @@ static void flexcop_pid_control(struct flexcop_device *fc,
        deb_ts("setting pid: %5d %04x at index %d '%s'\n",
                        pid, pid, index, onoff ? "on" : "off");
 
+       /* First 6 can be buggy - skip over them if option set */
+       if (fc->skip_6_hw_pid_filter)
+               index += 6;
+
        /* We could use bit magic here to reduce source code size.
         * I decided against it, but to use the real register names */
        switch (index) {
@@ -170,7 +174,10 @@ static int flexcop_toggle_fullts_streaming(struct flexcop_device *fc, int onoff)
 int flexcop_pid_feed_control(struct flexcop_device *fc,
                struct dvb_demux_feed *dvbdmxfeed, int onoff)
 {
-       int max_pid_filter = 6 + fc->has_32_hw_pid_filter*32;
+       int max_pid_filter = 6;
+
+       max_pid_filter -= 6 * fc->skip_6_hw_pid_filter;
+       max_pid_filter += 32 * fc->has_32_hw_pid_filter;
 
        fc->feedcount += onoff ? 1 : -1; /* the number of PIDs/Feed currently requested */
        if (dvbdmxfeed->index >= max_pid_filter)
@@ -217,7 +224,12 @@ void flexcop_hw_filter_init(struct flexcop_device *fc)
 {
        int i;
        flexcop_ibi_value v;
-       for (i = 0; i < 6 + 32*fc->has_32_hw_pid_filter; i++)
+       int max_pid_filter = 6;
+
+       max_pid_filter -= 6 * fc->skip_6_hw_pid_filter;
+       max_pid_filter += 32 * fc->has_32_hw_pid_filter;
+
+       for (i = 0; i < max_pid_filter; i++)
                flexcop_pid_control(fc, i, 0x1fff, 0);
 
        flexcop_pid_group_filter(fc, 0, 0x1fe0);