From patchwork Sun Apr 9 19:38:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9671749 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 211C2600CB for ; Sun, 9 Apr 2017 19:39:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D9CE26E8A for ; Sun, 9 Apr 2017 19:39:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 024EA27F10; Sun, 9 Apr 2017 19:39:07 +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 A084126E8A for ; Sun, 9 Apr 2017 19:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752671AbdDITjG (ORCPT ); Sun, 9 Apr 2017 15:39:06 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35451 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752586AbdDITix (ORCPT ); Sun, 9 Apr 2017 15:38:53 -0400 Received: by mail-wm0-f65.google.com with SMTP id d79so6410712wmi.2 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=NP+mfyp7yqu2j5KfXG9Qzn4OZajPczIq4HuJ4I2UJoA=; b=pb1aQa1q50sg0RL0KG0kb5IPuy2EvNzieir2aisApOvb+ppkhoCBmJT5AySCtbVsqv RrfSmXWmkVE4A+warjguM9KUrV5ypVorgmuHMysxjl8xq5MwRCQRKC537swJkok9gSej lB1LuCXQzjIcWlyA9qX0pCtjgv3jNMVs5Ja2aNeudkNs8siKfNzXVjo00qAJ0rZJBlaP zPpLPssbAWUnKbVmFtz68ATD0DGqj4Fm7yjnHzrLnFJedUykP/+h2vaKgf5fdHBbdumS pudjYA9mabzqpN9miReEn+z3DAHfT8EeUZwm74xeC1DMPbp4SilKAek7bEPaMwKmg2SF qPXg== 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=NP+mfyp7yqu2j5KfXG9Qzn4OZajPczIq4HuJ4I2UJoA=; b=a1jVK1wrNRA28uBa77i9V5I1HE07YB4AYcuOgl+mWrAmPB8RetvRVWcTZWRpq684Tl lG0Vn3nqtOK50ZuyxzRXT1/IsMPLfPPrAFJxpyRoaSfBolVpE8W+0/ySqV7M+sYWow8c akuPoo91HEWcGy/ptMs2hYNG+DUTjemUmDbYmxAZurkZJddXUHS1egZhhztx6H/OSLw1 EG8HlbdtKwHFpULACmSBoGV+I2X1q65XW8mjisR/jNPtaTfGMCLcQaBKlkbL2Usg1KOV gBszF4cALzVVnYcpg8OmgoEE9e6+J/DG8niYClvHPHX7olPQzEk3aiVBVaOK7y2WFAX0 VhDg== X-Gm-Message-State: AN3rC/6noROC24Kimz1NMM45iBnYrnvUrR2KEI6+3FXA8V9NCdv76PQ7 RuDEaZVid5L0aQ== X-Received: by 10.28.40.198 with SMTP id o189mr7742198wmo.108.1491766721293; Sun, 09 Apr 2017 12:38:41 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Apr 2017 12:38:40 -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 11/19] [media] dvb-frontends/cxd2841er: optionally tune earlier in set_frontend() Date: Sun, 9 Apr 2017 21:38:20 +0200 Message-Id: <20170409193828.18458-12-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 When AUTO_IFHZ is set and the tuner is supposed to provide proper IF speed values, it should be possible to have the tuner setup take place before the demod is configured, else the demod might be configured with either wrong (old), or even no values at all, which obviously will cause issues. To set this behaviour in the most flexible way, this is done with a separate flag instead of making this depend on AUTO_IFHZ. It should be evaluated if tuning shouldn't take place earlier in all cases and hardware constellations. Signed-off-by: Daniel Scheller Acked-by: Abylay Ospan --- drivers/media/dvb-frontends/cxd2841er.c | 14 ++++++++++++-- drivers/media/dvb-frontends/cxd2841er.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 7ca589a..894cb5a 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -3306,6 +3306,10 @@ static int cxd2841er_set_frontend_s(struct dvb_frontend *fe) __func__, (p->delivery_system == SYS_DVBS ? "DVB-S" : "DVB-S2"), p->frequency, symbol_rate, priv->xtal); + + if (priv->flags & CXD2841ER_EARLY_TUNE) + cxd2841er_tuner_set(fe); + switch (priv->state) { case STATE_SLEEP_S: ret = cxd2841er_sleep_s_to_active_s( @@ -3325,7 +3329,8 @@ static int cxd2841er_set_frontend_s(struct dvb_frontend *fe) goto done; } - cxd2841er_tuner_set(fe); + if (!(priv->flags & CXD2841ER_EARLY_TUNE)) + cxd2841er_tuner_set(fe); cxd2841er_tune_done(priv); timeout = ((3000000 + (symbol_rate - 1)) / symbol_rate) + 150; @@ -3365,6 +3370,10 @@ static int cxd2841er_set_frontend_tc(struct dvb_frontend *fe) dev_dbg(&priv->i2c->dev, "%s() delivery_system=%d bandwidth_hz=%d\n", __func__, p->delivery_system, p->bandwidth_hz); + + if (priv->flags & CXD2841ER_EARLY_TUNE) + cxd2841er_tuner_set(fe); + if (p->delivery_system == SYS_DVBT) { priv->system = SYS_DVBT; switch (priv->state) { @@ -3447,7 +3456,8 @@ static int cxd2841er_set_frontend_tc(struct dvb_frontend *fe) if (ret) goto done; - cxd2841er_tuner_set(fe); + if (!(priv->flags & CXD2841ER_EARLY_TUNE)) + cxd2841er_tuner_set(fe); cxd2841er_tune_done(priv); timeout = 2500; diff --git a/drivers/media/dvb-frontends/cxd2841er.h b/drivers/media/dvb-frontends/cxd2841er.h index 90ced97..061e551 100644 --- a/drivers/media/dvb-frontends/cxd2841er.h +++ b/drivers/media/dvb-frontends/cxd2841er.h @@ -28,6 +28,7 @@ #define CXD2841ER_AUTO_IFHZ 2 /* bit 1 */ #define CXD2841ER_TS_SERIAL 4 /* bit 2 */ #define CXD2841ER_ASCOT 8 /* bit 3 */ +#define CXD2841ER_EARLY_TUNE 16 /* bit 4 */ enum cxd2841er_xtal { SONY_XTAL_20500, /* 20.5 MHz */