From patchwork Fri May 22 20:28:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jemma Denson X-Patchwork-Id: 6467641 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3C2E2C0020 for ; Fri, 22 May 2015 20:29:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DBF1203EC for ; Fri, 22 May 2015 20:29:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2ED73203E6 for ; Fri, 22 May 2015 20:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757342AbbEVU3B (ORCPT ); Fri, 22 May 2015 16:29:01 -0400 Received: from mail-wg0-f41.google.com ([74.125.82.41]:34796 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757341AbbEVU3A (ORCPT ); Fri, 22 May 2015 16:29:00 -0400 Received: by wghq2 with SMTP id q2so27646477wgh.1 for ; Fri, 22 May 2015 13:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U6zqUQp/hXtG/bRs+PIC3RA9njoR+rx5MNlYe1vry2w=; b=h58V7Y/gPcAya8jCpyQsytWINqcwUytNNm9khyiKve3CgXwamJqsrla+Wv2n/wwuBo LEQCgfy3L92tHRdvqiGvQgBjbMJSoK0fv5D4QQfHB3CPVg7+8G4ZQuTFxPc05A1gdaxJ HVbfBgaRlQ6OZa0EmByemJ3BU7A5boY4UX7OnBs5B4fEEcWcIK2US0Wkvd/IoswRYPuT B+My4TDOGEGm67hmgaakMmmAQjghk6yv9eZhuLvaVfzHiwUUVVQxyeBoRwUHPo2FhCRY dGxMP0DJzfwyifctUGeOBwczRLI7VWfvIdX3p5yxJuN0bmyHe8B6H3sHZYcC3eiXxj6k yA0w== X-Received: by 10.180.24.65 with SMTP id s1mr10536015wif.66.1432326539550; Fri, 22 May 2015 13:28:59 -0700 (PDT) Received: from jemma-pc.denson.org.uk ([84.92.43.36]) by mx.google.com with ESMTPSA id vz2sm1968004wjc.20.2015.05.22.13.28.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 May 2015 13:28:58 -0700 (PDT) From: Jemma Denson To: linux-media@vger.kernel.org Cc: mchehab@osg.samsung.com, patrick.boettcher@posteo.de, Jemma Denson Subject: [PATCH 1/4] b2c2: Add option to skip the first 6 pid filters Date: Fri, 22 May 2015 21:28:25 +0100 Message-Id: <1432326508-6825-2-git-send-email-jdenson@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1432326508-6825-1-git-send-email-jdenson@gmail.com> References: <1432326508-6825-1-git-send-email-jdenson@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/media/common/b2c2/flexcop-common.h | 1 + drivers/media/common/b2c2/flexcop-fe-tuner.c | 3 +++ drivers/media/common/b2c2/flexcop-hw-filter.c | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/b2c2/flexcop-common.h b/drivers/media/common/b2c2/flexcop-common.h index 437912e..2b2460e 100644 --- a/drivers/media/common/b2c2/flexcop-common.h +++ b/drivers/media/common/b2c2/flexcop-common.h @@ -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 *, diff --git a/drivers/media/common/b2c2/flexcop-fe-tuner.c b/drivers/media/common/b2c2/flexcop-fe-tuner.c index 2426062..31ebf1e 100644 --- a/drivers/media/common/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/common/b2c2/flexcop-fe-tuner.c @@ -651,6 +651,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 diff --git a/drivers/media/common/b2c2/flexcop-hw-filter.c b/drivers/media/common/b2c2/flexcop-hw-filter.c index 77e4547..8220257 100644 --- a/drivers/media/common/b2c2/flexcop-hw-filter.c +++ b/drivers/media/common/b2c2/flexcop-hw-filter.c @@ -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);