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