From patchwork Fri Feb 9 18:22:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10209791 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 C667160247 for ; Fri, 9 Feb 2018 18:23:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3A7029555 for ; Fri, 9 Feb 2018 18:23:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B258E29523; Fri, 9 Feb 2018 18:23:56 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 C1CB429889 for ; Fri, 9 Feb 2018 18:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751343AbeBISWz (ORCPT ); Fri, 9 Feb 2018 13:22:55 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51095 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751004AbeBISWy (ORCPT ); Fri, 9 Feb 2018 13:22:54 -0500 Received: by mail-wm0-f68.google.com with SMTP id f71so16948501wmf.0 for ; Fri, 09 Feb 2018 10:22:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SRd7I/09KQE/2q+bfc3DpwM2Z62nlF3nRUaCPuyzqck=; b=DXhqZsWCILb50yXMqMSkkI2JNGjzWG2HFBQMqrgspWJ8xnAOyhCIl7P4Pe7DtCeH0F qdoSegrclDep2mPpyaps9rtQiB/j/CVuTZT04O/Ei24Y6hBpj0nII4vnpv1dr5GRPApz 5cpsXP5LVzHDsUbZUt72ki/9wPYwx+gloV+2DOHu+O0xaN6e3KuH7BhKpXttT8Z16AmR RYjPLeSh+DmNNKm8ov5bXfqK/BETGFDq0JXAKFZTDUkXmVfMVomCTfnJUIyUjSQjqjdb WslgcbalNgM5M3sjB+J8WsHPY8LnJkuI0TwTLanWIFkUDBQoyVkAax1PPuYPsf636kl7 PG7g== 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; bh=SRd7I/09KQE/2q+bfc3DpwM2Z62nlF3nRUaCPuyzqck=; b=qkMYOT75rzkL7aYdAnLx10sBPMqhQ/3wjOCjCDOI+aQGjpazEpAF5jlxFALId3cGm4 WNYnGEp0HOseRcgskKpbYIOtHqWMwIUv1/Eiu61+f+ZVNCAxgjZOskcYl5jAcbBblUG1 B3oHmp3HO7ScMYlns8JMxooi9TWFq5Onh9pwr57R00icEVE0hebhOho+nT2g0XKGxmmC gUbF6rS045xEyEal7b4dzGzLssauScUJtbtf4I4SrYPq7zvBLEfGwxwTAYdT6fyWT23K QW7nzngLLLsKNONxe2i4/50OL+eXZAzZGuJ+KZUIqcW2O/qJ1smg2413OAF0EkggCVvF z6kQ== X-Gm-Message-State: APf1xPDm5w5ox0TENUjS54CnTJDePpIvnSj0OpJm8thpejxCiEjAsSdR pQk5aDfWwnm2xn6ALkBgAfmiXA== X-Google-Smtp-Source: AH8x22609aUyiQVkrcL8RGEpuy39zqJz7r4nrzeaj7DCe+STHFFCjNcUF6NKGCIH7+LQYTWNSrAgZA== X-Received: by 10.28.100.213 with SMTP id y204mr2842537wmb.24.1518200573083; Fri, 09 Feb 2018 10:22:53 -0800 (PST) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id 56sm4970998wrt.23.2018.02.09.10.22.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 10:22:52 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: post@helmutauer.de, rascobie@slingshot.co.nz, d_spingler@freenet.de, Ralph Metzler Subject: [PATCH] [media] dvb-frontends/stv0910: rework and fix DiSEqC send Date: Fri, 9 Feb 2018 19:22:49 +0100 Message-Id: <20180209182249.11896-1-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 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 Rework both DiSEqC send functions (send_master_cmd() and send_burst()) to utilise the new SET_REG() and SET_FIELD() macros. Esp. due to SET_FIELD(), this makes sure that not all bits (with unrelated purposes) are always rewritten, but only those needed for sending DiSEqC commands. In send_burst(), this makes sure that DISEQC_MODE isn't changed from 3 to 2 inbetween when sending SEC_MINI_A. Also, change both functions to write DISEQC_MODE first before setting DIS_PRECHARGE. This makes diseqc control work more reliable for "fullblown" DiSEqC strings in VDR's diseqc.conf in combination with certain multiswitches. Fixes: 448461af0e19 ("media: dvb-frontends/stv0910: implement diseqc_send_burst") Reported-by: Helmut Auer Cc: Ralph Metzler Signed-off-by: Daniel Scheller Tested-by: Helmut Auer Tested-by: Richard Scobie Tested-by: Dietmar Spingler --- drivers/media/dvb-frontends/stv0910.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index a2f7c0c1587f..52355c14fd64 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1673,15 +1673,15 @@ static int send_master_cmd(struct dvb_frontend *fe, struct dvb_diseqc_master_cmd *cmd) { struct stv *state = fe->demodulator_priv; - u16 offs = state->nr ? 0x40 : 0; int i; - write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3E); + SET_FIELD(DISEQC_MODE, 2); + SET_FIELD(DIS_PRECHARGE, 1); for (i = 0; i < cmd->msg_len; i++) { wait_dis(state, 0x40, 0x00); - write_reg(state, RSTV0910_P1_DISTXFIFO + offs, cmd->msg[i]); + SET_REG(DISTXFIFO, cmd->msg[i]); } - write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3A); + SET_FIELD(DIS_PRECHARGE, 0); wait_dis(state, 0x20, 0x20); return 0; } @@ -1689,19 +1689,20 @@ static int send_master_cmd(struct dvb_frontend *fe, static int send_burst(struct dvb_frontend *fe, enum fe_sec_mini_cmd burst) { struct stv *state = fe->demodulator_priv; - u16 offs = state->nr ? 0x40 : 0; u8 value; if (burst == SEC_MINI_A) { - write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3F); + SET_FIELD(DISEQC_MODE, 3); value = 0x00; } else { - write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3E); + SET_FIELD(DISEQC_MODE, 2); value = 0xFF; } + + SET_FIELD(DIS_PRECHARGE, 1); wait_dis(state, 0x40, 0x00); - write_reg(state, RSTV0910_P1_DISTXFIFO + offs, value); - write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3A); + SET_REG(DISTXFIFO, value); + SET_FIELD(DIS_PRECHARGE, 0); wait_dis(state, 0x20, 0x20); return 0;