android_kernel_xiaomi_sm8350/drivers/media/common/tuners
Seth Barry a57c1dcb93 V4L/DVB (13109): tda18271: fix signedness issue in tda18271_rf_tracking_filters_init
While having tda18271 module set with debug=17 (cal & info prints) and
cal=0 (delay calibration process until first use) - I discovered that
during the calibration process, if the frequency test for 69750000
returned a bcal of 0 (see tda18721-fe.c in tda18271_powerscan func) that
the tuner wouldn't be able to pickup any of the frequencies in the range
(all the other frequencies bands returned bcal=1).  I spent some time
going over the code and the NXP's tda18271 spec (ver.4 of it i think) and
adding a lot of debug prints and walking/stepping through the calibration
process.  I found that when the powerscan fails to find a frequency, the
rf calibration is not run and the default value is supposed to be used in
its place (pulled from the RF_CAL_map table) - but something was getting
goofed up there.

Now, my c coding skills are very rusty, but i think root of the problem is
a signedness issue with the math operation for calculating the rf_a1 and
rf_a2 values in tda18271_rf_tracking_filters_init func, which results in
values like 20648 for rf_a1 (when it should probably have a value like 0,
or so slightly negative that it should be zero - this bad value for rf_a1
would in turn makes the approx calc within
tda18271c2_rf_tracking_filters_correction go out of whack).  The simplest
solution i found was to explicitly convert the signedness of the
denominator to avoid the implicit conversion.  The values placed into the
u32 rf_freq array should never exceed about 900mhz, so i think the s32 max
value shouldn't be an issue in this case.

I've tested it out a little, and even when i get a bcal=0 with the
modified code, the default calibration value gets used, rf_a1 is zero, and
the tuner seems to lock on the stream and mythtv seems to play it fine.

Signed-off-by: Seth Barry <seth@cyberseth.com>
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
CC: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-11-07 12:55:04 -02:00
..
Kconfig
Makefile
mc44s803_priv.h
mc44s803.c
mc44s803.h
mt20xx.c
mt20xx.h
mt2060_priv.h
mt2060.c
mt2060.h
mt2131_priv.h
mt2131.c
mt2131.h
mt2266.c
mt2266.h
mxl5005s.c
mxl5005s.h
mxl5007t.c
mxl5007t.h
qt1010_priv.h
qt1010.c
qt1010.h
tda827x.c
tda827x.h
tda8290.c
tda8290.h
tda9887.c
tda9887.h
tda18271-common.c V4L/DVB (12868): tda18271: improve error log in function tda18271_write_regs 2009-09-19 00:13:48 -03:00
tda18271-fe.c V4L/DVB (13109): tda18271: fix signedness issue in tda18271_rf_tracking_filters_init 2009-11-07 12:55:04 -02:00
tda18271-maps.c V4L/DVB (12871): tda18271: fix bad data in tda18271_cid_target table 2009-09-19 00:13:52 -03:00
tda18271-priv.h V4L/DVB (12864): tda18271: change output feature configuration to a bitmask 2009-09-19 00:13:43 -03:00
tda18271.h V4L/DVB (12864): tda18271: change output feature configuration to a bitmask 2009-09-19 00:13:43 -03:00
tea5761.c
tea5761.h
tea5767.c
tea5767.h
tuner-i2c.h
tuner-simple.c V4L/DVB (12573): FM1216MK5 FM radio 2009-09-12 12:19:33 -03:00
tuner-simple.h
tuner-types.c V4L/DVB (12964): tuner-core: add support for NXP TDA18271 without TDA829X demod 2009-09-19 00:16:01 -03:00
tuner-xc2028-types.h
tuner-xc2028.c
tuner-xc2028.h
xc5000.c
xc5000.h