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