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: 2681571 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7F880DF23A for ; Thu, 6 Jun 2013 15:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752131Ab3FFPqQ (ORCPT ); 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 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++) {