Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * descriptions for simple tuners.
0004  */
0005 
0006 #ifndef __TUNER_TYPES_H__
0007 #define __TUNER_TYPES_H__
0008 
0009 /**
0010  * enum param_type - type of the tuner pameters
0011  *
0012  * @TUNER_PARAM_TYPE_RADIO: Tuner params are for FM and/or AM radio
0013  * @TUNER_PARAM_TYPE_PAL:   Tuner params are for PAL color TV standard
0014  * @TUNER_PARAM_TYPE_SECAM: Tuner params are for SECAM color TV standard
0015  * @TUNER_PARAM_TYPE_NTSC:  Tuner params are for NTSC color TV standard
0016  * @TUNER_PARAM_TYPE_DIGITAL:   Tuner params are for digital TV
0017  */
0018 enum param_type {
0019     TUNER_PARAM_TYPE_RADIO,
0020     TUNER_PARAM_TYPE_PAL,
0021     TUNER_PARAM_TYPE_SECAM,
0022     TUNER_PARAM_TYPE_NTSC,
0023     TUNER_PARAM_TYPE_DIGITAL,
0024 };
0025 
0026 /**
0027  * struct tuner_range - define the frequencies supported by the tuner
0028  *
0029  * @limit:      Max frequency supported by that range, in 62.5 kHz
0030  *          (TV) or 62.5 Hz (Radio), as defined by
0031  *          V4L2_TUNER_CAP_LOW.
0032  * @config:     Value of the band switch byte (BB) to setup this mode.
0033  * @cb:         Value of the CB byte to setup this mode.
0034  *
0035  * Please notice that digital tuners like xc3028/xc4000/xc5000 don't use
0036  * those ranges, as they're defined inside the driver. This is used by
0037  * analog tuners that are compatible with the "Philips way" to setup the
0038  * tuners. On those devices, the tuner set is done via 4 bytes:
0039  *
0040  *  #) divider byte1 (DB1)
0041  *  #) divider byte 2 (DB2)
0042  *  #) Control byte (CB)
0043  *  #) band switch byte (BB)
0044  *
0045  * Some tuners also have an additional optional Auxiliary byte (AB).
0046  */
0047 struct tuner_range {
0048     unsigned short limit;
0049     unsigned char config;
0050     unsigned char cb;
0051 };
0052 
0053 /**
0054  * struct tuner_params - Parameters to be used to setup the tuner. Those
0055  *           are used by drivers/media/tuners/tuner-types.c in
0056  *           order to specify the tuner properties. Most of
0057  *           the parameters are for tuners based on tda9887 IF-PLL
0058  *           multi-standard analog TV/Radio demodulator, with is
0059  *           very common on legacy analog tuners.
0060  *
0061  * @type:           Type of the tuner parameters, as defined at
0062  *              enum param_type. If the tuner supports multiple
0063  *              standards, an array should be used, with one
0064  *              row per different standard.
0065  * @cb_first_if_lower_freq: Many Philips-based tuners have a comment in
0066  *              their datasheet like
0067  *              "For channel selection involving band
0068  *              switching, and to ensure smooth tuning to the
0069  *              desired channel without causing unnecessary
0070  *              charge pump action, it is recommended to
0071  *              consider the difference between wanted channel
0072  *              frequency and the current channel frequency.
0073  *              Unnecessary charge pump action will result
0074  *              in very low tuning voltage which may drive the
0075  *              oscillator to extreme conditions".
0076  *              Set cb_first_if_lower_freq to 1, if this check
0077  *              is required for this tuner. I tested this for
0078  *              PAL by first setting the TV frequency to
0079  *              203 MHz and then switching to 96.6 MHz FM
0080  *              radio. The result was static unless the
0081  *              control byte was sent first.
0082  * @has_tda9887:        Set to 1 if this tuner uses a tda9887
0083  * @port1_fm_high_sensitivity:  Many Philips tuners use tda9887 PORT1 to select
0084  *              the FM radio sensitivity. If this setting is 1,
0085  *              then set PORT1 to 1 to get proper FM reception.
0086  * @port2_fm_high_sensitivity:  Some Philips tuners use tda9887 PORT2 to select
0087  *              the FM radio sensitivity. If this setting is 1,
0088  *              then set PORT2 to 1 to get proper FM reception.
0089  * @fm_gain_normal:     Some Philips tuners use tda9887 cGainNormal to
0090  *              select the FM radio sensitivity. If this
0091  *              setting is 1, e register will use cGainNormal
0092  *              instead of cGainLow.
0093  * @intercarrier_mode:      Most tuners with a tda9887 use QSS mode.
0094  *              Some (cheaper) tuners use Intercarrier mode.
0095  *              If this setting is 1, then the tuner needs to
0096  *              be set to intercarrier mode.
0097  * @port1_active:       This setting sets the default value for PORT1.
0098  *              0 means inactive, 1 means active. Note: the
0099  *              actual bit value written to the tda9887 is
0100  *              inverted. So a 0 here means a 1 in the B6 bit.
0101  * @port2_active:       This setting sets the default value for PORT2.
0102  *              0 means inactive, 1 means active. Note: the
0103  *              actual bit value written to the tda9887 is
0104  *              inverted. So a 0 here means a 1 in the B7 bit.
0105  * @port1_invert_for_secam_lc:  Sometimes PORT1 is inverted when the SECAM-L'
0106  *              standard is selected. Set this bit to 1 if this
0107  *              is needed.
0108  * @port2_invert_for_secam_lc:  Sometimes PORT2 is inverted when the SECAM-L'
0109  *              standard is selected. Set this bit to 1 if this
0110  *              is needed.
0111  * @port1_set_for_fm_mono:  Some cards require PORT1 to be 1 for mono Radio
0112  *              FM and 0 for stereo.
0113  * @default_pll_gating_18:  Select 18% (or according to datasheet 0%)
0114  *              L standard PLL gating, vs the driver default
0115  *              of 36%.
0116  * @radio_if:           IF to use in radio mode.  Tuners with a
0117  *              separate radio IF filter seem to use 10.7,
0118  *              while those without use 33.3 for PAL/SECAM
0119  *              tuners and 41.3 for NTSC tuners.
0120  *              0 = 10.7, 1 = 33.3, 2 = 41.3
0121  * @default_top_low:        Default tda9887 TOP value in dB for the low
0122  *              band. Default is 0. Range: -16:+15
0123  * @default_top_mid:        Default tda9887 TOP value in dB for the mid
0124  *              band. Default is 0. Range: -16:+15
0125  * @default_top_high:       Default tda9887 TOP value in dB for the high
0126  *              band. Default is 0. Range: -16:+15
0127  * @default_top_secam_low:  Default tda9887 TOP value in dB for SECAM-L/L'
0128  *              for the low band. Default is 0. Several tuners
0129  *              require a different TOP value for the
0130  *              SECAM-L/L' standards. Range: -16:+15
0131  * @default_top_secam_mid:  Default tda9887 TOP value in dB for SECAM-L/L'
0132  *              for the mid band. Default is 0. Several tuners
0133  *              require a different TOP value for the
0134  *              SECAM-L/L' standards. Range: -16:+15
0135  * @default_top_secam_high: Default tda9887 TOP value in dB for SECAM-L/L'
0136  *              for the high band. Default is 0. Several tuners
0137  *              require a different TOP value for the
0138  *              SECAM-L/L' standards. Range: -16:+15
0139  * @iffreq:         Intermediate frequency (IF) used by the tuner
0140  *              on digital mode.
0141  * @count:          Size of the ranges array.
0142  * @ranges:         Array with the frequency ranges supported by
0143  *              the tuner.
0144  */
0145 struct tuner_params {
0146     enum param_type type;
0147 
0148     unsigned int cb_first_if_lower_freq:1;
0149     unsigned int has_tda9887:1;
0150     unsigned int port1_fm_high_sensitivity:1;
0151     unsigned int port2_fm_high_sensitivity:1;
0152     unsigned int fm_gain_normal:1;
0153     unsigned int intercarrier_mode:1;
0154     unsigned int port1_active:1;
0155     unsigned int port2_active:1;
0156     unsigned int port1_invert_for_secam_lc:1;
0157     unsigned int port2_invert_for_secam_lc:1;
0158     unsigned int port1_set_for_fm_mono:1;
0159     unsigned int default_pll_gating_18:1;
0160     unsigned int radio_if:2;
0161     signed int default_top_low:5;
0162     signed int default_top_mid:5;
0163     signed int default_top_high:5;
0164     signed int default_top_secam_low:5;
0165     signed int default_top_secam_mid:5;
0166     signed int default_top_secam_high:5;
0167 
0168     u16 iffreq;
0169 
0170     unsigned int count;
0171     struct tuner_range *ranges;
0172 };
0173 
0174 /**
0175  * struct tunertype - describes the known tuners.
0176  *
0177  * @name:   string with the tuner's name.
0178  * @count:  size of &struct tuner_params array.
0179  * @params: pointer to &struct tuner_params array.
0180  *
0181  * @min:    minimal tuner frequency, in 62.5 kHz step.
0182  *      should be multiplied to 16 to convert to MHz.
0183  * @max:    minimal tuner frequency, in 62.5 kHz step.
0184  *      Should be multiplied to 16 to convert to MHz.
0185  * @stepsize:   frequency step, in Hz.
0186  * @initdata:   optional byte sequence to initialize the tuner.
0187  * @sleepdata:  optional byte sequence to power down the tuner.
0188  */
0189 struct tunertype {
0190     char *name;
0191     unsigned int count;
0192     struct tuner_params *params;
0193 
0194     u16 min;
0195     u16 max;
0196     u32 stepsize;
0197 
0198     u8 *initdata;
0199     u8 *sleepdata;
0200 };
0201 
0202 extern struct tunertype tuners[];
0203 extern unsigned const int tuner_count;
0204 
0205 #endif