From patchwork Sun Apr 9 19:38:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9671737 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 B52A2600CB for ; Sun, 9 Apr 2017 19:38:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0D3526E8A for ; Sun, 9 Apr 2017 19:38:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9597727F10; Sun, 9 Apr 2017 19:38:57 +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 D84BF26E8A for ; Sun, 9 Apr 2017 19:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbdDITiz (ORCPT ); Sun, 9 Apr 2017 15:38:55 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35886 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752427AbdDITis (ORCPT ); Sun, 9 Apr 2017 15:38:48 -0400 Received: by mail-wm0-f66.google.com with SMTP id q125so6399736wmd.3 for ; Sun, 09 Apr 2017 12:38:47 -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=tvAnvyV7DfyClDboTjmf/4OY+1g6yLmOTUoLvMJ0m4o=; b=sRwjf21WAwSnwGYlQE1tK7LWVWG8HhjjePLQU2agfBotVFJf8arpJ7+1Gti+v0u5U/ fI7eXmkqMxmwP+4NLyvDz4QQaVPshyQjFTkcXcC88Az9Fin1dPo1/QaP1ZdEycIRWxbK Qqr2DMJC7cuGZHIBdy+VCGuYexDcnjQtvcSw123AP1vwisWy7N0o+ibOEBJjH3fhAtSl ifmK8G2M6iauTpuuCOk3QcYeEc0GmAx8W3KLs6ifo2YFJu6ki+mNfiwBuFisbxUQhr6C XH64Z5frVGyYlXja9O7GCHB/oUEsQHPQtXGneUaXdOwT6zKVAEcluy/jXHuPDHpKt8ig Y9wQ== 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=tvAnvyV7DfyClDboTjmf/4OY+1g6yLmOTUoLvMJ0m4o=; b=SVoBg6e6XAut0Y1F3TTOfXLUd+j+5Nh1WS6uBRtLTwnKCAG5eXsH3ThJoGaLOEyHv9 ZRONcBBJOSo/CP+k32iBIL1oF2BgpwnkSr0eH4nXO2+fappvqfpyfuvFpIZC22Za0Dm0 wl9F2oMEN9QiGvMnXrQtQCGu17LJsmQTjIXUGkTNwZ5AnK2XSEB0WBfqHSbnPDV+EbKC w1zOgYrOH0QjXw4tgc26cHbiJzKHS5ly3v61xoHUVuS0QQwP8HRB8nCLMyOQp5404zGG YKF3t4/Gny8OZ3m3FX87zVVsAJKxnEBITzzQ0nQUvk2V7bAQTPmM2/k+0NST3ED3UXo0 Vc6A== X-Gm-Message-State: AN3rC/7M9zx/eUtocu5hOF9lU/iwMxIV0I5eQTYRTFZeDtiS25k94pWI 2SzRrGjDQHbweg== X-Received: by 10.28.154.85 with SMTP id c82mr3096674wme.100.1491766720441; Sun, 09 Apr 2017 12:38:40 -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 f135sm7441407wmd.7.2017.04.09.12.38.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Apr 2017 12:38:39 -0700 (PDT) From: Daniel Scheller To: aospan@netup.ru, serjk@netup.ru, mchehab@kernel.org, linux-media@vger.kernel.org Cc: rjkm@metzlerbros.de Subject: [PATCH 10/19] [media] dvb-frontends/cxd2841er: make ASCOT use optional Date: Sun, 9 Apr 2017 21:38:19 +0200 Message-Id: <20170409193828.18458-11-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170409193828.18458-1-d.scheller.oss@gmail.com> References: <20170409193828.18458-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 The Sony CXD28xx demods may have other tuner types attached to them (e.g. NXP TDA18212), so don't mandatorily configure and enable the ASCOT functionality, but make this conditional by a config flag. Signed-off-by: Daniel Scheller Acked-by: Abylay Ospan --- drivers/media/dvb-frontends/cxd2841er.c | 70 ++++++++++++++-------- drivers/media/dvb-frontends/cxd2841er.h | 1 + drivers/media/pci/netup_unidvb/netup_unidvb_core.c | 2 +- 3 files changed, 46 insertions(+), 27 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 1df95c4..7ca589a 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -2277,7 +2277,8 @@ static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef8bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 4800000); @@ -2306,7 +2307,8 @@ static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef7bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 4200000); @@ -2335,7 +2337,8 @@ static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef6bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 3600000); @@ -2364,7 +2367,8 @@ static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef5bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 3600000); @@ -2393,7 +2397,8 @@ static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef17bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 3500000); @@ -2493,7 +2498,8 @@ static int cxd2841er_sleep_tc_to_active_t_band( /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef8bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 4800000); @@ -2529,7 +2535,8 @@ static int cxd2841er_sleep_tc_to_active_t_band( /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef7bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 4200000); @@ -2565,7 +2572,8 @@ static int cxd2841er_sleep_tc_to_active_t_band( /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef6bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 3600000); @@ -2601,7 +2609,8 @@ static int cxd2841er_sleep_tc_to_active_t_band( /* Group delay equaliser settings for * ASCOT2D, ASCOT2E and ASCOT3 tuners */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef5bw[priv->xtal], 14); /* */ ifhz = cxd2841er_get_if_hz(priv, 3600000); @@ -2703,7 +2712,8 @@ static int cxd2841er_sleep_tc_to_active_i_band( cxd2841er_write_regs(priv, I2C_SLVT, 0x9F, nominalRate8bw[priv->xtal], 5); /* Group delay equaliser settings for ASCOT tuners optimized */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef8bw[priv->xtal], 14); /* IF freq setting */ @@ -2733,7 +2743,8 @@ static int cxd2841er_sleep_tc_to_active_i_band( cxd2841er_write_regs(priv, I2C_SLVT, 0x9F, nominalRate7bw[priv->xtal], 5); /* Group delay equaliser settings for ASCOT tuners optimized */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef7bw[priv->xtal], 14); /* IF freq setting */ @@ -2763,7 +2774,8 @@ static int cxd2841er_sleep_tc_to_active_i_band( cxd2841er_write_regs(priv, I2C_SLVT, 0x9F, nominalRate6bw[priv->xtal], 5); /* Group delay equaliser settings for ASCOT tuners optimized */ - cxd2841er_write_regs(priv, I2C_SLVT, + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs(priv, I2C_SLVT, 0xA6, itbCoef6bw[priv->xtal], 14); /* IF freq setting */ @@ -2826,16 +2838,18 @@ static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, switch (bandwidth) { case 8000000: case 7000000: - cxd2841er_write_regs( - priv, I2C_SLVT, 0xa6, - bw7_8mhz_b10_a6, sizeof(bw7_8mhz_b10_a6)); + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs( + priv, I2C_SLVT, 0xa6, + bw7_8mhz_b10_a6, sizeof(bw7_8mhz_b10_a6)); ifhz = cxd2841er_get_if_hz(priv, 4900000); iffreq = cxd2841er_calc_iffreq(ifhz); break; case 6000000: - cxd2841er_write_regs( - priv, I2C_SLVT, 0xa6, - bw6mhz_b10_a6, sizeof(bw6mhz_b10_a6)); + if (priv->flags & CXD2841ER_ASCOT) + cxd2841er_write_regs( + priv, I2C_SLVT, 0xa6, + bw6mhz_b10_a6, sizeof(bw6mhz_b10_a6)); ifhz = cxd2841er_get_if_hz(priv, 3700000); iffreq = cxd2841er_calc_iffreq(ifhz); break; @@ -2924,8 +2938,9 @@ static int cxd2841er_sleep_tc_to_active_t(struct cxd2841er_priv *priv, cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); /* Set SLV-T Bank : 0x10 */ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); - /* ASCOT setting ON */ - cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); + /* ASCOT setting */ + cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, + ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); /* Set SLV-T Bank : 0x18 */ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); /* Pre-RS BER moniter setting */ @@ -3002,8 +3017,9 @@ static int cxd2841er_sleep_tc_to_active_t2(struct cxd2841er_priv *priv, cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); /* Set SLV-T Bank : 0x10 */ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); - /* ASCOT setting ON */ - cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); + /* ASCOT setting */ + cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, + ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); /* Set SLV-T Bank : 0x20 */ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); /* Acquisition optimization setting */ @@ -3140,8 +3156,9 @@ static int cxd2841er_sleep_tc_to_active_i(struct cxd2841er_priv *priv, cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); /* Enable ADC 4 */ cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); - /* ASCOT setting ON */ - cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); + /* ASCOT setting */ + cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, + ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); /* FEC Auto Recovery setting */ cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x00, 0x01); @@ -3225,8 +3242,9 @@ static int cxd2841er_sleep_tc_to_active_c(struct cxd2841er_priv *priv, cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x48); /* Set SLV-T Bank : 0x10 */ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); - /* ASCOT setting ON */ - cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); + /* ASCOT setting */ + cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, + ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); /* Set SLV-T Bank : 0x40 */ cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); /* Demod setting */ diff --git a/drivers/media/dvb-frontends/cxd2841er.h b/drivers/media/dvb-frontends/cxd2841er.h index 58fbd98..90ced97 100644 --- a/drivers/media/dvb-frontends/cxd2841er.h +++ b/drivers/media/dvb-frontends/cxd2841er.h @@ -27,6 +27,7 @@ #define CXD2841ER_USE_GATECTRL 1 /* bit 0 */ #define CXD2841ER_AUTO_IFHZ 2 /* bit 1 */ #define CXD2841ER_TS_SERIAL 4 /* bit 2 */ +#define CXD2841ER_ASCOT 8 /* bit 3 */ enum cxd2841er_xtal { SONY_XTAL_20500, /* 20.5 MHz */ diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c index 5e6553f..8b389b3 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c @@ -123,7 +123,7 @@ static void netup_unidvb_queue_cleanup(struct netup_dma *dma); static struct cxd2841er_config demod_config = { .i2c_addr = 0xc8, .xtal = SONY_XTAL_24000, - .flags = CXD2841ER_USE_GATECTRL + .flags = CXD2841ER_USE_GATECTRL | CXD2841ER_ASCOT }; static struct horus3a_config horus3a_conf = {