xref: /linux/include/media/tuner-types.h (revision 7022b15e2a9f878fd5184586064c63352c3dd225)
17b0ac9cdSMichael Krufky /*
27b0ac9cdSMichael Krufky  * descriptions for simple tuners.
37b0ac9cdSMichael Krufky  */
47b0ac9cdSMichael Krufky 
57b0ac9cdSMichael Krufky #ifndef __TUNER_TYPES_H__
67b0ac9cdSMichael Krufky #define __TUNER_TYPES_H__
77b0ac9cdSMichael Krufky 
87b0ac9cdSMichael Krufky enum param_type {
962325497SMichael Krufky 	TUNER_PARAM_TYPE_RADIO,
1062325497SMichael Krufky 	TUNER_PARAM_TYPE_PAL,
1162325497SMichael Krufky 	TUNER_PARAM_TYPE_SECAM,
1262325497SMichael Krufky 	TUNER_PARAM_TYPE_NTSC,
1362325497SMichael Krufky 	TUNER_PARAM_TYPE_DIGITAL,
147b0ac9cdSMichael Krufky };
157b0ac9cdSMichael Krufky 
167b0ac9cdSMichael Krufky struct tuner_range {
177b0ac9cdSMichael Krufky 	unsigned short limit;
183fc46d35SMichael Krufky 	unsigned char config;
197b0ac9cdSMichael Krufky 	unsigned char cb;
207b0ac9cdSMichael Krufky };
217b0ac9cdSMichael Krufky 
227b0ac9cdSMichael Krufky struct tuner_params {
237b0ac9cdSMichael Krufky 	enum param_type type;
24ba8fc399SHans Verkuil 
2527487d44SHans Verkuil 	/* Many Philips based tuners have a comment like this in their
2627487d44SHans Verkuil 	 * datasheet:
2727487d44SHans Verkuil 	 *
2827487d44SHans Verkuil 	 *   For channel selection involving band switching, and to ensure
2927487d44SHans Verkuil 	 *   smooth tuning to the desired channel without causing
3027487d44SHans Verkuil 	 *   unnecessary charge pump action, it is recommended to consider
3127487d44SHans Verkuil 	 *   the difference between wanted channel frequency and the
3227487d44SHans Verkuil 	 *   current channel frequency.  Unnecessary charge pump action
3327487d44SHans Verkuil 	 *   will result in very low tuning voltage which may drive the
3427487d44SHans Verkuil 	 *   oscillator to extreme conditions.
3527487d44SHans Verkuil 	 *
3601872c5dSMichael Krufky 	 * Set cb_first_if_lower_freq to 1, if this check is
3701872c5dSMichael Krufky 	 * required for this tuner.
3827487d44SHans Verkuil 	 *
3927487d44SHans Verkuil 	 * I tested this for PAL by first setting the TV frequency to
4027487d44SHans Verkuil 	 * 203 MHz and then switching to 96.6 MHz FM radio. The result was
4127487d44SHans Verkuil 	 * static unless the control byte was sent first.
4227487d44SHans Verkuil 	 */
4327487d44SHans Verkuil 	unsigned int cb_first_if_lower_freq:1;
44ba8fc399SHans Verkuil 	/* Set to 1 if this tuner uses a tda9887 */
45ba8fc399SHans Verkuil 	unsigned int has_tda9887:1;
46ba8fc399SHans Verkuil 	/* Many Philips tuners use tda9887 PORT1 to select the FM radio
47ba8fc399SHans Verkuil 	   sensitivity. If this setting is 1, then set PORT1 to 1 to
48ba8fc399SHans Verkuil 	   get proper FM reception. */
49ba8fc399SHans Verkuil 	unsigned int port1_fm_high_sensitivity:1;
50ba8fc399SHans Verkuil 	/* Some Philips tuners use tda9887 PORT2 to select the FM radio
51ba8fc399SHans Verkuil 	   sensitivity. If this setting is 1, then set PORT2 to 1 to
52ba8fc399SHans Verkuil 	   get proper FM reception. */
53ba8fc399SHans Verkuil 	unsigned int port2_fm_high_sensitivity:1;
54483deb0fSMauro Carvalho Chehab 	/* Some Philips tuners use tda9887 cGainNormal to select the FM radio
55483deb0fSMauro Carvalho Chehab 	   sensitivity. If this setting is 1, e register will use cGainNormal
56483deb0fSMauro Carvalho Chehab 	   instead of cGainLow. */
57483deb0fSMauro Carvalho Chehab 	unsigned int fm_gain_normal:1;
58ba8fc399SHans Verkuil 	/* Most tuners with a tda9887 use QSS mode. Some (cheaper) tuners
59ba8fc399SHans Verkuil 	   use Intercarrier mode. If this setting is 1, then the tuner
60ba8fc399SHans Verkuil 	   needs to be set to intercarrier mode. */
61ba8fc399SHans Verkuil 	unsigned int intercarrier_mode:1;
62ba8fc399SHans Verkuil 	/* This setting sets the default value for PORT1.
63ba8fc399SHans Verkuil 	   0 means inactive, 1 means active. Note: the actual bit
64ba8fc399SHans Verkuil 	   value written to the tda9887 is inverted. So a 0 here
65ba8fc399SHans Verkuil 	   means a 1 in the B6 bit. */
66ba8fc399SHans Verkuil 	unsigned int port1_active:1;
67ba8fc399SHans Verkuil 	/* This setting sets the default value for PORT2.
68ba8fc399SHans Verkuil 	   0 means inactive, 1 means active. Note: the actual bit
69ba8fc399SHans Verkuil 	   value written to the tda9887 is inverted. So a 0 here
70ba8fc399SHans Verkuil 	   means a 1 in the B7 bit. */
71ba8fc399SHans Verkuil 	unsigned int port2_active:1;
72ba8fc399SHans Verkuil 	/* Sometimes PORT1 is inverted when the SECAM-L' standard is selected.
73ba8fc399SHans Verkuil 	   Set this bit to 1 if this is needed. */
74ba8fc399SHans Verkuil 	unsigned int port1_invert_for_secam_lc:1;
75ba8fc399SHans Verkuil 	/* Sometimes PORT2 is inverted when the SECAM-L' standard is selected.
76ba8fc399SHans Verkuil 	   Set this bit to 1 if this is needed. */
77ba8fc399SHans Verkuil 	unsigned int port2_invert_for_secam_lc:1;
78ba8fc399SHans Verkuil 	/* Some cards require PORT1 to be 1 for mono Radio FM and 0 for stereo. */
79ba8fc399SHans Verkuil 	unsigned int port1_set_for_fm_mono:1;
80d7304deeSTrent Piepho 	/* Select 18% (or according to datasheet 0%) L standard PLL gating,
81d7304deeSTrent Piepho 	   vs the driver default of 36%. */
82d7304deeSTrent Piepho 	unsigned int default_pll_gating_18:1;
835e082f15STrent Piepho 	/* IF to use in radio mode.  Tuners with a separate radio IF filter
845e082f15STrent Piepho 	   seem to use 10.7, while those without use 33.3 for PAL/SECAM tuners
855e082f15STrent Piepho 	   and 41.3 for NTSC tuners. 0 = 10.7, 1 = 33.3, 2 = 41.3 */
865e082f15STrent Piepho 	unsigned int radio_if:2;
87ba8fc399SHans Verkuil 	/* Default tda9887 TOP value in dB for the low band. Default is 0.
88ba8fc399SHans Verkuil 	   Range: -16:+15 */
89ba8fc399SHans Verkuil 	signed int default_top_low:5;
90ba8fc399SHans Verkuil 	/* Default tda9887 TOP value in dB for the mid band. Default is 0.
91ba8fc399SHans Verkuil 	   Range: -16:+15 */
92ba8fc399SHans Verkuil 	signed int default_top_mid:5;
93ba8fc399SHans Verkuil 	/* Default tda9887 TOP value in dB for the high band. Default is 0.
94ba8fc399SHans Verkuil 	   Range: -16:+15 */
95ba8fc399SHans Verkuil 	signed int default_top_high:5;
96ba8fc399SHans Verkuil 	/* Default tda9887 TOP value in dB for SECAM-L/L' for the low band.
97ba8fc399SHans Verkuil 	   Default is 0. Several tuners require a different TOP value for
98ba8fc399SHans Verkuil 	   the SECAM-L/L' standards. Range: -16:+15 */
99ba8fc399SHans Verkuil 	signed int default_top_secam_low:5;
100ba8fc399SHans Verkuil 	/* Default tda9887 TOP value in dB for SECAM-L/L' for the mid band.
101ba8fc399SHans Verkuil 	   Default is 0. Several tuners require a different TOP value for
102ba8fc399SHans Verkuil 	   the SECAM-L/L' standards. Range: -16:+15 */
103ba8fc399SHans Verkuil 	signed int default_top_secam_mid:5;
104ba8fc399SHans Verkuil 	/* Default tda9887 TOP value in dB for SECAM-L/L' for the high band.
105ba8fc399SHans Verkuil 	   Default is 0. Several tuners require a different TOP value for
106ba8fc399SHans Verkuil 	   the SECAM-L/L' standards. Range: -16:+15 */
107ba8fc399SHans Verkuil 	signed int default_top_secam_high:5;
108ba8fc399SHans Verkuil 
10962325497SMichael Krufky 	u16 iffreq;
1107b0ac9cdSMichael Krufky 
1117b0ac9cdSMichael Krufky 	unsigned int count;
1127b0ac9cdSMichael Krufky 	struct tuner_range *ranges;
1137b0ac9cdSMichael Krufky };
1147b0ac9cdSMichael Krufky 
1157b0ac9cdSMichael Krufky struct tunertype {
1167b0ac9cdSMichael Krufky 	char *name;
117bbab6fd8SMichael Krufky 	unsigned int count;
1187b0ac9cdSMichael Krufky 	struct tuner_params *params;
11962325497SMichael Krufky 
12062325497SMichael Krufky 	u16 min;
12162325497SMichael Krufky 	u16 max;
122*23a88108SMichael Krufky 	u32 stepsize;
1236f4a5729SMichael Krufky 
1246f4a5729SMichael Krufky 	u8 *initdata;
1256f4a5729SMichael Krufky 	u8 *sleepdata;
1267b0ac9cdSMichael Krufky };
1277b0ac9cdSMichael Krufky 
1287b0ac9cdSMichael Krufky extern struct tunertype tuners[];
1297b0ac9cdSMichael Krufky extern unsigned const int tuner_count;
1307b0ac9cdSMichael Krufky 
1317b0ac9cdSMichael Krufky #endif
132