xref: /openbmc/linux/include/media/tuner-types.h (revision c537b994)
1 /*
2  * descriptions for simple tuners.
3  */
4 
5 #ifndef __TUNER_TYPES_H__
6 #define __TUNER_TYPES_H__
7 
8 enum param_type {
9 	TUNER_PARAM_TYPE_RADIO, \
10 	TUNER_PARAM_TYPE_PAL, \
11 	TUNER_PARAM_TYPE_SECAM, \
12 	TUNER_PARAM_TYPE_NTSC
13 };
14 
15 struct tuner_range {
16 	unsigned short limit;
17 	unsigned char config;
18 	unsigned char cb;
19 };
20 
21 struct tuner_params {
22 	enum param_type type;
23 
24 	/* Many Philips based tuners have a comment like this in their
25 	 * datasheet:
26 	 *
27 	 *   For channel selection involving band switching, and to ensure
28 	 *   smooth tuning to the desired channel without causing
29 	 *   unnecessary charge pump action, it is recommended to consider
30 	 *   the difference between wanted channel frequency and the
31 	 *   current channel frequency.  Unnecessary charge pump action
32 	 *   will result in very low tuning voltage which may drive the
33 	 *   oscillator to extreme conditions.
34 	 *
35 	 * Set cb_first_if_lower_freq to 1, if this check is
36 	 * required for this tuner.
37 	 *
38 	 * I tested this for PAL by first setting the TV frequency to
39 	 * 203 MHz and then switching to 96.6 MHz FM radio. The result was
40 	 * static unless the control byte was sent first.
41 	 */
42 	unsigned int cb_first_if_lower_freq:1;
43 	/* Set to 1 if this tuner uses a tda9887 */
44 	unsigned int has_tda9887:1;
45 	/* Many Philips tuners use tda9887 PORT1 to select the FM radio
46 	   sensitivity. If this setting is 1, then set PORT1 to 1 to
47 	   get proper FM reception. */
48 	unsigned int port1_fm_high_sensitivity:1;
49 	/* Some Philips tuners use tda9887 PORT2 to select the FM radio
50 	   sensitivity. If this setting is 1, then set PORT2 to 1 to
51 	   get proper FM reception. */
52 	unsigned int port2_fm_high_sensitivity:1;
53 	/* Some Philips tuners use tda9887 cGainNormal to select the FM radio
54 	   sensitivity. If this setting is 1, e register will use cGainNormal
55 	   instead of cGainLow. */
56 	unsigned int fm_gain_normal:1;
57 	/* Most tuners with a tda9887 use QSS mode. Some (cheaper) tuners
58 	   use Intercarrier mode. If this setting is 1, then the tuner
59 	   needs to be set to intercarrier mode. */
60 	unsigned int intercarrier_mode:1;
61 	/* This setting sets the default value for PORT1.
62 	   0 means inactive, 1 means active. Note: the actual bit
63 	   value written to the tda9887 is inverted. So a 0 here
64 	   means a 1 in the B6 bit. */
65 	unsigned int port1_active:1;
66 	/* This setting sets the default value for PORT2.
67 	   0 means inactive, 1 means active. Note: the actual bit
68 	   value written to the tda9887 is inverted. So a 0 here
69 	   means a 1 in the B7 bit. */
70 	unsigned int port2_active:1;
71 	/* Sometimes PORT1 is inverted when the SECAM-L' standard is selected.
72 	   Set this bit to 1 if this is needed. */
73 	unsigned int port1_invert_for_secam_lc:1;
74 	/* Sometimes PORT2 is inverted when the SECAM-L' standard is selected.
75 	   Set this bit to 1 if this is needed. */
76 	unsigned int port2_invert_for_secam_lc:1;
77 	/* Some cards require PORT1 to be 1 for mono Radio FM and 0 for stereo. */
78 	unsigned int port1_set_for_fm_mono:1;
79 	/* Select 18% (or according to datasheet 0%) L standard PLL gating,
80 	   vs the driver default of 36%. */
81 	unsigned int default_pll_gating_18:1;
82 	/* Default tda9887 TOP value in dB for the low band. Default is 0.
83 	   Range: -16:+15 */
84 	signed int default_top_low:5;
85 	/* Default tda9887 TOP value in dB for the mid band. Default is 0.
86 	   Range: -16:+15 */
87 	signed int default_top_mid:5;
88 	/* Default tda9887 TOP value in dB for the high band. Default is 0.
89 	   Range: -16:+15 */
90 	signed int default_top_high:5;
91 	/* Default tda9887 TOP value in dB for SECAM-L/L' for the low band.
92 	   Default is 0. Several tuners require a different TOP value for
93 	   the SECAM-L/L' standards. Range: -16:+15 */
94 	signed int default_top_secam_low:5;
95 	/* Default tda9887 TOP value in dB for SECAM-L/L' for the mid band.
96 	   Default is 0. Several tuners require a different TOP value for
97 	   the SECAM-L/L' standards. Range: -16:+15 */
98 	signed int default_top_secam_mid:5;
99 	/* Default tda9887 TOP value in dB for SECAM-L/L' for the high band.
100 	   Default is 0. Several tuners require a different TOP value for
101 	   the SECAM-L/L' standards. Range: -16:+15 */
102 	signed int default_top_secam_high:5;
103 
104 
105 	unsigned int count;
106 	struct tuner_range *ranges;
107 };
108 
109 struct tunertype {
110 	char *name;
111 	unsigned int count;
112 	struct tuner_params *params;
113 };
114 
115 extern struct tunertype tuners[];
116 extern unsigned const int tuner_count;
117 
118 #endif
119