STRUCT TUNER_PARAMS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct tuner_params(9) πŸŽ€

Okay bestie, welcome to the Kernel API Manual entry for struct tuner_params, aka the little glow-up sheet that tells the kernel how to set up your tuner ✨


πŸ’– NAME πŸ’–

struct tuner_params β€” the parameters used to set up the tuner πŸ’…

Lowkey important context: these are used by drivers/media/tuners/tuner-types.c in order to specify the tuner properties. And most of these parameters? They're for tuners based on the tda9887 IF-PLL multi-standard analog TV/Radio demodulator, which is very common on legacy analog tuners. No cap, that demodulator is everywhere in the old stuff 🫢


⭐ SYNOPSIS ⭐

struct tuner_params {
    enum param_type type;
    unsigned int cb_first_if_lower_freq:1;
    unsigned int has_tda9887:1;
    unsigned int port1_fm_high_sensitivity:1;
    unsigned int port2_fm_high_sensitivity:1;
    unsigned int fm_gain_normal:1;
    unsigned int intercarrier_mode:1;
    unsigned int port1_active:1;
    unsigned int port2_active:1;
    unsigned int port1_invert_for_secam_lc:1;
    unsigned int port2_invert_for_secam_lc:1;
    unsigned int port1_set_for_fm_mono:1;
    unsigned int default_pll_gating_18:1;
    unsigned int radio_if:2;
    signed int default_top_low:5;
    signed int default_top_mid:5;
    signed int default_top_high:5;
    signed int default_top_secam_low:5;
    signed int default_top_secam_mid:5;
    signed int default_top_secam_high:5;
    u16 iffreq;
    unsigned int count;
    const struct tuner_range *ranges;
 };

Look at all those bitfields, she's thriving πŸ¦‹


🌸 Members 🌸

  • type β€” the type of the tuner parameters, as defined at enum param_type. If the tuner supports multiple standards, an array should be used, with one row per different standard. Slay, organized queen πŸ‘‘
  • cb_first_if_lower_freq β€” okay so many Philips-based tuners have a comment in their datasheet that goes a little something like this, and I quote: "For channel selection involving band switching, and to ensure smooth tuning to the desired channel without causing unnecessary charge pump action, it is recommended to consider the difference between wanted channel frequency and the current channel frequency. Unnecessary charge pump action will result in very low tuning voltage which may drive the oscillator to extreme conditions". Set cb_first_if_lower_freq to 1 if this check is required for this tuner. And the lore? I tested this for PAL by first setting the TV frequency to 203 MHz and then switching to 96.6 MHz FM radio. The result was static unless the control byte was sent first. 😭 Iconic field, genuinely.
  • has_tda9887 β€” set to 1 if this tuner uses a tda9887.
  • port1_fm_high_sensitivity β€” many Philips tuners use tda9887 PORT1 to select the FM radio sensitivity. If this setting is 1, then set PORT1 to 1 to get proper FM reception πŸ“»
  • port2_fm_high_sensitivity β€” some Philips tuners use tda9887 PORT2 to select the FM radio sensitivity. If this setting is 1, then set PORT2 to 1 to get proper FM reception πŸ’–
  • fm_gain_normal β€” some Philips tuners use tda9887 cGainNormal to select the FM radio sensitivity. If this setting is 1, the e register will use cGainNormal instead of cGainLow.
  • intercarrier_mode β€” most tuners with a tda9887 use QSS mode. Some (cheaper) tuners use Intercarrier mode. If this setting is 1, then the tuner needs to be set to intercarrier mode. Budget tuners stay budgeting πŸ’€
  • port1_active β€” this sets the default value for PORT1. 0 means inactive, 1 means active. Note: the actual bit value written to the tda9887 is inverted. So a 0 here means a 1 in the B6 bit. Sneaky little flip πŸ™ˆ
  • port2_active β€” this sets the default value for PORT2. 0 means inactive, 1 means active. Note: the actual bit value written to the tda9887 is inverted. So a 0 here means a 1 in the B7 bit. Same energy, different bit ✨
  • port1_invert_for_secam_lc β€” sometimes PORT1 is inverted when the SECAM-L' standard is selected. Set this bit to 1 if this is needed.
  • port2_invert_for_secam_lc β€” sometimes PORT2 is inverted when the SECAM-L' standard is selected. Set this bit to 1 if this is needed.
  • port1_set_for_fm_mono β€” some cards require PORT1 to be 1 for mono Radio FM and 0 for stereo 🎢
  • default_pll_gating_18 β€” select 18% (or according to datasheet 0%) L standard PLL gating, vs the driver default of 36%. Choices were made, bestie.
  • radio_if β€” the IF to use in radio mode. Tuners with a separate radio IF filter seem to use 10.7, while those without use 33.3 for PAL/SECAM tuners and 41.3 for NTSC tuners. So: 0 = 10.7, 1 = 33.3, 2 = 41.3. Three vibes, pick one 🌈
  • default_top_low β€” default tda9887 TOP value in dB for the low band. Default is 0. Range: -16:+15.
  • default_top_mid β€” default tda9887 TOP value in dB for the mid band. Default is 0. Range: -16:+15.
  • default_top_high β€” default tda9887 TOP value in dB for the high band. Default is 0. Range: -16:+15.
  • default_top_secam_low β€” default tda9887 TOP value in dB for SECAM-L/L' for the low band. Default is 0. Several tuners require a different TOP value for the SECAM-L/L' standards. Range: -16:+15.
  • default_top_secam_mid β€” default tda9887 TOP value in dB for SECAM-L/L' for the mid band. Default is 0. Several tuners require a different TOP value for the SECAM-L/L' standards. Range: -16:+15.
  • default_top_secam_high β€” default tda9887 TOP value in dB for SECAM-L/L' for the high band. Default is 0. Several tuners require a different TOP value for the SECAM-L/L' standards. Range: -16:+15.
  • iffreq β€” the Intermediate frequency (IF) used by the tuner on digital mode πŸ“‘
  • count β€” the size of the ranges array. Gotta know how many you're working with, fr fr.
  • ranges β€” the array with the frequency ranges supported by the tuner πŸ‘‘

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./include/media/tuner-types.h, plus these iconic siblings:

  • enum param_type(9)
  • struct tuner_range(9)
  • struct tunertype(9)

Bestie heads up: those 1-bit fields are bitfields, so it's 1 or 0 and nothing in between. Don't come in with a 2 and expect a good time πŸ’€

That's the whole page, you ate it, no crumbs πŸ’… Sourced from ./include/media (struct tuner_params(9), October 2026) β€” go forth and tune something iconic, mwah πŸŽ€πŸ”§πŸ’œ

πŸ“¦ where this page comes from