From patchwork Sat Jun 24 16:02:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9807807 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 C1A806086C for ; Sat, 24 Jun 2017 16:03:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B12752876D for ; Sat, 24 Jun 2017 16:03:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5F6E28774; Sat, 24 Jun 2017 16:03:13 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 3EA9928773 for ; Sat, 24 Jun 2017 16:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbdFXQDK (ORCPT ); Sat, 24 Jun 2017 12:03:10 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34016 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751417AbdFXQDJ (ORCPT ); Sat, 24 Jun 2017 12:03:09 -0400 Received: by mail-wr0-f193.google.com with SMTP id k67so19936584wrc.1 for ; Sat, 24 Jun 2017 09:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yZFjd5FmF9hvdjI1ogL1JN0vpSE6EYOf1GC3hFPRVf8=; b=jl9phLRpf3M7T3tWr54EohypvceYMcq3m2jUq9Fbkm/rqmFCiMFawNPZnXM5IaJa7q 9YVRYT4uVS5Z0a0mvr0C9Otfntts32QIzJdmKegYZErnI8TdEykBtgeKhsrBrjR5PZB3 dMcrIqAsX6lb1zJgwE1yqXN9Jj44HSMMAZUpsWuewiix4cPwFID2/meZhv/pw6J4W3k8 wyrIBmUMnro3Y+QzbQ81hTTNGhEKMS6O2bAtODQlg0yHrRLdAeFp2YMM/pbrXrmYYp2y id6NhxzhxwIyC+E4jBUNX0/14tpSwrRj9/I8sSDZuPCecSmGSdR2Xln4n75r4V86X8GB SBlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yZFjd5FmF9hvdjI1ogL1JN0vpSE6EYOf1GC3hFPRVf8=; b=lHaJOG9jIGWGJbhEwqdxP4bn91k/0ZNTBsLRA+XFE6MD7JooXxzZnkXU6JaS4kgfav bdkCkrz796ZW0gmz7kKKOrBl84EKfsMLfs1U9n+kVAOvbFuRUhtiTutY8knq3MgOFtuk i9yIndvpEvEME7SpZ6tp5rUoACD6xEp+VRijPWiY05O4xDv9NXF7PJOChYRVtmiD+mAW Xv7DUfAYlCMMGN1H0cIvwrGxUx+Xqp7e0m7kNIXBntMxcse+bxfhHZ2IxW5BT3LXJ43+ NWvuvIGov01cugmBhE+4Bii5g7dn7ODUEyDmCs15Iov0g8gpd/NobnJdpjk1ZNkzVAVn t8Dg== X-Gm-Message-State: AKS2vOwKRUHHzloAPjiLr8icHRIDC3nrpLNUCNmPRaATHK2326iwJPD6 vXV22AWwqShg0YbG X-Received: by 10.28.141.72 with SMTP id p69mr8695254wmd.12.1498320187831; Sat, 24 Jun 2017 09:03:07 -0700 (PDT) Received: from dvbdev.wuest.de (ip-37-24-178-151.hsi14.unitymediagroup.de. [37.24.178.151]) by smtp.gmail.com with ESMTPSA id n31sm9935301wrn.59.2017.06.24.09.03.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Jun 2017 09:03:07 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: rjkm@metzlerbros.de, jasmin@anw.at Subject: [PATCH 3/9] [media] dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities Date: Sat, 24 Jun 2017 18:02:55 +0200 Message-Id: <20170624160301.17710-4-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170624160301.17710-1-d.scheller.oss@gmail.com> References: <20170624160301.17710-1-d.scheller.oss@gmail.com> 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 From: Daniel Scheller Implements stream_id filter and scrambling code setup in Start() and also sets FE_CAN_MULTISTREAM in frontend_ops. This enables the driver to properly receive and handle multistream transponders, functionality has been reported working fine by testers with access to such streams, in conjunction with VDR on the userspace side. The code snippet originates from the original vendor's dddvb driver package and has been made working properly with the current in-kernel DVB core API. Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0910.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index a5eac1a3a048..999ee6a8ea23 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -124,9 +124,7 @@ struct stv { int isVCM; u32 CurScramblingCode; - u32 ForceScramblingCode; u32 ScramblingCode; - u32 DefaultInputStreamID; u32 LastBERNumerator; u32 LastBERDenominator; @@ -972,6 +970,7 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p) s32 Freq; u8 regDMDCFGMD; u16 symb; + u32 ScramblingCode = 1; if (p->symbol_rate < 100000 || p->symbol_rate > 70000000) return -EINVAL; @@ -985,6 +984,28 @@ static int Start(struct stv *state, struct dtv_frontend_properties *p) init_search_param(state); + if (p->stream_id != NO_STREAM_ID_FILTER) { + /* Backwards compatibility to "crazy" API. + * PRBS X root cannot be 0, so this should always work. + */ + if (p->stream_id & 0xffffff00) + ScramblingCode = p->stream_id >> 8; + write_reg(state, RSTV0910_P2_ISIENTRY + state->regoff, + p->stream_id & 0xff); + write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, + 0xff); + } + + if (ScramblingCode != state->CurScramblingCode) { + write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff, + ScramblingCode & 0xff); + write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff, + (ScramblingCode >> 8) & 0xff); + write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff, + (ScramblingCode >> 16) & 0x07); + state->CurScramblingCode = ScramblingCode; + } + if (p->symbol_rate <= 1000000) { /* SR <=1Msps */ state->DemodTimeout = 3000; state->FecTimeout = 2000; @@ -1643,7 +1664,8 @@ static struct dvb_frontend_ops stv0910_ops = { .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_AUTO | FE_CAN_QPSK | - FE_CAN_2G_MODULATION + FE_CAN_2G_MODULATION | + FE_CAN_MULTISTREAM }, .sleep = sleep, .release = release, @@ -1687,9 +1709,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, state->SearchRange = 16000000; state->DEMOD = 0x10; /* Inversion : Auto with reset to 0 */ state->ReceiveMode = Mode_None; - state->CurScramblingCode = (u32) -1; - state->ForceScramblingCode = (u32) -1; - state->DefaultInputStreamID = (u32) -1; + state->CurScramblingCode = (~0U); state->single = cfg->single ? 1 : 0; base = match_base(i2c, cfg->adr);