On Sun, Sep 27, 2009 at 12:25 PM, Michael Krufky <mkrufky@xxxxxxxxxxxxxx> wrote: > On Thu, Sep 24, 2009 at 5:42 PM, <spam@xxxxxxxxxxxxxxxxx> wrote: >> On Thu, Sep 24, 2009 at 02:46:06PM -0400, Michael Krufky wrote: >>> On Tue, Sep 22, 2009 at 5:05 PM, <spam@xxxxxxxxxxxxxxxxx> wrote: >>> > >>> > 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 >> ... >>> > - freq = freq / 1000; >>> > + freq = params->frequency * 625; >>> > + freq = freq / 10; >> >> Hmm now that I review my own patch: >> >> - freq = freq / 1000; >> + freq = params->frequency * 125; >> + freq = freq / 2; >> >> might even be better... > > Henk, > > That certainly is better, but I am going to go with an even simpler & > cleaner approach: > > diff -r f52640ced9e8 linux/drivers/media/common/tuners/tda18271-fe.c > --- a/linux/drivers/media/common/tuners/tda18271-fe.c Tue Sep 15 > 01:25:35 2009 -0400 > +++ b/linux/drivers/media/common/tuners/tda18271-fe.c Sun Sep 27 > 12:21:37 2009 -0400 > @@ -1001,12 +1001,12 @@ > struct tda18271_std_map_item *map; > char *mode; > int ret; > - u32 freq = params->frequency * 62500; > + u32 freq = params->frequency * > + ((params->mode == V4L2_TUNER_RADIO) ? 125 / 2 : 62500); > > priv->mode = TDA18271_ANALOG; > > if (params->mode == V4L2_TUNER_RADIO) { > - freq = freq / 1000; > map = &std_map->fm_radio; > mode = "fm"; > } else if (params->std & V4L2_STD_MN) { > > > You still get the credit for spotting the problem & providing the > original fix -- thanks again! I'm going to push this along with the > others today. On a second thought, I see that my above patch loses some precision ... this is even better: diff -r f52640ced9e8 linux/drivers/media/common/tuners/tda18271-fe.c --- a/linux/drivers/media/common/tuners/tda18271-fe.c Tue Sep 15 01:25:35 2009 -0400 +++ b/linux/drivers/media/common/tuners/tda18271-fe.c Sun Sep 27 12:33:20 2009 -0400 @@ -1001,12 +1001,12 @@ struct tda18271_std_map_item *map; char *mode; int ret; - u32 freq = params->frequency * 62500; + u32 freq = params->frequency * 125 * + ((params->mode == V4L2_TUNER_RADIO) ? 1 : 1000) / 2; priv->mode = TDA18271_ANALOG; if (params->mode == V4L2_TUNER_RADIO) { - freq = freq / 1000; map = &std_map->fm_radio; mode = "fm"; } else if (params->std & V4L2_STD_MN) { Cheers, Mike -- 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