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