From patchwork Sun May 22 16:03:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 9130975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DAF8D60761 for ; Sun, 22 May 2016 16:03:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 943D92819E for ; Sun, 22 May 2016 16:03:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8906B281AC; Sun, 22 May 2016 16:03:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC59E281A2 for ; Sun, 22 May 2016 16:03:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752572AbcEVQDj (ORCPT ); Sun, 22 May 2016 12:03:39 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36840 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbcEVQDg (ORCPT ); Sun, 22 May 2016 12:03:36 -0400 Received: by mail-wm0-f68.google.com with SMTP id q62so8819197wmg.3 for ; Sun, 22 May 2016 09:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=0rjrsSxGQBK1TfHE4QbtCmcARjD1sNXMdkpnPsMrqMw=; b=dCWAOLP0cRrYR0s+3o1KmZxtNrRszjgeVFw/PLJV1Ak5PbXmNuQDCD1C4s59bD8kr9 GXwl8V/6LKk4u+XNgAX3ibPxOr2Z8yu3cmZiVR+eRwgP2guak9ubf/SZDa0BOEYrangW FjBuOTXcm7bThU5nD3iwxHL1NImmrawoux+kvmvwhodzE56UJWE5oZgNPJon53YerQ7k DTMNghvJiC4BGDDS9XcGgotcrUUdSW8vNqQ9M6VsIaijnGeqhujpBJ0FYdS38Lr9/TCZ ZSZ05VmxJgn2rVhkOCB6Hb8X6TdmiBowfOPZ7PiKUTXa6OdgwceLv7yDHsCKtTPbQCZr pfSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0rjrsSxGQBK1TfHE4QbtCmcARjD1sNXMdkpnPsMrqMw=; b=Dutafb1iAsv5NAsAVruVOsxku/aNLFtEAh5VAhkOcAXaLVVWW8+RfavDMqeNYOgSP0 UUYW2Iq3V6s65rpttpXFABLIdZmaEHB5G1BwtGe/Jw4CgeQy3EDXfLaVpkUX8HTzyXbX aFB30dbtZwAvzWXS5ysrnek+v2+FZzoDUQgU5q327GYwajdjGXRiBTqp8Ymzyn7qyPK/ w6lPqOue88ayHzHKorY+muUsAaqkqBndAev+9bddCvFoBkbV+I3yzo6uXPW2IpmVsJAF 3OVd1/2FrBfMUfOOzPX37SocKXcaU9cc2A48nOSpEf8gJ4nnc5l2gnENqNeAjbG5nJsv bW+A== X-Gm-Message-State: AOPr4FXUAaELhzdSVY43yXlL31cCJidK6sr4cM07jDhIwJ/+7xXCqA9feUFQ1hnSdmRsew== X-Received: by 10.194.120.69 with SMTP id la5mr13317965wjb.152.1463933015141; Sun, 22 May 2016 09:03:35 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD3CD1B04DDFC3D73ABD3822E.dip0.t-ipconnect.de. [2003:dc:d3cd:1b04:ddfc:3d73:abd3:822e]) by smtp.googlemail.com with ESMTPSA id u64sm1682621wmd.8.2016.05.22.09.03.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 May 2016 09:03:33 -0700 (PDT) From: Martin Blumenstingl To: linux-media@vger.kernel.org Cc: benjamin@southpole.se, Martin Blumenstingl Subject: [PATCH v2] [media] rtl2832: add support for slave ts pid filter Date: Sun, 22 May 2016 18:03:07 +0200 Message-Id: <1463932987-10526-1-git-send-email-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.8.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The rtl2832 demod has 2 sets of PID filters. This patch enables the filter support when using a slave demod. Signed-off-by: Benjamin Larsson Signed-off-by: Martin Blumenstingl --- This patch was originally written by Benjamin Larsson, all I did was rebasing the patch and to extend the dev_dbg statements with the slave_ts information. This also supersedes the following patch: https://patchwork.linuxtv.org/patch/34358/ drivers/media/dvb-frontends/rtl2832.c | 26 ++++++++++++++++++++------ drivers/media/dvb-frontends/rtl2832_priv.h | 1 + 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 7c96f76..ba67fb4 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -409,6 +409,7 @@ static int rtl2832_init(struct dvb_frontend *fe) c->post_bit_count.len = 1; c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; dev->sleeping = false; + dev->slave_ts = false; return 0; err: @@ -1103,6 +1104,8 @@ static int rtl2832_slave_ts_ctrl(struct i2c_client *client, bool enable) goto err; } + dev->slave_ts = enable; + return 0; err: dev_dbg(&client->dev, "failed=%d\n", ret); @@ -1116,7 +1119,7 @@ static int rtl2832_pid_filter_ctrl(struct dvb_frontend *fe, int onoff) int ret; u8 u8tmp; - dev_dbg(&client->dev, "onoff=%d\n", onoff); + dev_dbg(&client->dev, "onoff=%d, slave_ts=%d\n", onoff, dev->slave_ts); /* enable / disable PID filter */ if (onoff) @@ -1124,7 +1127,10 @@ static int rtl2832_pid_filter_ctrl(struct dvb_frontend *fe, int onoff) else u8tmp = 0x00; - ret = rtl2832_update_bits(client, 0x061, 0xc0, u8tmp); + if (dev->slave_ts) + ret = rtl2832_update_bits(client, 0x021, 0xc0, u8tmp); + else + ret = rtl2832_update_bits(client, 0x061, 0xc0, u8tmp); if (ret) goto err; @@ -1142,8 +1148,8 @@ static int rtl2832_pid_filter(struct dvb_frontend *fe, u8 index, u16 pid, int ret; u8 buf[4]; - dev_dbg(&client->dev, "index=%d pid=%04x onoff=%d\n", - index, pid, onoff); + dev_dbg(&client->dev, "index=%d pid=%04x onoff=%d slave_ts=%d\n", + index, pid, onoff, dev->slave_ts); /* skip invalid PIDs (0x2000) */ if (pid > 0x1fff || index > 32) @@ -1159,14 +1165,22 @@ static int rtl2832_pid_filter(struct dvb_frontend *fe, u8 index, u16 pid, buf[1] = (dev->filters >> 8) & 0xff; buf[2] = (dev->filters >> 16) & 0xff; buf[3] = (dev->filters >> 24) & 0xff; - ret = rtl2832_bulk_write(client, 0x062, buf, 4); + + if (dev->slave_ts) + ret = rtl2832_bulk_write(client, 0x022, buf, 4); + else + ret = rtl2832_bulk_write(client, 0x062, buf, 4); if (ret) goto err; /* add PID */ buf[0] = (pid >> 8) & 0xff; buf[1] = (pid >> 0) & 0xff; - ret = rtl2832_bulk_write(client, 0x066 + 2 * index, buf, 2); + + if (dev->slave_ts) + ret = rtl2832_bulk_write(client, 0x026 + 2 * index, buf, 2); + else + ret = rtl2832_bulk_write(client, 0x066 + 2 * index, buf, 2); if (ret) goto err; diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h b/drivers/media/dvb-frontends/rtl2832_priv.h index 6b875f4..8eb2e0b 100644 --- a/drivers/media/dvb-frontends/rtl2832_priv.h +++ b/drivers/media/dvb-frontends/rtl2832_priv.h @@ -45,6 +45,7 @@ struct rtl2832_dev { bool sleeping; struct delayed_work i2c_gate_work; unsigned long filters; /* PID filter */ + bool slave_ts; }; struct rtl2832_reg_entry {