From patchwork Thu Jun 6 15:45:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gianluca Gennari X-Patchwork-Id: 18805 X-Patchwork-Delegate: mkrufky@linuxtv.org Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1UkcOL-0007qr-8k; Thu, 06 Jun 2013 17:46:21 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-7) with esmtp id 1UkcOI-0003uu-0k; Thu, 06 Jun 2013 17:46:19 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752131Ab3FFPqQ (ORCPT + 1 other); Thu, 6 Jun 2013 11:46:16 -0400 Received: from mail-ea0-f180.google.com ([209.85.215.180]:47916 "EHLO mail-ea0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751340Ab3FFPqP (ORCPT ); Thu, 6 Jun 2013 11:46:15 -0400 Received: by mail-ea0-f180.google.com with SMTP id k10so2868954eaj.11 for ; Thu, 06 Jun 2013 08:46:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=rByZq5H75Ze+n/gh1ShQUBzwV2IQ57Ho7wAxIlmpwjw=; b=0MX+kpSu2LsoHfDzE2U5k8tfEScX2kjzd1KziwjCMRxChSxGqrGyKsmUYk/whv0rJh HpgdY5qFRTnjXNUEdgYQjCEErT577f0Iy4+mav15iwKFTGZCuF0J20kDWiH/D4G8o434 UAgjfPgw9U9B5oaHuI/co8Sl9X1Wjs87B2hOxPJaqLmuWJQjqBHNwvh4RXhdi1t//ZlM ZLmu8I5kdlo1+FO58VAwAoah1IPK0nWv2zH5WJwLAwKkmcVYuyujWttrJQCksaIL4HOq Mq1AvTGCSwXdNCelKK0cZAreehPSC9Wct73cyMzgX3aDY4P02S+CBGNXhP+yraDO1Sqv ySyg== X-Received: by 10.14.181.131 with SMTP id l3mr35073643eem.16.1370533574391; Thu, 06 Jun 2013 08:46:14 -0700 (PDT) Received: from localhost.localdomain (93-50-34-119.ip150.fastwebnet.it. [93.50.34.119]) by mx.google.com with ESMTPSA id l6sm107063845eef.12.2013.06.06.08.46.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Jun 2013 08:46:13 -0700 (PDT) From: Gianluca Gennari To: linux-media@vger.kernel.org, mchehab@redhat.com, crope@iki.fi Cc: mkrufky@linuxtv.org, Gianluca Gennari Subject: [PATCH] r820t: fix imr calibration Date: Thu, 6 Jun 2013 17:45:42 +0200 Message-Id: <1370533542-4432-1-git-send-email-gennarone@gmail.com> X-Mailer: git-send-email 1.8.3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.6.6.153324 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1500_1599 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' The r820t_imr() calibration function of the Rafael Micro R820T tuner generates this error at every tune attempt: r820t 0-001a: No valid PLL values for 2252021 kHz! The function was inspired by the original Realtek driver for rtl2832 devices with the r820t tuner; anyway, in the original code the XTAL frequency of the tuner was expressed in KHz, while in the kernel driver it is expressed in Hz; so the calibration failed because of an out-of-range initial value. The final result of the computation is then passed to the r820t_set_mux() and r820t_set_pll() functions, but the conversion from KHz to Hz is already correctly implemented. Signed-off-by: Gianluca Gennari --- drivers/media/tuners/r820t.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index 4835021..b817110 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -1857,9 +1857,9 @@ static int r820t_imr(struct r820t_priv *priv, unsigned imr_mem, bool im_flag) int reg18, reg19, reg1f; if (priv->cfg->xtal > 24000000) - ring_ref = priv->cfg->xtal / 2; + ring_ref = priv->cfg->xtal / 2000; else - ring_ref = priv->cfg->xtal; + ring_ref = priv->cfg->xtal / 1000; n_ring = 15; for (n = 0; n < 16; n++) {