From patchwork Tue Sep 22 21:05:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: spam@systol-ng.god.lan X-Patchwork-Id: 49426 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8ML5Khk014466 for ; Tue, 22 Sep 2009 21:05:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751556AbZIVVFP (ORCPT ); Tue, 22 Sep 2009 17:05:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750978AbZIVVFP (ORCPT ); Tue, 22 Sep 2009 17:05:15 -0400 Received: from ip78-183-211-87.adsl2.static.versatel.nl ([87.211.183.78]:40759 "EHLO god.dyndns.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751377AbZIVVFO (ORCPT ); Tue, 22 Sep 2009 17:05:14 -0400 Received: by god.dyndns.org (Postfix, from userid 1005) id 2BC6411B618C; Tue, 22 Sep 2009 23:05:00 +0200 (CEST) Date: Tue, 22 Sep 2009 23:05:00 +0200 From: spam@systol-ng.god.lan To: linux-media@vger.kernel.org Cc: mkrufky@gmail.com Subject: [PATCH 1/4] tda18271_set_analog_params major bugfix Message-ID: <20090922210500.GA8661@systol-ng.god.lan> Reply-To: Henk.Vergonet@gmail.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Multiplication by 62500 causes an overflow in the 32 bits "freq" register when using radio. FM radio reception on a Zolid Hybrid PCI is now working. Other tda18271 configurations may also benefit from this change ;) Signed-off-by: Henk.Vergonet@gmail.com Signed-off-by: Michael Krufky --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -r 29e4ba1a09bc linux/drivers/media/common/tuners/tda18271-fe.c --- a/linux/drivers/media/common/tuners/tda18271-fe.c Sat Sep 19 09:45:22 2009 -0300 +++ b/linux/drivers/media/common/tuners/tda18271-fe.c Tue Sep 22 22:06:31 2009 +0200 @@ -1001,38 +1020,43 @@ struct tda18271_std_map_item *map; char *mode; int ret; - u32 freq = params->frequency * 62500; + u32 freq; priv->mode = TDA18271_ANALOG; if (params->mode == V4L2_TUNER_RADIO) { - freq = freq / 1000; + freq = params->frequency * 625; + freq = freq / 10; map = &std_map->fm_radio; mode = "fm"; - } else if (params->std & V4L2_STD_MN) { - map = &std_map->atv_mn; - mode = "MN"; - } else if (params->std & V4L2_STD_B) { - map = &std_map->atv_b; - mode = "B"; - } else if (params->std & V4L2_STD_GH) { - map = &std_map->atv_gh; - mode = "GH"; - } else if (params->std & V4L2_STD_PAL_I) { - map = &std_map->atv_i; - mode = "I"; - } else if (params->std & V4L2_STD_DK) { - map = &std_map->atv_dk; - mode = "DK"; - } else if (params->std & V4L2_STD_SECAM_L) { - map = &std_map->atv_l; - mode = "L"; - } else if (params->std & V4L2_STD_SECAM_LC) { - map = &std_map->atv_lc; - mode = "L'"; } else { - map = &std_map->atv_i; - mode = "xx"; + freq = params->frequency * 62500; + + if (params->std & V4L2_STD_MN) { + map = &std_map->atv_mn; + mode = "MN"; + } else if (params->std & V4L2_STD_B) { + map = &std_map->atv_b; + mode = "B"; + } else if (params->std & V4L2_STD_GH) { + map = &std_map->atv_gh; + mode = "GH"; + } else if (params->std & V4L2_STD_PAL_I) { + map = &std_map->atv_i; + mode = "I"; + } else if (params->std & V4L2_STD_DK) { + map = &std_map->atv_dk; + mode = "DK"; + } else if (params->std & V4L2_STD_SECAM_L) { + map = &std_map->atv_l; + mode = "L"; + } else if (params->std & V4L2_STD_SECAM_LC) { + map = &std_map->atv_lc; + mode = "L'"; + } else { + map = &std_map->atv_i; + mode = "xx"; + } } tda_dbg("setting tda18271 to system %s\n", mode);