From patchwork Sun May 6 18:07:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hollstegge X-Patchwork-Id: 10382953 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 7C1256037F for ; Sun, 6 May 2018 18:08:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69630286B1 for ; Sun, 6 May 2018 18:08:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C0C4289D0; Sun, 6 May 2018 18:08:44 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 DFE64286B1 for ; Sun, 6 May 2018 18:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751800AbeEFSIm (ORCPT ); Sun, 6 May 2018 14:08:42 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51283 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751771AbeEFSIm (ORCPT ); Sun, 6 May 2018 14:08:42 -0400 Received: by mail-wm0-f65.google.com with SMTP id j4so10750697wme.1 for ; Sun, 06 May 2018 11:08:41 -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=SNgd0FoKVbw0ImUOJM8Ffo2Jmw+wCnM/ct0VmRoyTOw=; b=VvQPISEarxegY+YzM5orgrc5jsslYMaZO2HU4rGgZb0vnhAXH+pGJs5e8cyAPAIZ+x dS8JrHuk5CVNrhxPbDSH3DN0AHu9mws0/OzmNdDxm3YS9L3C2PCcbXg/oITsvVpyzbNn 612qZcxZQackd5H1X+4sZbDOjQM6+BpVqVBJGSfOg4liAO5Yhw0txjBSYdvMC5RVzMKg RU/uFyaRpUQ5sxgAn6Of56AsDFBfIQnE2rNFgT9FoBMSWRIhJ/m/itfpRetsUYnAPlzJ RdVpBBp94f61t6zO9rGXlxFfvC1b0eM4+wbDVucd0vLTCZ9nlqUmSngyyC3CgeZ/KRuK sc4w== 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=SNgd0FoKVbw0ImUOJM8Ffo2Jmw+wCnM/ct0VmRoyTOw=; b=go2VQ1wkG9aACyx03P/YWsWw7hFc5ql6CKF8ci3h3D7UOL/RQlxuFoL4atQOQ91CT8 Ol6CAXpk2CV4mhKBG0N2WSkxGBr5MtlU2uafagezeg+fSA+2mT7RmsI+GrSWgi/3oB/B nL+zxJleWGll1MG4alm21ggY7wBAf+M3R4xOIFDdQfhXFXcghttUaFoSnpF0MDcNCD5b KJD+jU1+UQmuGq1PQHF7+r1SDrXon+gsh1oFsbczFqNZ8Jbi9lk/HV/WQwOuUrufP7OZ WBmwQtMA3TMsRqonECzrDhhcZDXLCO4/CAPKxv2rDwWtuLZ/fdvsElkMOifY+XRnwQE3 199g== X-Gm-Message-State: ALQs6tAUf24BkznBOd46SSt0SLFJWy4iafCGMZy4Us4kcJUuVaJrySdG Bpel4mS7HxnTojLioAUMihuM5Ux1Dcw= X-Google-Smtp-Source: AB8JxZoSB5NFFAXDrvezivX77ACNsZKRI81sQ0qUDuYzKbCz9xissVC/bo6HUkaZd/m+nQJBBjFIKQ== X-Received: by 10.28.118.9 with SMTP id r9mr24081375wmc.111.1525630120545; Sun, 06 May 2018 11:08:40 -0700 (PDT) Received: from x1.local (p200300E55F2109000000000000000281.dip0.t-ipconnect.de. [2003:e5:5f21:900::281]) by smtp.googlemail.com with ESMTPSA id h81sm8290414wmd.0.2018.05.06.11.08.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 06 May 2018 11:08:39 -0700 (PDT) From: Thomas Hollstegge To: linux-media@vger.kernel.org Cc: Antti Palosaari , Mauro Carvalho Chehab , Thomas Hollstegge Subject: [PATCH v2 1/2] si2168: Set TS clock mode and frequency Date: Sun, 6 May 2018 20:07:59 +0200 Message-Id: <1525630080-19329-2-git-send-email-thomas.hollstegge@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525630080-19329-1-git-send-email-thomas.hollstegge@gmail.com> References: <1525513831-17682-1-git-send-email-thomas.hollstegge@gmail.com> <1525630080-19329-1-git-send-email-thomas.hollstegge@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 Some devices require a higher TS clock frequency to demodulate some muxes. This adds two optional parameters to control the TS clock frequency mode as well as the frequency. Signed-off-by: Thomas Hollstegge --- drivers/media/dvb-frontends/si2168.c | 20 +++++++++++++++++++- drivers/media/dvb-frontends/si2168.h | 8 ++++++++ drivers/media/dvb-frontends/si2168_priv.h | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c index 324493e..80740db 100644 --- a/drivers/media/dvb-frontends/si2168.c +++ b/drivers/media/dvb-frontends/si2168.c @@ -92,13 +92,15 @@ static int si2168_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) dev_dbg(&client->dev, "%s acquire: %d\n", __func__, acquire); /* set TS_MODE property */ - memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6); + memcpy(cmd.args, "\x14\x00\x01\x10\x00\x00", 6); if (acquire) cmd.args[4] |= dev->ts_mode; else cmd.args[4] |= SI2168_TS_TRISTATE; if (dev->ts_clock_gapped) cmd.args[4] |= 0x40; + cmd.args[4] |= (dev->ts_clock_mode & 0x03) << 4; + cmd.wlen = 6; cmd.rlen = 4; ret = si2168_cmd_execute(client, &cmd); @@ -398,6 +400,18 @@ static int si2168_set_frontend(struct dvb_frontend *fe) if (ret) goto err; + /* set TS frequency */ + if (dev->ts_clock_freq) { + memcpy(cmd.args, "\x14\x00\x0d\x10", 4); + cmd.args[4] = ((dev->ts_clock_freq / 10000) >> 0) & 0xff; + cmd.args[5] = ((dev->ts_clock_freq / 10000) >> 8) & 0xff; + cmd.wlen = 6; + cmd.rlen = 4; + ret = si2168_cmd_execute(client, &cmd); + if (ret) + goto err; + } + memcpy(cmd.args, "\x14\x00\x08\x10\xd7\x05", 6); cmd.args[5] |= dev->ts_clock_inv ? 0x00 : 0x10; cmd.wlen = 6; @@ -806,6 +820,10 @@ static int si2168_probe(struct i2c_client *client, dev->ts_mode = config->ts_mode; dev->ts_clock_inv = config->ts_clock_inv; dev->ts_clock_gapped = config->ts_clock_gapped; + dev->ts_clock_mode = config->ts_clock_mode; + if (!dev->ts_clock_mode) + dev->ts_clock_mode = SI2168_TS_CLOCK_MODE_AUTO_ADAPT; + dev->ts_clock_freq = config->ts_clock_freq; dev->spectral_inversion = config->spectral_inversion; dev_info(&client->dev, "Silicon Labs Si2168-%c%d%d successfully identified\n", diff --git a/drivers/media/dvb-frontends/si2168.h b/drivers/media/dvb-frontends/si2168.h index d519edd..3f52ee8 100644 --- a/drivers/media/dvb-frontends/si2168.h +++ b/drivers/media/dvb-frontends/si2168.h @@ -47,6 +47,14 @@ struct si2168_config { /* TS clock gapped */ bool ts_clock_gapped; + /* TS clock mode */ +#define SI2168_TS_CLOCK_MODE_AUTO_ADAPT 0x01 +#define SI2168_TS_CLOCK_MODE_MANUAL 0x02 + u8 ts_clock_mode; + + /* TS clock frequency (for manual mode) */ + u32 ts_clock_freq; + /* Inverted spectrum */ bool spectral_inversion; }; diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h index 2d362e1..8173d6c 100644 --- a/drivers/media/dvb-frontends/si2168_priv.h +++ b/drivers/media/dvb-frontends/si2168_priv.h @@ -48,6 +48,8 @@ struct si2168_dev { u8 ts_mode; bool ts_clock_inv; bool ts_clock_gapped; + u8 ts_clock_mode; + u32 ts_clock_freq; bool spectral_inversion; };