Hi Mauro, On 12/19/19 7:13 AM, Mauro Carvalho Chehab wrote: > Em Sun, 24 Nov 2019 07:09:07 +0200 > Antti Palosaari <crope@xxxxxx> escreveu: > >> On 11/14/19 10:03 PM, Brad Love wrote: >>> Include set_analog_params, get_frequency, and get_bandwidth. >>> >>> Tested with NTSC and PAL standards via ch3/4 generator. Other standards >>> are included, but are untested due to lack of generator. >>> >>> Signed-off-by: Brad Love <brad@xxxxxxxxxxxxxxxx> >>> --- >>> Changes since v1: >>> - remove __func__ from dev_dbg macros >> After all it looks pretty simply, but implementation is not done that >> simply. Crazy RF/IF offsets, impossible values and so. >> >> I think you need to study some tuner basics: >> * what IF frequency is, why, and so >> * IF vs. BW, what is relation, what are possible values >> * Down conversion RF to IF. OK, *on that case* firmware covers PLL, but >> it is fundamental. So basics of integer-N and fractional-N PLL is always >> you must to know. >> * Filtering. Especially IF filtering, which is generally low-pass >> filtering. Think possible filters when selecting IF. > For me, the implementation seems to make sense. I mean, for analog TV, both > channel bandwidth and chroma/audio sub-carrier IF depends on the TV standard > only. > > So, for NTSC and PAL/M/N/N', bandwidth is always 6MHz. For other standards, it > may be either 6MHz, 7MHz or 8MHz. the actual bandwidth depends if it is > a channel at VHF or at UHF range. > > So, this part of the patch sounds OK to me. > > The IF is actually a little trickier. Yet, if you take a lok on other > tuners, like drivers/media/tuners/tda827x.c, it is up tot he tuner to > automatically set the IF that will work for each video standard: > > static void tda827x_set_std(struct dvb_frontend *fe, > struct analog_parameters *params) > { > struct tda827x_priv *priv = fe->tuner_priv; > char *mode; > > priv->lpsel = 0; > if (params->std & V4L2_STD_MN) { > priv->sgIF = 92; > priv->lpsel = 1; > mode = "MN"; > } else if (params->std & V4L2_STD_B) { > priv->sgIF = 108; > mode = "B"; > ... > > static int tda827xo_set_analog_params(struct dvb_frontend *fe, > struct analog_parameters *params) > { > > ... > > N = freq + priv->sgIF; > > In other words, for analog TV, the tuner will always receive the > channel central frequency, with may vary depending on the video > standard, and will adjust it to tune at the right channel, using the > per-standard IF (if needed), as, on most tuner drivers, the tunning > frequency should be either initial frequency or the main carrier > frequency, and not the center frequency. > > > Cheers, > Mauro This code has been widely tested by multiple Hauppauge customers across North America and Europe. This code has been in use by various parties for years, with zero issues reported. I am merely working to upstream all of the code we have generated over the years. It took a while for me to get tester and test bench time, but included below is results from using an analog generator and testing channels across the entire frequency range for ATSC and PAL-I analog TV channels. First lock and signal strength were verified, then video and audio signal decoding was verified. Decoding is flawless on every channel tried. Software used for validation is scantv, tvtime, vlc, and qv4l2. Cheers, Brad $ ######################### $ # USA ATSC TESTING $ ######################### $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 5 ( 77.25 MHz): ??? [unknown (5)] channel = 5 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 10 (193.25 MHz): ??? [unknown (10)] channel = 10 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 17 (489.25 MHz): ??? [unknown (17)] channel = 17 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 30 (567.25 MHz): ??? [unknown (30)] channel = 30 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 40 (627.25 MHz): ??? [unknown (40)] channel = 40 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 50 (687.25 MHz): ??? [unknown (50)] channel = 50 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 60 (747.25 MHz): ??? [unknown (60)] channel = 60 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 70 (807.25 MHz): ??? [unknown (70)] channel = 70 <...> $ $ scantv -n NTSC-M -f us-bcast vid-open-auto: using analog TV device /dev/video0 [global] freqtab = us-bcast [defaults] input = Television norm = NTSC-M scanning channel list us-bcast... <...> 83 (885.25 MHz): ??? [unknown (83)] channel = 83 $ ######################### $ # EUROPEAN PAL-I TESTING $ ######################### $ $ scantv -n PAL-I -f europe-west vid-open-auto: using analog TV device /dev/video0 [global] freqtab = europe-west [defaults] input = Television norm = PAL-I scanning channel list europe-west... <...> 21 (471.25 MHz): ??? [unknown (21)] channel = 21 <...> $ $ scantv -n PAL-I -f europe-west vid-open-auto: using analog TV device /dev/video0 [global] freqtab = europe-west [defaults] input = Television norm = PAL-I scanning channel list europe-west... <...> 30 (543.25 MHz): ??? [unknown (30)] channel = 30 <...> $ $ scantv -n PAL-I -f europe-west vid-open-auto: using analog TV device /dev/video0 [global] freqtab = europe-west [defaults] input = Television norm = PAL-I scanning channel list europe-west... <...> 40 (623.25 MHz): ??? [unknown (40)] channel = 40 <...> $ $ scantv -n PAL-I -f europe-west vid-open-auto: using analog TV device /dev/video0 [global] freqtab = europe-west [defaults] input = Television norm = PAL-I scanning channel list europe-west... <...> 50 (703.25 MHz): ??? [unknown (50)] channel = 50 <...> $ $ scantv -n PAL-I -f europe-west vid-open-auto: using analog TV device /dev/video0 [global] freqtab = europe-west [defaults] input = Television norm = PAL-I scanning channel list europe-west... <...> 60 (783.25 MHz): ??? [unknown (60)] channel = 60 <...> $ $ scantv -n PAL-I -f europe-west vid-open-auto: using analog TV device /dev/video0 [global] freqtab = europe-west [defaults] input = Television norm = PAL-I scanning channel list europe-west... <...> 68 (847.25 MHz): ??? [unknown (68)] channel = 68 <...> $ $ $