xref: /openbmc/linux/include/uapi/linux/dvb/frontend.h (revision 1825788e)
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  * @FEC_11_45: Forward Error Correction Code 11/45
300  * @FEC_4_15: Forward Error Correction Code 4/15
301  * @FEC_14_45: Forward Error Correction Code 14/45
302  * @FEC_7_15: Forward Error Correction Code 7/15
303  *
304  * Please note that not all FEC types are supported by a given standard.
305  */
306 enum fe_code_rate {
307 	FEC_NONE = 0,
308 	FEC_1_2,
309 	FEC_2_3,
310 	FEC_3_4,
311 	FEC_4_5,
312 	FEC_5_6,
313 	FEC_6_7,
314 	FEC_7_8,
315 	FEC_8_9,
316 	FEC_AUTO,
317 	FEC_3_5,
318 	FEC_9_10,
319 	FEC_2_5,
320 	FEC_1_3,
321 	FEC_1_4,
322 	FEC_5_9,
323 	FEC_7_9,
324 	FEC_8_15,
325 	FEC_11_15,
326 	FEC_13_18,
327 	FEC_9_20,
328 	FEC_11_20,
329 	FEC_23_36,
330 	FEC_25_36,
331 	FEC_13_45,
332 	FEC_26_45,
333 	FEC_28_45,
334 	FEC_32_45,
335 	FEC_77_90,
336 	FEC_11_45,
337 	FEC_4_15,
338 	FEC_14_45,
339 	FEC_7_15,
340 };
341 
342 /**
343  * enum fe_modulation - Type of modulation/constellation
344  * @QPSK:	QPSK modulation
345  * @QAM_16:	16-QAM modulation
346  * @QAM_32:	32-QAM modulation
347  * @QAM_64:	64-QAM modulation
348  * @QAM_128:	128-QAM modulation
349  * @QAM_256:	256-QAM modulation
350  * @QAM_AUTO:	Autodetect QAM modulation
351  * @VSB_8:	8-VSB modulation
352  * @VSB_16:	16-VSB modulation
353  * @PSK_8:	8-PSK modulation
354  * @APSK_16:	16-APSK modulation
355  * @APSK_32:	32-APSK modulation
356  * @DQPSK:	DQPSK modulation
357  * @QAM_4_NR:	4-QAM-NR modulation
358  * @QAM_1024:	1024-QAM modulation
359  * @QAM_4096:	4096-QAM modulation
360  * @APSK_8_L:	8APSK-L modulation
361  * @APSK_16_L:	16APSK-L modulation
362  * @APSK_32_L:	32APSK-L modulation
363  * @APSK_64:	64APSK modulation
364  * @APSK_64_L:	64APSK-L modulation
365  *
366  * Please note that not all modulations are supported by a given standard.
367  *
368  */
369 enum fe_modulation {
370 	QPSK,
371 	QAM_16,
372 	QAM_32,
373 	QAM_64,
374 	QAM_128,
375 	QAM_256,
376 	QAM_AUTO,
377 	VSB_8,
378 	VSB_16,
379 	PSK_8,
380 	APSK_16,
381 	APSK_32,
382 	DQPSK,
383 	QAM_4_NR,
384 	QAM_1024,
385 	QAM_4096,
386 	APSK_8_L,
387 	APSK_16_L,
388 	APSK_32_L,
389 	APSK_64,
390 	APSK_64_L,
391 };
392 
393 /**
394  * enum fe_transmit_mode - Transmission mode
395  *
396  * @TRANSMISSION_MODE_AUTO:
397  *	Autodetect transmission mode. The hardware will try to find the
398  *	correct FFT-size (if capable) to fill in the missing parameters.
399  * @TRANSMISSION_MODE_1K:
400  *	Transmission mode 1K
401  * @TRANSMISSION_MODE_2K:
402  *	Transmission mode 2K
403  * @TRANSMISSION_MODE_8K:
404  *	Transmission mode 8K
405  * @TRANSMISSION_MODE_4K:
406  *	Transmission mode 4K
407  * @TRANSMISSION_MODE_16K:
408  *	Transmission mode 16K
409  * @TRANSMISSION_MODE_32K:
410  *	Transmission mode 32K
411  * @TRANSMISSION_MODE_C1:
412  *	Single Carrier (C=1) transmission mode (DTMB only)
413  * @TRANSMISSION_MODE_C3780:
414  *	Multi Carrier (C=3780) transmission mode (DTMB only)
415  *
416  * Please note that not all transmission modes are supported by a given
417  * standard.
418  */
419 enum fe_transmit_mode {
420 	TRANSMISSION_MODE_2K,
421 	TRANSMISSION_MODE_8K,
422 	TRANSMISSION_MODE_AUTO,
423 	TRANSMISSION_MODE_4K,
424 	TRANSMISSION_MODE_1K,
425 	TRANSMISSION_MODE_16K,
426 	TRANSMISSION_MODE_32K,
427 	TRANSMISSION_MODE_C1,
428 	TRANSMISSION_MODE_C3780,
429 };
430 
431 /**
432  * enum fe_guard_interval - Guard interval
433  *
434  * @GUARD_INTERVAL_AUTO:	Autodetect the guard interval
435  * @GUARD_INTERVAL_1_128:	Guard interval 1/128
436  * @GUARD_INTERVAL_1_32:	Guard interval 1/32
437  * @GUARD_INTERVAL_1_16:	Guard interval 1/16
438  * @GUARD_INTERVAL_1_8:		Guard interval 1/8
439  * @GUARD_INTERVAL_1_4:		Guard interval 1/4
440  * @GUARD_INTERVAL_19_128:	Guard interval 19/128
441  * @GUARD_INTERVAL_19_256:	Guard interval 19/256
442  * @GUARD_INTERVAL_PN420:	PN length 420 (1/4)
443  * @GUARD_INTERVAL_PN595:	PN length 595 (1/6)
444  * @GUARD_INTERVAL_PN945:	PN length 945 (1/9)
445  * @GUARD_INTERVAL_1_64:	Guard interval 1/64
446  *
447  * Please note that not all guard intervals are supported by a given standard.
448  */
449 enum fe_guard_interval {
450 	GUARD_INTERVAL_1_32,
451 	GUARD_INTERVAL_1_16,
452 	GUARD_INTERVAL_1_8,
453 	GUARD_INTERVAL_1_4,
454 	GUARD_INTERVAL_AUTO,
455 	GUARD_INTERVAL_1_128,
456 	GUARD_INTERVAL_19_128,
457 	GUARD_INTERVAL_19_256,
458 	GUARD_INTERVAL_PN420,
459 	GUARD_INTERVAL_PN595,
460 	GUARD_INTERVAL_PN945,
461 	GUARD_INTERVAL_1_64,
462 };
463 
464 /**
465  * enum fe_hierarchy - Hierarchy
466  * @HIERARCHY_NONE:	No hierarchy
467  * @HIERARCHY_AUTO:	Autodetect hierarchy (if supported)
468  * @HIERARCHY_1:	Hierarchy 1
469  * @HIERARCHY_2:	Hierarchy 2
470  * @HIERARCHY_4:	Hierarchy 4
471  *
472  * Please note that not all hierarchy types are supported by a given standard.
473  */
474 enum fe_hierarchy {
475 	HIERARCHY_NONE,
476 	HIERARCHY_1,
477 	HIERARCHY_2,
478 	HIERARCHY_4,
479 	HIERARCHY_AUTO
480 };
481 
482 /**
483  * enum fe_interleaving - Interleaving
484  * @INTERLEAVING_NONE:	No interleaving.
485  * @INTERLEAVING_AUTO:	Auto-detect interleaving.
486  * @INTERLEAVING_240:	Interleaving of 240 symbols.
487  * @INTERLEAVING_720:	Interleaving of 720 symbols.
488  *
489  * Please note that, currently, only DTMB uses it.
490  */
491 enum fe_interleaving {
492 	INTERLEAVING_NONE,
493 	INTERLEAVING_AUTO,
494 	INTERLEAVING_240,
495 	INTERLEAVING_720,
496 };
497 
498 /* DVBv5 property Commands */
499 
500 #define DTV_UNDEFINED		0
501 #define DTV_TUNE		1
502 #define DTV_CLEAR		2
503 #define DTV_FREQUENCY		3
504 #define DTV_MODULATION		4
505 #define DTV_BANDWIDTH_HZ	5
506 #define DTV_INVERSION		6
507 #define DTV_DISEQC_MASTER	7
508 #define DTV_SYMBOL_RATE		8
509 #define DTV_INNER_FEC		9
510 #define DTV_VOLTAGE		10
511 #define DTV_TONE		11
512 #define DTV_PILOT		12
513 #define DTV_ROLLOFF		13
514 #define DTV_DISEQC_SLAVE_REPLY	14
515 
516 /* Basic enumeration set for querying unlimited capabilities */
517 #define DTV_FE_CAPABILITY_COUNT	15
518 #define DTV_FE_CAPABILITY	16
519 #define DTV_DELIVERY_SYSTEM	17
520 
521 /* ISDB-T and ISDB-Tsb */
522 #define DTV_ISDBT_PARTIAL_RECEPTION	18
523 #define DTV_ISDBT_SOUND_BROADCASTING	19
524 
525 #define DTV_ISDBT_SB_SUBCHANNEL_ID	20
526 #define DTV_ISDBT_SB_SEGMENT_IDX	21
527 #define DTV_ISDBT_SB_SEGMENT_COUNT	22
528 
529 #define DTV_ISDBT_LAYERA_FEC			23
530 #define DTV_ISDBT_LAYERA_MODULATION		24
531 #define DTV_ISDBT_LAYERA_SEGMENT_COUNT		25
532 #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING	26
533 
534 #define DTV_ISDBT_LAYERB_FEC			27
535 #define DTV_ISDBT_LAYERB_MODULATION		28
536 #define DTV_ISDBT_LAYERB_SEGMENT_COUNT		29
537 #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING	30
538 
539 #define DTV_ISDBT_LAYERC_FEC			31
540 #define DTV_ISDBT_LAYERC_MODULATION		32
541 #define DTV_ISDBT_LAYERC_SEGMENT_COUNT		33
542 #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING	34
543 
544 #define DTV_API_VERSION		35
545 
546 #define DTV_CODE_RATE_HP	36
547 #define DTV_CODE_RATE_LP	37
548 #define DTV_GUARD_INTERVAL	38
549 #define DTV_TRANSMISSION_MODE	39
550 #define DTV_HIERARCHY		40
551 
552 #define DTV_ISDBT_LAYER_ENABLED	41
553 
554 #define DTV_STREAM_ID		42
555 #define DTV_ISDBS_TS_ID_LEGACY	DTV_STREAM_ID
556 #define DTV_DVBT2_PLP_ID_LEGACY	43
557 
558 #define DTV_ENUM_DELSYS		44
559 
560 /* ATSC-MH */
561 #define DTV_ATSCMH_FIC_VER		45
562 #define DTV_ATSCMH_PARADE_ID		46
563 #define DTV_ATSCMH_NOG			47
564 #define DTV_ATSCMH_TNOG			48
565 #define DTV_ATSCMH_SGN			49
566 #define DTV_ATSCMH_PRC			50
567 #define DTV_ATSCMH_RS_FRAME_MODE	51
568 #define DTV_ATSCMH_RS_FRAME_ENSEMBLE	52
569 #define DTV_ATSCMH_RS_CODE_MODE_PRI	53
570 #define DTV_ATSCMH_RS_CODE_MODE_SEC	54
571 #define DTV_ATSCMH_SCCC_BLOCK_MODE	55
572 #define DTV_ATSCMH_SCCC_CODE_MODE_A	56
573 #define DTV_ATSCMH_SCCC_CODE_MODE_B	57
574 #define DTV_ATSCMH_SCCC_CODE_MODE_C	58
575 #define DTV_ATSCMH_SCCC_CODE_MODE_D	59
576 
577 #define DTV_INTERLEAVING			60
578 #define DTV_LNA					61
579 
580 /* Quality parameters */
581 #define DTV_STAT_SIGNAL_STRENGTH	62
582 #define DTV_STAT_CNR			63
583 #define DTV_STAT_PRE_ERROR_BIT_COUNT	64
584 #define DTV_STAT_PRE_TOTAL_BIT_COUNT	65
585 #define DTV_STAT_POST_ERROR_BIT_COUNT	66
586 #define DTV_STAT_POST_TOTAL_BIT_COUNT	67
587 #define DTV_STAT_ERROR_BLOCK_COUNT	68
588 #define DTV_STAT_TOTAL_BLOCK_COUNT	69
589 
590 /* Physical layer scrambling */
591 #define DTV_SCRAMBLING_SEQUENCE_INDEX	70
592 
593 #define DTV_MAX_COMMAND		DTV_SCRAMBLING_SEQUENCE_INDEX
594 
595 /**
596  * enum fe_pilot - Type of pilot tone
597  *
598  * @PILOT_ON:	Pilot tones enabled
599  * @PILOT_OFF:	Pilot tones disabled
600  * @PILOT_AUTO:	Autodetect pilot tones
601  */
602 enum fe_pilot {
603 	PILOT_ON,
604 	PILOT_OFF,
605 	PILOT_AUTO,
606 };
607 
608 /**
609  * enum fe_rolloff - Rolloff factor
610  * @ROLLOFF_35:		Roloff factor: α=35%
611  * @ROLLOFF_20:		Roloff factor: α=20%
612  * @ROLLOFF_25:		Roloff factor: α=25%
613  * @ROLLOFF_AUTO:	Auto-detect the roloff factor.
614  * @ROLLOFF_15:		Rolloff factor: α=15%
615  * @ROLLOFF_10:		Rolloff factor: α=10%
616  * @ROLLOFF_5:		Rolloff factor: α=5%
617  *
618  * .. note:
619  *
620  *    Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default.
621  */
622 enum fe_rolloff {
623 	ROLLOFF_35,
624 	ROLLOFF_20,
625 	ROLLOFF_25,
626 	ROLLOFF_AUTO,
627 	ROLLOFF_15,
628 	ROLLOFF_10,
629 	ROLLOFF_5,
630 };
631 
632 /**
633  * enum fe_delivery_system - Type of the delivery system
634  *
635  * @SYS_UNDEFINED:
636  *	Undefined standard. Generally, indicates an error
637  * @SYS_DVBC_ANNEX_A:
638  *	Cable TV: DVB-C following ITU-T J.83 Annex A spec
639  * @SYS_DVBC_ANNEX_B:
640  *	Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)
641  * @SYS_DVBC_ANNEX_C:
642  *	Cable TV: DVB-C following ITU-T J.83 Annex C spec
643  * @SYS_DVBC2:
644  *      Cable TV: DVB-C2
645  * @SYS_ISDBC:
646  *	Cable TV: ISDB-C (no drivers yet)
647  * @SYS_DVBT:
648  *	Terrestrial TV: DVB-T
649  * @SYS_DVBT2:
650  *	Terrestrial TV: DVB-T2
651  * @SYS_ISDBT:
652  *	Terrestrial TV: ISDB-T
653  * @SYS_ATSC:
654  *	Terrestrial TV: ATSC
655  * @SYS_ATSCMH:
656  *	Terrestrial TV (mobile): ATSC-M/H
657  * @SYS_DTMB:
658  *	Terrestrial TV: DTMB
659  * @SYS_DVBS:
660  *	Satellite TV: DVB-S
661  * @SYS_DVBS2:
662  *	Satellite TV: DVB-S2 and DVB-S2X
663  * @SYS_TURBO:
664  *	Satellite TV: DVB-S Turbo
665  * @SYS_ISDBS:
666  *	Satellite TV: ISDB-S
667  * @SYS_DAB:
668  *	Digital audio: DAB (not fully supported)
669  * @SYS_DSS:
670  *	Satellite TV: DSS (not fully supported)
671  * @SYS_CMMB:
672  *	Terrestrial TV (mobile): CMMB (not fully supported)
673  * @SYS_DVBH:
674  *	Terrestrial TV (mobile): DVB-H (standard deprecated)
675  */
676 enum fe_delivery_system {
677 	SYS_UNDEFINED,
678 	SYS_DVBC_ANNEX_A,
679 	SYS_DVBC_ANNEX_B,
680 	SYS_DVBT,
681 	SYS_DSS,
682 	SYS_DVBS,
683 	SYS_DVBS2,
684 	SYS_DVBH,
685 	SYS_ISDBT,
686 	SYS_ISDBS,
687 	SYS_ISDBC,
688 	SYS_ATSC,
689 	SYS_ATSCMH,
690 	SYS_DTMB,
691 	SYS_CMMB,
692 	SYS_DAB,
693 	SYS_DVBT2,
694 	SYS_TURBO,
695 	SYS_DVBC_ANNEX_C,
696 	SYS_DVBC2,
697 };
698 
699 /* backward compatibility definitions for delivery systems */
700 #define SYS_DVBC_ANNEX_AC	SYS_DVBC_ANNEX_A
701 #define SYS_DMBTH		SYS_DTMB /* DMB-TH is legacy name, use DTMB */
702 
703 /* ATSC-MH specific parameters */
704 
705 /**
706  * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional
707  *				 Code Block Mode.
708  *
709  * @ATSCMH_SCCC_BLK_SEP:
710  *	Separate SCCC: the SCCC outer code mode shall be set independently
711  *	for each Group Region (A, B, C, D)
712  * @ATSCMH_SCCC_BLK_COMB:
713  *	Combined SCCC: all four Regions shall have the same SCCC outer
714  *	code mode.
715  * @ATSCMH_SCCC_BLK_RES:
716  *	Reserved. Shouldn't be used.
717  */
718 enum atscmh_sccc_block_mode {
719 	ATSCMH_SCCC_BLK_SEP      = 0,
720 	ATSCMH_SCCC_BLK_COMB     = 1,
721 	ATSCMH_SCCC_BLK_RES      = 2,
722 };
723 
724 /**
725  * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional
726  *				Code Rate.
727  *
728  * @ATSCMH_SCCC_CODE_HLF:
729  *	The outer code rate of a SCCC Block is 1/2 rate.
730  * @ATSCMH_SCCC_CODE_QTR:
731  *	The outer code rate of a SCCC Block is 1/4 rate.
732  * @ATSCMH_SCCC_CODE_RES:
733  *	Reserved. Should not be used.
734  */
735 enum atscmh_sccc_code_mode {
736 	ATSCMH_SCCC_CODE_HLF     = 0,
737 	ATSCMH_SCCC_CODE_QTR     = 1,
738 	ATSCMH_SCCC_CODE_RES     = 2,
739 };
740 
741 /**
742  * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble.
743  *
744  * @ATSCMH_RSFRAME_ENS_PRI:	Primary Ensemble.
745  * @ATSCMH_RSFRAME_ENS_SEC:	Secondary Ensemble.
746  */
747 enum atscmh_rs_frame_ensemble {
748 	ATSCMH_RSFRAME_ENS_PRI   = 0,
749 	ATSCMH_RSFRAME_ENS_SEC   = 1,
750 };
751 
752 /**
753  * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode.
754  *
755  * @ATSCMH_RSFRAME_PRI_ONLY:
756  *	Single Frame: There is only a primary RS Frame for all Group
757  *	Regions.
758  * @ATSCMH_RSFRAME_PRI_SEC:
759  *	Dual Frame: There are two separate RS Frames: Primary RS Frame for
760  *	Group Region A and B and Secondary RS Frame for Group Region C and
761  *	D.
762  * @ATSCMH_RSFRAME_RES:
763  *	Reserved. Shouldn't be used.
764  */
765 enum atscmh_rs_frame_mode {
766 	ATSCMH_RSFRAME_PRI_ONLY  = 0,
767 	ATSCMH_RSFRAME_PRI_SEC   = 1,
768 	ATSCMH_RSFRAME_RES       = 2,
769 };
770 
771 /**
772  * enum atscmh_rs_code_mode - ATSC-M/H Reed Solomon modes
773  * @ATSCMH_RSCODE_211_187:	Reed Solomon code (211,187).
774  * @ATSCMH_RSCODE_223_187:	Reed Solomon code (223,187).
775  * @ATSCMH_RSCODE_235_187:	Reed Solomon code (235,187).
776  * @ATSCMH_RSCODE_RES:		Reserved. Shouldn't be used.
777  */
778 enum atscmh_rs_code_mode {
779 	ATSCMH_RSCODE_211_187    = 0,
780 	ATSCMH_RSCODE_223_187    = 1,
781 	ATSCMH_RSCODE_235_187    = 2,
782 	ATSCMH_RSCODE_RES        = 3,
783 };
784 
785 #define NO_STREAM_ID_FILTER	(~0U)
786 #define LNA_AUTO                (~0U)
787 
788 /**
789  * enum fecap_scale_params - scale types for the quality parameters.
790  *
791  * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
792  *			    could indicate a temporary or a permanent
793  *			    condition.
794  * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
795  *		      used on signal measures.
796  * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
797  *		       ranging from 0 (0%) to 0xffff (100%).
798  * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like
799  *		      bit error, block error, lapsed time.
800  */
801 enum fecap_scale_params {
802 	FE_SCALE_NOT_AVAILABLE = 0,
803 	FE_SCALE_DECIBEL,
804 	FE_SCALE_RELATIVE,
805 	FE_SCALE_COUNTER
806 };
807 
808 /**
809  * struct dtv_stats - Used for reading a DTV status property
810  *
811  * @scale:
812  *	Filled with enum fecap_scale_params - the scale in usage
813  *	for that parameter
814  *
815  * @svalue:
816  *	integer value of the measure, for %FE_SCALE_DECIBEL,
817  *	used for dB measures. The unit is 0.001 dB.
818  *
819  * @uvalue:
820  *	unsigned integer value of the measure, used when @scale is
821  *	either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER.
822  *
823  * For most delivery systems, this will return a single value for each
824  * parameter.
825  *
826  * It should be noticed, however, that new OFDM delivery systems like
827  * ISDB can use different modulation types for each group of carriers.
828  * On such standards, up to 8 groups of statistics can be provided, one
829  * for each carrier group (called "layer" on ISDB).
830  *
831  * In order to be consistent with other delivery systems, the first
832  * value refers to the entire set of carriers ("global").
833  *
834  * @scale should use the value %FE_SCALE_NOT_AVAILABLE when
835  * the value for the entire group of carriers or from one specific layer
836  * is not provided by the hardware.
837  *
838  * @len should be filled with the latest filled status + 1.
839  *
840  * In other words, for ISDB, those values should be filled like::
841  *
842  *	u.st.stat.svalue[0] = global statistics;
843  *	u.st.stat.scale[0] = FE_SCALE_DECIBEL;
844  *	u.st.stat.value[1] = layer A statistics;
845  *	u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
846  *	u.st.stat.svalue[2] = layer B statistics;
847  *	u.st.stat.scale[2] = FE_SCALE_DECIBEL;
848  *	u.st.stat.svalue[3] = layer C statistics;
849  *	u.st.stat.scale[3] = FE_SCALE_DECIBEL;
850  *	u.st.len = 4;
851  */
852 struct dtv_stats {
853 	__u8 scale;	/* enum fecap_scale_params type */
854 	union {
855 		__u64 uvalue;	/* for counters and relative scales */
856 		__s64 svalue;	/* for 0.001 dB measures */
857 	};
858 } __attribute__ ((packed));
859 
860 
861 #define MAX_DTV_STATS   4
862 
863 /**
864  * struct dtv_fe_stats - store Digital TV frontend statistics
865  *
866  * @len:	length of the statistics - if zero, stats is disabled.
867  * @stat:	array with digital TV statistics.
868  *
869  * On most standards, @len can either be 0 or 1. However, for ISDB, each
870  * layer is modulated in separate. So, each layer may have its own set
871  * of statistics. If so, stat[0] carries on a global value for the property.
872  * Indexes 1 to 3 means layer A to B.
873  */
874 struct dtv_fe_stats {
875 	__u8 len;
876 	struct dtv_stats stat[MAX_DTV_STATS];
877 } __attribute__ ((packed));
878 
879 /**
880  * struct dtv_property - store one of frontend command and its value
881  *
882  * @cmd:		Digital TV command.
883  * @reserved:		Not used.
884  * @u:			Union with the values for the command.
885  * @u.data:		A unsigned 32 bits integer with command value.
886  * @u.buffer:		Struct to store bigger properties.
887  *			Currently unused.
888  * @u.buffer.data:	an unsigned 32-bits array.
889  * @u.buffer.len:	number of elements of the buffer.
890  * @u.buffer.reserved1:	Reserved.
891  * @u.buffer.reserved2:	Reserved.
892  * @u.st:		a &struct dtv_fe_stats array of statistics.
893  * @result:		Currently unused.
894  *
895  */
896 struct dtv_property {
897 	__u32 cmd;
898 	__u32 reserved[3];
899 	union {
900 		__u32 data;
901 		struct dtv_fe_stats st;
902 		struct {
903 			__u8 data[32];
904 			__u32 len;
905 			__u32 reserved1[3];
906 			void *reserved2;
907 		} buffer;
908 	} u;
909 	int result;
910 } __attribute__ ((packed));
911 
912 /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
913 #define DTV_IOCTL_MAX_MSGS 64
914 
915 /**
916  * struct dtv_properties - a set of command/value pairs.
917  *
918  * @num:	amount of commands stored at the struct.
919  * @props:	a pointer to &struct dtv_property.
920  */
921 struct dtv_properties {
922 	__u32 num;
923 	struct dtv_property *props;
924 };
925 
926 /*
927  * When set, this flag will disable any zigzagging or other "normal" tuning
928  * behavior. Additionally, there will be no automatic monitoring of the lock
929  * status, and hence no frontend events will be generated. If a frontend device
930  * is closed, this flag will be automatically turned off when the device is
931  * reopened read-write.
932  */
933 #define FE_TUNE_MODE_ONESHOT 0x01
934 
935 /* Digital TV Frontend API calls */
936 
937 #define FE_GET_INFO		   _IOR('o', 61, struct dvb_frontend_info)
938 
939 #define FE_DISEQC_RESET_OVERLOAD   _IO('o', 62)
940 #define FE_DISEQC_SEND_MASTER_CMD  _IOW('o', 63, struct dvb_diseqc_master_cmd)
941 #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
942 #define FE_DISEQC_SEND_BURST       _IO('o', 65)  /* fe_sec_mini_cmd_t */
943 
944 #define FE_SET_TONE		   _IO('o', 66)  /* fe_sec_tone_mode_t */
945 #define FE_SET_VOLTAGE		   _IO('o', 67)  /* fe_sec_voltage_t */
946 #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68)  /* int */
947 
948 #define FE_READ_STATUS		   _IOR('o', 69, fe_status_t)
949 #define FE_READ_BER		   _IOR('o', 70, __u32)
950 #define FE_READ_SIGNAL_STRENGTH    _IOR('o', 71, __u16)
951 #define FE_READ_SNR		   _IOR('o', 72, __u16)
952 #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
953 
954 #define FE_SET_FRONTEND_TUNE_MODE  _IO('o', 81) /* unsigned int */
955 #define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
956 
957 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
958 
959 #define FE_SET_PROPERTY		   _IOW('o', 82, struct dtv_properties)
960 #define FE_GET_PROPERTY		   _IOR('o', 83, struct dtv_properties)
961 
962 #if defined(__DVB_CORE__) || !defined(__KERNEL__)
963 
964 /*
965  * DEPRECATED: Everything below is deprecated in favor of DVBv5 API
966  *
967  * The DVBv3 only ioctls, structs and enums should not be used on
968  * newer programs, as it doesn't support the second generation of
969  * digital TV standards, nor supports newer delivery systems.
970  * They also don't support modern frontends with usually support multiple
971  * delivery systems.
972  *
973  * Drivers shouldn't use them.
974  *
975  * New applications should use DVBv5 delivery system instead
976  */
977 
978 /*
979  */
980 
981 enum fe_bandwidth {
982 	BANDWIDTH_8_MHZ,
983 	BANDWIDTH_7_MHZ,
984 	BANDWIDTH_6_MHZ,
985 	BANDWIDTH_AUTO,
986 	BANDWIDTH_5_MHZ,
987 	BANDWIDTH_10_MHZ,
988 	BANDWIDTH_1_712_MHZ,
989 };
990 
991 /* This is kept for legacy userspace support */
992 typedef enum fe_sec_voltage fe_sec_voltage_t;
993 typedef enum fe_caps fe_caps_t;
994 typedef enum fe_type fe_type_t;
995 typedef enum fe_sec_tone_mode fe_sec_tone_mode_t;
996 typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t;
997 typedef enum fe_status fe_status_t;
998 typedef enum fe_spectral_inversion fe_spectral_inversion_t;
999 typedef enum fe_code_rate fe_code_rate_t;
1000 typedef enum fe_modulation fe_modulation_t;
1001 typedef enum fe_transmit_mode fe_transmit_mode_t;
1002 typedef enum fe_bandwidth fe_bandwidth_t;
1003 typedef enum fe_guard_interval fe_guard_interval_t;
1004 typedef enum fe_hierarchy fe_hierarchy_t;
1005 typedef enum fe_pilot fe_pilot_t;
1006 typedef enum fe_rolloff fe_rolloff_t;
1007 typedef enum fe_delivery_system fe_delivery_system_t;
1008 
1009 /* DVBv3 structs */
1010 
1011 struct dvb_qpsk_parameters {
1012 	__u32		symbol_rate;  /* symbol rate in Symbols per second */
1013 	fe_code_rate_t	fec_inner;    /* forward error correction (see above) */
1014 };
1015 
1016 struct dvb_qam_parameters {
1017 	__u32		symbol_rate; /* symbol rate in Symbols per second */
1018 	fe_code_rate_t	fec_inner;   /* forward error correction (see above) */
1019 	fe_modulation_t	modulation;  /* modulation type (see above) */
1020 };
1021 
1022 struct dvb_vsb_parameters {
1023 	fe_modulation_t	modulation;  /* modulation type (see above) */
1024 };
1025 
1026 struct dvb_ofdm_parameters {
1027 	fe_bandwidth_t      bandwidth;
1028 	fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
1029 	fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
1030 	fe_modulation_t     constellation; /* modulation type (see above) */
1031 	fe_transmit_mode_t  transmission_mode;
1032 	fe_guard_interval_t guard_interval;
1033 	fe_hierarchy_t      hierarchy_information;
1034 };
1035 
1036 struct dvb_frontend_parameters {
1037 	__u32 frequency;  /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */
1038 			  /* intermediate frequency in kHz for DVB-S */
1039 	fe_spectral_inversion_t inversion;
1040 	union {
1041 		struct dvb_qpsk_parameters qpsk;	/* DVB-S */
1042 		struct dvb_qam_parameters  qam;		/* DVB-C */
1043 		struct dvb_ofdm_parameters ofdm;	/* DVB-T */
1044 		struct dvb_vsb_parameters vsb;		/* ATSC */
1045 	} u;
1046 };
1047 
1048 struct dvb_frontend_event {
1049 	fe_status_t status;
1050 	struct dvb_frontend_parameters parameters;
1051 };
1052 
1053 /* DVBv3 API calls */
1054 
1055 #define FE_SET_FRONTEND		   _IOW('o', 76, struct dvb_frontend_parameters)
1056 #define FE_GET_FRONTEND		   _IOR('o', 77, struct dvb_frontend_parameters)
1057 
1058 #endif
1059 
1060 #endif /*_DVBFRONTEND_H_*/
1061