From patchwork Fri Jun 30 20:50:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9820481 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 0ED8D603F3 for ; Fri, 30 Jun 2017 20:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 022001FFD6 for ; Fri, 30 Jun 2017 20:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB04328516; Fri, 30 Jun 2017 20:51:34 +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 7EFD1285ED for ; Fri, 30 Jun 2017 20:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752996AbdF3Uvb (ORCPT ); Fri, 30 Jun 2017 16:51:31 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33636 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752993AbdF3Uva (ORCPT ); Fri, 30 Jun 2017 16:51:30 -0400 Received: by mail-wm0-f68.google.com with SMTP id j85so9870699wmj.0 for ; Fri, 30 Jun 2017 13:51:24 -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=J68+iBJJUx5Rh3dUYd6Tl/6dJE5D4vijxrYX692TsdU=; b=bzbI+Q/8VYQzc6wt8fWDCkCLRPM/RwH3eVKN6rb3DAsRVNQUq+Py20HrZ32EUJxPoN o9HQOyc9offeeNAtsyDBFdrjRRAf7sxMPatoR3TSQNAJdPHmx2//e5JvxwQt/aHcEhTP ODFiGNahEqqB+eRAUuhY4CgZRbn7r1Z4dC0De3F7QSEi0meiHdtDsan9xCZv0kqwun9Y o53NmMES2+PVO3ZokJVTnyItuP7bTdjrSGThBKgrsx0YmoTO2moDLNrfENs1/lyQt97z ohvznQUN5wRmb+1k6YtHRPGOkr2LWlfSpcQCPt0f65Mgses/zdK5AWN4GFex/bliTbG0 aLPQ== 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=J68+iBJJUx5Rh3dUYd6Tl/6dJE5D4vijxrYX692TsdU=; b=AsOQy0q2I2QwT4VYZikKmFrPEAi3nMBfTUXBfQjR8CchjSLKus9wFLCvS/kY4UPuCF 209N8J2WjuowkXJAM6biuQXZCTuP7iRghht/O1gdAEo8k9YzxzBy5oSPnusfmnG3k0nF +SqIHefp40JAXyDk7qKFBolXKvqSnLbPYN7+IFrp166MiVImj7ExJfvb+hxzbWDo3ntJ fvATTK2ZiMPt/C2ZWG/skbzweljTqdhiyq543xOHve2mv9EmFZz+EYA6xM8D++7dCX5D hlMTmK9NRbloaDgNpNMqgcZWyfzFJp/tkZZ1q5TwssDRKZA6Xi3eYxlf8B/9s4K0k51r rkOg== X-Gm-Message-State: AKS2vOzGn651t+oVz6/GIzGK8q7srZrv15Iyf3+xqGhQqQ6880NTg08E SRaRvw1IbWAZ9yv3 X-Received: by 10.28.220.212 with SMTP id t203mr7508773wmg.13.1498855873322; Fri, 30 Jun 2017 13:51:13 -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 e24sm6420051wrc.35.2017.06.30.13.51.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Jun 2017 13:51:12 -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 v2 03/10] [media] dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities Date: Fri, 30 Jun 2017 22:50:59 +0200 Message-Id: <20170630205106.1268-4-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170630205106.1268-1-d.scheller.oss@gmail.com> References: <20170630205106.1268-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 5a5d190298ea..b9d6a61e6017 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -120,9 +120,7 @@ struct stv { int is_vcm; u32 cur_scrambling_code; - u32 force_scrambling_code; u32 scrambling_code; - u32 default_input_stream_id; u32 last_bernumerator; u32 last_berdenominator; @@ -970,6 +968,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; @@ -983,6 +982,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; @@ -1600,7 +1621,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, @@ -1658,9 +1680,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 = (u32) -1; - state->force_scrambling_code = (u32) -1; - state->default_input_stream_id = (u32) -1; + state->cur_scrambling_code = (~0U); state->single = cfg->single ? 1 : 0; base = match_base(i2c, cfg->adr);