From patchwork Tue Mar 7 18:57:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9609849 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 20453602B4 for ; Tue, 7 Mar 2017 21:08:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E24872853D for ; Tue, 7 Mar 2017 21:08:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D72B42853F; Tue, 7 Mar 2017 21:08:15 +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 789792853D for ; Tue, 7 Mar 2017 21:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755916AbdCGVHU (ORCPT ); Tue, 7 Mar 2017 16:07:20 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36476 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755797AbdCGVHS (ORCPT ); Tue, 7 Mar 2017 16:07:18 -0500 Received: by mail-wm0-f65.google.com with SMTP id v190so3024771wme.3 for ; Tue, 07 Mar 2017 13:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=FXqMH58fWDFqQ/mYuKYZnKWkOhIusbViqaYdQ2HSUnE=; b=kA1F14uRE79iJkj/mztOoJoeQuhNHe1E9aWF4+8n19iHJIXYavYkPQn6rQd1DZsrP+ BK5rfSyHIWzxyWiMWbCro+yWDN4n0E7GMMAmjGPQUfIyDnhpot84SAsQzPeITdaGcWEP 4UrG1OTefG2McrQiGCaY3Lhpl7Ogd2/Om6JG1tbLhNsIvYNpG9Eogaf/U3E+efgxjhPz ZmmvVRxUprL8VRWtavtobWx9GatY8SXV7Lf8nMIFHaJuaw1nbJXNoXQ0rWr1DFl7Q27V OxSVpuYxGUkFqZ5/5PPhVhYkzNRIH+OCIuI0FlnJYPcQr3sKE4pHaBWIXCs1spv9hWaU Te9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=FXqMH58fWDFqQ/mYuKYZnKWkOhIusbViqaYdQ2HSUnE=; b=ja7fPa8GRsejZf0jBO6Yk96ZP4OzWpNljpK5xBgnmDtTU0gkSjjKXWN5ztpUhwZoyX jSdcQCnxGXagSH5EqXsXj6136Z+gCSjVki/I1xtaTj5XMg9H6kR2c7l+M247KgGA6tfU +GdoQMx6VmVeDTKbGRCvdHFs9Xo5O+XA7vXqfhm/v25BxTmVqmDd1bPxEKYLBQalR0bf ZD7Eu09JjzUt7YX5xphmZTpkPT09j2XBsfPwEu6WunFk9VJCrPAFLOszmYZTPt3v3WKI NSkuvQMynFBzO+c5ScblG0AxmJWSM3wtfdbB/VCiTq0IVP9VXviU6ZWQlmU6qj37NDEF nBVw== X-Gm-Message-State: AMke39liwbVViqfRBOQi7xC9vqvM/EAe5LRb3UyELhkjFo+mgqP14JZQa4KnUXfDgzxATg== X-Received: by 10.28.13.20 with SMTP id 20mr19410001wmn.24.1488913119495; Tue, 07 Mar 2017 10:58:39 -0800 (PST) Received: from dvbdev.wuest.de (ip-178-201-73-185.hsi08.unitymediagroup.de. [178.201.73.185]) by smtp.gmail.com with ESMTPSA id m186sm13760369wmd.21.2017.03.07.10.58.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Mar 2017 10:58:39 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org Subject: [PATCH 12/13] [media] tuners/tda18212: add flag for retrying tuner init on failure Date: Tue, 7 Mar 2017 19:57:26 +0100 Message-Id: <20170307185727.564-13-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170307185727.564-1-d.scheller.oss@gmail.com> References: <20170307185727.564-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 Taken from tda18212dd, first read after cold reset sometimes fails on some cards, trying twice shall do the trick. This is the case with the STV0367 demods soldered on the CineCTv6 bridge boards and older DuoFlex CT modules. All other users (configs) of the tda18212 are updated as well to be sure they won't be affected at all by this change. Signed-off-by: Daniel Scheller --- drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c | 1 + drivers/media/tuners/tda18212.c | 5 +++++ drivers/media/tuners/tda18212.h | 7 +++++++ drivers/media/usb/dvb-usb-v2/anysee.c | 2 ++ drivers/media/usb/em28xx/em28xx-dvb.c | 1 + 5 files changed, 16 insertions(+) diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c index 2c0015b..03688ee 100644 --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-dvb.c @@ -111,6 +111,7 @@ static struct tda18212_config tda18212_conf = { .if_dvbt_7 = 4150, .if_dvbt_8 = 4500, .if_dvbc = 5000, + .init_flags = 0, }; int c8sectpfe_frontend_attach(struct dvb_frontend **fe, diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c index 7b80683..2488537 100644 --- a/drivers/media/tuners/tda18212.c +++ b/drivers/media/tuners/tda18212.c @@ -220,6 +220,11 @@ static int tda18212_probe(struct i2c_client *client, fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */ ret = regmap_read(dev->regmap, 0x00, &chip_id); + + /* retry probe if desired */ + if (ret && (cfg->init_flags & TDA18212_INIT_RETRY)) + ret = regmap_read(dev->regmap, 0x00, &chip_id); + dev_dbg(&dev->client->dev, "chip_id=%02x\n", chip_id); if (fe->ops.i2c_gate_ctrl) diff --git a/drivers/media/tuners/tda18212.h b/drivers/media/tuners/tda18212.h index 6391daf..717aa2c 100644 --- a/drivers/media/tuners/tda18212.h +++ b/drivers/media/tuners/tda18212.h @@ -23,6 +23,8 @@ #include "dvb_frontend.h" +#define TDA18212_INIT_RETRY (1 << 0) + struct tda18212_config { u16 if_dvbt_6; u16 if_dvbt_7; @@ -36,6 +38,11 @@ struct tda18212_config { u16 if_atsc_qam; /* + * flags for tuner init control + */ + u32 init_flags; + + /* * pointer to DVB frontend */ struct dvb_frontend *fe; diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index 6795c0c..c35b66e 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c @@ -332,6 +332,7 @@ static struct tda18212_config anysee_tda18212_config = { .if_dvbt_7 = 4150, .if_dvbt_8 = 4150, .if_dvbc = 5000, + .init_flags = 0, }; static struct tda18212_config anysee_tda18212_config2 = { @@ -342,6 +343,7 @@ static struct tda18212_config anysee_tda18212_config2 = { .if_dvbt2_7 = 4000, .if_dvbt2_8 = 4000, .if_dvbc = 5000, + .init_flags = 0, }; static struct cx24116_config anysee_cx24116_config = { diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index 82edd37..143efb0 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -380,6 +380,7 @@ static struct tda18271_config kworld_ub435q_v2_config = { static struct tda18212_config kworld_ub435q_v3_config = { .if_atsc_vsb = 3600, .if_atsc_qam = 3600, + .init_flags = 0, }; static struct zl10353_config em28xx_zl10353_xc3028_no_i2c_gate = {