Zhiqiang Han | a67a825 | 2023-02-25 18:23:48 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 2 | /* |
| 3 | * frontend.h |
| 4 | * |
| 5 | * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 6 | * Ralph Metzler <ralph@convergence.de> |
| 7 | * Holger Waechtler <holger@convergence.de> |
| 8 | * Andre Draszik <ad@convergence.de> |
| 9 | * for convergence integrated media GmbH |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 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 | #define CONFIG_AMLOGIC_DVB_COMPAT |
| 31 | #include <linux/types.h> |
| 32 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 33 | #include <linux/videodev2.h> |
| 34 | #endif |
| 35 | |
| 36 | enum fe_type { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 37 | FE_QPSK, |
| 38 | FE_QAM, |
| 39 | FE_OFDM, |
| 40 | FE_ATSC, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 41 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 42 | FE_ANALOG, |
| 43 | FE_DTMB, |
| 44 | FE_ISDBT |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 45 | #endif |
| 46 | }; |
| 47 | |
| 48 | enum fe_caps { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 49 | FE_IS_STUPID = 0, |
| 50 | FE_CAN_INVERSION_AUTO = 0x1, |
| 51 | FE_CAN_FEC_1_2 = 0x2, |
| 52 | FE_CAN_FEC_2_3 = 0x4, |
| 53 | FE_CAN_FEC_3_4 = 0x8, |
| 54 | FE_CAN_FEC_4_5 = 0x10, |
| 55 | FE_CAN_FEC_5_6 = 0x20, |
| 56 | FE_CAN_FEC_6_7 = 0x40, |
| 57 | FE_CAN_FEC_7_8 = 0x80, |
| 58 | FE_CAN_FEC_8_9 = 0x100, |
| 59 | FE_CAN_FEC_AUTO = 0x200, |
| 60 | FE_CAN_QPSK = 0x400, |
| 61 | FE_CAN_QAM_16 = 0x800, |
| 62 | FE_CAN_QAM_32 = 0x1000, |
| 63 | FE_CAN_QAM_64 = 0x2000, |
| 64 | FE_CAN_QAM_128 = 0x4000, |
| 65 | FE_CAN_QAM_256 = 0x8000, |
| 66 | FE_CAN_QAM_AUTO = 0x10000, |
| 67 | FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000, |
| 68 | FE_CAN_BANDWIDTH_AUTO = 0x40000, |
| 69 | FE_CAN_GUARD_INTERVAL_AUTO = 0x80000, |
| 70 | FE_CAN_HIERARCHY_AUTO = 0x100000, |
| 71 | FE_CAN_8VSB = 0x200000, |
| 72 | FE_CAN_16VSB = 0x400000, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 73 | /* We need more bitspace for newer APIs, indicate this. */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 74 | FE_HAS_EXTENDED_CAPS = 0x800000, |
| 75 | FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports multistream filtering */ |
| 76 | FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 77 | /* frontend supports "2nd generation modulation" (DVB-S2) */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 78 | FE_CAN_2G_MODULATION = 0x10000000, |
| 79 | FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ |
| 80 | FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ |
| 81 | FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 82 | }; |
| 83 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 84 | #define FE_CAN_3_LAYER FE_CAN_MULTISTREAM |
| 85 | #endif |
| 86 | struct dvb_frontend_info { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 87 | char name[128]; |
| 88 | enum fe_type type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */ |
| 89 | __u32 frequency_min; |
| 90 | __u32 frequency_max; |
| 91 | __u32 frequency_stepsize; |
| 92 | __u32 frequency_tolerance; |
| 93 | __u32 symbol_rate_min; |
| 94 | __u32 symbol_rate_max; |
| 95 | __u32 symbol_rate_tolerance; /* ppm */ |
| 96 | __u32 notifier_delay; /* DEPRECATED */ |
| 97 | enum fe_caps caps; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | |
| 101 | /** |
| 102 | * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for |
| 103 | * the meaning of this struct... |
| 104 | */ |
| 105 | struct dvb_diseqc_master_cmd { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 106 | __u8 msg [6]; /* { framing, address, command, data [3] } */ |
| 107 | __u8 msg_len; /* valid values are 3...6 */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | struct dvb_diseqc_slave_reply { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 111 | __u8 msg [4]; /* { framing, data [3] } */ |
| 112 | __u8 msg_len; /* valid values are 0...4, 0 means no msg */ |
| 113 | int timeout; /* return from ioctl after timeout ms with */ |
| 114 | }; /* errorcode when no message was received */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 115 | |
| 116 | enum fe_sec_voltage { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 117 | SEC_VOLTAGE_13, |
| 118 | SEC_VOLTAGE_18, |
| 119 | SEC_VOLTAGE_OFF, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | enum fe_sec_tone_mode { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 123 | SEC_TONE_ON, |
| 124 | SEC_TONE_OFF |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | enum fe_sec_mini_cmd { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 128 | SEC_MINI_A, |
| 129 | SEC_MINI_B |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 130 | }; |
| 131 | |
| 132 | /** |
| 133 | * enum fe_status - enumerates the possible frontend status |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 134 | * @FE_HAS_SIGNAL: found something above the noise level |
| 135 | * @FE_HAS_CARRIER: found a DVB signal |
| 136 | * @FE_HAS_VITERBI: FEC is stable |
| 137 | * @FE_HAS_SYNC: found sync bytes |
| 138 | * @FE_HAS_LOCK: everything's working |
| 139 | * @FE_TIMEDOUT: no lock within the last ~2 seconds |
| 140 | * @FE_REINIT: frontend was reinitialized, application is recommended |
| 141 | * to reset DiSEqC, tone and parameters |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 142 | */ |
| 143 | enum fe_status { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 144 | FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ |
| 145 | FE_HAS_CARRIER = 0x02, /* found a DVB signal */ |
| 146 | FE_HAS_VITERBI = 0x04, /* FEC is stable */ |
| 147 | FE_HAS_SYNC = 0x08, /* found sync bytes */ |
| 148 | FE_HAS_LOCK = 0x10, /* everything's working... */ |
| 149 | FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ |
| 150 | FE_REINIT = 0x40, /* frontend was reinitialized, */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 151 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 152 | BLINDSCAN_NONEDO = 0x80, /* not blind scan */ |
| 153 | BLINDSCAN_UPDATESTARTFREQ = 0x100, /* blind scan update start freq */ |
| 154 | BLINDSCAN_UPDATEPROCESS = 0x200, /* blind scan update process */ |
| 155 | BLINDSCAN_UPDATERESULTFREQ = 0x400/* blind scan update result */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 156 | #endif |
| 157 | }; /* application is recommended to reset */ |
| 158 | /* DiSEqC, tone and parameters */ |
| 159 | |
| 160 | enum fe_spectral_inversion { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 161 | INVERSION_OFF, |
| 162 | INVERSION_ON, |
| 163 | INVERSION_AUTO |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | enum fe_code_rate { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 167 | FEC_NONE = 0, |
| 168 | FEC_1_2, |
| 169 | FEC_2_3, |
| 170 | FEC_3_4, |
| 171 | FEC_4_5, |
| 172 | FEC_5_6, |
| 173 | FEC_6_7, |
| 174 | FEC_7_8, |
| 175 | FEC_8_9, |
| 176 | FEC_AUTO, |
| 177 | FEC_3_5, |
| 178 | FEC_9_10, |
| 179 | FEC_2_5, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 180 | }; |
| 181 | |
| 182 | enum fe_modulation { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 183 | QPSK, |
| 184 | QAM_16, |
| 185 | QAM_32, |
| 186 | QAM_64, |
| 187 | QAM_128, |
| 188 | QAM_256, |
| 189 | QAM_AUTO, |
| 190 | VSB_8, |
| 191 | VSB_16, |
| 192 | PSK_8, |
| 193 | APSK_16, |
| 194 | APSK_32, |
| 195 | DQPSK, |
| 196 | QAM_4_NR, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | enum fe_transmit_mode { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 200 | TRANSMISSION_MODE_2K, |
| 201 | TRANSMISSION_MODE_8K, |
| 202 | TRANSMISSION_MODE_AUTO, |
| 203 | TRANSMISSION_MODE_4K, |
| 204 | TRANSMISSION_MODE_1K, |
| 205 | TRANSMISSION_MODE_16K, |
| 206 | TRANSMISSION_MODE_32K, |
| 207 | TRANSMISSION_MODE_C1, |
| 208 | TRANSMISSION_MODE_C3780, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 209 | }; |
| 210 | |
| 211 | enum fe_guard_interval { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 212 | GUARD_INTERVAL_1_32, |
| 213 | GUARD_INTERVAL_1_16, |
| 214 | GUARD_INTERVAL_1_8, |
| 215 | GUARD_INTERVAL_1_4, |
| 216 | GUARD_INTERVAL_AUTO, |
| 217 | GUARD_INTERVAL_1_128, |
| 218 | GUARD_INTERVAL_19_128, |
| 219 | GUARD_INTERVAL_19_256, |
| 220 | GUARD_INTERVAL_PN420, |
| 221 | GUARD_INTERVAL_PN595, |
| 222 | GUARD_INTERVAL_PN945, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 223 | }; |
| 224 | |
| 225 | enum fe_hierarchy { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 226 | HIERARCHY_NONE, |
| 227 | HIERARCHY_1, |
| 228 | HIERARCHY_2, |
| 229 | HIERARCHY_4, |
| 230 | HIERARCHY_AUTO |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 231 | }; |
| 232 | |
| 233 | enum fe_interleaving { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 234 | INTERLEAVING_NONE, |
| 235 | INTERLEAVING_AUTO, |
| 236 | INTERLEAVING_240, |
| 237 | INTERLEAVING_720, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 238 | }; |
| 239 | |
| 240 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 241 | struct fe_blind_scan_parameters { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 242 | /* minimum tuner frequency in kHz */ |
| 243 | __u32 min_frequency; |
| 244 | /* maximum tuner frequency in kHz */ |
| 245 | __u32 max_frequency; |
| 246 | /* minimum symbol rate in sym/sec */ |
| 247 | __u32 min_symbol_rate; |
| 248 | /* maximum symbol rate in sym/sec */ |
| 249 | __u32 max_symbol_rate; |
| 250 | /* search range in kHz. freq -/+freqRange will be searched */ |
| 251 | __u32 frequency_range; |
| 252 | /* tuner step frequency in kHz */ |
| 253 | __u32 frequency_step; |
| 254 | /* blindscan event timeout */ |
| 255 | __s32 timeout; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 256 | }; |
| 257 | #endif |
| 258 | |
| 259 | /* S2API Commands */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 260 | #define DTV_UNDEFINED 0 |
| 261 | #define DTV_TUNE 1 |
| 262 | #define DTV_CLEAR 2 |
| 263 | #define DTV_FREQUENCY 3 |
| 264 | #define DTV_MODULATION 4 |
| 265 | #define DTV_BANDWIDTH_HZ 5 |
| 266 | #define DTV_INVERSION 6 |
| 267 | #define DTV_DISEQC_MASTER 7 |
| 268 | #define DTV_SYMBOL_RATE 8 |
| 269 | #define DTV_INNER_FEC 9 |
| 270 | #define DTV_VOLTAGE 10 |
| 271 | #define DTV_TONE 11 |
| 272 | #define DTV_PILOT 12 |
| 273 | #define DTV_ROLLOFF 13 |
| 274 | #define DTV_DISEQC_SLAVE_REPLY 14 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 275 | |
| 276 | /* Basic enumeration set for querying unlimited capabilities */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 277 | #define DTV_FE_CAPABILITY_COUNT 15 |
| 278 | #define DTV_FE_CAPABILITY 16 |
| 279 | #define DTV_DELIVERY_SYSTEM 17 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 280 | |
| 281 | /* ISDB-T and ISDB-Tsb */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 282 | #define DTV_ISDBT_PARTIAL_RECEPTION 18 |
| 283 | #define DTV_ISDBT_SOUND_BROADCASTING 19 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 284 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 285 | #define DTV_ISDBT_SB_SUBCHANNEL_ID 20 |
| 286 | #define DTV_ISDBT_SB_SEGMENT_IDX 21 |
| 287 | #define DTV_ISDBT_SB_SEGMENT_COUNT 22 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 288 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 289 | #define DTV_ISDBT_LAYERA_FEC 23 |
| 290 | #define DTV_ISDBT_LAYERA_MODULATION 24 |
| 291 | #define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25 |
| 292 | #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 293 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 294 | #define DTV_ISDBT_LAYERB_FEC 27 |
| 295 | #define DTV_ISDBT_LAYERB_MODULATION 28 |
| 296 | #define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29 |
| 297 | #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 298 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 299 | #define DTV_ISDBT_LAYERC_FEC 31 |
| 300 | #define DTV_ISDBT_LAYERC_MODULATION 32 |
| 301 | #define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33 |
| 302 | #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 303 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 304 | #define DTV_API_VERSION 35 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 305 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 306 | #define DTV_CODE_RATE_HP 36 |
| 307 | #define DTV_CODE_RATE_LP 37 |
| 308 | #define DTV_GUARD_INTERVAL 38 |
| 309 | #define DTV_TRANSMISSION_MODE 39 |
| 310 | #define DTV_HIERARCHY 40 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 311 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 312 | #define DTV_ISDBT_LAYER_ENABLED 41 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 313 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 314 | #define DTV_STREAM_ID 42 |
| 315 | #define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID |
| 316 | #define DTV_DVBT2_PLP_ID_LEGACY 43 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 317 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 318 | #define DTV_ENUM_DELSYS 44 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 319 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 320 | #define DTV_DVBT2_PLP_ID DTV_DVBT2_PLP_ID_LEGACY |
| 321 | #endif |
| 322 | /* ATSC-MH */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 323 | #define DTV_ATSCMH_FIC_VER 45 |
| 324 | #define DTV_ATSCMH_PARADE_ID 46 |
| 325 | #define DTV_ATSCMH_NOG 47 |
| 326 | #define DTV_ATSCMH_TNOG 48 |
| 327 | #define DTV_ATSCMH_SGN 49 |
| 328 | #define DTV_ATSCMH_PRC 50 |
| 329 | #define DTV_ATSCMH_RS_FRAME_MODE 51 |
| 330 | #define DTV_ATSCMH_RS_FRAME_ENSEMBLE 52 |
| 331 | #define DTV_ATSCMH_RS_CODE_MODE_PRI 53 |
| 332 | #define DTV_ATSCMH_RS_CODE_MODE_SEC 54 |
| 333 | #define DTV_ATSCMH_SCCC_BLOCK_MODE 55 |
| 334 | #define DTV_ATSCMH_SCCC_CODE_MODE_A 56 |
| 335 | #define DTV_ATSCMH_SCCC_CODE_MODE_B 57 |
| 336 | #define DTV_ATSCMH_SCCC_CODE_MODE_C 58 |
| 337 | #define DTV_ATSCMH_SCCC_CODE_MODE_D 59 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 338 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 339 | #define DTV_INTERLEAVING 60 |
| 340 | #define DTV_LNA 61 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 341 | |
| 342 | /* Quality parameters */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 343 | #define DTV_STAT_SIGNAL_STRENGTH 62 |
| 344 | #define DTV_STAT_CNR 63 |
| 345 | #define DTV_STAT_PRE_ERROR_BIT_COUNT 64 |
| 346 | #define DTV_STAT_PRE_TOTAL_BIT_COUNT 65 |
| 347 | #define DTV_STAT_POST_ERROR_BIT_COUNT 66 |
| 348 | #define DTV_STAT_POST_TOTAL_BIT_COUNT 67 |
| 349 | #define DTV_STAT_ERROR_BLOCK_COUNT 68 |
| 350 | #define DTV_STAT_TOTAL_BLOCK_COUNT 69 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 351 | |
| 352 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 353 | |
| 354 | /* Get tne TS input of the frontend */ |
Chuangcheng Peng | 6a9df48 | 2020-12-29 13:50:48 +0800 | [diff] [blame] | 355 | #define DTV_TS_INPUT 100 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 356 | /* Blind scan */ |
Chuangcheng Peng | 6a9df48 | 2020-12-29 13:50:48 +0800 | [diff] [blame] | 357 | #define DTV_START_BLIND_SCAN 101 |
| 358 | #define DTV_CANCEL_BLIND_SCAN 102 |
| 359 | #define DTV_BLIND_SCAN_MIN_FRE 103 |
| 360 | #define DTV_BLIND_SCAN_MAX_FRE 104 |
| 361 | #define DTV_BLIND_SCAN_MIN_SRATE 105 |
| 362 | #define DTV_BLIND_SCAN_MAX_SRATE 106 |
| 363 | #define DTV_BLIND_SCAN_FRE_RANGE 107 |
| 364 | #define DTV_BLIND_SCAN_FRE_STEP 108 |
| 365 | #define DTV_BLIND_SCAN_TIMEOUT 109 |
zhicheng.huang | f92bcce | 2022-10-12 20:13:20 +0800 | [diff] [blame] | 366 | #define DTV_SINGLE_CABLE_VER 110 |
| 367 | #define DTV_SINGLE_CABLE_USER_BAND 111 |
| 368 | #define DTV_SINGLE_CABLE_BAND_FRE 112 |
| 369 | #define DTV_SINGLE_CABLE_BANK 113 |
| 370 | #define DTV_SINGLE_CABLE_UNCOMMITTED 114 |
| 371 | #define DTV_SINGLE_CABLE_COMMITTED 115 |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 372 | /* Blind scan end*/ |
zhicheng.huang | f92bcce | 2022-10-12 20:13:20 +0800 | [diff] [blame] | 373 | #define DTV_DELIVERY_SUB_SYSTEM 116 |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 374 | #define DTV_MAX_COMMAND DTV_DELIVERY_SUB_SYSTEM |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 375 | |
| 376 | #else /*!defined(CONFIG_AMLOGIC_DVB_COMPAT)*/ |
| 377 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 378 | #define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 379 | |
| 380 | #endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ |
| 381 | |
| 382 | |
| 383 | enum fe_pilot { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 384 | PILOT_ON, |
| 385 | PILOT_OFF, |
| 386 | PILOT_AUTO, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 387 | }; |
| 388 | |
| 389 | enum fe_rolloff { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 390 | ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */ |
| 391 | ROLLOFF_20, |
| 392 | ROLLOFF_25, |
| 393 | ROLLOFF_AUTO, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 394 | }; |
| 395 | |
| 396 | enum fe_delivery_system { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 397 | SYS_UNDEFINED, |
| 398 | SYS_DVBC_ANNEX_A, |
| 399 | SYS_DVBC_ANNEX_B, |
| 400 | SYS_DVBT, |
| 401 | SYS_DSS, |
| 402 | SYS_DVBS, |
| 403 | SYS_DVBS2, |
| 404 | SYS_DVBH, |
| 405 | SYS_ISDBT, |
| 406 | SYS_ISDBS, |
| 407 | SYS_ISDBC, |
| 408 | SYS_ATSC, |
| 409 | SYS_ATSCMH, |
| 410 | SYS_DTMB, |
| 411 | SYS_CMMB, |
| 412 | SYS_DAB, |
| 413 | SYS_DVBT2, |
| 414 | SYS_TURBO, |
| 415 | SYS_DVBC_ANNEX_C, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 416 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 417 | SYS_ANALOG |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 418 | #endif |
| 419 | }; |
| 420 | |
| 421 | /* backward compatibility */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 422 | #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 423 | #define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */ |
| 424 | |
| 425 | /* ATSC-MH */ |
| 426 | |
| 427 | enum atscmh_sccc_block_mode { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 428 | ATSCMH_SCCC_BLK_SEP = 0, |
| 429 | ATSCMH_SCCC_BLK_COMB = 1, |
| 430 | ATSCMH_SCCC_BLK_RES = 2, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 431 | }; |
| 432 | |
| 433 | enum atscmh_sccc_code_mode { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 434 | ATSCMH_SCCC_CODE_HLF = 0, |
| 435 | ATSCMH_SCCC_CODE_QTR = 1, |
| 436 | ATSCMH_SCCC_CODE_RES = 2, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 437 | }; |
| 438 | |
| 439 | enum atscmh_rs_frame_ensemble { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 440 | ATSCMH_RSFRAME_ENS_PRI = 0, |
| 441 | ATSCMH_RSFRAME_ENS_SEC = 1, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 442 | }; |
| 443 | |
| 444 | enum atscmh_rs_frame_mode { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 445 | ATSCMH_RSFRAME_PRI_ONLY = 0, |
| 446 | ATSCMH_RSFRAME_PRI_SEC = 1, |
| 447 | ATSCMH_RSFRAME_RES = 2, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 448 | }; |
| 449 | |
| 450 | enum atscmh_rs_code_mode { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 451 | ATSCMH_RSCODE_211_187 = 0, |
| 452 | ATSCMH_RSCODE_223_187 = 1, |
| 453 | ATSCMH_RSCODE_235_187 = 2, |
| 454 | ATSCMH_RSCODE_RES = 3, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 455 | }; |
| 456 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 457 | #define NO_STREAM_ID_FILTER (~0U) |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 458 | #define LNA_AUTO (~0U) |
| 459 | |
| 460 | struct dtv_cmds_h { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 461 | char *name; /* A display name for debugging purposes */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 462 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 463 | __u32 cmd; /* A unique ID */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 464 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 465 | /* Flags */ |
| 466 | __u32 set:1; /* Either a set or get property */ |
| 467 | __u32 buffer:1; /* Does this property use the buffer? */ |
| 468 | __u32 reserved:30; /* Align */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 469 | }; |
| 470 | |
| 471 | /** |
| 472 | * Scale types for the quality parameters. |
| 473 | * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 474 | * could indicate a temporary or a permanent |
| 475 | * condition. |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 476 | * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 477 | * used on signal measures. |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 478 | * @FE_SCALE_RELATIVE: The scale is a relative percentual measure, |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 479 | * ranging from 0 (0%) to 0xffff (100%). |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 480 | * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 481 | * bit error, block error, lapsed time. |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 482 | */ |
| 483 | enum fecap_scale_params { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 484 | FE_SCALE_NOT_AVAILABLE = 0, |
| 485 | FE_SCALE_DECIBEL, |
| 486 | FE_SCALE_RELATIVE, |
| 487 | FE_SCALE_COUNTER |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 488 | }; |
| 489 | |
| 490 | /** |
| 491 | * struct dtv_stats - Used for reading a DTV status property |
| 492 | * |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 493 | * @value: value of the measure. Should range from 0 to 0xffff; |
| 494 | * @scale: Filled with enum fecap_scale_params - the scale |
| 495 | * in usage for that parameter |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 496 | * |
| 497 | * For most delivery systems, this will return a single value for each |
| 498 | * parameter. |
| 499 | * It should be noticed, however, that new OFDM delivery systems like |
| 500 | * ISDB can use different modulation types for each group of carriers. |
| 501 | * On such standards, up to 8 groups of statistics can be provided, one |
| 502 | * for each carrier group (called "layer" on ISDB). |
| 503 | * In order to be consistent with other delivery systems, the first |
| 504 | * value refers to the entire set of carriers ("global"). |
| 505 | * dtv_status:scale should use the value FE_SCALE_NOT_AVAILABLE when |
| 506 | * the value for the entire group of carriers or from one specific layer |
| 507 | * is not provided by the hardware. |
| 508 | * st.len should be filled with the latest filled status + 1. |
| 509 | * |
| 510 | * In other words, for ISDB, those values should be filled like: |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 511 | * u.st.stat.svalue[0] = global statistics; |
| 512 | * u.st.stat.scale[0] = FE_SCALE_DECIBEL; |
| 513 | * u.st.stat.value[1] = layer A statistics; |
| 514 | * u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available); |
| 515 | * u.st.stat.svalue[2] = layer B statistics; |
| 516 | * u.st.stat.scale[2] = FE_SCALE_DECIBEL; |
| 517 | * u.st.stat.svalue[3] = layer C statistics; |
| 518 | * u.st.stat.scale[3] = FE_SCALE_DECIBEL; |
| 519 | * u.st.len = 4; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 520 | */ |
| 521 | struct dtv_stats { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 522 | __u8 scale; /* enum fecap_scale_params type */ |
| 523 | union { |
| 524 | __u64 uvalue; /* for counters and relative scales */ |
| 525 | __s64 svalue; /* for 0.001 dB measures */ |
| 526 | }; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 527 | } __attribute__ ((packed)); |
| 528 | |
| 529 | |
| 530 | #define MAX_DTV_STATS 4 |
| 531 | |
| 532 | struct dtv_fe_stats { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 533 | __u8 len; |
| 534 | struct dtv_stats stat[MAX_DTV_STATS]; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 535 | } __attribute__ ((packed)); |
| 536 | |
| 537 | struct dtv_property { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 538 | __u32 cmd; |
| 539 | __u32 reserved[3]; |
| 540 | union { |
| 541 | __u32 data; |
| 542 | struct dtv_fe_stats st; |
| 543 | struct { |
| 544 | __u8 data[32]; |
| 545 | __u32 len; |
| 546 | __u32 reserved1[3]; |
| 547 | void *reserved2; |
| 548 | } buffer; |
| 549 | } u; |
| 550 | int result; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 551 | } __attribute__ ((packed)); |
| 552 | |
| 553 | struct dtv_property_32 { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 554 | __u32 cmd; |
| 555 | __u32 reserved[3]; |
| 556 | union { |
| 557 | __u32 data; |
| 558 | struct dtv_fe_stats st; |
| 559 | struct { |
| 560 | __u8 data[32]; |
| 561 | __u32 len; |
| 562 | __u32 reserved1[3]; |
| 563 | __u32 reserved2; |
| 564 | } buffer; |
| 565 | } u; |
| 566 | int result; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 567 | } __attribute__ ((packed)); |
| 568 | |
| 569 | struct dtv_property_64 { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 570 | __u32 cmd; |
| 571 | __u32 reserved[3]; |
| 572 | union { |
| 573 | __u32 data; |
| 574 | struct dtv_fe_stats st; |
| 575 | struct { |
| 576 | __u8 data[32]; |
| 577 | __u32 len; |
| 578 | __u32 reserved1[3]; |
| 579 | __u64 reserved2; |
| 580 | } buffer; |
| 581 | } u; |
| 582 | int result; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 583 | } __attribute__ ((packed)); |
| 584 | |
| 585 | /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ |
| 586 | #define DTV_IOCTL_MAX_MSGS 64 |
| 587 | |
| 588 | struct dtv_properties { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 589 | __u32 num; |
| 590 | struct dtv_property *props; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 591 | }; |
| 592 | |
| 593 | struct dtv_properties_32 { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 594 | __u32 num; |
| 595 | __u32 props; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 596 | }; |
| 597 | |
| 598 | struct dtv_properties_64 { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 599 | __u32 num; |
| 600 | __u64 props; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 601 | }; |
| 602 | |
| 603 | #if defined(__DVB_CORE__) || !defined (__KERNEL__) |
| 604 | |
| 605 | /* |
| 606 | * DEPRECATED: The DVBv3 ioctls, structs and enums should not be used on |
| 607 | * newer programs, as it doesn't support the second generation of digital |
| 608 | * TV standards, nor supports newer delivery systems. |
| 609 | */ |
| 610 | |
| 611 | enum fe_bandwidth { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 612 | BANDWIDTH_8_MHZ, |
| 613 | BANDWIDTH_7_MHZ, |
| 614 | BANDWIDTH_6_MHZ, |
| 615 | BANDWIDTH_AUTO, |
| 616 | BANDWIDTH_5_MHZ, |
| 617 | BANDWIDTH_10_MHZ, |
| 618 | BANDWIDTH_1_712_MHZ, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 619 | }; |
| 620 | |
| 621 | /* This is needed for legacy userspace support */ |
| 622 | typedef enum fe_sec_voltage fe_sec_voltage_t; |
| 623 | typedef enum fe_caps fe_caps_t; |
| 624 | typedef enum fe_type fe_type_t; |
| 625 | typedef enum fe_sec_tone_mode fe_sec_tone_mode_t; |
| 626 | typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t; |
| 627 | typedef enum fe_status fe_status_t; |
| 628 | typedef enum fe_spectral_inversion fe_spectral_inversion_t; |
| 629 | typedef enum fe_code_rate fe_code_rate_t; |
| 630 | typedef enum fe_modulation fe_modulation_t; |
| 631 | typedef enum fe_transmit_mode fe_transmit_mode_t; |
| 632 | typedef enum fe_bandwidth fe_bandwidth_t; |
| 633 | typedef enum fe_guard_interval fe_guard_interval_t; |
| 634 | typedef enum fe_hierarchy fe_hierarchy_t; |
| 635 | typedef enum fe_pilot fe_pilot_t; |
| 636 | typedef enum fe_rolloff fe_rolloff_t; |
| 637 | typedef enum fe_delivery_system fe_delivery_system_t; |
| 638 | |
| 639 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 640 | enum fe_ofdm_mode { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 641 | OFDM_DVBT, |
| 642 | OFDM_DVBT2, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 643 | }; |
| 644 | #endif |
| 645 | |
| 646 | struct dvb_qpsk_parameters { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 647 | __u32 symbol_rate; /* symbol rate in Symbols per second */ |
| 648 | fe_code_rate_t fec_inner; /* forward error correction (see above) */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 649 | }; |
| 650 | |
| 651 | struct dvb_qam_parameters { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 652 | __u32 symbol_rate; /* symbol rate in Symbols per second */ |
| 653 | fe_code_rate_t fec_inner; /* forward error correction (see above) */ |
| 654 | fe_modulation_t modulation; /* modulation type (see above) */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 655 | }; |
| 656 | |
| 657 | struct dvb_vsb_parameters { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 658 | fe_modulation_t modulation; /* modulation type (see above) */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 659 | }; |
| 660 | |
| 661 | struct dvb_ofdm_parameters { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 662 | fe_bandwidth_t bandwidth; |
| 663 | fe_code_rate_t code_rate_HP; /* high priority stream code rate */ |
| 664 | fe_code_rate_t code_rate_LP; /* low priority stream code rate */ |
| 665 | fe_modulation_t constellation; /* modulation type (see above) */ |
| 666 | fe_transmit_mode_t transmission_mode; |
| 667 | fe_guard_interval_t guard_interval; |
| 668 | fe_hierarchy_t hierarchy_information; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 669 | }; |
| 670 | |
| 671 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 672 | #define ANALOG_FLAG_ENABLE_AFC 0X00000001 |
| 673 | #define ANALOG_FLAG_MANUL_SCAN 0x00000011 |
| 674 | struct dvb_analog_parameters { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 675 | /*V4L2_TUNER_MODE_MONO,V4L2_TUNER_MODE_STEREO,*/ |
| 676 | /*V4L2_TUNER_MODE_LANG2,V4L2_TUNER_MODE_SAP,*/ |
| 677 | /*V4L2_TUNER_MODE_LANG1,V4L2_TUNER_MODE_LANG1_LANG2 */ |
| 678 | unsigned int audmode; |
| 679 | unsigned int soundsys; /*A2,BTSC,EIAJ,NICAM */ |
| 680 | v4l2_std_id std; |
| 681 | unsigned int flag; |
| 682 | unsigned int afc_range; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 683 | }; |
| 684 | #endif |
| 685 | |
| 686 | struct dvb_frontend_parameters { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 687 | /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */ |
| 688 | __u32 frequency; |
| 689 | /* intermediate frequency in kHz for DVB-S */ |
| 690 | fe_spectral_inversion_t inversion; |
| 691 | union { |
| 692 | struct dvb_qpsk_parameters qpsk; /* DVB-S */ |
| 693 | struct dvb_qam_parameters qam; /* DVB-C */ |
| 694 | struct dvb_ofdm_parameters ofdm; /* DVB-T */ |
| 695 | struct dvb_vsb_parameters vsb; /* ATSC */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 696 | #if 0 && defined(CONFIG_AMLOGIC_DVB_COMPAT) |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 697 | struct dvb_analog_parameters analog; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 698 | #endif |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 699 | } u; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 700 | }; |
| 701 | |
| 702 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 703 | |
| 704 | struct dvb_frontend_parameters_ex { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 705 | __u32 frequency; /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */ |
| 706 | /* intermediate frequency in kHz for DVB-S */ |
| 707 | fe_spectral_inversion_t inversion; |
| 708 | union { |
| 709 | struct dvb_qpsk_parameters qpsk; /* DVB-S */ |
| 710 | struct dvb_qam_parameters qam; /* DVB-C */ |
| 711 | struct dvb_ofdm_parameters ofdm; /* DVB-T */ |
| 712 | struct dvb_vsb_parameters vsb; /* ATSC */ |
| 713 | struct dvb_analog_parameters analog; |
Wentao MA | 270dc0f | 2022-08-23 13:17:26 +0800 | [diff] [blame] | 714 | /* Add extension data here */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 715 | } u; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 716 | }; |
| 717 | |
| 718 | /* |
| 719 | static char dvb_check_frontend_parameters_size[ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 720 | (sizeof(struct dvb_frontend_parameters_ex) |
| 721 | == sizeof(struct dvb_frontend_parameters)) ? 1 : -1] |
| 722 | __attribute__((__unused__)); |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 723 | */ |
| 724 | |
| 725 | #endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ |
| 726 | |
| 727 | struct dvb_frontend_event { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 728 | fe_status_t status; |
| 729 | struct dvb_frontend_parameters parameters; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 730 | }; |
| 731 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 732 | /* Satellite blind scan event */ |
| 733 | struct dvbsx_blindscanevent { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 734 | enum fe_status status; |
| 735 | union { |
| 736 | /* The percentage completion of the*/ |
| 737 | /*blind scan procedure. A value of*/ |
| 738 | /*100 indicates that the blind scan*/ |
| 739 | /*is finished. */ |
| 740 | __u16 m_uiprogress; |
| 741 | /*The start scan frequency in units of kHz.*/ |
| 742 | /*The minimum value depends on the tuner*/ |
| 743 | /*specification.*/ |
| 744 | __u32 m_uistartfreq_khz; |
| 745 | /* Blind scan channel info. */ |
| 746 | struct dvb_frontend_parameters parameters; |
| 747 | } u; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 748 | }; |
| 749 | #endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ |
| 750 | #endif |
| 751 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 752 | #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) |
| 753 | #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties) |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 754 | |
| 755 | #define FE_SET_PROPERTY_32 _IOW('o', 82, struct dtv_properties_32) |
| 756 | #define FE_GET_PROPERTY_32 _IOR('o', 83, struct dtv_properties_32) |
| 757 | |
| 758 | #define FE_SET_PROPERTY_64 _IOW('o', 82, struct dtv_properties_64) |
| 759 | #define FE_GET_PROPERTY_64 _IOR('o', 83, struct dtv_properties_64) |
| 760 | |
| 761 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 762 | /*for atv*/ |
| 763 | struct tuner_status_s { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 764 | unsigned int frequency; |
| 765 | unsigned int rssi; |
| 766 | unsigned char mode;/*dtv:0 or atv:1*/ |
| 767 | unsigned char tuner_locked;/*notlocked:0,locked:1*/ |
| 768 | union { |
| 769 | void *ressrved; |
| 770 | __u64 reserved1; |
| 771 | }; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 772 | }; |
| 773 | |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 774 | struct atv_status_s { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 775 | unsigned char atv_lock;/*notlocked:0,locked 1*/ |
| 776 | v4l2_std_id std; |
| 777 | unsigned int audmode; |
| 778 | int snr; |
| 779 | int afc; |
| 780 | union { |
| 781 | void *resrvred; |
| 782 | __u64 reserved1; |
| 783 | }; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 784 | }; |
| 785 | |
| 786 | struct sound_status_s { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 787 | unsigned short sound_sys;/*A2DK/A2BG/NICAM BG/NICAM DK/BTSC/EIAJ*/ |
| 788 | unsigned short sound_mode;/*SETERO/DUAL/MONO/SAP*/ |
| 789 | union { |
| 790 | void *resrvred; |
| 791 | __u64 reserved1; |
| 792 | }; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 793 | }; |
| 794 | |
| 795 | |
| 796 | enum tuner_param_cmd_e { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 797 | TUNER_CMD_AUDIO_MUTE = 0x0000, |
| 798 | TUNER_CMD_AUDIO_ON, |
| 799 | TUNER_CMD_TUNER_POWER_ON, |
| 800 | TUNER_CMD_TUNER_POWER_DOWN, |
| 801 | TUNER_CMD_SET_VOLUME, |
| 802 | TUNER_CMD_SET_LEAP_SETP_SIZE, |
| 803 | TUNER_CMD_GET_MONO_MODE, |
| 804 | TUNER_CMD_SET_BEST_LOCK_RANGE, |
| 805 | TUNER_CMD_GET_BEST_LOCK_RANGE, |
| 806 | TUNER_CMD_SET_CVBS_AMP_OUT, |
| 807 | TUNER_CMD_GET_CVBS_AMP_OUT, |
| 808 | TUNER_CMD_NULL, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 809 | }; |
| 810 | |
| 811 | |
| 812 | /*parameter for set param box*/ |
| 813 | struct tuner_param_s { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 814 | enum tuner_param_cmd_e cmd; |
| 815 | unsigned int parm; |
Wentao MA | 270dc0f | 2022-08-23 13:17:26 +0800 | [diff] [blame] | 816 | unsigned int reserved; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 817 | }; |
| 818 | |
| 819 | |
| 820 | enum fe_layer { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 821 | Layer_A_B_C, |
| 822 | Layer_A, |
| 823 | Layer_B, |
| 824 | Layer_C, |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 825 | }; |
| 826 | |
| 827 | // typedef struct dvb_analog_parameters dvb_analog_parameters_t; |
| 828 | // typedef struct tuner_status_s tuner_status_t; |
| 829 | // typedef struct atv_status_s atv_status_t; |
| 830 | // typedef struct sound_status_s sound_status_t; |
| 831 | // typedef enum tuner_param_cmd_e tuner_param_cmd_t; |
| 832 | // typedef struct tuner_param_s tuner_param_t; |
| 833 | // typedef enum fe_layer fe_layer_t; |
| 834 | // typedef enum fe_ofdm_mode fe_ofdm_mode_t; |
| 835 | |
| 836 | |
| 837 | /* Satellite blind scan settings */ |
| 838 | struct dvbsx_blindscanpara { |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 839 | __u32 minfrequency;/* minimum tuner frequency in kHz */ |
| 840 | __u32 maxfrequency;/* maximum tuner frequency in kHz */ |
| 841 | __u32 minSymbolRate;/* minimum symbol rate in sym/sec */ |
| 842 | __u32 maxSymbolRate;/* maximum symbol rate in sym/sec */ |
| 843 | /*search range in kHz. freq -/+freqRange will be searched */ |
| 844 | __u32 frequencyRange; |
| 845 | __u32 frequencyStep;/* tuner step frequency in kHz */ |
| 846 | __s32 timeout;/* blindscan event timeout*/ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 847 | }; |
zhicheng.huang | f92bcce | 2022-10-12 20:13:20 +0800 | [diff] [blame] | 848 | |
| 849 | struct dvbsx_singlecable_parameters { |
| 850 | /* not singlecable: 0, 1.0X - 1(EN50494), 2.0X - 2(EN50607) */ |
| 851 | __u32 version; |
| 852 | __u32 userband; /* 1.0X: 0 - 7, 2.0X: 0 - 31 */ |
| 853 | __u32 frequency; /* KHz */ |
| 854 | __u32 bank; |
| 855 | /* |
| 856 | * Uncommitted switches setting for SCD2 (Similar to DiSEqC WriteN1 command, |
| 857 | * but lower 4 bits only) |
| 858 | * Bit[0] : Switch 1 Position A or B |
| 859 | * Bit[1] : Switch 2 Position A or B |
| 860 | * Bit[2] : Switch 3 Position A or B |
| 861 | * Bit[3] : Switch 4 Position A or B |
| 862 | */ |
| 863 | __u32 uncommitted; |
| 864 | /* |
| 865 | * Committed switches setting for SCD2 (Similar to DiSEqC WriteN0 command, |
| 866 | * but lower 4 bits only) |
| 867 | * Bit[0] : Low or High Band |
| 868 | * Bit[1] : Vertical or Horizontal Polarization |
| 869 | * Bit[2] : Satellite Position A or B |
| 870 | * Bit[3] : Option Switch Position A or B |
| 871 | */ |
| 872 | __u32 committed; |
| 873 | }; |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 874 | #endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ |
| 875 | /** |
| 876 | * When set, this flag will disable any zigzagging or other "normal" tuning |
| 877 | * behaviour. Additionally, there will be no automatic monitoring of the lock |
| 878 | * status, and hence no frontend events will be generated. If a frontend device |
| 879 | * is closed, this flag will be automatically turned off when the device is |
| 880 | * reopened read-write. |
| 881 | */ |
| 882 | #define FE_TUNE_MODE_ONESHOT 0x01 |
| 883 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 884 | #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 885 | |
| 886 | #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62) |
| 887 | #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd) |
| 888 | #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply) |
| 889 | #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */ |
| 890 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 891 | #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */ |
| 892 | #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */ |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 893 | #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ |
| 894 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 895 | #define FE_READ_STATUS _IOR('o', 69, fe_status_t) |
| 896 | #define FE_READ_BER _IOR('o', 70, __u32) |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 897 | #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16) |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 898 | #define FE_READ_SNR _IOR('o', 72, __u16) |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 899 | #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32) |
| 900 | |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 901 | #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) |
| 902 | #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 903 | #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */ |
hualing chen | 002e5b9 | 2022-02-23 17:51:21 +0800 | [diff] [blame] | 904 | #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) |
Chuanzhi Wang | 10a382f | 2020-09-03 15:34:38 +0800 | [diff] [blame] | 905 | |
| 906 | #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ |
| 907 | |
| 908 | #ifdef CONFIG_AMLOGIC_DVB_COMPAT |
| 909 | /*need del this ioctl, used set PROPERTY instead*/ |
| 910 | #define FE_SET_DELAY _IO('o', 100) |
| 911 | #define FE_READ_AFC _IOR('o', 91, __u32) |
| 912 | #define FE_FINE_TUNE _IOW('o', 92, __u32) |
| 913 | #define FE_READ_TUNER_STATUS _IOR('o', 93, struct tuner_status_s) |
| 914 | #define FE_READ_ANALOG_STATUS _IOR('o', 94, struct atv_status_s) |
| 915 | #define FE_READ_SD_STATUS _IOR('o', 95, struct sound_status_s) |
| 916 | /*set & get the tuner parameters only atv*/ |
| 917 | #define FE_SET_PARAM_BOX _IOWR('o', 97, struct tuner_param_s) |
| 918 | #define FE_SET_AFC _IOW('o', 98, __u32) |
| 919 | #endif /*CONFIG_AMLOGIC_DVB_COMPAT*/ |
| 920 | |
| 921 | #endif /*_DVBFRONTEND_H_*/ |