blob: ad9a75f27b018cfb275b4159c9a6182f2b3e2670 [file] [log] [blame]
Greg Kroah-Hartmane2be04c2017-11-01 15:09:13 +01001/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
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 * 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
Jaswinder Singh Rajputde189f02009-01-30 19:56:41 +053030#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
chuangcheng peng62fb9f92022-08-11 19:32:43 +080032/* amlogic define */
33#include <linux/videodev2.h>
34/* amlogic define end */
35
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -040036/**
37 * enum fe_caps - Frontend capabilities
38 *
39 * @FE_IS_STUPID: There's something wrong at the
40 * frontend, and it can't report its
41 * capabilities.
42 * @FE_CAN_INVERSION_AUTO: Can auto-detect frequency spectral
43 * band inversion
44 * @FE_CAN_FEC_1_2: Supports FEC 1/2
45 * @FE_CAN_FEC_2_3: Supports FEC 2/3
46 * @FE_CAN_FEC_3_4: Supports FEC 3/4
47 * @FE_CAN_FEC_4_5: Supports FEC 4/5
48 * @FE_CAN_FEC_5_6: Supports FEC 5/6
49 * @FE_CAN_FEC_6_7: Supports FEC 6/7
50 * @FE_CAN_FEC_7_8: Supports FEC 7/8
51 * @FE_CAN_FEC_8_9: Supports FEC 8/9
52 * @FE_CAN_FEC_AUTO: Can auto-detect FEC
53 * @FE_CAN_QPSK: Supports QPSK modulation
54 * @FE_CAN_QAM_16: Supports 16-QAM modulation
55 * @FE_CAN_QAM_32: Supports 32-QAM modulation
56 * @FE_CAN_QAM_64: Supports 64-QAM modulation
57 * @FE_CAN_QAM_128: Supports 128-QAM modulation
58 * @FE_CAN_QAM_256: Supports 256-QAM modulation
59 * @FE_CAN_QAM_AUTO: Can auto-detect QAM modulation
60 * @FE_CAN_TRANSMISSION_MODE_AUTO: Can auto-detect transmission mode
61 * @FE_CAN_BANDWIDTH_AUTO: Can auto-detect bandwidth
62 * @FE_CAN_GUARD_INTERVAL_AUTO: Can auto-detect guard interval
63 * @FE_CAN_HIERARCHY_AUTO: Can auto-detect hierarchy
64 * @FE_CAN_8VSB: Supports 8-VSB modulation
65 * @FE_CAN_16VSB: Supporta 16-VSB modulation
66 * @FE_HAS_EXTENDED_CAPS: Unused
67 * @FE_CAN_MULTISTREAM: Supports multistream filtering
68 * @FE_CAN_TURBO_FEC: Supports "turbo FEC" modulation
69 * @FE_CAN_2G_MODULATION: Supports "2nd generation" modulation,
70 * e. g. DVB-S2, DVB-T2, DVB-C2
71 * @FE_NEEDS_BENDING: Unused
72 * @FE_CAN_RECOVER: Can recover from a cable unplug
73 * automatically
74 * @FE_CAN_MUTE_TS: Can stop spurious TS data output
75 */
Mauro Carvalho Chehab97f411d2015-05-26 07:34:21 -030076enum fe_caps {
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 FE_IS_STUPID = 0,
78 FE_CAN_INVERSION_AUTO = 0x1,
79 FE_CAN_FEC_1_2 = 0x2,
80 FE_CAN_FEC_2_3 = 0x4,
81 FE_CAN_FEC_3_4 = 0x8,
82 FE_CAN_FEC_4_5 = 0x10,
83 FE_CAN_FEC_5_6 = 0x20,
84 FE_CAN_FEC_6_7 = 0x40,
85 FE_CAN_FEC_7_8 = 0x80,
86 FE_CAN_FEC_8_9 = 0x100,
87 FE_CAN_FEC_AUTO = 0x200,
88 FE_CAN_QPSK = 0x400,
89 FE_CAN_QAM_16 = 0x800,
90 FE_CAN_QAM_32 = 0x1000,
91 FE_CAN_QAM_64 = 0x2000,
92 FE_CAN_QAM_128 = 0x4000,
93 FE_CAN_QAM_256 = 0x8000,
94 FE_CAN_QAM_AUTO = 0x10000,
95 FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000,
96 FE_CAN_BANDWIDTH_AUTO = 0x40000,
97 FE_CAN_GUARD_INTERVAL_AUTO = 0x80000,
98 FE_CAN_HIERARCHY_AUTO = 0x100000,
99 FE_CAN_8VSB = 0x200000,
100 FE_CAN_16VSB = 0x400000,
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400101 FE_HAS_EXTENDED_CAPS = 0x800000,
102 FE_CAN_MULTISTREAM = 0x4000000,
103 FE_CAN_TURBO_FEC = 0x8000000,
104 FE_CAN_2G_MODULATION = 0x10000000,
105 FE_NEEDS_BENDING = 0x20000000,
106 FE_CAN_RECOVER = 0x40000000,
107 FE_CAN_MUTE_TS = 0x80000000
Mauro Carvalho Chehab97f411d2015-05-26 07:34:21 -0300108};
109
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400110/*
111 * DEPRECATED: Should be kept just due to backward compatibility.
112 */
113enum fe_type {
114 FE_QPSK,
115 FE_QAM,
116 FE_OFDM,
chuangcheng peng62fb9f92022-08-11 19:32:43 +0800117 FE_ATSC,
118 /*amlogic define*/
119 FE_ANALOG,
120 FE_DTMB,
121 FE_ISDBT
122 /*amlogic define end*/
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400123};
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400124/**
125 * struct dvb_frontend_info - Frontend properties and capabilities
126 *
127 * @name: Name of the frontend
128 * @type: **DEPRECATED**.
129 * Should not be used on modern programs,
130 * as a frontend may have more than one type.
131 * In order to get the support types of a given
132 * frontend, use :c:type:`DTV_ENUM_DELSYS`
133 * instead.
134 * @frequency_min: Minimal frequency supported by the frontend.
135 * @frequency_max: Minimal frequency supported by the frontend.
136 * @frequency_stepsize: All frequencies are multiple of this value.
137 * @frequency_tolerance: Frequency tolerance.
138 * @symbol_rate_min: Minimal symbol rate, in bauds
139 * (for Cable/Satellite systems).
140 * @symbol_rate_max: Maximal symbol rate, in bauds
141 * (for Cable/Satellite systems).
142 * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm
143 * (for Cable/Satellite systems).
144 * @notifier_delay: **DEPRECATED**. Not used by any driver.
145 * @caps: Capabilities supported by the frontend,
146 * as specified in &enum fe_caps.
147 *
148 * .. note:
149 *
150 * #. The frequencies are specified in Hz for Terrestrial and Cable
151 * systems.
152 * #. The frequencies are specified in kHz for Satellite systems.
153 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154struct dvb_frontend_info {
155 char name[128];
Mauro Carvalho Chehab0df289a2015-06-07 14:53:52 -0300156 enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 __u32 frequency_min;
158 __u32 frequency_max;
159 __u32 frequency_stepsize;
160 __u32 frequency_tolerance;
161 __u32 symbol_rate_min;
162 __u32 symbol_rate_max;
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400163 __u32 symbol_rate_tolerance;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 __u32 notifier_delay; /* DEPRECATED */
Mauro Carvalho Chehab0df289a2015-06-07 14:53:52 -0300165 enum fe_caps caps;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166};
167
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168/**
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400169 * struct dvb_diseqc_master_cmd - DiSEqC master command
170 *
171 * @msg:
172 * DiSEqC message to be sent. It contains a 3 bytes header with:
173 * framing + address + command, and an optional argument
174 * of up to 3 bytes of data.
175 * @msg_len:
176 * Length of the DiSEqC message. Valid values are 3 to 6.
177 *
178 * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
179 * the possible messages that can be used.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180 */
181struct dvb_diseqc_master_cmd {
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400182 __u8 msg[6];
183 __u8 msg_len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184};
185
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400186/**
187 * struct dvb_diseqc_slave_reply - DiSEqC received data
188 *
189 * @msg:
190 * DiSEqC message buffer to store a message received via DiSEqC.
191 * It contains one byte header with: framing and
192 * an optional argument of up to 3 bytes of data.
193 * @msg_len:
194 * Length of the DiSEqC message. Valid values are 0 to 4,
195 * where 0 means no message.
196 * @timeout:
197 * Return from ioctl after timeout ms with errorcode when
198 * no message was received.
199 *
200 * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
201 * the possible messages that can be used.
202 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203struct dvb_diseqc_slave_reply {
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400204 __u8 msg[4];
205 __u8 msg_len;
206 int timeout;
207};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400209/**
210 * enum fe_sec_voltage - DC Voltage used to feed the LNBf
211 *
212 * @SEC_VOLTAGE_13: Output 13V to the LNBf
213 * @SEC_VOLTAGE_18: Output 18V to the LNBf
214 * @SEC_VOLTAGE_OFF: Don't feed the LNBf with a DC voltage
215 */
Mauro Carvalho Chehabd6b6d342015-05-26 19:33:58 -0300216enum fe_sec_voltage {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 SEC_VOLTAGE_13,
218 SEC_VOLTAGE_18,
219 SEC_VOLTAGE_OFF
Mauro Carvalho Chehabd6b6d342015-05-26 19:33:58 -0300220};
221
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400222/**
223 * enum fe_sec_tone_mode - Type of tone to be send to the LNBf.
224 * @SEC_TONE_ON: Sends a 22kHz tone burst to the antenna.
225 * @SEC_TONE_OFF: Don't send a 22kHz tone to the antenna (except
226 * if the ``FE_DISEQC_*`` ioctls are called).
227 */
Mauro Carvalho Chehab6dc59e72015-05-27 07:15:50 -0300228enum fe_sec_tone_mode {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 SEC_TONE_ON,
230 SEC_TONE_OFF
Mauro Carvalho Chehab6dc59e72015-05-27 07:15:50 -0300231};
232
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400233/**
234 * enum fe_sec_mini_cmd - Type of mini burst to be sent
235 *
236 * @SEC_MINI_A: Sends a mini-DiSEqC 22kHz '0' Tone Burst to select
237 * satellite-A
238 * @SEC_MINI_B: Sends a mini-DiSEqC 22kHz '1' Data Burst to select
239 * satellite-B
240 */
Mauro Carvalho Chehab81959d92015-05-27 22:20:14 -0300241enum fe_sec_mini_cmd {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 SEC_MINI_A,
243 SEC_MINI_B
Mauro Carvalho Chehab81959d92015-05-27 22:20:14 -0300244};
245
Mauro Carvalho Chehab0d27bbf2012-08-13 17:03:12 -0300246/**
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400247 * enum fe_status - Enumerates the possible frontend status.
248 * @FE_NONE: The frontend doesn't have any kind of lock.
249 * That's the initial frontend status
250 * @FE_HAS_SIGNAL: Has found something above the noise level.
Mauro Carvalho Chehab5176d6e2017-09-01 15:05:28 -0400251 * @FE_HAS_CARRIER: Has found a signal.
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400252 * @FE_HAS_VITERBI: FEC inner coding (Viterbi, LDPC or other inner code).
253 * is stable.
254 * @FE_HAS_SYNC: Synchronization bytes was found.
Mauro Carvalho Chehab5176d6e2017-09-01 15:05:28 -0400255 * @FE_HAS_LOCK: Digital TV were locked and everything is working.
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400256 * @FE_TIMEDOUT: Fo lock within the last about 2 seconds.
257 * @FE_REINIT: Frontend was reinitialized, application is recommended
258 * to reset DiSEqC, tone and parameters.
Mauro Carvalho Chehab0d27bbf2012-08-13 17:03:12 -0300259 */
Mauro Carvalho Chehab97f411d2015-05-26 07:34:21 -0300260enum fe_status {
Colin Ian Kinga9e49982017-07-20 18:12:07 -0400261 FE_NONE = 0x00,
Mauro Carvalho Chehab0d27bbf2012-08-13 17:03:12 -0300262 FE_HAS_SIGNAL = 0x01,
263 FE_HAS_CARRIER = 0x02,
264 FE_HAS_VITERBI = 0x04,
265 FE_HAS_SYNC = 0x08,
266 FE_HAS_LOCK = 0x10,
267 FE_TIMEDOUT = 0x20,
268 FE_REINIT = 0x40,
chuangcheng peng62fb9f92022-08-11 19:32:43 +0800269 /*amlogic define*/
270 BLINDSCAN_NONEDO = 0x80, /* not blind scan */
271 BLINDSCAN_UPDATESTARTFREQ = 0x100, /* blind scan update start freq */
272 BLINDSCAN_UPDATEPROCESS = 0x200, /* blind scan update process */
273 BLINDSCAN_UPDATERESULTFREQ = 0x400/* blind scan update result */
274 /*amlogic define end*/
Mauro Carvalho Chehab97f411d2015-05-26 07:34:21 -0300275};
276
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400277/**
278 * enum fe_spectral_inversion - Type of inversion band
279 *
280 * @INVERSION_OFF: Don't do spectral band inversion.
281 * @INVERSION_ON: Do spectral band inversion.
282 * @INVERSION_AUTO: Autodetect spectral band inversion.
283 *
284 * This parameter indicates if spectral inversion should be presumed or
285 * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try
286 * to figure out the correct setting by itself. If the hardware doesn't
Mauro Carvalho Chehab5176d6e2017-09-01 15:05:28 -0400287 * support, the %dvb_frontend will try to lock at the carrier first with
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400288 * inversion off. If it fails, it will try to enable inversion.
289 */
Mauro Carvalho Chehab58e11cc2015-05-28 20:00:43 -0300290enum fe_spectral_inversion {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 INVERSION_OFF,
292 INVERSION_ON,
293 INVERSION_AUTO
Mauro Carvalho Chehab58e11cc2015-05-28 20:00:43 -0300294};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400296/**
297 * enum fe_code_rate - Type of Forward Error Correction (FEC)
298 *
299 *
300 * @FEC_NONE: No Forward Error Correction Code
301 * @FEC_1_2: Forward Error Correction Code 1/2
302 * @FEC_2_3: Forward Error Correction Code 2/3
303 * @FEC_3_4: Forward Error Correction Code 3/4
304 * @FEC_4_5: Forward Error Correction Code 4/5
305 * @FEC_5_6: Forward Error Correction Code 5/6
306 * @FEC_6_7: Forward Error Correction Code 6/7
307 * @FEC_7_8: Forward Error Correction Code 7/8
308 * @FEC_8_9: Forward Error Correction Code 8/9
309 * @FEC_AUTO: Autodetect Error Correction Code
310 * @FEC_3_5: Forward Error Correction Code 3/5
311 * @FEC_9_10: Forward Error Correction Code 9/10
312 * @FEC_2_5: Forward Error Correction Code 2/5
313 *
314 * Please note that not all FEC types are supported by a given standard.
315 */
Mauro Carvalho Chehab2d457b82015-05-28 21:38:44 -0300316enum fe_code_rate {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 FEC_NONE = 0,
318 FEC_1_2,
319 FEC_2_3,
320 FEC_3_4,
321 FEC_4_5,
322 FEC_5_6,
323 FEC_6_7,
324 FEC_7_8,
325 FEC_8_9,
Steven Toth6b73eea2008-09-04 01:12:25 -0300326 FEC_AUTO,
327 FEC_3_5,
328 FEC_9_10,
Antti Palosaari224b6642012-08-12 22:33:21 -0300329 FEC_2_5,
Mauro Carvalho Chehab2d457b82015-05-28 21:38:44 -0300330};
331
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400332/**
333 * enum fe_modulation - Type of modulation/constellation
334 * @QPSK: QPSK modulation
335 * @QAM_16: 16-QAM modulation
336 * @QAM_32: 32-QAM modulation
337 * @QAM_64: 64-QAM modulation
338 * @QAM_128: 128-QAM modulation
339 * @QAM_256: 256-QAM modulation
340 * @QAM_AUTO: Autodetect QAM modulation
341 * @VSB_8: 8-VSB modulation
342 * @VSB_16: 16-VSB modulation
343 * @PSK_8: 8-PSK modulation
344 * @APSK_16: 16-APSK modulation
345 * @APSK_32: 32-APSK modulation
346 * @DQPSK: DQPSK modulation
347 * @QAM_4_NR: 4-QAM-NR modulation
348 *
349 * Please note that not all modulations are supported by a given standard.
350 *
351 */
Mauro Carvalho Chehab997eb9032015-05-28 17:21:05 -0300352enum fe_modulation {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353 QPSK,
354 QAM_16,
355 QAM_32,
356 QAM_64,
357 QAM_128,
358 QAM_256,
359 QAM_AUTO,
360 VSB_8,
Steven Toth6b73eea2008-09-04 01:12:25 -0300361 VSB_16,
Steven Toth0a6393a2008-10-06 21:06:48 -0300362 PSK_8,
363 APSK_16,
Manu Abraham97854822008-10-14 19:48:07 -0300364 APSK_32,
Steven Toth6b73eea2008-09-04 01:12:25 -0300365 DQPSK,
Antti Palosaari224b6642012-08-12 22:33:21 -0300366 QAM_4_NR,
Mauro Carvalho Chehab997eb9032015-05-28 17:21:05 -0300367};
368
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400369/**
370 * enum fe_transmit_mode - Transmission mode
371 *
372 * @TRANSMISSION_MODE_AUTO:
373 * Autodetect transmission mode. The hardware will try to find the
374 * correct FFT-size (if capable) to fill in the missing parameters.
375 * @TRANSMISSION_MODE_1K:
376 * Transmission mode 1K
377 * @TRANSMISSION_MODE_2K:
378 * Transmission mode 2K
379 * @TRANSMISSION_MODE_8K:
380 * Transmission mode 8K
381 * @TRANSMISSION_MODE_4K:
382 * Transmission mode 4K
383 * @TRANSMISSION_MODE_16K:
384 * Transmission mode 16K
385 * @TRANSMISSION_MODE_32K:
386 * Transmission mode 32K
387 * @TRANSMISSION_MODE_C1:
388 * Single Carrier (C=1) transmission mode (DTMB only)
389 * @TRANSMISSION_MODE_C3780:
390 * Multi Carrier (C=3780) transmission mode (DTMB only)
391 *
392 * Please note that not all transmission modes are supported by a given
393 * standard.
394 */
Mauro Carvalho Chehab0577a2f2015-05-28 20:52:52 -0300395enum fe_transmit_mode {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 TRANSMISSION_MODE_2K,
397 TRANSMISSION_MODE_8K,
Patrick Boettcherb6e760f2009-08-03 14:39:15 -0300398 TRANSMISSION_MODE_AUTO,
Andreas Oberritter94d56ff2011-05-12 18:11:06 -0300399 TRANSMISSION_MODE_4K,
400 TRANSMISSION_MODE_1K,
401 TRANSMISSION_MODE_16K,
402 TRANSMISSION_MODE_32K,
Antti Palosaari224b6642012-08-12 22:33:21 -0300403 TRANSMISSION_MODE_C1,
404 TRANSMISSION_MODE_C3780,
Mauro Carvalho Chehab0577a2f2015-05-28 20:52:52 -0300405};
406
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400407/**
408 * enum fe_guard_interval - Guard interval
409 *
410 * @GUARD_INTERVAL_AUTO: Autodetect the guard interval
411 * @GUARD_INTERVAL_1_128: Guard interval 1/128
412 * @GUARD_INTERVAL_1_32: Guard interval 1/32
413 * @GUARD_INTERVAL_1_16: Guard interval 1/16
414 * @GUARD_INTERVAL_1_8: Guard interval 1/8
415 * @GUARD_INTERVAL_1_4: Guard interval 1/4
416 * @GUARD_INTERVAL_19_128: Guard interval 19/128
417 * @GUARD_INTERVAL_19_256: Guard interval 19/256
418 * @GUARD_INTERVAL_PN420: PN length 420 (1/4)
419 * @GUARD_INTERVAL_PN595: PN length 595 (1/6)
420 * @GUARD_INTERVAL_PN945: PN length 945 (1/9)
421 *
422 * Please note that not all guard intervals are supported by a given standard.
423 */
Mauro Carvalho Chehab903142e2015-05-28 22:01:41 -0300424enum fe_guard_interval {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 GUARD_INTERVAL_1_32,
426 GUARD_INTERVAL_1_16,
427 GUARD_INTERVAL_1_8,
428 GUARD_INTERVAL_1_4,
Andreas Oberritter94d56ff2011-05-12 18:11:06 -0300429 GUARD_INTERVAL_AUTO,
430 GUARD_INTERVAL_1_128,
431 GUARD_INTERVAL_19_128,
432 GUARD_INTERVAL_19_256,
Antti Palosaari224b6642012-08-12 22:33:21 -0300433 GUARD_INTERVAL_PN420,
434 GUARD_INTERVAL_PN595,
435 GUARD_INTERVAL_PN945,
Mauro Carvalho Chehab903142e2015-05-28 22:01:41 -0300436};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400438/**
439 * enum fe_hierarchy - Hierarchy
440 * @HIERARCHY_NONE: No hierarchy
441 * @HIERARCHY_AUTO: Autodetect hierarchy (if supported)
442 * @HIERARCHY_1: Hierarchy 1
443 * @HIERARCHY_2: Hierarchy 2
444 * @HIERARCHY_4: Hierarchy 4
445 *
446 * Please note that not all hierarchy types are supported by a given standard.
447 */
Mauro Carvalho Chehab9df4fc52015-05-28 22:06:56 -0300448enum fe_hierarchy {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449 HIERARCHY_NONE,
450 HIERARCHY_1,
451 HIERARCHY_2,
452 HIERARCHY_4,
453 HIERARCHY_AUTO
Mauro Carvalho Chehab9df4fc52015-05-28 22:06:56 -0300454};
455
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400456/**
457 * enum fe_interleaving - Interleaving
458 * @INTERLEAVING_NONE: No interleaving.
459 * @INTERLEAVING_AUTO: Auto-detect interleaving.
460 * @INTERLEAVING_240: Interleaving of 240 symbols.
461 * @INTERLEAVING_720: Interleaving of 720 symbols.
462 *
463 * Please note that, currently, only DTMB uses it.
464 */
Antti Palosaari224b6642012-08-12 22:33:21 -0300465enum fe_interleaving {
466 INTERLEAVING_NONE,
Antti Palosaari8746add2012-08-12 22:33:22 -0300467 INTERLEAVING_AUTO,
Antti Palosaari224b6642012-08-12 22:33:21 -0300468 INTERLEAVING_240,
469 INTERLEAVING_720,
470};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471
chuangcheng peng62fb9f92022-08-11 19:32:43 +0800472/*amlogic define*/
473struct fe_blind_scan_parameters {
474 /* minimum tuner frequency in kHz */
475 __u32 min_frequency;
476 /* maximum tuner frequency in kHz */
477 __u32 max_frequency;
478 /* minimum symbol rate in sym/sec */
479 __u32 min_symbol_rate;
480 /* maximum symbol rate in sym/sec */
481 __u32 max_symbol_rate;
482 /* search range in kHz. freq -/+freqRange will be searched */
483 __u32 frequency_range;
484 /* tuner step frequency in kHz */
485 __u32 frequency_step;
486 /* blindscan event timeout */
487 __s32 timeout;
488};
489
490/*amlogic define end*/
491
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400492/* DVBv5 property Commands */
493
Steven Toth459702b2008-09-26 00:04:52 -0300494#define DTV_UNDEFINED 0
495#define DTV_TUNE 1
496#define DTV_CLEAR 2
497#define DTV_FREQUENCY 3
498#define DTV_MODULATION 4
499#define DTV_BANDWIDTH_HZ 5
500#define DTV_INVERSION 6
501#define DTV_DISEQC_MASTER 7
502#define DTV_SYMBOL_RATE 8
503#define DTV_INNER_FEC 9
504#define DTV_VOLTAGE 10
505#define DTV_TONE 11
506#define DTV_PILOT 12
507#define DTV_ROLLOFF 13
508#define DTV_DISEQC_SLAVE_REPLY 14
Steven Toth6b73eea2008-09-04 01:12:25 -0300509
Steven Toth459702b2008-09-26 00:04:52 -0300510/* Basic enumeration set for querying unlimited capabilities */
511#define DTV_FE_CAPABILITY_COUNT 15
512#define DTV_FE_CAPABILITY 16
513#define DTV_DELIVERY_SYSTEM 17
Steven Toth75b7f942008-09-13 16:56:34 -0300514
Patrick Boettcherb6e760f2009-08-03 14:39:15 -0300515/* ISDB-T and ISDB-Tsb */
516#define DTV_ISDBT_PARTIAL_RECEPTION 18
517#define DTV_ISDBT_SOUND_BROADCASTING 19
Steven Toth6b73eea2008-09-04 01:12:25 -0300518
Patrick Boettcherb6e760f2009-08-03 14:39:15 -0300519#define DTV_ISDBT_SB_SUBCHANNEL_ID 20
520#define DTV_ISDBT_SB_SEGMENT_IDX 21
521#define DTV_ISDBT_SB_SEGMENT_COUNT 22
522
523#define DTV_ISDBT_LAYERA_FEC 23
524#define DTV_ISDBT_LAYERA_MODULATION 24
525#define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25
526#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26
527
528#define DTV_ISDBT_LAYERB_FEC 27
529#define DTV_ISDBT_LAYERB_MODULATION 28
530#define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29
531#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30
532
533#define DTV_ISDBT_LAYERC_FEC 31
534#define DTV_ISDBT_LAYERC_MODULATION 32
535#define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33
536#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34
537
538#define DTV_API_VERSION 35
539
540#define DTV_CODE_RATE_HP 36
541#define DTV_CODE_RATE_LP 37
542#define DTV_GUARD_INTERVAL 38
543#define DTV_TRANSMISSION_MODE 39
544#define DTV_HIERARCHY 40
545
546#define DTV_ISDBT_LAYER_ENABLED 41
547
Evgeny Plehov287cefd2012-09-13 10:13:30 -0300548#define DTV_STREAM_ID 42
549#define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID
550#define DTV_DVBT2_PLP_ID_LEGACY 43
Andreas Oberritter94d56ff2011-05-12 18:11:06 -0300551
Manu Abrahamba2780c2011-11-13 18:47:44 -0300552#define DTV_ENUM_DELSYS 44
chuangcheng peng62fb9f92022-08-11 19:32:43 +0800553/*amlogic define*/
554#define DTV_DVBT2_PLP_ID DTV_DVBT2_PLP_ID_LEGACY
555/*amlogic define end*/
Manu Abrahamba2780c2011-11-13 18:47:44 -0300556
Michael Krufkyca689482012-01-29 15:44:58 -0300557/* ATSC-MH */
558#define DTV_ATSCMH_FIC_VER 45
559#define DTV_ATSCMH_PARADE_ID 46
560#define DTV_ATSCMH_NOG 47
561#define DTV_ATSCMH_TNOG 48
562#define DTV_ATSCMH_SGN 49
563#define DTV_ATSCMH_PRC 50
564#define DTV_ATSCMH_RS_FRAME_MODE 51
565#define DTV_ATSCMH_RS_FRAME_ENSEMBLE 52
566#define DTV_ATSCMH_RS_CODE_MODE_PRI 53
567#define DTV_ATSCMH_RS_CODE_MODE_SEC 54
568#define DTV_ATSCMH_SCCC_BLOCK_MODE 55
569#define DTV_ATSCMH_SCCC_CODE_MODE_A 56
570#define DTV_ATSCMH_SCCC_CODE_MODE_B 57
571#define DTV_ATSCMH_SCCC_CODE_MODE_C 58
572#define DTV_ATSCMH_SCCC_CODE_MODE_D 59
Michael Krufkyca689482012-01-29 15:44:58 -0300573
Antti Palosaari224b6642012-08-12 22:33:21 -0300574#define DTV_INTERLEAVING 60
Antti Palosaari8a2697a2012-07-11 21:54:50 -0300575#define DTV_LNA 61
Antti Palosaari224b6642012-08-12 22:33:21 -0300576
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300577/* Quality parameters */
578#define DTV_STAT_SIGNAL_STRENGTH 62
579#define DTV_STAT_CNR 63
580#define DTV_STAT_PRE_ERROR_BIT_COUNT 64
581#define DTV_STAT_PRE_TOTAL_BIT_COUNT 65
582#define DTV_STAT_POST_ERROR_BIT_COUNT 66
583#define DTV_STAT_POST_TOTAL_BIT_COUNT 67
584#define DTV_STAT_ERROR_BLOCK_COUNT 68
585#define DTV_STAT_TOTAL_BLOCK_COUNT 69
586
Athanasios Oikonomouf9d79122017-12-16 07:23:38 -0500587/* Physical layer scrambling */
588#define DTV_SCRAMBLING_SEQUENCE_INDEX 70
589
chuangcheng peng62fb9f92022-08-11 19:32:43 +0800590/* amlogic define */
591/* Get tne TS input of the frontend */
592#define DTV_TS_INPUT 100
593/* Blind scan */
594#define DTV_START_BLIND_SCAN 101
595#define DTV_CANCEL_BLIND_SCAN 102
596#define DTV_BLIND_SCAN_MIN_FRE 103
597#define DTV_BLIND_SCAN_MAX_FRE 104
598#define DTV_BLIND_SCAN_MIN_SRATE 105
599#define DTV_BLIND_SCAN_MAX_SRATE 106
600#define DTV_BLIND_SCAN_FRE_RANGE 107
601#define DTV_BLIND_SCAN_FRE_STEP 108
602#define DTV_BLIND_SCAN_TIMEOUT 109
603/* Blind scan end*/
604#define DTV_DELIVERY_SUB_SYSTEM 110
605#define DTV_MAX_COMMAND DTV_DELIVERY_SUB_SYSTEM
606/* amlogic define end */
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400607/**
608 * enum fe_pilot - Type of pilot tone
609 *
610 * @PILOT_ON: Pilot tones enabled
611 * @PILOT_OFF: Pilot tones disabled
612 * @PILOT_AUTO: Autodetect pilot tones
613 */
Mauro Carvalho Chehab448bac12015-06-07 11:18:16 -0300614enum fe_pilot {
Steven Toth6b73eea2008-09-04 01:12:25 -0300615 PILOT_ON,
616 PILOT_OFF,
617 PILOT_AUTO,
Mauro Carvalho Chehab448bac12015-06-07 11:18:16 -0300618};
619
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400620/**
Mauro Carvalho Chehab9d5e27c2017-08-30 13:45:20 -0400621 * enum fe_rolloff - Rolloff factor
622 * @ROLLOFF_35: Roloff factor: α=35%
623 * @ROLLOFF_20: Roloff factor: α=20%
624 * @ROLLOFF_25: Roloff factor: α=25%
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400625 * @ROLLOFF_AUTO: Auto-detect the roloff factor.
626 *
627 * .. note:
628 *
629 * Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default.
630 */
Mauro Carvalho Chehabb35f6ba2015-06-07 11:59:27 -0300631enum fe_rolloff {
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400632 ROLLOFF_35,
Steven Toth6b73eea2008-09-04 01:12:25 -0300633 ROLLOFF_20,
634 ROLLOFF_25,
Steven Toth6b73eea2008-09-04 01:12:25 -0300635 ROLLOFF_AUTO,
Mauro Carvalho Chehabb35f6ba2015-06-07 11:59:27 -0300636};
637
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400638/**
639 * enum fe_delivery_system - Type of the delivery system
640 *
641 * @SYS_UNDEFINED:
642 * Undefined standard. Generally, indicates an error
643 * @SYS_DVBC_ANNEX_A:
644 * Cable TV: DVB-C following ITU-T J.83 Annex A spec
645 * @SYS_DVBC_ANNEX_B:
646 * Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)
647 * @SYS_DVBC_ANNEX_C:
648 * Cable TV: DVB-C following ITU-T J.83 Annex C spec
649 * @SYS_ISDBC:
650 * Cable TV: ISDB-C (no drivers yet)
651 * @SYS_DVBT:
652 * Terrestrial TV: DVB-T
653 * @SYS_DVBT2:
654 * Terrestrial TV: DVB-T2
655 * @SYS_ISDBT:
656 * Terrestrial TV: ISDB-T
657 * @SYS_ATSC:
658 * Terrestrial TV: ATSC
659 * @SYS_ATSCMH:
660 * Terrestrial TV (mobile): ATSC-M/H
661 * @SYS_DTMB:
662 * Terrestrial TV: DTMB
663 * @SYS_DVBS:
664 * Satellite TV: DVB-S
665 * @SYS_DVBS2:
666 * Satellite TV: DVB-S2
667 * @SYS_TURBO:
668 * Satellite TV: DVB-S Turbo
669 * @SYS_ISDBS:
670 * Satellite TV: ISDB-S
671 * @SYS_DAB:
672 * Digital audio: DAB (not fully supported)
673 * @SYS_DSS:
674 * Satellite TV: DSS (not fully supported)
675 * @SYS_CMMB:
676 * Terrestrial TV (mobile): CMMB (not fully supported)
677 * @SYS_DVBH:
678 * Terrestrial TV (mobile): DVB-H (standard deprecated)
679 */
Mauro Carvalho Chehabd21ddba2015-06-07 14:21:09 -0300680enum fe_delivery_system {
Steven Toth6b73eea2008-09-04 01:12:25 -0300681 SYS_UNDEFINED,
Manu Abrahambf3b8402011-12-17 20:36:55 -0300682 SYS_DVBC_ANNEX_A,
Steven Toth6b73eea2008-09-04 01:12:25 -0300683 SYS_DVBC_ANNEX_B,
684 SYS_DVBT,
Manu Abraham5ba4ecc2008-10-14 19:50:03 -0300685 SYS_DSS,
Steven Toth6b73eea2008-09-04 01:12:25 -0300686 SYS_DVBS,
687 SYS_DVBS2,
688 SYS_DVBH,
689 SYS_ISDBT,
690 SYS_ISDBS,
691 SYS_ISDBC,
692 SYS_ATSC,
693 SYS_ATSCMH,
Antti Palosaari224b6642012-08-12 22:33:21 -0300694 SYS_DTMB,
Steven Toth6b73eea2008-09-04 01:12:25 -0300695 SYS_CMMB,
696 SYS_DAB,
Andreas Oberritter94d56ff2011-05-12 18:11:06 -0300697 SYS_DVBT2,
Andreas Oberritter83dc3142011-08-08 11:54:35 -0300698 SYS_TURBO,
Manu Abrahambf3b8402011-12-17 20:36:55 -0300699 SYS_DVBC_ANNEX_C,
chuangcheng peng62fb9f92022-08-11 19:32:43 +0800700 /* amlogic define */
701 SYS_ANALOG
702 /* amlogic define end */
Mauro Carvalho Chehabd21ddba2015-06-07 14:21:09 -0300703};
704
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400705/* backward compatibility definitions for delivery systems */
Manu Abrahambf3b8402011-12-17 20:36:55 -0300706#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400707#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB */
Manu Abrahambf3b8402011-12-17 20:36:55 -0300708
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400709/* ATSC-MH specific parameters */
Michael Krufkyca689482012-01-29 15:44:58 -0300710
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400711/**
712 * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional
713 * Code Block Mode.
714 *
715 * @ATSCMH_SCCC_BLK_SEP:
716 * Separate SCCC: the SCCC outer code mode shall be set independently
717 * for each Group Region (A, B, C, D)
718 * @ATSCMH_SCCC_BLK_COMB:
719 * Combined SCCC: all four Regions shall have the same SCCC outer
720 * code mode.
721 * @ATSCMH_SCCC_BLK_RES:
722 * Reserved. Shouldn't be used.
723 */
Michael Krufkyca689482012-01-29 15:44:58 -0300724enum atscmh_sccc_block_mode {
725 ATSCMH_SCCC_BLK_SEP = 0,
726 ATSCMH_SCCC_BLK_COMB = 1,
727 ATSCMH_SCCC_BLK_RES = 2,
728};
729
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400730/**
731 * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional
732 * Code Rate.
733 *
734 * @ATSCMH_SCCC_CODE_HLF:
735 * The outer code rate of a SCCC Block is 1/2 rate.
736 * @ATSCMH_SCCC_CODE_QTR:
737 * The outer code rate of a SCCC Block is 1/4 rate.
738 * @ATSCMH_SCCC_CODE_RES:
739 * Reserved. Should not be used.
740 */
Michael Krufkyca689482012-01-29 15:44:58 -0300741enum atscmh_sccc_code_mode {
742 ATSCMH_SCCC_CODE_HLF = 0,
743 ATSCMH_SCCC_CODE_QTR = 1,
744 ATSCMH_SCCC_CODE_RES = 2,
745};
746
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400747/**
748 * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble.
749 *
750 * @ATSCMH_RSFRAME_ENS_PRI: Primary Ensemble.
751 * @ATSCMH_RSFRAME_ENS_SEC: Secondary Ensemble.
752 */
Michael Krufkyca689482012-01-29 15:44:58 -0300753enum atscmh_rs_frame_ensemble {
754 ATSCMH_RSFRAME_ENS_PRI = 0,
755 ATSCMH_RSFRAME_ENS_SEC = 1,
756};
757
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400758/**
759 * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode.
760 *
761 * @ATSCMH_RSFRAME_PRI_ONLY:
762 * Single Frame: There is only a primary RS Frame for all Group
763 * Regions.
764 * @ATSCMH_RSFRAME_PRI_SEC:
765 * Dual Frame: There are two separate RS Frames: Primary RS Frame for
766 * Group Region A and B and Secondary RS Frame for Group Region C and
767 * D.
768 * @ATSCMH_RSFRAME_RES:
769 * Reserved. Shouldn't be used.
770 */
Michael Krufkyca689482012-01-29 15:44:58 -0300771enum atscmh_rs_frame_mode {
772 ATSCMH_RSFRAME_PRI_ONLY = 0,
773 ATSCMH_RSFRAME_PRI_SEC = 1,
774 ATSCMH_RSFRAME_RES = 2,
775};
776
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400777/**
778 * enum atscmh_rs_code_mode
779 * @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187).
780 * @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187).
781 * @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187).
782 * @ATSCMH_RSCODE_RES: Reserved. Shouldn't be used.
783 */
Michael Krufkyca689482012-01-29 15:44:58 -0300784enum atscmh_rs_code_mode {
785 ATSCMH_RSCODE_211_187 = 0,
786 ATSCMH_RSCODE_223_187 = 1,
787 ATSCMH_RSCODE_235_187 = 2,
788 ATSCMH_RSCODE_RES = 3,
789};
790
Evgeny Plehov287cefd2012-09-13 10:13:30 -0300791#define NO_STREAM_ID_FILTER (~0U)
Antti Palosaari8a2697a2012-07-11 21:54:50 -0300792#define LNA_AUTO (~0U)
Manu Abrahambf3b8402011-12-17 20:36:55 -0300793
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300794/**
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400795 * enum fecap_scale_params - scale types for the quality parameters.
796 *
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300797 * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
798 * could indicate a temporary or a permanent
799 * condition.
David Howells4c12ada2015-04-09 16:36:49 -0300800 * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400801 * used on signal measures.
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300802 * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400803 * ranging from 0 (0%) to 0xffff (100%).
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300804 * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400805 * bit error, block error, lapsed time.
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300806 */
807enum fecap_scale_params {
808 FE_SCALE_NOT_AVAILABLE = 0,
809 FE_SCALE_DECIBEL,
810 FE_SCALE_RELATIVE,
811 FE_SCALE_COUNTER
812};
813
814/**
815 * struct dtv_stats - Used for reading a DTV status property
816 *
Mauro Carvalho Chehab0bd92982017-09-27 09:22:01 -0400817 * @scale:
818 * Filled with enum fecap_scale_params - the scale in usage
819 * for that parameter
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300820 *
Mauro Carvalho Chehab0bd92982017-09-27 09:22:01 -0400821 * @svalue:
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400822 * integer value of the measure, for %FE_SCALE_DECIBEL,
823 * used for dB measures. The unit is 0.001 dB.
824 *
Mauro Carvalho Chehab0bd92982017-09-27 09:22:01 -0400825 * @uvalue:
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400826 * unsigned integer value of the measure, used when @scale is
827 * either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER.
828 *
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300829 * For most delivery systems, this will return a single value for each
830 * parameter.
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400831 *
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300832 * It should be noticed, however, that new OFDM delivery systems like
833 * ISDB can use different modulation types for each group of carriers.
834 * On such standards, up to 8 groups of statistics can be provided, one
835 * for each carrier group (called "layer" on ISDB).
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400836 *
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300837 * In order to be consistent with other delivery systems, the first
838 * value refers to the entire set of carriers ("global").
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400839 *
840 * @scale should use the value %FE_SCALE_NOT_AVAILABLE when
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300841 * the value for the entire group of carriers or from one specific layer
842 * is not provided by the hardware.
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300843 *
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400844 * @len should be filled with the latest filled status + 1.
845 *
846 * In other words, for ISDB, those values should be filled like::
847 *
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300848 * u.st.stat.svalue[0] = global statistics;
Mauro Carvalho Chehab76add032015-06-07 16:28:33 -0300849 * u.st.stat.scale[0] = FE_SCALE_DECIBEL;
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300850 * u.st.stat.value[1] = layer A statistics;
851 * u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
852 * u.st.stat.svalue[2] = layer B statistics;
Mauro Carvalho Chehab76add032015-06-07 16:28:33 -0300853 * u.st.stat.scale[2] = FE_SCALE_DECIBEL;
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300854 * u.st.stat.svalue[3] = layer C statistics;
Mauro Carvalho Chehab76add032015-06-07 16:28:33 -0300855 * u.st.stat.scale[3] = FE_SCALE_DECIBEL;
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300856 * u.st.len = 4;
857 */
858struct dtv_stats {
859 __u8 scale; /* enum fecap_scale_params type */
860 union {
861 __u64 uvalue; /* for counters and relative scales */
David Howells4c12ada2015-04-09 16:36:49 -0300862 __s64 svalue; /* for 0.001 dB measures */
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300863 };
864} __attribute__ ((packed));
865
866
867#define MAX_DTV_STATS 4
868
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400869/**
870 * struct dtv_fe_stats - store Digital TV frontend statistics
871 *
872 * @len: length of the statistics - if zero, stats is disabled.
873 * @stat: array with digital TV statistics.
874 *
875 * On most standards, @len can either be 0 or 1. However, for ISDB, each
876 * layer is modulated in separate. So, each layer may have its own set
877 * of statistics. If so, stat[0] carries on a global value for the property.
878 * Indexes 1 to 3 means layer A to B.
879 */
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300880struct dtv_fe_stats {
881 __u8 len;
882 struct dtv_stats stat[MAX_DTV_STATS];
883} __attribute__ ((packed));
884
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400885/**
886 * struct dtv_property - store one of frontend command and its value
887 *
Mauro Carvalho Chehab0bd92982017-09-27 09:22:01 -0400888 * @cmd: Digital TV command.
889 * @reserved: Not used.
890 * @u: Union with the values for the command.
891 * @u.data: A unsigned 32 bits integer with command value.
892 * @u.buffer: Struct to store bigger properties.
893 * Currently unused.
894 * @u.buffer.data: an unsigned 32-bits array.
895 * @u.buffer.len: number of elements of the buffer.
896 * @u.buffer.reserved1: Reserved.
897 * @u.buffer.reserved2: Reserved.
898 * @u.st: a &struct dtv_fe_stats array of statistics.
899 * @result: Currently unused.
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400900 *
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400901 */
Steven Tothe7fee0f32008-09-11 10:23:01 -0300902struct dtv_property {
Steven Toth6b73eea2008-09-04 01:12:25 -0300903 __u32 cmd;
Steven Tothe7fee0f32008-09-11 10:23:01 -0300904 __u32 reserved[3];
Steven Toth6b73eea2008-09-04 01:12:25 -0300905 union {
906 __u32 data;
Mauro Carvalho Chehab95697932013-01-06 12:22:06 -0300907 struct dtv_fe_stats st;
Steven Toth6b73eea2008-09-04 01:12:25 -0300908 struct {
909 __u8 data[32];
910 __u32 len;
Steven Tothe7fee0f32008-09-11 10:23:01 -0300911 __u32 reserved1[3];
912 void *reserved2;
Steven Toth6b73eea2008-09-04 01:12:25 -0300913 } buffer;
914 } u;
Steven Tothd48cb402008-09-26 00:16:25 -0300915 int result;
Steven Tothe7fee0f32008-09-11 10:23:01 -0300916} __attribute__ ((packed));
Steven Toth6b73eea2008-09-04 01:12:25 -0300917
Brandon Philipscc7d7052008-10-06 21:31:48 -0300918/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
919#define DTV_IOCTL_MAX_MSGS 64
920
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400921/**
922 * struct dtv_properties - a set of command/value pairs.
923 *
924 * @num: amount of commands stored at the struct.
925 * @props: a pointer to &struct dtv_property.
926 */
Steven Tothe7fee0f32008-09-11 10:23:01 -0300927struct dtv_properties {
928 __u32 num;
929 struct dtv_property *props;
930};
Steven Toth6b73eea2008-09-04 01:12:25 -0300931
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400932/*
933 * When set, this flag will disable any zigzagging or other "normal" tuning
934 * behavior. Additionally, there will be no automatic monitoring of the lock
935 * status, and hence no frontend events will be generated. If a frontend device
936 * is closed, this flag will be automatically turned off when the device is
937 * reopened read-write.
938 */
939#define FE_TUNE_MODE_ONESHOT 0x01
940
941/* Digital TV Frontend API calls */
942
943#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info)
944
945#define FE_DISEQC_RESET_OVERLOAD _IO('o', 62)
946#define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd)
947#define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
948#define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */
949
950#define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */
951#define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */
952#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */
953
954#define FE_READ_STATUS _IOR('o', 69, fe_status_t)
955#define FE_READ_BER _IOR('o', 70, __u32)
956#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16)
957#define FE_READ_SNR _IOR('o', 72, __u16)
958#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
959
960#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */
961#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event)
962
963#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
964
965#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties)
966#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
967
Mauro Carvalho Chehabe4faa092017-09-05 07:02:44 -0400968#if defined(__DVB_CORE__) || !defined(__KERNEL__)
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -0300969
Mauro Carvalho Chehab486ef852015-06-07 16:44:21 -0300970/*
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400971 * DEPRECATED: Everything below is deprecated in favor of DVBv5 API
972 *
973 * The DVBv3 only ioctls, structs and enums should not be used on
974 * newer programs, as it doesn't support the second generation of
975 * digital TV standards, nor supports newer delivery systems.
976 * They also don't support modern frontends with usually support multiple
977 * delivery systems.
978 *
979 * Drivers shouldn't use them.
980 *
981 * New applications should use DVBv5 delivery system instead
982 */
983
984/*
Mauro Carvalho Chehab486ef852015-06-07 16:44:21 -0300985 */
986
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -0300987enum fe_bandwidth {
988 BANDWIDTH_8_MHZ,
989 BANDWIDTH_7_MHZ,
990 BANDWIDTH_6_MHZ,
991 BANDWIDTH_AUTO,
992 BANDWIDTH_5_MHZ,
993 BANDWIDTH_10_MHZ,
994 BANDWIDTH_1_712_MHZ,
995};
996
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -0400997/* This is kept for legacy userspace support */
Mauro Carvalho Chehabb1e28ff2015-06-07 15:01:15 -0300998typedef enum fe_sec_voltage fe_sec_voltage_t;
999typedef enum fe_caps fe_caps_t;
1000typedef enum fe_type fe_type_t;
1001typedef enum fe_sec_tone_mode fe_sec_tone_mode_t;
1002typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t;
1003typedef enum fe_status fe_status_t;
1004typedef enum fe_spectral_inversion fe_spectral_inversion_t;
1005typedef enum fe_code_rate fe_code_rate_t;
1006typedef enum fe_modulation fe_modulation_t;
1007typedef enum fe_transmit_mode fe_transmit_mode_t;
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -03001008typedef enum fe_bandwidth fe_bandwidth_t;
Mauro Carvalho Chehabb1e28ff2015-06-07 15:01:15 -03001009typedef enum fe_guard_interval fe_guard_interval_t;
1010typedef enum fe_hierarchy fe_hierarchy_t;
1011typedef enum fe_pilot fe_pilot_t;
1012typedef enum fe_rolloff fe_rolloff_t;
1013typedef enum fe_delivery_system fe_delivery_system_t;
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -03001014
chuangcheng peng62fb9f92022-08-11 19:32:43 +08001015/* amlogic define */
1016enum fe_ofdm_mode {
1017 OFDM_DVBT,
1018 OFDM_DVBT2,
1019};
1020
1021/* amlogic define end */
1022
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -04001023/* DVBv3 structs */
1024
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -03001025struct dvb_qpsk_parameters {
1026 __u32 symbol_rate; /* symbol rate in Symbols per second */
1027 fe_code_rate_t fec_inner; /* forward error correction (see above) */
1028};
1029
1030struct dvb_qam_parameters {
1031 __u32 symbol_rate; /* symbol rate in Symbols per second */
1032 fe_code_rate_t fec_inner; /* forward error correction (see above) */
1033 fe_modulation_t modulation; /* modulation type (see above) */
1034};
1035
1036struct dvb_vsb_parameters {
1037 fe_modulation_t modulation; /* modulation type (see above) */
1038};
1039
1040struct dvb_ofdm_parameters {
1041 fe_bandwidth_t bandwidth;
1042 fe_code_rate_t code_rate_HP; /* high priority stream code rate */
1043 fe_code_rate_t code_rate_LP; /* low priority stream code rate */
1044 fe_modulation_t constellation; /* modulation type (see above) */
1045 fe_transmit_mode_t transmission_mode;
1046 fe_guard_interval_t guard_interval;
1047 fe_hierarchy_t hierarchy_information;
1048};
1049
chuangcheng peng62fb9f92022-08-11 19:32:43 +08001050/* amlogic define */
1051#define ANALOG_FLAG_ENABLE_AFC 0X00000001
1052#define ANALOG_FLAG_MANUL_SCAN 0x00000011
1053struct dvb_analog_parameters {
1054 /*V4L2_TUNER_MODE_MONO,V4L2_TUNER_MODE_STEREO,*/
1055 /*V4L2_TUNER_MODE_LANG2,V4L2_TUNER_MODE_SAP,*/
1056 /*V4L2_TUNER_MODE_LANG1,V4L2_TUNER_MODE_LANG1_LANG2 */
1057 unsigned int audmode;
1058 unsigned int soundsys; /*A2,BTSC,EIAJ,NICAM */
1059 v4l2_std_id std;
1060 unsigned int flag;
1061 unsigned int afc_range;
1062};
1063
1064/* amlogic define end */
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -03001065struct dvb_frontend_parameters {
Mauro Carvalho Chehabe4faa092017-09-05 07:02:44 -04001066 __u32 frequency; /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */
1067 /* intermediate frequency in kHz for DVB-S */
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -03001068 fe_spectral_inversion_t inversion;
1069 union {
Mauro Carvalho Chehab81a7c6d2015-06-07 16:33:30 -03001070 struct dvb_qpsk_parameters qpsk; /* DVB-S */
1071 struct dvb_qam_parameters qam; /* DVB-C */
1072 struct dvb_ofdm_parameters ofdm; /* DVB-T */
1073 struct dvb_vsb_parameters vsb; /* ATSC */
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -03001074 } u;
1075};
1076
1077struct dvb_frontend_event {
1078 fe_status_t status;
1079 struct dvb_frontend_parameters parameters;
1080};
Mauro Carvalho Chehabaf6392d2015-06-07 15:00:17 -03001081
chuangcheng peng62fb9f92022-08-11 19:32:43 +08001082/* amlogic define */
1083/* Satellite blind scan event */
1084struct dvbsx_blindscanevent {
1085 enum fe_status status;
1086 union {
1087 /* The percentage completion of the*/
1088 /*blind scan procedure. A value of*/
1089 /*100 indicates that the blind scan*/
1090 /*is finished. */
1091 __u16 m_uiprogress;
1092 /*The start scan frequency in units of kHz.*/
1093 /*The minimum value depends on the tuner*/
1094 /*specification.*/
1095 __u32 m_uistartfreq_khz;
1096 /* Blind scan channel info. */
1097 struct dvb_frontend_parameters parameters;
1098 } u;
1099};
1100
1101/*for atv*/
1102struct tuner_status_s {
1103 unsigned int frequency;
1104 unsigned int rssi;
1105 unsigned char mode;/*dtv:0 or atv:1*/
1106 unsigned char tuner_locked;/*notlocked:0,locked:1*/
1107 union {
1108 void *ressrved;
1109 __u64 reserved1;
1110 };
1111};
1112
1113struct atv_status_s {
1114 unsigned char atv_lock;/*notlocked:0,locked 1*/
1115 v4l2_std_id std;
1116 unsigned int audmode;
1117 int snr;
1118 int afc;
1119 union {
1120 void *resrvred;
1121 __u64 reserved1;
1122 };
1123};
1124
1125struct sound_status_s {
1126 unsigned short sound_sys;/*A2DK/A2BG/NICAM BG/NICAM DK/BTSC/EIAJ*/
1127 unsigned short sound_mode;/*SETERO/DUAL/MONO/SAP*/
1128 union {
1129 void *resrvred;
1130 __u64 reserved1;
1131 };
1132};
1133
1134enum tuner_param_cmd_e {
1135 TUNER_CMD_AUDIO_MUTE = 0x0000,
1136 TUNER_CMD_AUDIO_ON,
1137 TUNER_CMD_TUNER_POWER_ON,
1138 TUNER_CMD_TUNER_POWER_DOWN,
1139 TUNER_CMD_SET_VOLUME,
1140 TUNER_CMD_SET_LEAP_SETP_SIZE,
1141 TUNER_CMD_GET_MONO_MODE,
1142 TUNER_CMD_SET_BEST_LOCK_RANGE,
1143 TUNER_CMD_GET_BEST_LOCK_RANGE,
1144 TUNER_CMD_SET_CVBS_AMP_OUT,
1145 TUNER_CMD_GET_CVBS_AMP_OUT,
1146 TUNER_CMD_NULL,
1147};
1148
1149/*parameter for set param box*/
1150struct tuner_param_s {
1151 enum tuner_param_cmd_e cmd;
1152 unsigned int parm;
1153 unsigned int resvred;
1154};
1155
1156// typedef struct dvb_analog_parameters dvb_analog_parameters_t;
1157// typedef struct tuner_status_s tuner_status_t;
1158// typedef struct atv_status_s atv_status_t;
1159// typedef struct sound_status_s sound_status_t;
1160// typedef enum tuner_param_cmd_e tuner_param_cmd_t;
1161// typedef struct tuner_param_s tuner_param_t;
1162// typedef enum fe_layer fe_layer_t;
1163// typedef enum fe_ofdm_mode fe_ofdm_mode_t;
1164
1165/* Satellite blind scan settings */
1166struct dvbsx_blindscanpara {
1167 __u32 minfrequency;/* minimum tuner frequency in kHz */
1168 __u32 maxfrequency;/* maximum tuner frequency in kHz */
1169 __u32 minSymbolRate;/* minimum symbol rate in sym/sec */
1170 __u32 maxSymbolRate;/* maximum symbol rate in sym/sec */
1171 /*search range in kHz. freq -/+freqRange will be searched */
1172 __u32 frequencyRange;
1173 __u32 frequencyStep;/* tuner step frequency in kHz */
1174 __s32 timeout;/* blindscan event timeout*/
1175};
1176
1177/* amlogic define end */
1178
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -04001179/* DVBv3 API calls */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001180
1181#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
1182#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001183
Mauro Carvalho Chehab8220ead2017-08-30 08:12:38 -04001184#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001185
1186#endif /*_DVBFRONTEND_H_*/