From patchwork Mon Jul 3 17:20:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9823759 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 3217460237 for ; Mon, 3 Jul 2017 17:21:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1919E27F7F for ; Mon, 3 Jul 2017 17:21:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D77A285F2; Mon, 3 Jul 2017 17:21:16 +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 94A7D27FB1 for ; Mon, 3 Jul 2017 17:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755509AbdGCRVO (ORCPT ); Mon, 3 Jul 2017 13:21:14 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36066 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755496AbdGCRVM (ORCPT ); Mon, 3 Jul 2017 13:21:12 -0400 Received: by mail-wm0-f68.google.com with SMTP id y5so21687884wmh.3 for ; Mon, 03 Jul 2017 10:21:11 -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=i3osyUCS+P2dBeiE5O0Hfrmv7YP3gha2hRY91M+vEPo=; b=VoRTaJtVCF1GryZxf1iDu/fMWS0bkGdeNwhjoJArB4SkcwcRMXI/Qb12Z4mosGYGRz cemCvZZAH6ahlhIq00ckP4CZTlq+0lZS5F2Zt3J7C9W//4j4cD2VUwYddwHc2mgKZYn7 oCv+vlwiXQZU0pO6IoPOT+MU3IFiA0a4Q5Ibry4b/yD9ERuiVbS3bgAnpQTHUwOEH7W7 HL4LmYVmROjpN/Ew5ErooSemp+45uQKr/r4++rcqhJAhe8HO2DxOHMlX6b+HiYBsYzH9 GbEOgCGqpT0avYBfrI4841ibEse4aT2RCj6eqYhP65MtGXQ/yUqMgIVhOqTbIKdz6IB3 yAmA== 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=i3osyUCS+P2dBeiE5O0Hfrmv7YP3gha2hRY91M+vEPo=; b=lyk5P00zv0Gv8JnyDcvpqthAaxfZ+KjiScgch4Gmqhu9Bl0kI9RHyqgNcUm2dx45yP UTlhktRiJ28HhVphIOs/uZ/zYG4eZLGYn5sBBS0q1qvtxKpQrszFWvkhDy8FcV93m+i8 UnA+rYNgeM4yfo6pNirJuv+PjrqTrJiX6QzkyLkvWmza3gLXNK62SOj9OXftU7JkxeZN 1tewiyGIjmcp/C4y5SdEM7FnlPzJB/OEIlD3kJqo+GYuoQolBn3hB0saP/fSyCtnaelD q1oaCqzjUW5gYqLsRgCDy+uugSGZBWM/0i3xkrNm5h+sOUJK38nREA32nvANpIb7vhXR 7bbQ== X-Gm-Message-State: AKS2vOyYl0pfsIf+ZW3rEfvt2pKrIfE3EtLJKoAcX2AQuTD2Kb15t1xt u2rr8KvC5OWBB84H X-Received: by 10.28.4.131 with SMTP id 125mr20780921wme.69.1499102470713; Mon, 03 Jul 2017 10:21:10 -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 x21sm17350309wme.24.2017.07.03.10.21.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Jul 2017 10:21:10 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: jasmin@anw.at, rjkm@metzlerbros.de Subject: [PATCH v3 03/10] [media] dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities Date: Mon, 3 Jul 2017 19:20:56 +0200 Message-Id: <20170703172104.27283-4-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170703172104.27283-1-d.scheller.oss@gmail.com> References: <20170703172104.27283-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 Tested-by: Richard Scobie --- drivers/media/dvb-frontends/stv0910.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 85439d3b725e..dc848ebe1a44 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -119,6 +119,8 @@ struct stv { int is_standard_broadcast; int is_vcm; + u32 cur_scrambling_code; + u32 last_bernumerator; u32 last_berdenominator; u8 berscale; @@ -965,6 +967,7 @@ static int start(struct stv *state, struct dtv_frontend_properties *p) s32 freq; u8 reg_dmdcfgmd; u16 symb; + u32 scrambling_code = 1; if (p->symbol_rate < 100000 || p->symbol_rate > 70000000) return -EINVAL; @@ -978,6 +981,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) + scrambling_code = 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 (scrambling_code != state->cur_scrambling_code) { + write_reg(state, RSTV0910_P2_PLROOT0 + state->regoff, + scrambling_code & 0xff); + write_reg(state, RSTV0910_P2_PLROOT1 + state->regoff, + (scrambling_code >> 8) & 0xff); + write_reg(state, RSTV0910_P2_PLROOT2 + state->regoff, + (scrambling_code >> 16) & 0x07); + state->cur_scrambling_code = scrambling_code; + } + if (p->symbol_rate <= 1000000) { /* SR <=1Msps */ state->demod_timeout = 3000; state->fec_timeout = 2000; @@ -1597,7 +1622,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, @@ -1655,6 +1681,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, state->search_range = 16000000; state->demod_bits = 0x10; /* Inversion : Auto with reset to 0 */ state->receive_mode = RCVMODE_NONE; + state->cur_scrambling_code = (~0U); state->single = cfg->single ? 1 : 0; base = match_base(i2c, cfg->adr);