Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2414995imm; Sat, 12 May 2018 11:25:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZolzjeXvG9fWvwrv5Cry5zBBrdFtcQyEuQo/aUdG5XYCjryD9VxdHqI6E1NicP5Ocl7cdKO X-Received: by 2002:a62:ccdc:: with SMTP id j89-v6mr4066555pfk.182.1526149558125; Sat, 12 May 2018 11:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526149558; cv=none; d=google.com; s=arc-20160816; b=StPAmHDHOnJPHsxUfbuBdHxhlVcFdmutDMEl9myx9VQRXAR+MESuVqhmoHsUC8Oerm uiOwd3p6aJWsaZmY2ZP+4Bie26aHmg5FlY1qsNwgsJEjILpwO+85CaAbWtSh1RkzUY1+ pOtPT186EfqPVobIJYhCjgNSa3xsvdES1+ueWTbxJsx7OC1tbMzTFUJKwa+8pFmKf5kj v1zi3/M2o3LhHQXffgsZ9iuU3igtWzP2lvpMRw0wP81Gouol4tEPy//q+K9JWbpZ9j+F JzvehOyYyMLnQvSAEs2lMJ3Finn1B1xFoodPVrP+eVOgPFNfY+0/j/6aTxtpFNEmqo+N fz1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Fk/8/6n9XRP/qxxNzcmRop7GRFPWv9JzAVDNffRy2yg=; b=HKP5OHJHAfW40LDRHtuyk6Wc891qpUvZTW+Z5HnqZMpG4TOT4ePK/iFqjxgojr/IJu H/Gk3tSQ4Hfqb8NZvCrWTPiN9cs8Pbj7cT+kZnYuFv3ged0FtzyfrotIsScy/DUYuOEZ JZARVPhZ227YhrU1M0SdrLehPOXUuoCPORecYyTcvC0QI3twCR1QzbALxAdlOdbFvdfr jLTIcXcPljvq3hyCBeEZWn+pjAOASb3gb5XQdHNxGW2WbpFehByn9uAufI77/aRZxiKg dUUgJkCXKo1fZhnVZkEd79G/xkdvdJUeYH4tws6rX4+zuFkYPipiON3RX6vQNmDGBP/K Rg0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tEmdWnng; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14-v6si5866601pfj.178.2018.05.12.11.25.43; Sat, 12 May 2018 11:25:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tEmdWnng; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751885AbeELSZQ (ORCPT + 99 others); Sat, 12 May 2018 14:25:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:53683 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbeELSZP (ORCPT ); Sat, 12 May 2018 14:25:15 -0400 Received: by mail-wm0-f66.google.com with SMTP id a67-v6so7220006wmf.3; Sat, 12 May 2018 11:25:14 -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; bh=Fk/8/6n9XRP/qxxNzcmRop7GRFPWv9JzAVDNffRy2yg=; b=tEmdWnngB+aTkHKSaDqHam9LWWfv5smCK8LaMOs14rqyaJQPhFyBVfxDPl8zWvG+bZ X1KdhfcRTgk/3yW9lFIjltn0no9aApXz0Ciuxv8tKcIdHQ6XakI/kMkn1cV0P7POhmQC ZFh/qlynMceq9qALRXg9Tv4sxdwBihl7NWba9iyZA0G1YEwkZ3DCtbYiSvbqDxxD6xcF Q62QZFs/N5EHQ5FRBkY25jdUaSlEvtllUMLjW4C/7c1INWrlSxye6Ccd9pttOOgJo1VS Q54485WtqlJ7LUc+sdBTeQhlqJ4QvkiKJ3o59+M527NiD3TXE7Wn3RGUkm46NSbzh94x veNA== 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=Fk/8/6n9XRP/qxxNzcmRop7GRFPWv9JzAVDNffRy2yg=; b=gzwRxDxAMGZEWnOaQUjk8QocWxv7jCFpLEOFyH8km7KdeybgK5S5BbqXLGexI2y8IZ w60+4LORLZySL/R74127QovZA+C5XxDtl+timW6Zj8nY7vZIsGWUgCMRXT4dvF6PR24u TcGpMXQha47j2zXEI+tp7/royNikjWZRwEbUHZZv5pAfz9qv4p5KygQaq+K4fGqaTcqh 7sbshyjK9j8SOtnougzI2440LQeaEvheXVYINqAYUBogVvyK8HhxUCPNOgQd8yEheetw 5HjGfJIsRHrb+PAtIxJ21qEV61x966KE8IZV+gRGhtmkzTT3MXy0iaoIQ9osxVwZ3dme niAw== X-Gm-Message-State: ALKqPwcLon96F4q/u72QlaBZEHfTrYlJxgdB8eEzVKN0ABp5arMU1jLk fA7WPL75QsB+FP+oabt+1j2Zo/XvBoM= X-Received: by 2002:a1c:455d:: with SMTP id s90-v6mr1546084wma.156.1526149513313; Sat, 12 May 2018 11:25:13 -0700 (PDT) Received: from x1.local (p200300E55F2109000000000000000281.dip0.t-ipconnect.de. [2003:e5:5f21:900::281]) by smtp.googlemail.com with ESMTPSA id i30-v6sm9556468wra.38.2018.05.12.11.25.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 May 2018 11:25:12 -0700 (PDT) From: Thomas Hollstegge To: linux-media@vger.kernel.org Cc: thomas.hollstegge@gmail.com, Antti Palosaari , Mauro Carvalho Chehab , Sean Young , Hans Verkuil , =?UTF-8?q?Stefan=20Br=C3=BCns?= , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] si2168: Set TS clock mode and frequency Date: Sat, 12 May 2018 20:24:58 +0200 Message-Id: <1526149500-9256-1-git-send-email-thomas.hollstegge@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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..b05e677 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 == 0) + 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; }; -- 2.7.4