[PATCH 1/4] tda18271_set_analog_params major bugfix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx

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);
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux