xref: /openbmc/linux/include/uapi/linux/dvb/frontend.h (revision 3f58ff6b)
1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
2 /*
3  * frontend.h
4  *
5  * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
6  *		    Ralph  Metzler <ralph@convergence.de>
7  *		    Holger Waechtler <holger@convergence.de>
8  *		    Andre Draszik <ad@convergence.de>
9  *		    for convergence integrated media GmbH
10  */
11 
12 #ifndef _DVBFRONTEND_H_
13 #define _DVBFRONTEND_H_
14 
15 #include <linux/types.h>
16 
17 /**
18  * enum fe_caps - Frontend capabilities
19  *
20  * @FE_IS_STUPID:			There's something wrong at the
21  *					frontend, and it can't report its
22  *					capabilities.
23  * @FE_CAN_INVERSION_AUTO:		Can auto-detect frequency spectral
24  *					band inversion
25  * @FE_CAN_FEC_1_2:			Supports FEC 1/2
26  * @FE_CAN_FEC_2_3:			Supports FEC 2/3
27  * @FE_CAN_FEC_3_4:			Supports FEC 3/4
28  * @FE_CAN_FEC_4_5:			Supports FEC 4/5
29  * @FE_CAN_FEC_5_6:			Supports FEC 5/6
30  * @FE_CAN_FEC_6_7:			Supports FEC 6/7
31  * @FE_CAN_FEC_7_8:			Supports FEC 7/8
32  * @FE_CAN_FEC_8_9:			Supports FEC 8/9
33  * @FE_CAN_FEC_AUTO:			Can auto-detect FEC
34  * @FE_CAN_QPSK:			Supports QPSK modulation
35  * @FE_CAN_QAM_16:			Supports 16-QAM modulation
36  * @FE_CAN_QAM_32:			Supports 32-QAM modulation
37  * @FE_CAN_QAM_64:			Supports 64-QAM modulation
38  * @FE_CAN_QAM_128:			Supports 128-QAM modulation
39  * @FE_CAN_QAM_256:			Supports 256-QAM modulation
40  * @FE_CAN_QAM_AUTO:			Can auto-detect QAM modulation
41  * @FE_CAN_TRANSMISSION_MODE_AUTO:	Can auto-detect transmission mode
42  * @FE_CAN_BANDWIDTH_AUTO:		Can auto-detect bandwidth
43  * @FE_CAN_GUARD_INTERVAL_AUTO:		Can auto-detect guard interval
44  * @FE_CAN_HIERARCHY_AUTO:		Can auto-detect hierarchy
45  * @FE_CAN_8VSB:			Supports 8-VSB modulation
46  * @FE_CAN_16VSB:			Supporta 16-VSB modulation
47  * @FE_HAS_EXTENDED_CAPS:		Unused
48  * @FE_CAN_MULTISTREAM:			Supports multistream filtering
49  * @FE_CAN_TURBO_FEC:			Supports "turbo FEC" modulation
50  * @FE_CAN_2G_MODULATION:		Supports "2nd generation" modulation,
51  *					e. g. DVB-S2, DVB-T2, DVB-C2
52  * @FE_NEEDS_BENDING:			Unused
53  * @FE_CAN_RECOVER:			Can recover from a cable unplug
54  *					automatically
55  * @FE_CAN_MUTE_TS:			Can stop spurious TS data output
56  */
57 enum fe_caps {
58 	FE_IS_STUPID			= 0,
59 	FE_CAN_INVERSION_AUTO		= 0x1,
60 	FE_CAN_FEC_1_2			= 0x2,
61 	FE_CAN_FEC_2_3			= 0x4,
62 	FE_CAN_FEC_3_4			= 0x8,
63 	FE_CAN_FEC_4_5			= 0x10,
64 	FE_CAN_FEC_5_6			= 0x20,
65 	FE_CAN_FEC_6_7			= 0x40,
66 	FE_CAN_FEC_7_8			= 0x80,
67 	FE_CAN_FEC_8_9			= 0x100,
68 	FE_CAN_FEC_AUTO			= 0x200,
69 	FE_CAN_QPSK			= 0x400,
70 	FE_CAN_QAM_16			= 0x800,
71 	FE_CAN_QAM_32			= 0x1000,
72 	FE_CAN_QAM_64			= 0x2000,
73 	FE_CAN_QAM_128			= 0x4000,
74 	FE_CAN_QAM_256			= 0x8000,
75 	FE_CAN_QAM_AUTO			= 0x10000,
76 	FE_CAN_TRANSMISSION_MODE_AUTO	= 0x20000,
77 	FE_CAN_BANDWIDTH_AUTO		= 0x40000,
78 	FE_CAN_GUARD_INTERVAL_AUTO	= 0x80000,
79 	FE_CAN_HIERARCHY_AUTO		= 0x100000,
80 	FE_CAN_8VSB			= 0x200000,
81 	FE_CAN_16VSB			= 0x400000,
82 	FE_HAS_EXTENDED_CAPS		= 0x800000,
83 	FE_CAN_MULTISTREAM		= 0x4000000,
84 	FE_CAN_TURBO_FEC		= 0x8000000,
85 	FE_CAN_2G_MODULATION		= 0x10000000,
86 	FE_NEEDS_BENDING		= 0x20000000,
87 	FE_CAN_RECOVER			= 0x40000000,
88 	FE_CAN_MUTE_TS			= 0x80000000
89 };
90 
91 /*
92  * DEPRECATED: Should be kept just due to backward compatibility.
93  */
94 enum fe_type {
95 	FE_QPSK,
96 	FE_QAM,
97 	FE_OFDM,
98 	FE_ATSC
99 };
100 
101 /**
102  * struct dvb_frontend_info - Frontend properties and capabilities
103  *
104  * @name:			Name of the frontend
105  * @type:			**DEPRECATED**.
106  *				Should not be used on modern programs,
107  *				as a frontend may have more than one type.
108  *				In order to get the support types of a given
109  *				frontend, use :c:type:`DTV_ENUM_DELSYS`
110  *				instead.
111  * @frequency_min:		Minimal frequency supported by the frontend.
112  * @frequency_max:		Minimal frequency supported by the frontend.
113  * @frequency_stepsize:		All frequencies are multiple of this value.
114  * @frequency_tolerance:	Frequency tolerance.
115  * @symbol_rate_min:		Minimal symbol rate, in bauds
116  *				(for Cable/Satellite systems).
117  * @symbol_rate_max:		Maximal symbol rate, in bauds
118  *				(for Cable/Satellite systems).
119  * @symbol_rate_tolerance:	Maximal symbol rate tolerance, in ppm
120  *				(for Cable/Satellite systems).
121  * @notifier_delay:		**DEPRECATED**. Not used by any driver.
122  * @caps:			Capabilities supported by the frontend,
123  *				as specified in &enum fe_caps.
124  *
125  * .. note:
126  *
127  *    #. The frequencies are specified in Hz for Terrestrial and Cable
128  *       systems.
129  *    #. The frequencies are specified in kHz for Satellite systems.
130  */
131 struct dvb_frontend_info {
132 	char       name[128];
133 	enum fe_type type;	/* DEPRECATED. Use DTV_ENUM_DELSYS instead */
134 	__u32      frequency_min;
135 	__u32      frequency_max;
136 	__u32      frequency_stepsize;
137 	__u32      frequency_tolerance;
138 	__u32      symbol_rate_min;
139 	__u32      symbol_rate_max;
140 	__u32      symbol_rate_tolerance;
141 	__u32      notifier_delay;		/* DEPRECATED */
142 	enum fe_caps caps;
143 };
144 
145 /**
146  * struct dvb_diseqc_master_cmd - DiSEqC master command
147  *
148  * @msg:
149  *	DiSEqC message to be sent. It contains a 3 bytes header with:
150  *	framing + address + command, and an optional argument
151  *	of up to 3 bytes of data.
152  * @msg_len:
153  *	Length of the DiSEqC message. Valid values are 3 to 6.
154  *
155  * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
156  * the possible messages that can be used.
157  */
158 struct dvb_diseqc_master_cmd {
159 	__u8 msg[6];
160 	__u8 msg_len;
161 };
162 
163 /**
164  * struct dvb_diseqc_slave_reply - DiSEqC received data
165  *
166  * @msg:
167  *	DiSEqC message buffer to store a message received via DiSEqC.
168  *	It contains one byte header with: framing and
169  *	an optional argument of up to 3 bytes of data.
170  * @msg_len:
171  *	Length of the DiSEqC message. Valid values are 0 to 4,
172  *	where 0 means no message.
173  * @timeout:
174  *	Return from ioctl after timeout ms with errorcode when
175  *	no message was received.
176  *
177  * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
178  * the possible messages that can be used.
179  */
180 struct dvb_diseqc_slave_reply {
181 	__u8 msg[4];
182 	__u8 msg_len;
183 	int  timeout;
184 };
185 
186 /**
187  * enum fe_sec_voltage - DC Voltage used to feed the LNBf
188  *
189  * @SEC_VOLTAGE_13:	Output 13V to the LNBf
190  * @SEC_VOLTAGE_18:	Output 18V to the LNBf
191  * @SEC_VOLTAGE_OFF:	Don't feed the LNBf with a DC voltage
192  */
193 enum fe_sec_voltage {
194 	SEC_VOLTAGE_13,
195 	SEC_VOLTAGE_18,
196 	SEC_VOLTAGE_OFF
197 };
198 
199 /**
200  * enum fe_sec_tone_mode - Type of tone to be send to the LNBf.
201  * @SEC_TONE_ON:	Sends a 22kHz tone burst to the antenna.
202  * @SEC_TONE_OFF:	Don't send a 22kHz tone to the antenna (except
203  *			if the ``FE_DISEQC_*`` ioctls are called).
204  */
205 enum fe_sec_tone_mode {
206 	SEC_TONE_ON,
207 	SEC_TONE_OFF
208 };
209 
210 /**
211  * enum fe_sec_mini_cmd - Type of mini burst to be sent
212  *
213  * @SEC_MINI_A:		Sends a mini-DiSEqC 22kHz '0' Tone Burst to select
214  *			satellite-A
215  * @SEC_MINI_B:		Sends a mini-DiSEqC 22kHz '1' Data Burst to select
216  *			satellite-B
217  */
218 enum fe_sec_mini_cmd {
219 	SEC_MINI_A,
220 	SEC_MINI_B
221 };
222 
223 /**
224  * enum fe_status - Enumerates the possible frontend status.
225  * @FE_NONE:		The frontend doesn't have any kind of lock.
226  *			That's the initial frontend status
227  * @FE_HAS_SIGNAL:	Has found something above the noise level.
228  * @FE_HAS_CARRIER:	Has found a signal.
229  * @FE_HAS_VITERBI:	FEC inner coding (Viterbi, LDPC or other inner code).
230  *			is stable.
231  * @FE_HAS_SYNC:	Synchronization bytes was found.
232  * @FE_HAS_LOCK:	Digital TV were locked and everything is working.
233  * @FE_TIMEDOUT:	Fo lock within the last about 2 seconds.
234  * @FE_REINIT:		Frontend was reinitialized, application is recommended
235  *			to reset DiSEqC, tone and parameters.
236  */
237 enum fe_status {
238 	FE_NONE			= 0x00,
239 	FE_HAS_SIGNAL		= 0x01,
240 	FE_HAS_CARRIER		= 0x02,
241 	FE_HAS_VITERBI		= 0x04,
242 	FE_HAS_SYNC		= 0x08,
243 	FE_HAS_LOCK		= 0x10,
244 	FE_TIMEDOUT		= 0x20,
245 	FE_REINIT		= 0x40,
246 };
247 
248 /**
249  * enum fe_spectral_inversion - Type of inversion band
250  *
251  * @INVERSION_OFF:	Don't do spectral band inversion.
252  * @INVERSION_ON:	Do spectral band inversion.
253  * @INVERSION_AUTO:	Autodetect spectral band inversion.
254  *
255  * This parameter indicates if spectral inversion should be presumed or
256  * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try
257  * to figure out the correct setting by itself. If the hardware doesn't
258  * support, the %dvb_frontend will try to lock at the carrier first with
259  * inversion off. If it fails, it will try to enable inversion.
260  */
261 enum fe_spectral_inversion {
262 	INVERSION_OFF,
263 	INVERSION_ON,
264 	INVERSION_AUTO
265 };
266 
267 /**
268  * enum fe_code_rate - Type of Forward Error Correction (FEC)
269  *
270  * @FEC_NONE: No Forward Error Correction Code
271  * @FEC_1_2:  Forward Error Correction Code 1/2
272  * @FEC_2_3:  Forward Error Correction Code 2/3
273  * @FEC_3_4:  Forward Error Correction Code 3/4
274  * @FEC_4_5:  Forward Error Correction Code 4/5
275  * @FEC_5_6:  Forward Error Correction Code 5/6
276  * @FEC_6_7:  Forward Error Correction Code 6/7
277  * @FEC_7_8:  Forward Error Correction Code 7/8
278  * @FEC_8_9:  Forward Error Correction Code 8/9
279  * @FEC_AUTO: Autodetect Error Correction Code
280  * @FEC_3_5:  Forward Error Correction Code 3/5
281  * @FEC_9_10: Forward Error Correction Code 9/10
282  * @FEC_2_5:  Forward Error Correction Code 2/5
283  * @FEC_1_3:  Forward Error Correction Code 1/3
284  * @FEC_1_4:  Forward Error Correction Code 1/4
285  * @FEC_5_9:  Forward Error Correction Code 5/9
286  * @FEC_7_9:  Forward Error Correction Code 7/9
287  * @FEC_8_15:  Forward Error Correction Code 8/15
288  * @FEC_11_15: Forward Error Correction Code 11/15
289  * @FEC_13_18: Forward Error Correction Code 13/18
290  * @FEC_9_20:  Forward Error Correction Code 9/20
291  * @FEC_11_20: Forward Error Correction Code 11/20
292  * @FEC_23_36: Forward Error Correction Code 23/36
293  * @FEC_25_36: Forward Error Correction Code 25/36
294  * @FEC_13_45: Forward Error Correction Code 13/45
295  * @FEC_26_45: Forward Error Correction Code 26/45
296  * @FEC_28_45: Forward Error Correction Code 28/45
297  * @FEC_32_45: Forward Error Correction Code 32/45
298  * @FEC_77_90: Forward Error Correction Code 77/90
299  *
300  * Please note that not all FEC types are supported by a given standard.
301  */
302 enum fe_code_rate {
303 	FEC_NONE = 0,
304 	FEC_1_2,
305 	FEC_2_3,
306 	FEC_3_4,
307 	FEC_4_5,
308 	FEC_5_6,
309 	FEC_6_7,
310 	FEC_7_8,
311 	FEC_8_9,
312 	FEC_AUTO,
313 	FEC_3_5,
314 	FEC_9_10,
315 	FEC_2_5,
316 	FEC_1_3,
317 	FEC_1_4,
318 	FEC_5_9,
319 	FEC_7_9,
320 	FEC_8_15,
321 	FEC_11_15,
322 	FEC_13_18,
323 	FEC_9_20,
324 	FEC_11_20,
325 	FEC_23_36,
326 	FEC_25_36,
327 	FEC_13_45,
328 	FEC_26_45,
329 	FEC_28_45,
330 	FEC_32_45,
331 	FEC_77_90,
332 };
333 
334 /**
335  * enum fe_modulation - Type of modulation/constellation
336  * @QPSK:	QPSK modulation
337  * @QAM_16:	16-QAM modulation
338  * @QAM_32:	32-QAM modulation
339  * @QAM_64:	64-QAM modulation
340  * @QAM_128:	128-QAM modulation
341  * @QAM_256:	256-QAM modulation
342  * @QAM_AUTO:	Autodetect QAM modulation
343  * @VSB_8:	8-VSB modulation
344  * @VSB_16:	16-VSB modulation
345  * @PSK_8:	8-PSK modulation
346  * @APSK_16:	16-APSK modulation
347  * @APSK_32:	32-APSK modulation
348  * @DQPSK:	DQPSK modulation
349  * @QAM_4_NR:	4-QAM-NR modulation
350  * @QAM_1024:	1024-QAM modulation
351  * @QAM_4096:	4096-QAM modulation
352  * @APSK_8_L:	8APSK-L modulation
353  * @APSK_16_L:	16APSK-L modulation
354  * @APSK_32_L:	32APSK-L modulation
355  * @APSK_64:	64APSK modulation
356  * @APSK_64_L:	64APSK-L modulation
357  *
358  * Please note that not all modulations are supported by a given standard.
359  *
360  */
361 enum fe_modulation {
362 	QPSK,
363 	QAM_16,
364 	QAM_32,
365 	QAM_64,
366 	QAM_128,
367 	QAM_256,
368 	QAM_AUTO,
369 	VSB_8,
370 	VSB_16,
371 	PSK_8,
372 	APSK_16,
373 	APSK_32,
374 	DQPSK,
375 	QAM_4_NR,
376 	QAM_1024,
377 	QAM_4096,
378 	APSK_8_L,
379 	APSK_16_L,
380 	APSK_32_L,
381 	APSK_64,
382 	APSK_64_L,
383 };
384 
385 /**
386  * enum fe_transmit_mode - Transmission mode
387  *
388  * @TRANSMISSION_MODE_AUTO:
389  *	Autodetect transmission mode. The hardware will try to find the
390  *	correct FFT-size (if capable) to fill in the missing parameters.
391  * @TRANSMISSION_MODE_1K:
392  *	Transmission mode 1K
393  * @TRANSMISSION_MODE_2K:
394  *	Transmission mode 2K
395  * @TRANSMISSION_MODE_8K:
396  *	Transmission mode 8K
397  * @TRANSMISSION_MODE_4K:
398  *	Transmission mode 4K
399  * @TRANSMISSION_MODE_16K:
400  *	Transmission mode 16K
401  * @TRANSMISSION_MODE_32K:
402  *	Transmission mode 32K
403  * @TRANSMISSION_MODE_C1:
404  *	Single Carrier (C=1) transmission mode (DTMB only)
405  * @TRANSMISSION_MODE_C3780:
406  *	Multi Carrier (C=3780) transmission mode (DTMB only)
407  *
408  * Please note that not all transmission modes are supported by a given
409  * standard.
410  */
411 enum fe_transmit_mode {
412 	TRANSMISSION_MODE_2K,
413 	TRANSMISSION_MODE_8K,
414 	TRANSMISSION_MODE_AUTO,
415 	TRANSMISSION_MODE_4K,
416 	TRANSMISSION_MODE_1K,
417 	TRANSMISSION_MODE_16K,
418 	TRANSMISSION_MODE_32K,
419 	TRANSMISSION_MODE_C1,
420 	TRANSMISSION_MODE_C3780,
421 };
422 
423 /**
424  * enum fe_guard_interval - Guard interval
425  *
426  * @GUARD_INTERVAL_AUTO:	Autodetect the guard interval
427  * @GUARD_INTERVAL_1_128:	Guard interval 1/128
428  * @GUARD_INTERVAL_1_32:	Guard interval 1/32
429  * @GUARD_INTERVAL_1_16:	Guard interval 1/16
430  * @GUARD_INTERVAL_1_8:		Guard interval 1/8
431  * @GUARD_INTERVAL_1_4:		Guard interval 1/4
432  * @GUARD_INTERVAL_19_128:	Guard interval 19/128
433  * @GUARD_INTERVAL_19_256:	Guard interval 19/256
434  * @GUARD_INTERVAL_PN420:	PN length 420 (1/4)
435  * @GUARD_INTERVAL_PN595:	PN length 595 (1/6)
436  * @GUARD_INTERVAL_PN945:	PN length 945 (1/9)
437  * @GUARD_INTERVAL_1_64:	Guard interval 1/64
438  *
439  * Please note that not all guard intervals are supported by a given standard.
440  */
441 enum fe_guard_interval {
442 	GUARD_INTERVAL_1_32,
443 	GUARD_INTERVAL_1_16,
444 	GUARD_INTERVAL_1_8,
445 	GUARD_INTERVAL_1_4,
446 	GUARD_INTERVAL_AUTO,
447 	GUARD_INTERVAL_1_128,
448 	GUARD_INTERVAL_19_128,
449 	GUARD_INTERVAL_19_256,
450 	GUARD_INTERVAL_PN420,
451 	GUARD_INTERVAL_PN595,
452 	GUARD_INTERVAL_PN945,
453 	GUARD_INTERVAL_1_64,
454 };
455 
456 /**
457  * enum fe_hierarchy - Hierarchy
458  * @HIERARCHY_NONE:	No hierarchy
459  * @HIERARCHY_AUTO:	Autodetect hierarchy (if supported)
460  * @HIERARCHY_1:	Hierarchy 1
461  * @HIERARCHY_2:	Hierarchy 2
462  * @HIERARCHY_4:	Hierarchy 4
463  *
464  * Please note that not all hierarchy types are supported by a given standard.
465  */
466 enum fe_hierarchy {
467 	HIERARCHY_NONE,
468 	HIERARCHY_1,
469 	HIERARCHY_2,
470 	HIERARCHY_4,
471 	HIERARCHY_AUTO
472 };
473 
474 /**
475  * enum fe_interleaving - Interleaving
476  * @INTERLEAVING_NONE:	No interleaving.
477  * @INTERLEAVING_AUTO:	Auto-detect interleaving.
478  * @INTERLEAVING_240:	Interleaving of 240 symbols.
479  * @INTERLEAVING_720:	Interleaving of 720 symbols.
480  *
481  * Please note that, currently, only DTMB uses it.
482  */
483 enum fe_interleaving {
484 	INTERLEAVING_NONE,
485 	INTERLEAVING_AUTO,
486 	INTERLEAVING_240,
487 	INTERLEAVING_720,
488 };
489 
490 /* DVBv5 property Commands */
491 
492 #define DTV_UNDEFINED		0
493 #define DTV_TUNE		1
494 #define DTV_CLEAR		2
495 #define DTV_FREQUENCY		3
496 #define DTV_MODULATION		4
497 #define DTV_BANDWIDTH_HZ	5
498 #define DTV_INVERSION		6
499 #define DTV_DISEQC_MASTER	7
500 #define DTV_SYMBOL_RATE		8
501 #define DTV_INNER_FEC		9
502 #define DTV_VOLTAGE		10
503 #define DTV_TONE		11
504 #define DTV_PILOT		12
505 #define DTV_ROLLOFF		13
506 #define DTV_DISEQC_SLAVE_REPLY	14
507 
508 /* Basic enumeration set for querying unlimited capabilities */
509 #define DTV_FE_CAPABILITY_COUNT	15
510 #define DTV_FE_CAPABILITY	16
511 #define DTV_DELIVERY_SYSTEM	17
512 
513 /* ISDB-T and ISDB-Tsb */
514 #define DTV_ISDBT_PARTIAL_RECEPTION	18
515 #define DTV_ISDBT_SOUND_BROADCASTING	19
516 
517 #define DTV_ISDBT_SB_SUBCHANNEL_ID	20
518 #define DTV_ISDBT_SB_SEGMENT_IDX	21
519 #define DTV_ISDBT_SB_SEGMENT_COUNT	22
520 
521 #define DTV_ISDBT_LAYERA_FEC			23
522 #define DTV_ISDBT_LAYERA_MODULATION		24
523 #define DTV_ISDBT_LAYERA_SEGMENT_COUNT		25
524 #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING	26
525 
526 #define DTV_ISDBT_LAYERB_FEC			27
527 #define DTV_ISDBT_LAYERB_MODULATION		28
528 #define DTV_ISDBT_LAYERB_SEGMENT_COUNT		29
529 #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING	30
530 
531 #define DTV_ISDBT_LAYERC_FEC			31
532 #define DTV_ISDBT_LAYERC_MODULATION		32
533 #define DTV_ISDBT_LAYERC_SEGMENT_COUNT		33
534 #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING	34
535 
536 #define DTV_API_VERSION		35
537 
538 #define DTV_CODE_RATE_HP	36
539 #define DTV_CODE_RATE_LP	37
540 #define DTV_GUARD_INTERVAL	38
541 #define DTV_TRANSMISSION_MODE	39
542 #define DTV_HIERARCHY		40
543 
544 #define DTV_ISDBT_LAYER_ENABLED	41
545 
546 #define DTV_STREAM_ID		42
547 #define DTV_ISDBS_TS_ID_LEGACY	DTV_STREAM_ID
548 #define DTV_DVBT2_PLP_ID_LEGACY	43
549 
550 #define DTV_ENUM_DELSYS		44
551 
552 /* ATSC-MH */
553 #define DTV_ATSCMH_FIC_VER		45
554 #define DTV_ATSCMH_PARADE_ID		46
555 #define DTV_ATSCMH_NOG			47
556 #define DTV_ATSCMH_TNOG			48
557 #define DTV_ATSCMH_SGN			49
558 #define DTV_ATSCMH_PRC			50
559 #define DTV_ATSCMH_RS_FRAME_MODE	51
560 #define DTV_ATSCMH_RS_FRAME_ENSEMBLE	52
561 #define DTV_ATSCMH_RS_CODE_MODE_PRI	53
562 #define DTV_ATSCMH_RS_CODE_MODE_SEC	54
563 #define DTV_ATSCMH_SCCC_BLOCK_MODE	55
564 #define DTV_ATSCMH_SCCC_CODE_MODE_A	56
565 #define DTV_ATSCMH_SCCC_CODE_MODE_B	57
566 #define DTV_ATSCMH_SCCC_CODE_MODE_C	58
567 #define DTV_ATSCMH_SCCC_CODE_MODE_D	59
568 
569 #define DTV_INTERLEAVING			60
570 #define DTV_LNA					61
571 
572 /* Quality parameters */
573 #define DTV_STAT_SIGNAL_STRENGTH	62
574 #define DTV_STAT_CNR			63
575 #define DTV_STAT_PRE_ERROR_BIT_COUNT	64
576 #define DTV_STAT_PRE_TOTAL_BIT_COUNT	65
577 #define DTV_STAT_POST_ERROR_BIT_COUNT	66
578 #define DTV_STAT_POST_TOTAL_BIT_COUNT	67
579 #define DTV_STAT_ERROR_BLOCK_COUNT	68
580 #define DTV_STAT_TOTAL_BLOCK_COUNT	69
581 
582 /* Physical layer scrambling */
583 #define DTV_SCRAMBLING_SEQUENCE_INDEX	70
584 
585 #define DTV_MAX_COMMAND		DTV_SCRAMBLING_SEQUENCE_INDEX
586 
587 /**
588  * enum fe_pilot - Type of pilot tone
589  *
590  * @PILOT_ON:	Pilot tones enabled
591  * @PILOT_OFF:	Pilot tones disabled
592  * @PILOT_AUTO:	Autodetect pilot tones
593  */
594 enum fe_pilot {
595 	PILOT_ON,
596 	PILOT_OFF,
597 	PILOT_AUTO,
598 };
599 
600 /**
601  * enum fe_rolloff - Rolloff factor
602  * @ROLLOFF_35:		Roloff factor: α=35%
603  * @ROLLOFF_20:		Roloff factor: α=20%
604  * @ROLLOFF_25:		Roloff factor: α=25%
605  * @ROLLOFF_AUTO:	Auto-detect the roloff factor.
606  * @ROLLOFF_15:		Rolloff factor: α=15%
607  * @ROLLOFF_10:		Rolloff factor: α=10%
608  * @ROLLOFF_5:		Rolloff factor: α=5%
609  *
610  * .. note:
611  *
612  *    Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default.
613  */
614 enum fe_rolloff {
615 	ROLLOFF_35,
616 	ROLLOFF_20,
617 	ROLLOFF_25,
618 	ROLLOFF_AUTO,
619 	ROLLOFF_15,
620 	ROLLOFF_10,
621 	ROLLOFF_5,
622 };
623 
624 /**
625  * enum fe_delivery_system - Type of the delivery system
626  *
627  * @SYS_UNDEFINED:
628  *	Undefined standard. Generally, indicates an error
629  * @SYS_DVBC_ANNEX_A:
630  *	Cable TV: DVB-C following ITU-T J.83 Annex A spec
631  * @SYS_DVBC_ANNEX_B:
632  *	Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)
633  * @SYS_DVBC_ANNEX_C:
634  *	Cable TV: DVB-C following ITU-T J.83 Annex C spec
635  * @SYS_DVBC2:
636  *      Cable TV: DVB-C2
637  * @SYS_ISDBC:
638  *	Cable TV: ISDB-C (no drivers yet)
639  * @SYS_DVBT:
640  *	Terrestrial TV: DVB-T
641  * @SYS_DVBT2:
642  *	Terrestrial TV: DVB-T2
643  * @SYS_ISDBT:
644  *	Terrestrial TV: ISDB-T
645  * @SYS_ATSC:
646  *	Terrestrial TV: ATSC
647  * @SYS_ATSCMH:
648  *	Terrestrial TV (mobile): ATSC-M/H
649  * @SYS_DTMB:
650  *	Terrestrial TV: DTMB
651  * @SYS_DVBS:
652  *	Satellite TV: DVB-S
653  * @SYS_DVBS2:
654  *	Satellite TV: DVB-S2 and DVB-S2X
655  * @SYS_TURBO:
656  *	Satellite TV: DVB-S Turbo
657  * @SYS_ISDBS:
658  *	Satellite TV: ISDB-S
659  * @SYS_DAB:
660  *	Digital audio: DAB (not fully supported)
661  * @SYS_DSS:
662  *	Satellite TV: DSS (not fully supported)
663  * @SYS_CMMB:
664  *	Terrestrial TV (mobile): CMMB (not fully supported)
665  * @SYS_DVBH:
666  *	Terrestrial TV (mobile): DVB-H (standard deprecated)
667  */
668 enum fe_delivery_system {
669 	SYS_UNDEFINED,
670 	SYS_DVBC_ANNEX_A,
671 	SYS_DVBC_ANNEX_B,
672 	SYS_DVBT,
673 	SYS_DSS,
674 	SYS_DVBS,
675 	SYS_DVBS2,
676 	SYS_DVBH,
677 	SYS_ISDBT,
678 	SYS_ISDBS,
679 	SYS_ISDBC,
680 	SYS_ATSC,
681 	SYS_ATSCMH,
682 	SYS_DTMB,
683 	SYS_CMMB,
684 	SYS_DAB,
685 	SYS_DVBT2,
686 	SYS_TURBO,
687 	SYS_DVBC_ANNEX_C,
688 	SYS_DVBC2,
689 };
690 
691 /* backward compatibility definitions for delivery systems */
692 #define SYS_DVBC_ANNEX_AC	SYS_DVBC_ANNEX_A
693 #define SYS_DMBTH		SYS_DTMB /* DMB-TH is legacy name, use DTMB */
694 
695 /* ATSC-MH specific parameters */
696 
697 /**
698  * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional
699  *				 Code Block Mode.
700  *
701  * @ATSCMH_SCCC_BLK_SEP:
702  *	Separate SCCC: the SCCC outer code mode shall be set independently
703  *	for each Group Region (A, B, C, D)
704  * @ATSCMH_SCCC_BLK_COMB:
705  *	Combined SCCC: all four Regions shall have the same SCCC outer
706  *	code mode.
707  * @ATSCMH_SCCC_BLK_RES:
708  *	Reserved. Shouldn't be used.
709  */
710 enum atscmh_sccc_block_mode {
711 	ATSCMH_SCCC_BLK_SEP      = 0,
712 	ATSCMH_SCCC_BLK_COMB     = 1,
713 	ATSCMH_SCCC_BLK_RES      = 2,
714 };
715 
716 /**
717  * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional
718  *				Code Rate.
719  *
720  * @ATSCMH_SCCC_CODE_HLF:
721  *	The outer code rate of a SCCC Block is 1/2 rate.
722  * @ATSCMH_SCCC_CODE_QTR:
723  *	The outer code rate of a SCCC Block is 1/4 rate.
724  * @ATSCMH_SCCC_CODE_RES:
725  *	Reserved. Should not be used.
726  */
727 enum atscmh_sccc_code_mode {
728 	ATSCMH_SCCC_CODE_HLF     = 0,
729 	ATSCMH_SCCC_CODE_QTR     = 1,
730 	ATSCMH_SCCC_CODE_RES     = 2,
731 };
732 
733 /**
734  * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble.
735  *
736  * @ATSCMH_RSFRAME_ENS_PRI:	Primary Ensemble.
737  * @ATSCMH_RSFRAME_ENS_SEC:	Secondary Ensemble.
738  */
739 enum atscmh_rs_frame_ensemble {
740 	ATSCMH_RSFRAME_ENS_PRI   = 0,
741 	ATSCMH_RSFRAME_ENS_SEC   = 1,
742 };
743 
744 /**
745  * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode.
746  *
747  * @ATSCMH_RSFRAME_PRI_ONLY:
748  *	Single Frame: There is only a primary RS Frame for all Group
749  *	Regions.
750  * @ATSCMH_RSFRAME_PRI_SEC:
751  *	Dual Frame: There are two separate RS Frames: Primary RS Frame for
752  *	Group Region A and B and Secondary RS Frame for Group Region C and
753  *	D.
754  * @ATSCMH_RSFRAME_RES:
755  *	Reserved. Shouldn't be used.
756  */
757 enum atscmh_rs_frame_mode {
758 	ATSCMH_RSFRAME_PRI_ONLY  = 0,
759 	ATSCMH_RSFRAME_PRI_SEC   = 1,
760 	ATSCMH_RSFRAME_RES       = 2,
761 };
762 
763 /**
764  * enum atscmh_rs_code_mode - ATSC-M/H Reed Solomon modes
765  * @ATSCMH_RSCODE_211_187:	Reed Solomon code (211,187).
766  * @ATSCMH_RSCODE_223_187:	Reed Solomon code (223,187).
767  * @ATSCMH_RSCODE_235_187:	Reed Solomon code (235,187).
768  * @ATSCMH_RSCODE_RES:		Reserved. Shouldn't be used.
769  */
770 enum atscmh_rs_code_mode {
771 	ATSCMH_RSCODE_211_187    = 0,
772 	ATSCMH_RSCODE_223_187    = 1,
773 	ATSCMH_RSCODE_235_187    = 2,
774 	ATSCMH_RSCODE_RES        = 3,
775 };
776 
777 #define NO_STREAM_ID_FILTER	(~0U)
778 #define LNA_AUTO                (~0U)
779 
780 /**
781  * enum fecap_scale_params - scale types for the quality parameters.
782  *
783  * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
784  *			    could indicate a temporary or a permanent
785  *			    condition.
786  * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
787  *		      used on signal measures.
788  * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
789  *		       ranging from 0 (0%) to 0xffff (100%).
790  * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like
791  *		      bit error, block error, lapsed time.
792  */
793 enum fecap_scale_params {
794 	FE_SCALE_NOT_AVAILABLE = 0,
795 	FE_SCALE_DECIBEL,
796 	FE_SCALE_RELATIVE,
797 	FE_SCALE_COUNTER
798 };
799 
800 /**
801  * struct dtv_stats - Used for reading a DTV status property
802  *
803  * @scale:
804  *	Filled with enum fecap_scale_params - the scale in usage
805  *	for that parameter
806  *
807  * @svalue:
808  *	integer value of the measure, for %FE_SCALE_DECIBEL,
809  *	used for dB measures. The unit is 0.001 dB.
810  *
811  * @uvalue:
812  *	unsigned integer value of the measure, used when @scale is
813  *	either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER.
814  *
815  * For most delivery systems, this will return a single value for each
816  * parameter.
817  *
818  * It should be noticed, however, that new OFDM delivery systems like
819  * ISDB can use different modulation types for each group of carriers.
820  * On such standards, up to 8 groups of statistics can be provided, one
821  * for each carrier group (called "layer" on ISDB).
822  *
823  * In order to be consistent with other delivery systems, the first
824  * value refers to the entire set of carriers ("global").
825  *
826  * @scale should use the value %FE_SCALE_NOT_AVAILABLE when
827  * the value for the entire group of carriers or from one specific layer
828  * is not provided by the hardware.
829  *
830  * @len should be filled with the latest filled status + 1.
831  *
832  * In other words, for ISDB, those values should be filled like::
833  *
834  *	u.st.stat.svalue[0] = global statistics;
835  *	u.st.stat.scale[0] = FE_SCALE_DECIBEL;
836  *	u.st.stat.value[1] = layer A statistics;
837  *	u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
838  *	u.st.stat.svalue[2] = layer B statistics;
839  *	u.st.stat.scale[2] = FE_SCALE_DECIBEL;
840  *	u.st.stat.svalue[3] = layer C statistics;
841  *	u.st.stat.scale[3] = FE_SCALE_DECIBEL;
842  *	u.st.len = 4;
843  */
844 struct dtv_stats {
845 	__u8 scale;	/* enum fecap_scale_params type */
846 	union {
847 		__u64 uvalue;	/* for counters and relative scales */
848 		__s64 svalue;	/* for 0.001 dB measures */
849 	};
850 } __attribute__ ((packed));
851 
852 
853 #define MAX_DTV_STATS   4
854 
855 /**
856  * struct dtv_fe_stats - store Digital TV frontend statistics
857  *
858  * @len:	length of the statistics - if zero, stats is disabled.
859  * @stat:	array with digital TV statistics.
860  *
861  * On most standards, @len can either be 0 or 1. However, for ISDB, each
862  * layer is modulated in separate. So, each layer may have its own set
863  * of statistics. If so, stat[0] carries on a global value for the property.
864  * Indexes 1 to 3 means layer A to B.
865  */
866 struct dtv_fe_stats {
867 	__u8 len;
868 	struct dtv_stats stat[MAX_DTV_STATS];
869 } __attribute__ ((packed));
870 
871 /**
872  * struct dtv_property - store one of frontend command and its value
873  *
874  * @cmd:		Digital TV command.
875  * @reserved:		Not used.
876  * @u:			Union with the values for the command.
877  * @u.data:		A unsigned 32 bits integer with command value.
878  * @u.buffer:		Struct to store bigger properties.
879  *			Currently unused.
880  * @u.buffer.data:	an unsigned 32-bits array.
881  * @u.buffer.len:	number of elements of the buffer.
882  * @u.buffer.reserved1:	Reserved.
883  * @u.buffer.reserved2:	Reserved.
884  * @u.st:		a &struct dtv_fe_stats array of statistics.
885  * @result:		Currently unused.
886  *
887  */
888 struct dtv_property {
889 	__u32 cmd;
890 	__u32 reserved[3];
891 	union {
892 		__u32 data;
893 		struct dtv_fe_stats st;
894 		struct {
895 			__u8 data[32];
896 			__u32 len;
897 			__u32 reserved1[3];
898 			void *reserved2;
899 		} buffer;
900 	} u;
901 	int result;
902 } __attribute__ ((packed));
903 
904 /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
905 #define DTV_IOCTL_MAX_MSGS 64
906 
907 /**
908  * struct dtv_properties - a set of command/value pairs.
909  *
910  * @num:	amount of commands stored at the struct.
911  * @props:	a pointer to &struct dtv_property.
912  */
913 struct dtv_properties {
914 	__u32 num;
915 	struct dtv_property *props;
916 };
917 
918 /*
919  * When set, this flag will disable any zigzagging or other "normal" tuning
920  * behavior. Additionally, there will be no automatic monitoring of the lock
921  * status, and hence no frontend events will be generated. If a frontend device
922  * is closed, this flag will be automatically turned off when the device is
923  * reopened read-write.
924  */
925 #define FE_TUNE_MODE_ONESHOT 0x01
926 
927 /* Digital TV Frontend API calls */
928 
929 #define FE_GET_INFO		   _IOR('o', 61, struct dvb_frontend_info)
930 
931 #define FE_DISEQC_RESET_OVERLOAD   _IO('o', 62)
932 #define FE_DISEQC_SEND_MASTER_CMD  _IOW('o', 63, struct dvb_diseqc_master_cmd)
933 #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
934 #define FE_DISEQC_SEND_BURST       _IO('o', 65)  /* fe_sec_mini_cmd_t */
935 
936 #define FE_SET_TONE		   _IO('o', 66)  /* fe_sec_tone_mode_t */
937 #define FE_SET_VOLTAGE		   _IO('o', 67)  /* fe_sec_voltage_t */
938 #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68)  /* int */
939 
940 #define FE_READ_STATUS		   _IOR('o', 69, fe_status_t)
941 #define FE_READ_BER		   _IOR('o', 70, __u32)
942 #define FE_READ_SIGNAL_STRENGTH    _IOR('o', 71, __u16)
943 #define FE_READ_SNR		   _IOR('o', 72, __u16)
944 #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
945 
946 #define FE_SET_FRONTEND_TUNE_MODE  _IO('o', 81) /* unsigned int */
947 #define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
948 
949 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
950 
951 #define FE_SET_PROPERTY		   _IOW('o', 82, struct dtv_properties)
952 #define FE_GET_PROPERTY		   _IOR('o', 83, struct dtv_properties)
953 
954 #if defined(__DVB_CORE__) || !defined(__KERNEL__)
955 
956 /*
957  * DEPRECATED: Everything below is deprecated in favor of DVBv5 API
958  *
959  * The DVBv3 only ioctls, structs and enums should not be used on
960  * newer programs, as it doesn't support the second generation of
961  * digital TV standards, nor supports newer delivery systems.
962  * They also don't support modern frontends with usually support multiple
963  * delivery systems.
964  *
965  * Drivers shouldn't use them.
966  *
967  * New applications should use DVBv5 delivery system instead
968  */
969 
970 /*
971  */
972 
973 enum fe_bandwidth {
974 	BANDWIDTH_8_MHZ,
975 	BANDWIDTH_7_MHZ,
976 	BANDWIDTH_6_MHZ,
977 	BANDWIDTH_AUTO,
978 	BANDWIDTH_5_MHZ,
979 	BANDWIDTH_10_MHZ,
980 	BANDWIDTH_1_712_MHZ,
981 };
982 
983 /* This is kept for legacy userspace support */
984 typedef enum fe_sec_voltage fe_sec_voltage_t;
985 typedef enum fe_caps fe_caps_t;
986 typedef enum fe_type fe_type_t;
987 typedef enum fe_sec_tone_mode fe_sec_tone_mode_t;
988 typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t;
989 typedef enum fe_status fe_status_t;
990 typedef enum fe_spectral_inversion fe_spectral_inversion_t;
991 typedef enum fe_code_rate fe_code_rate_t;
992 typedef enum fe_modulation fe_modulation_t;
993 typedef enum fe_transmit_mode fe_transmit_mode_t;
994 typedef enum fe_bandwidth fe_bandwidth_t;
995 typedef enum fe_guard_interval fe_guard_interval_t;
996 typedef enum fe_hierarchy fe_hierarchy_t;
997 typedef enum fe_pilot fe_pilot_t;
998 typedef enum fe_rolloff fe_rolloff_t;
999 typedef enum fe_delivery_system fe_delivery_system_t;
1000 
1001 /* DVBv3 structs */
1002 
1003 struct dvb_qpsk_parameters {
1004 	__u32		symbol_rate;  /* symbol rate in Symbols per second */
1005 	fe_code_rate_t	fec_inner;    /* forward error correction (see above) */
1006 };
1007 
1008 struct dvb_qam_parameters {
1009 	__u32		symbol_rate; /* symbol rate in Symbols per second */
1010 	fe_code_rate_t	fec_inner;   /* forward error correction (see above) */
1011 	fe_modulation_t	modulation;  /* modulation type (see above) */
1012 };
1013 
1014 struct dvb_vsb_parameters {
1015 	fe_modulation_t	modulation;  /* modulation type (see above) */
1016 };
1017 
1018 struct dvb_ofdm_parameters {
1019 	fe_bandwidth_t      bandwidth;
1020 	fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
1021 	fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
1022 	fe_modulation_t     constellation; /* modulation type (see above) */
1023 	fe_transmit_mode_t  transmission_mode;
1024 	fe_guard_interval_t guard_interval;
1025 	fe_hierarchy_t      hierarchy_information;
1026 };
1027 
1028 struct dvb_frontend_parameters {
1029 	__u32 frequency;  /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */
1030 			  /* intermediate frequency in kHz for DVB-S */
1031 	fe_spectral_inversion_t inversion;
1032 	union {
1033 		struct dvb_qpsk_parameters qpsk;	/* DVB-S */
1034 		struct dvb_qam_parameters  qam;		/* DVB-C */
1035 		struct dvb_ofdm_parameters ofdm;	/* DVB-T */
1036 		struct dvb_vsb_parameters vsb;		/* ATSC */
1037 	} u;
1038 };
1039 
1040 struct dvb_frontend_event {
1041 	fe_status_t status;
1042 	struct dvb_frontend_parameters parameters;
1043 };
1044 
1045 /* DVBv3 API calls */
1046 
1047 #define FE_SET_FRONTEND		   _IOW('o', 76, struct dvb_frontend_parameters)
1048 #define FE_GET_FRONTEND		   _IOR('o', 77, struct dvb_frontend_parameters)
1049 
1050 #endif
1051 
1052 #endif /*_DVBFRONTEND_H_*/
1053