Fix type of prog_cal and prog_tab variables to avoid any possible
calculation errors.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Misplaced parenthesis cause a calculation bug in
tda18271_rf_tracking_filters_init
Thanks to Stefan Sibiga for pointing this out.
Cc: Stefan Sibiga <stefansibiga@yahoo.ca>
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Instead of doing:
[ 82.581639] tda18271 4-0060: creating new instance
[ 82.588411] Unknown device detected @ 4-0060, device not supported.
[ 82.594695] tda18271_attach: [4-0060|M] error -22 on line 1272
[ 82.600530] tda18271 4-0060: destroying instance
Print:
[ 468.740392] Unknown device (0) detected @ 4-0060, device not supported.
for the error message, to help detecting what's going wrong with the
device.
This helps to detect when the driver is using the wrong I2C bus (or have
the i2g gate switch pointing to the wrong place), on devices like cx231xx
that just return 0 on reads to a non-existent i2c device.
Reviewed-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Fix error detection of failures during initialization of first instance:
Dont pass a function into the tda_fail macro. Instead, save the function
return value and pass that into the tda_fail macro.
This prevents the function from being called twice in cases of failure,
for example:
[19026.074070] tuner 4-0060: chip found @ 0xc0 (device #0)
[19026.087755] tda18271 4-0060: creating new instance
[19026.089965] Unknown device detected @ 4-0060, device not supported.
[19026.092233] Unknown device detected @ 4-0060, device not supported.
[19026.092241] tda18271_attach: [4-0060|M] error -22 on line 1275
[19026.092327] tda18271 4-0060: destroying instance
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
In the changeset entitled, "tda18271: add support for the set_config method",
the initialization order was changed such that the standard map overrides
were being applied before loading the default standard map, based on the
stepping of the silicon. This changeset restores the proper order by
processing the standard map overrides both within the tda18271_set_config()
and the tda18271_attach() functions, after we read the id register of the
tuner.
Thanks to Michael Obst for his testing, helping me to identify the regression.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Michael Obst <mike.obst@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
consolidate common code used to determine if calibration on startup is needed
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
If rf_cal_on_startup is enabled in the structure passed into
tda18271_attach, and the cal module option isn't disabled, then we
should run the initialization and calibration procedures during the
tda18271_attach function call, regardless of how many instances of the
driver have been attached. If the device is already calibrated, the
driver will detect that and will only calibrate again if necessary.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
If rf_cal_on_startup is enabled in the structure passed into
tda18271_set_config, and the cal module option isn't disabled,
then we should run the initialization and calibration procedures
during the tda18271_set_config function call.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Add the set_config method to allow drivers to configure the
tda18271 driver options after attach.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
There is already an option for sending 16 byte chunks rather that writing
39 bytes all at once during the tuner's initialization. Some i2c buses
can't send 16 bytes at once, so create an option for sending 8 byte chunks.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Convert tda18271_rf_tracking_filter_cal.rf_[ab][12] from int to s32.
Convert tda18271_priv.tm_rfcal from unsigned int to u8.
Cast subtractions between u32 values as s32.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Use temporary variables for signed calulations between unsigned values
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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>
Multiplication by 62500 causes an overflow in the 32 bit freq variable,
which is later divided by 1000 when using FM radio.
This patch prevents the overflow by scaling the frequency value correctly
upfront. Thanks to Henk Vergonet for spotting the problem and providing
a preliminary patch, which this changeset was based upon.
Cc: Henk Vergonet <Henk.Vergonet@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
CC: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Update the tda18271c2_rf_tracking_filters_correction function to include
the modified temperature compensation calculatation formula as described
in Rev.04 of the TDA18271HD datasheet.
Signed-off-by: Henk Vergonet <Henk.Vergonet@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Don't display "no agc configuration provided" unless DBG_ADV is set.
Fix comments in function, tda18271_agc. This config variable is not
for LNA configuration -- it is for external AGC configuration.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
For the case of multiple tuner instances, ensure that non-default
configuration options are saved into the driver's state.
This resolves an issue where a configuration option may not be
carried into the driver if the analog side of a hybrid driver
initializes before the digital side.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
minor cleanup: move small_i2c assignment to the state config block
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
For better readability, treat the low power standby mode configuration
as an output option feature configuration, and change it to a bitmask.
If left unconfigured, all features will remain enabled, just as the
default configuration was before these changes were introduced.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
By default, the driver enters standby mode with slave tuner output
loop thru enabled and xtal oscillator on.
Not all designs require that slave tuner output loop thru and
xtal oscillator remain active while in standby mode, so two
additional standby modes have been added:
- standby mode with xtal oscillator on (loop thru off)
- total power off
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
On certain master / slave dual tuner configurations, tuning performance
improves when the RF tracking filter calibration is performed sequentially.
This patch allows for the bridge driver to specify this behavior in the
configuration structure at attach-time.
The "cal" module option will continue to override this attach-time
configuration: set cal=0 to prevent RF tracking filter calibration
on startup, and set cal=1 to force it.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Reviewed-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The tda827x driver supports a feature that the tda18271 driver was lacking
until now. This patch adds support for device-level configuration via the
tuner callback configuration interface.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The break after the return or goto serves no purpose.
Signed-off-by: Julia Lawall <julia@diku.dk>
Reviewed-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Having the thermometer on during channel configuration
could cause tuning instability.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
The IF notch bit gets unset when we update the Main Post Div register
value, before we have a chance to write the desired IF notch setting
to the tuner. Move the IF notch configuration to after we update MPD.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Abort rf band calibration loop for the TDA18271HD/C2 if an error is detected.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
There were several issues in the past, caused by the hybrid tuner design, since
now, the same tuner can be used by drivers/media/dvb and drivers/media/video.
Kconfig items were rearranged, to split V4L/DVB core from their drivers.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2008-04-29 18:41:37 -03:00
Renamed from drivers/media/dvb/frontends/tda18271-fe.c (Browse further)