1 Index: drivers/media/dvb/dvb-core/dvb_frontend.h
2 ===================================================================
3 --- drivers/media/dvb/dvb-core/dvb_frontend.h (revision 1)
4 +++ drivers/media/dvb/dvb-core/dvb_frontend.h (working copy)
8 struct dvb_frontend_tune_settings {
12 - struct dvb_frontend_parameters parameters;
16 + struct dvb_frontend_parameters parameters;
21 +//NOTE : LINUX_2_6_31 related stuffs are added to make back-porting of frontend driver easier.
23 +#define LINUX_2_6_31 1
27 +#define FE_TUNE_MODE_ONESHOT 0x01
28 +#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */
30 +struct delayed_work {
31 + struct work_struct work;
32 + struct timer_list timer;
35 +#define DVB_MAX_ADAPTERS 8
37 +#define DVB_UNSET (-1)
39 +#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
40 + static short adapter_nr[] = \
41 + {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
42 + module_param_array(adapter_nr, short, NULL, 0444); \
43 + MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
47 struct dvb_tuner_info {
54 +struct analog_parameters {
55 + unsigned int frequency;
57 + unsigned int audmode;
62 + DVBFE_MODCOD_DUMMY_PLFRAME = 0,
63 + DVBFE_MODCOD_QPSK_1_4,
64 + DVBFE_MODCOD_QPSK_1_3,
65 + DVBFE_MODCOD_QPSK_2_5,
66 + DVBFE_MODCOD_QPSK_1_2,
67 + DVBFE_MODCOD_QPSK_3_5,
68 + DVBFE_MODCOD_QPSK_2_3,
69 + DVBFE_MODCOD_QPSK_3_4,
70 + DVBFE_MODCOD_QPSK_4_5,
71 + DVBFE_MODCOD_QPSK_5_6,
72 + DVBFE_MODCOD_QPSK_8_9,
73 + DVBFE_MODCOD_QPSK_9_10,
74 + DVBFE_MODCOD_8PSK_3_5,
75 + DVBFE_MODCOD_8PSK_2_3,
76 + DVBFE_MODCOD_8PSK_3_4,
77 + DVBFE_MODCOD_8PSK_5_6,
78 + DVBFE_MODCOD_8PSK_8_9,
79 + DVBFE_MODCOD_8PSK_9_10,
80 + DVBFE_MODCOD_16APSK_2_3,
81 + DVBFE_MODCOD_16APSK_3_4,
82 + DVBFE_MODCOD_16APSK_4_5,
83 + DVBFE_MODCOD_16APSK_5_6,
84 + DVBFE_MODCOD_16APSK_8_9,
85 + DVBFE_MODCOD_16APSK_9_10,
86 + DVBFE_MODCOD_32APSK_3_4,
87 + DVBFE_MODCOD_32APSK_4_5,
88 + DVBFE_MODCOD_32APSK_5_6,
89 + DVBFE_MODCOD_32APSK_8_9,
90 + DVBFE_MODCOD_32APSK_9_10,
91 + DVBFE_MODCOD_RESERVED_1,
92 + DVBFE_MODCOD_BPSK_1_3,
93 + DVBFE_MODCOD_BPSK_1_4,
94 + DVBFE_MODCOD_RESERVED_2
98 + DVBFE_TUNER_FREQUENCY = (1 << 0),
99 + DVBFE_TUNER_TUNERSTEP = (1 << 1),
100 + DVBFE_TUNER_IFFREQ = (1 << 2),
101 + DVBFE_TUNER_BANDWIDTH = (1 << 3),
102 + DVBFE_TUNER_REFCLOCK = (1 << 4),
103 + DVBFE_TUNER_IQSENSE = (1 << 5),
104 + DVBFE_TUNER_DUMMY = (1 << 31)
108 + * ALGO_HW: (Hardware Algorithm)
109 + * ----------------------------------------------------------------
110 + * Devices that support this algorithm do everything in hardware
111 + * and no software support is needed to handle them.
112 + * Requesting these devices to LOCK is the only thing required,
113 + * device is supposed to do everything in the hardware.
115 + * ALGO_SW: (Software Algorithm)
116 + * ----------------------------------------------------------------
117 + * These are dumb devices, that require software to do everything
119 + * ALGO_CUSTOM: (Customizable Agorithm)
120 + * ----------------------------------------------------------------
121 + * Devices having this algorithm can be customized to have specific
122 + * algorithms in the frontend driver, rather than simply doing a
123 + * software zig-zag. In this case the zigzag maybe hardware assisted
124 + * or it maybe completely done in hardware. In all cases, usage of
125 + * this algorithm, in conjunction with the search and track
126 + * callbacks, utilizes the driver specific algorithm.
128 + * ALGO_RECOVERY: (Recovery Algorithm)
129 + * ----------------------------------------------------------------
130 + * These devices have AUTO recovery capabilities from LOCK failure
133 + DVBFE_ALGO_HW = (1 << 0),
134 + DVBFE_ALGO_SW = (1 << 1),
135 + DVBFE_ALGO_CUSTOM = (1 << 2),
136 + DVBFE_ALGO_RECOVERY = (1 << 31)
139 +struct tuner_state {
149 + * search callback possible return status
151 + * DVBFE_ALGO_SEARCH_SUCCESS
152 + * The frontend search algorithm completed and returned succesfully
154 + * DVBFE_ALGO_SEARCH_ASLEEP
155 + * The frontend search algorithm is sleeping
157 + * DVBFE_ALGO_SEARCH_FAILED
158 + * The frontend search for a signal failed
160 + * DVBFE_ALGO_SEARCH_INVALID
161 + * The frontend search algorith was probably supplied with invalid
162 + * parameters and the search is an invalid one
164 + * DVBFE_ALGO_SEARCH_ERROR
165 + * The frontend search algorithm failed due to some error
167 + * DVBFE_ALGO_SEARCH_AGAIN
168 + * The frontend search algorithm was requested to search again
171 + DVBFE_ALGO_SEARCH_SUCCESS = (1 << 0),
172 + DVBFE_ALGO_SEARCH_ASLEEP = (1 << 1),
173 + DVBFE_ALGO_SEARCH_FAILED = (1 << 2),
174 + DVBFE_ALGO_SEARCH_INVALID = (1 << 3),
175 + DVBFE_ALGO_SEARCH_AGAIN = (1 << 4),
176 + DVBFE_ALGO_SEARCH_ERROR = (1 << 31),
180 struct dvb_tuner_ops {
182 struct dvb_tuner_info info;
185 /** This is for simple PLLs - set all parameters in one go. */
186 int (*set_params)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p);
187 + int (*set_analog_params)(struct dvb_frontend *fe, struct analog_parameters *p);
189 /** This is support for demods like the mt352 - fills out the supplied buffer with what to write. */
190 int (*calc_regs)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p, u8 *buf, int buf_len);
192 + /** This is to allow setting tuner-specific configs */
193 + int (*set_config)(struct dvb_frontend *fe, void *priv_cfg);
195 int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency);
196 int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
198 #define TUNER_STATUS_LOCKED 1
199 +#define TUNER_STATUS_STEREO 2
200 int (*get_status)(struct dvb_frontend *fe, u32 *status);
201 + int (*get_rf_strength)(struct dvb_frontend *fe, u16 *strength);
203 /** These are provided seperately from set_params in order to facilitate silicon
204 * tuners which require sophisticated tuning loops, controlling each parameter seperately. */
205 int (*set_frequency)(struct dvb_frontend *fe, u32 frequency);
206 int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth);
209 + * These are provided seperately from set_params in order to facilitate silicon
210 + * tuners which require sophisticated tuning loops, controlling each parameter seperately.
212 + int (*set_state)(struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state);
213 + int (*get_state)(struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *state);
215 +struct analog_demod_info {
219 +struct analog_demod_ops {
221 + struct analog_demod_info info;
223 + void (*set_params)(struct dvb_frontend *fe,
224 + struct analog_parameters *params);
225 + int (*has_signal)(struct dvb_frontend *fe);
226 + int (*is_stereo)(struct dvb_frontend *fe);
227 + int (*get_afc)(struct dvb_frontend *fe);
228 + void (*tuner_status)(struct dvb_frontend *fe);
229 + void (*standby)(struct dvb_frontend *fe);
230 + void (*release)(struct dvb_frontend *fe);
231 + int (*i2c_gate_ctrl)(struct dvb_frontend *fe, int enable);
233 + /** This is to allow setting tuner-specific configuration */
234 + int (*set_config)(struct dvb_frontend *fe, void *priv_cfg);
236 +struct dtv_property {
244 + __u32 reserved1[3];
249 +} __attribute__ ((packed));
254 struct dvb_frontend_ops {
256 struct dvb_frontend_info info;
259 int (*init)(struct dvb_frontend* fe);
260 int (*sleep)(struct dvb_frontend* fe);
263 /* if this is set, it overrides the default swzigzag */
264 int (*tune)(struct dvb_frontend* fe,
265 struct dvb_frontend_parameters* params,
266 @@ -106,11 +309,11 @@
267 int (*get_frontend_algo)(struct dvb_frontend *fe);
269 /* these two are only used for the swzigzag code */
271 int (*set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
272 + int (*get_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
273 int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);
275 - int (*get_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
277 int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
278 int (*read_ber)(struct dvb_frontend* fe, u32* ber);
279 int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength);
280 @@ -123,11 +326,27 @@
281 int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
282 int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
283 int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
284 - int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg);
285 - int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
286 - int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
287 + int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, int arg);
288 + int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd);
290 - struct dvb_tuner_ops tuner_ops;
292 + int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
293 + int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire);
295 + /* These callbacks are for devices that implement their own
296 + * tuning algorithms, rather than a simple swzigzag
298 + enum dvbfe_search (*search)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p);
299 + int (*track)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p);
301 + struct dvb_tuner_ops tuner_ops;
302 + struct analog_demod_ops analog_ops;
304 + int (*set_property)(struct dvb_frontend* fe, struct dtv_property* tvp);
305 + int (*get_property)(struct dvb_frontend* fe, struct dtv_property* tvp);
308 + int (*set_sw_loopthrough)(struct dvb_frontend* fe, int* arg);
312 @@ -141,13 +360,102 @@
313 struct semaphore sem;
319 +typedef enum fe_pilot {
325 +typedef enum fe_rolloff {
326 + ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */
332 +typedef enum fe_delivery_system {
349 +} fe_delivery_system_t;
351 +struct dtv_frontend_properties {
357 + fe_modulation_t modulation;
359 + fe_sec_voltage_t voltage;
360 + fe_sec_tone_mode_t sectone;
361 + fe_spectral_inversion_t inversion;
362 + fe_code_rate_t fec_inner;
363 + fe_transmit_mode_t transmission_mode;
364 + u32 bandwidth_hz; /* 0 = AUTO */
365 + fe_guard_interval_t guard_interval;
366 + fe_hierarchy_t hierarchy;
368 + fe_code_rate_t code_rate_HP;
369 + fe_code_rate_t code_rate_LP;
372 + fe_rolloff_t rolloff;
374 + fe_delivery_system_t delivery_system;
387 +#define KERN_CONT "<c>"
392 struct dvb_frontend {
393 +#ifndef LINUX_2_6_31
394 + struct dvb_frontend_ops* ops;
395 + struct dvb_adapter *dvb;
396 + void* demodulator_priv;
397 + void* frontend_priv;
399 struct dvb_frontend_ops ops;
400 struct dvb_adapter *dvb;
401 void* demodulator_priv;
403 - void* frontend_priv;
406 + void *frontend_priv;
408 + void *analog_demod_priv;
409 + struct dtv_frontend_properties dtv_property_cache;
410 +#define DVB_FRONTEND_COMPONENT_TUNER 0
411 + int (*callback)(void *adapter_priv, int component, int cmd, int arg);
417 extern int dvb_register_frontend(struct dvb_adapter* dvb,
420 extern int dvb_unregister_frontend(struct dvb_frontend* fe);
422 -extern void dvb_frontend_reinitialise(struct dvb_frontend *fe);
424 extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec);
425 extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime);