From patchwork Sat May 5 09:50:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hollstegge X-Patchwork-Id: 10382085 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 4251360236 for ; Sat, 5 May 2018 09:50:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3328829457 for ; Sat, 5 May 2018 09:50:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 280072954A; Sat, 5 May 2018 09:50:50 +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 B820629457 for ; Sat, 5 May 2018 09:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751398AbeEEJus (ORCPT ); Sat, 5 May 2018 05:50:48 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38830 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337AbeEEJuq (ORCPT ); Sat, 5 May 2018 05:50:46 -0400 Received: by mail-wr0-f193.google.com with SMTP id 94-v6so21999086wrf.5 for ; Sat, 05 May 2018 02:50:46 -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=dBGUcmKbtc4qBvPHowvUlWRTI90hfud5eCFIedv8e6hHRTOkhUZE2kjhhS+8rIbUMb kSh4DiuoFFdFr25Ewn3wkwml4t+CcRD6Vn4beVI7X05tzYTrU/D6VsMtnuvya4aklyFA pCdRCuf7YAqoPH774l13gun4CdySjWWsD3TFVDCceY+VH7SdJY7LXaLnD6OLVLIKG/LY BSLZKUPbuh9GNupKwtH7OaxdcX3IOcJwjPlMa/88/Uby7zyNLRqHEJ0xEJ3uRobjmG9G rJpZ+7ipqguC1ePb5SjdQ1gPEs3mvgETXRhkxpnWm76p2PdCJU+fC4ES2AoQleme46Y3 3DIQ== 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=o9NezSOfb/0wbJSsIdC4679hJPbnjwBjxbpu0tx8q4eCG2Jcr/u7Xsay0TWqB8yXIu qI1QM8Y0BtMBP9qn/1ruAsT8beK/8LubV9iDy0V3boFJTn/+BbQ+v7xQkcj99IO6OzEw WVSRo0szE4s7J62EFPcpoA4I7vFXZXfpAa9A1OmZxQ0pGWHfX/ZSM+u+X35ozL7wOmru 4oVuPug+hm6e+9cfBDhg4Ar0xaq5pR7WK1GzebHC8dhNkt4oSkwwkb7qbYvhe1zUJ29W 6z02MyqWQLHCOo+hsGTzul4gx5kRlrqLgRRqbimL+c7USL1DwuC6GHZ22mapd89uQniS 6aFg== X-Gm-Message-State: ALQs6tCNEETUN8P1yxMPVwd40UsvLa/LsqyPpvrc1VKz3x+/YaSn+KDm FjWpyWqABEl8I0qwvC2ObbFm9OXGhf0= X-Google-Smtp-Source: AB8JxZrVDpgv/Ex0VMXWOKxMhIkXKEmIYh7uhsK14lnrpN6CWpPyKxw4TBCM+GkVm2PZRYxlSZ+7rQ== X-Received: by 2002:adf:a673:: with SMTP id k106-v6mr25666238wrc.231.1525513844573; Sat, 05 May 2018 02:50:44 -0700 (PDT) Received: from localhost.localdomain (x2f7f055.dyn.telefonica.de. [2.247.240.85]) by smtp.googlemail.com with ESMTPSA id w11-v6sm30793221wrn.86.2018.05.05.02.50.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 05 May 2018 02:50:43 -0700 (PDT) From: Thomas Hollstegge To: linux-media@vger.kernel.org Cc: Antti Palosaari , Mauro Carvalho Chehab , Thomas Hollstegge Subject: [PATCH 1/2] si2168: Set TS clock mode and frequency Date: Sat, 5 May 2018 11:50:30 +0200 Message-Id: <1525513831-17682-2-git-send-email-thomas.hollstegge@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525513831-17682-1-git-send-email-thomas.hollstegge@gmail.com> References: <1525513831-17682-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; };