![]() |
|
|||
0001 /* 0002 * dvb_frontend.h 0003 * 0004 * The Digital TV Frontend kABI defines a driver-internal interface for 0005 * registering low-level, hardware specific driver to a hardware independent 0006 * frontend layer. 0007 * 0008 * Copyright (C) 2001 convergence integrated media GmbH 0009 * Copyright (C) 2004 convergence GmbH 0010 * 0011 * Written by Ralph Metzler 0012 * Overhauled by Holger Waechtler 0013 * Kernel I2C stuff by Michael Hunold <hunold@convergence.de> 0014 * 0015 * This program is free software; you can redistribute it and/or 0016 * modify it under the terms of the GNU Lesser General Public License 0017 * as published by the Free Software Foundation; either version 2.1 0018 * of the License, or (at your option) any later version. 0019 * 0020 * This program is distributed in the hope that it will be useful, 0021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0023 * GNU General Public License for more details. 0024 * 0025 0026 * You should have received a copy of the GNU Lesser General Public License 0027 * along with this program; if not, write to the Free Software 0028 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 0029 * 0030 */ 0031 0032 #ifndef _DVB_FRONTEND_H_ 0033 #define _DVB_FRONTEND_H_ 0034 0035 #include <linux/types.h> 0036 #include <linux/sched.h> 0037 #include <linux/ioctl.h> 0038 #include <linux/i2c.h> 0039 #include <linux/module.h> 0040 #include <linux/errno.h> 0041 #include <linux/delay.h> 0042 #include <linux/mutex.h> 0043 #include <linux/slab.h> 0044 #include <linux/bitops.h> 0045 0046 #include <linux/dvb/frontend.h> 0047 0048 #include <media/dvbdev.h> 0049 0050 /* 0051 * Maximum number of Delivery systems per frontend. It 0052 * should be smaller or equal to 32 0053 */ 0054 #define MAX_DELSYS 8 0055 0056 /* Helper definitions to be used at frontend drivers */ 0057 #define kHz 1000UL 0058 #define MHz 1000000UL 0059 0060 /** 0061 * struct dvb_frontend_tune_settings - parameters to adjust frontend tuning 0062 * 0063 * @min_delay_ms: minimum delay for tuning, in ms 0064 * @step_size: step size between two consecutive frequencies 0065 * @max_drift: maximum drift 0066 * 0067 * NOTE: step_size is in Hz, for terrestrial/cable or kHz for satellite 0068 */ 0069 struct dvb_frontend_tune_settings { 0070 int min_delay_ms; 0071 int step_size; 0072 int max_drift; 0073 }; 0074 0075 struct dvb_frontend; 0076 0077 /** 0078 * struct dvb_tuner_info - Frontend name and min/max ranges/bandwidths 0079 * 0080 * @name: name of the Frontend 0081 * @frequency_min_hz: minimal frequency supported in Hz 0082 * @frequency_max_hz: maximum frequency supported in Hz 0083 * @frequency_step_hz: frequency step in Hz 0084 * @bandwidth_min: minimal frontend bandwidth supported 0085 * @bandwidth_max: maximum frontend bandwidth supported 0086 * @bandwidth_step: frontend bandwidth step 0087 */ 0088 struct dvb_tuner_info { 0089 char name[128]; 0090 0091 u32 frequency_min_hz; 0092 u32 frequency_max_hz; 0093 u32 frequency_step_hz; 0094 0095 u32 bandwidth_min; 0096 u32 bandwidth_max; 0097 u32 bandwidth_step; 0098 }; 0099 0100 /** 0101 * struct analog_parameters - Parameters to tune into an analog/radio channel 0102 * 0103 * @frequency: Frequency used by analog TV tuner (either in 62.5 kHz step, 0104 * for TV, or 62.5 Hz for radio) 0105 * @mode: Tuner mode, as defined on enum v4l2_tuner_type 0106 * @audmode: Audio mode as defined for the rxsubchans field at videodev2.h, 0107 * e. g. V4L2_TUNER_MODE_* 0108 * @std: TV standard bitmap as defined at videodev2.h, e. g. V4L2_STD_* 0109 * 0110 * Hybrid tuners should be supported by both V4L2 and DVB APIs. This 0111 * struct contains the data that are used by the V4L2 side. To avoid 0112 * dependencies from V4L2 headers, all enums here are declared as integers. 0113 */ 0114 struct analog_parameters { 0115 unsigned int frequency; 0116 unsigned int mode; 0117 unsigned int audmode; 0118 u64 std; 0119 }; 0120 0121 /** 0122 * enum dvbfe_algo - defines the algorithm used to tune into a channel 0123 * 0124 * @DVBFE_ALGO_HW: Hardware Algorithm - 0125 * Devices that support this algorithm do everything in hardware 0126 * and no software support is needed to handle them. 0127 * Requesting these devices to LOCK is the only thing required, 0128 * device is supposed to do everything in the hardware. 0129 * 0130 * @DVBFE_ALGO_SW: Software Algorithm - 0131 * These are dumb devices, that require software to do everything 0132 * 0133 * @DVBFE_ALGO_CUSTOM: Customizable Agorithm - 0134 * Devices having this algorithm can be customized to have specific 0135 * algorithms in the frontend driver, rather than simply doing a 0136 * software zig-zag. In this case the zigzag maybe hardware assisted 0137 * or it maybe completely done in hardware. In all cases, usage of 0138 * this algorithm, in conjunction with the search and track 0139 * callbacks, utilizes the driver specific algorithm. 0140 * 0141 * @DVBFE_ALGO_RECOVERY: Recovery Algorithm - 0142 * These devices have AUTO recovery capabilities from LOCK failure 0143 */ 0144 enum dvbfe_algo { 0145 DVBFE_ALGO_HW = BIT(0), 0146 DVBFE_ALGO_SW = BIT(1), 0147 DVBFE_ALGO_CUSTOM = BIT(2), 0148 DVBFE_ALGO_RECOVERY = BIT(31), 0149 }; 0150 0151 /** 0152 * enum dvbfe_search - search callback possible return status 0153 * 0154 * @DVBFE_ALGO_SEARCH_SUCCESS: 0155 * The frontend search algorithm completed and returned successfully 0156 * 0157 * @DVBFE_ALGO_SEARCH_ASLEEP: 0158 * The frontend search algorithm is sleeping 0159 * 0160 * @DVBFE_ALGO_SEARCH_FAILED: 0161 * The frontend search for a signal failed 0162 * 0163 * @DVBFE_ALGO_SEARCH_INVALID: 0164 * The frontend search algorithm was probably supplied with invalid 0165 * parameters and the search is an invalid one 0166 * 0167 * @DVBFE_ALGO_SEARCH_ERROR: 0168 * The frontend search algorithm failed due to some error 0169 * 0170 * @DVBFE_ALGO_SEARCH_AGAIN: 0171 * The frontend search algorithm was requested to search again 0172 */ 0173 enum dvbfe_search { 0174 DVBFE_ALGO_SEARCH_SUCCESS = BIT(0), 0175 DVBFE_ALGO_SEARCH_ASLEEP = BIT(1), 0176 DVBFE_ALGO_SEARCH_FAILED = BIT(2), 0177 DVBFE_ALGO_SEARCH_INVALID = BIT(3), 0178 DVBFE_ALGO_SEARCH_AGAIN = BIT(4), 0179 DVBFE_ALGO_SEARCH_ERROR = BIT(31), 0180 }; 0181 0182 /** 0183 * struct dvb_tuner_ops - Tuner information and callbacks 0184 * 0185 * @info: embedded &struct dvb_tuner_info with tuner properties 0186 * @release: callback function called when frontend is detached. 0187 * drivers should free any allocated memory. 0188 * @init: callback function used to initialize the tuner device. 0189 * @sleep: callback function used to put the tuner to sleep. 0190 * @suspend: callback function used to inform that the Kernel will 0191 * suspend. 0192 * @resume: callback function used to inform that the Kernel is 0193 * resuming from suspend. 0194 * @set_params: callback function used to inform the tuner to tune 0195 * into a digital TV channel. The properties to be used 0196 * are stored at &struct dvb_frontend.dtv_property_cache. 0197 * The tuner demod can change the parameters to reflect 0198 * the changes needed for the channel to be tuned, and 0199 * update statistics. This is the recommended way to set 0200 * the tuner parameters and should be used on newer 0201 * drivers. 0202 * @set_analog_params: callback function used to tune into an analog TV 0203 * channel on hybrid tuners. It passes @analog_parameters 0204 * to the driver. 0205 * @set_config: callback function used to send some tuner-specific 0206 * parameters. 0207 * @get_frequency: get the actual tuned frequency 0208 * @get_bandwidth: get the bandwidth used by the low pass filters 0209 * @get_if_frequency: get the Intermediate Frequency, in Hz. For baseband, 0210 * should return 0. 0211 * @get_status: returns the frontend lock status 0212 * @get_rf_strength: returns the RF signal strength. Used mostly to support 0213 * analog TV and radio. Digital TV should report, instead, 0214 * via DVBv5 API (&struct dvb_frontend.dtv_property_cache). 0215 * @get_afc: Used only by analog TV core. Reports the frequency 0216 * drift due to AFC. 0217 * @calc_regs: callback function used to pass register data settings 0218 * for simple tuners. Shouldn't be used on newer drivers. 0219 * @set_frequency: Set a new frequency. Shouldn't be used on newer drivers. 0220 * @set_bandwidth: Set a new frequency. Shouldn't be used on newer drivers. 0221 * 0222 * NOTE: frequencies used on @get_frequency and @set_frequency are in Hz for 0223 * terrestrial/cable or kHz for satellite. 0224 * 0225 */ 0226 struct dvb_tuner_ops { 0227 0228 struct dvb_tuner_info info; 0229 0230 void (*release)(struct dvb_frontend *fe); 0231 int (*init)(struct dvb_frontend *fe); 0232 int (*sleep)(struct dvb_frontend *fe); 0233 int (*suspend)(struct dvb_frontend *fe); 0234 int (*resume)(struct dvb_frontend *fe); 0235 0236 /* This is the recommended way to set the tuner */ 0237 int (*set_params)(struct dvb_frontend *fe); 0238 int (*set_analog_params)(struct dvb_frontend *fe, struct analog_parameters *p); 0239 0240 int (*set_config)(struct dvb_frontend *fe, void *priv_cfg); 0241 0242 int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency); 0243 int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth); 0244 int (*get_if_frequency)(struct dvb_frontend *fe, u32 *frequency); 0245 0246 #define TUNER_STATUS_LOCKED 1 0247 #define TUNER_STATUS_STEREO 2 0248 int (*get_status)(struct dvb_frontend *fe, u32 *status); 0249 int (*get_rf_strength)(struct dvb_frontend *fe, u16 *strength); 0250 int (*get_afc)(struct dvb_frontend *fe, s32 *afc); 0251 0252 /* 0253 * This is support for demods like the mt352 - fills out the supplied 0254 * buffer with what to write. 0255 * 0256 * Don't use on newer drivers. 0257 */ 0258 int (*calc_regs)(struct dvb_frontend *fe, u8 *buf, int buf_len); 0259 0260 /* 0261 * These are provided separately from set_params in order to 0262 * facilitate silicon tuners which require sophisticated tuning loops, 0263 * controlling each parameter separately. 0264 * 0265 * Don't use on newer drivers. 0266 */ 0267 int (*set_frequency)(struct dvb_frontend *fe, u32 frequency); 0268 int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); 0269 }; 0270 0271 /** 0272 * struct analog_demod_info - Information struct for analog TV part of the demod 0273 * 0274 * @name: Name of the analog TV demodulator 0275 */ 0276 struct analog_demod_info { 0277 char *name; 0278 }; 0279 0280 /** 0281 * struct analog_demod_ops - Demodulation information and callbacks for 0282 * analog TV and radio 0283 * 0284 * @info: pointer to struct analog_demod_info 0285 * @set_params: callback function used to inform the demod to set the 0286 * demodulator parameters needed to decode an analog or 0287 * radio channel. The properties are passed via 0288 * &struct analog_params. 0289 * @has_signal: returns 0xffff if has signal, or 0 if it doesn't. 0290 * @get_afc: Used only by analog TV core. Reports the frequency 0291 * drift due to AFC. 0292 * @tuner_status: callback function that returns tuner status bits, e. g. 0293 * %TUNER_STATUS_LOCKED and %TUNER_STATUS_STEREO. 0294 * @standby: set the tuner to standby mode. 0295 * @release: callback function called when frontend is detached. 0296 * drivers should free any allocated memory. 0297 * @i2c_gate_ctrl: controls the I2C gate. Newer drivers should use I2C 0298 * mux support instead. 0299 * @set_config: callback function used to send some tuner-specific 0300 * parameters. 0301 */ 0302 struct analog_demod_ops { 0303 0304 struct analog_demod_info info; 0305 0306 void (*set_params)(struct dvb_frontend *fe, 0307 struct analog_parameters *params); 0308 int (*has_signal)(struct dvb_frontend *fe, u16 *signal); 0309 int (*get_afc)(struct dvb_frontend *fe, s32 *afc); 0310 void (*tuner_status)(struct dvb_frontend *fe); 0311 void (*standby)(struct dvb_frontend *fe); 0312 void (*release)(struct dvb_frontend *fe); 0313 int (*i2c_gate_ctrl)(struct dvb_frontend *fe, int enable); 0314 0315 /** This is to allow setting tuner-specific configuration */ 0316 int (*set_config)(struct dvb_frontend *fe, void *priv_cfg); 0317 }; 0318 0319 struct dtv_frontend_properties; 0320 0321 /** 0322 * struct dvb_frontend_internal_info - Frontend properties and capabilities 0323 * 0324 * @name: Name of the frontend 0325 * @frequency_min_hz: Minimal frequency supported by the frontend. 0326 * @frequency_max_hz: Minimal frequency supported by the frontend. 0327 * @frequency_stepsize_hz: All frequencies are multiple of this value. 0328 * @frequency_tolerance_hz: Frequency tolerance. 0329 * @symbol_rate_min: Minimal symbol rate, in bauds 0330 * (for Cable/Satellite systems). 0331 * @symbol_rate_max: Maximal symbol rate, in bauds 0332 * (for Cable/Satellite systems). 0333 * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm 0334 * (for Cable/Satellite systems). 0335 * @caps: Capabilities supported by the frontend, 0336 * as specified in &enum fe_caps. 0337 */ 0338 struct dvb_frontend_internal_info { 0339 char name[128]; 0340 u32 frequency_min_hz; 0341 u32 frequency_max_hz; 0342 u32 frequency_stepsize_hz; 0343 u32 frequency_tolerance_hz; 0344 u32 symbol_rate_min; 0345 u32 symbol_rate_max; 0346 u32 symbol_rate_tolerance; 0347 enum fe_caps caps; 0348 }; 0349 0350 /** 0351 * struct dvb_frontend_ops - Demodulation information and callbacks for 0352 * ditialt TV 0353 * 0354 * @info: embedded &struct dvb_tuner_info with tuner properties 0355 * @delsys: Delivery systems supported by the frontend 0356 * @detach: callback function called when frontend is detached. 0357 * drivers should clean up, but not yet free the &struct 0358 * dvb_frontend allocation. 0359 * @release: callback function called when frontend is ready to be 0360 * freed. 0361 * drivers should free any allocated memory. 0362 * @release_sec: callback function requesting that the Satellite Equipment 0363 * Control (SEC) driver to release and free any memory 0364 * allocated by the driver. 0365 * @init: callback function used to initialize the tuner device. 0366 * @sleep: callback function used to put the tuner to sleep. 0367 * @suspend: callback function used to inform that the Kernel will 0368 * suspend. 0369 * @resume: callback function used to inform that the Kernel is 0370 * resuming from suspend. 0371 * @write: callback function used by some demod legacy drivers to 0372 * allow other drivers to write data into their registers. 0373 * Should not be used on new drivers. 0374 * @tune: callback function used by demod drivers that use 0375 * @DVBFE_ALGO_HW to tune into a frequency. 0376 * @get_frontend_algo: returns the desired hardware algorithm. 0377 * @set_frontend: callback function used to inform the demod to set the 0378 * parameters for demodulating a digital TV channel. 0379 * The properties to be used are stored at &struct 0380 * dvb_frontend.dtv_property_cache. The demod can change 0381 * the parameters to reflect the changes needed for the 0382 * channel to be decoded, and update statistics. 0383 * @get_tune_settings: callback function 0384 * @get_frontend: callback function used to inform the parameters 0385 * actuall in use. The properties to be used are stored at 0386 * &struct dvb_frontend.dtv_property_cache and update 0387 * statistics. Please notice that it should not return 0388 * an error code if the statistics are not available 0389 * because the demog is not locked. 0390 * @read_status: returns the locking status of the frontend. 0391 * @read_ber: legacy callback function to return the bit error rate. 0392 * Newer drivers should provide such info via DVBv5 API, 0393 * e. g. @set_frontend;/@get_frontend, implementing this 0394 * callback only if DVBv3 API compatibility is wanted. 0395 * @read_signal_strength: legacy callback function to return the signal 0396 * strength. Newer drivers should provide such info via 0397 * DVBv5 API, e. g. @set_frontend/@get_frontend, 0398 * implementing this callback only if DVBv3 API 0399 * compatibility is wanted. 0400 * @read_snr: legacy callback function to return the Signal/Noise 0401 * rate. Newer drivers should provide such info via 0402 * DVBv5 API, e. g. @set_frontend/@get_frontend, 0403 * implementing this callback only if DVBv3 API 0404 * compatibility is wanted. 0405 * @read_ucblocks: legacy callback function to return the Uncorrected Error 0406 * Blocks. Newer drivers should provide such info via 0407 * DVBv5 API, e. g. @set_frontend/@get_frontend, 0408 * implementing this callback only if DVBv3 API 0409 * compatibility is wanted. 0410 * @diseqc_reset_overload: callback function to implement the 0411 * FE_DISEQC_RESET_OVERLOAD() ioctl (only Satellite) 0412 * @diseqc_send_master_cmd: callback function to implement the 0413 * FE_DISEQC_SEND_MASTER_CMD() ioctl (only Satellite). 0414 * @diseqc_recv_slave_reply: callback function to implement the 0415 * FE_DISEQC_RECV_SLAVE_REPLY() ioctl (only Satellite) 0416 * @diseqc_send_burst: callback function to implement the 0417 * FE_DISEQC_SEND_BURST() ioctl (only Satellite). 0418 * @set_tone: callback function to implement the 0419 * FE_SET_TONE() ioctl (only Satellite). 0420 * @set_voltage: callback function to implement the 0421 * FE_SET_VOLTAGE() ioctl (only Satellite). 0422 * @enable_high_lnb_voltage: callback function to implement the 0423 * FE_ENABLE_HIGH_LNB_VOLTAGE() ioctl (only Satellite). 0424 * @dishnetwork_send_legacy_command: callback function to implement the 0425 * FE_DISHNETWORK_SEND_LEGACY_CMD() ioctl (only Satellite). 0426 * Drivers should not use this, except when the DVB 0427 * core emulation fails to provide proper support (e.g. 0428 * if @set_voltage takes more than 8ms to work), and 0429 * when backward compatibility with this legacy API is 0430 * required. 0431 * @i2c_gate_ctrl: controls the I2C gate. Newer drivers should use I2C 0432 * mux support instead. 0433 * @ts_bus_ctrl: callback function used to take control of the TS bus. 0434 * @set_lna: callback function to power on/off/auto the LNA. 0435 * @search: callback function used on some custom algo search algos. 0436 * @tuner_ops: pointer to &struct dvb_tuner_ops 0437 * @analog_ops: pointer to &struct analog_demod_ops 0438 */ 0439 struct dvb_frontend_ops { 0440 struct dvb_frontend_internal_info info; 0441 0442 u8 delsys[MAX_DELSYS]; 0443 0444 void (*detach)(struct dvb_frontend *fe); 0445 void (*release)(struct dvb_frontend* fe); 0446 void (*release_sec)(struct dvb_frontend* fe); 0447 0448 int (*init)(struct dvb_frontend* fe); 0449 int (*sleep)(struct dvb_frontend* fe); 0450 int (*suspend)(struct dvb_frontend *fe); 0451 int (*resume)(struct dvb_frontend *fe); 0452 0453 int (*write)(struct dvb_frontend* fe, const u8 buf[], int len); 0454 0455 /* if this is set, it overrides the default swzigzag */ 0456 int (*tune)(struct dvb_frontend* fe, 0457 bool re_tune, 0458 unsigned int mode_flags, 0459 unsigned int *delay, 0460 enum fe_status *status); 0461 0462 /* get frontend tuning algorithm from the module */ 0463 enum dvbfe_algo (*get_frontend_algo)(struct dvb_frontend *fe); 0464 0465 /* these two are only used for the swzigzag code */ 0466 int (*set_frontend)(struct dvb_frontend *fe); 0467 int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings); 0468 0469 int (*get_frontend)(struct dvb_frontend *fe, 0470 struct dtv_frontend_properties *props); 0471 0472 int (*read_status)(struct dvb_frontend *fe, enum fe_status *status); 0473 int (*read_ber)(struct dvb_frontend* fe, u32* ber); 0474 int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength); 0475 int (*read_snr)(struct dvb_frontend* fe, u16* snr); 0476 int (*read_ucblocks)(struct dvb_frontend* fe, u32* ucblocks); 0477 0478 int (*diseqc_reset_overload)(struct dvb_frontend* fe); 0479 int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd); 0480 int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply); 0481 int (*diseqc_send_burst)(struct dvb_frontend *fe, 0482 enum fe_sec_mini_cmd minicmd); 0483 int (*set_tone)(struct dvb_frontend *fe, enum fe_sec_tone_mode tone); 0484 int (*set_voltage)(struct dvb_frontend *fe, 0485 enum fe_sec_voltage voltage); 0486 int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg); 0487 int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); 0488 int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); 0489 int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire); 0490 int (*set_lna)(struct dvb_frontend *); 0491 0492 /* 0493 * These callbacks are for devices that implement their own 0494 * tuning algorithms, rather than a simple swzigzag 0495 */ 0496 enum dvbfe_search (*search)(struct dvb_frontend *fe); 0497 0498 struct dvb_tuner_ops tuner_ops; 0499 struct analog_demod_ops analog_ops; 0500 }; 0501 0502 #ifdef __DVB_CORE__ 0503 #define MAX_EVENT 8 0504 0505 /* Used only internally at dvb_frontend.c */ 0506 struct dvb_fe_events { 0507 struct dvb_frontend_event events[MAX_EVENT]; 0508 int eventw; 0509 int eventr; 0510 int overflow; 0511 wait_queue_head_t wait_queue; 0512 struct mutex mtx; 0513 }; 0514 #endif 0515 0516 /** 0517 * struct dtv_frontend_properties - contains a list of properties that are 0518 * specific to a digital TV standard. 0519 * 0520 * @frequency: frequency in Hz for terrestrial/cable or in kHz for 0521 * Satellite 0522 * @modulation: Frontend modulation type 0523 * @voltage: SEC voltage (only Satellite) 0524 * @sectone: SEC tone mode (only Satellite) 0525 * @inversion: Spectral inversion 0526 * @fec_inner: Forward error correction inner Code Rate 0527 * @transmission_mode: Transmission Mode 0528 * @bandwidth_hz: Bandwidth, in Hz. A zero value means that userspace 0529 * wants to autodetect. 0530 * @guard_interval: Guard Interval 0531 * @hierarchy: Hierarchy 0532 * @symbol_rate: Symbol Rate 0533 * @code_rate_HP: high priority stream code rate 0534 * @code_rate_LP: low priority stream code rate 0535 * @pilot: Enable/disable/autodetect pilot tones 0536 * @rolloff: Rolloff factor (alpha) 0537 * @delivery_system: FE delivery system (e. g. digital TV standard) 0538 * @interleaving: interleaving 0539 * @isdbt_partial_reception: ISDB-T partial reception (only ISDB standard) 0540 * @isdbt_sb_mode: ISDB-T Sound Broadcast (SB) mode (only ISDB standard) 0541 * @isdbt_sb_subchannel: ISDB-T SB subchannel (only ISDB standard) 0542 * @isdbt_sb_segment_idx: ISDB-T SB segment index (only ISDB standard) 0543 * @isdbt_sb_segment_count: ISDB-T SB segment count (only ISDB standard) 0544 * @isdbt_layer_enabled: ISDB Layer enabled (only ISDB standard) 0545 * @layer: ISDB per-layer data (only ISDB standard) 0546 * @layer.segment_count: Segment Count; 0547 * @layer.fec: per layer code rate; 0548 * @layer.modulation: per layer modulation; 0549 * @layer.interleaving: per layer interleaving. 0550 * @stream_id: If different than zero, enable substream filtering, if 0551 * hardware supports (DVB-S2 and DVB-T2). 0552 * @scrambling_sequence_index: Carries the index of the DVB-S2 physical layer 0553 * scrambling sequence. 0554 * @atscmh_fic_ver: Version number of the FIC (Fast Information Channel) 0555 * signaling data (only ATSC-M/H) 0556 * @atscmh_parade_id: Parade identification number (only ATSC-M/H) 0557 * @atscmh_nog: Number of MH groups per MH subframe for a designated 0558 * parade (only ATSC-M/H) 0559 * @atscmh_tnog: Total number of MH groups including all MH groups 0560 * belonging to all MH parades in one MH subframe 0561 * (only ATSC-M/H) 0562 * @atscmh_sgn: Start group number (only ATSC-M/H) 0563 * @atscmh_prc: Parade repetition cycle (only ATSC-M/H) 0564 * @atscmh_rs_frame_mode: Reed Solomon (RS) frame mode (only ATSC-M/H) 0565 * @atscmh_rs_frame_ensemble: RS frame ensemble (only ATSC-M/H) 0566 * @atscmh_rs_code_mode_pri: RS code mode pri (only ATSC-M/H) 0567 * @atscmh_rs_code_mode_sec: RS code mode sec (only ATSC-M/H) 0568 * @atscmh_sccc_block_mode: Series Concatenated Convolutional Code (SCCC) 0569 * Block Mode (only ATSC-M/H) 0570 * @atscmh_sccc_code_mode_a: SCCC code mode A (only ATSC-M/H) 0571 * @atscmh_sccc_code_mode_b: SCCC code mode B (only ATSC-M/H) 0572 * @atscmh_sccc_code_mode_c: SCCC code mode C (only ATSC-M/H) 0573 * @atscmh_sccc_code_mode_d: SCCC code mode D (only ATSC-M/H) 0574 * @lna: Power ON/OFF/AUTO the Linear Now-noise Amplifier (LNA) 0575 * @strength: DVBv5 API statistics: Signal Strength 0576 * @cnr: DVBv5 API statistics: Signal to Noise ratio of the 0577 * (main) carrier 0578 * @pre_bit_error: DVBv5 API statistics: pre-Viterbi bit error count 0579 * @pre_bit_count: DVBv5 API statistics: pre-Viterbi bit count 0580 * @post_bit_error: DVBv5 API statistics: post-Viterbi bit error count 0581 * @post_bit_count: DVBv5 API statistics: post-Viterbi bit count 0582 * @block_error: DVBv5 API statistics: block error count 0583 * @block_count: DVBv5 API statistics: block count 0584 * 0585 * NOTE: derivated statistics like Uncorrected Error blocks (UCE) are 0586 * calculated on userspace. 0587 * 0588 * Only a subset of the properties are needed for a given delivery system. 0589 * For more info, consult the media_api.html with the documentation of the 0590 * Userspace API. 0591 */ 0592 struct dtv_frontend_properties { 0593 u32 frequency; 0594 enum fe_modulation modulation; 0595 0596 enum fe_sec_voltage voltage; 0597 enum fe_sec_tone_mode sectone; 0598 enum fe_spectral_inversion inversion; 0599 enum fe_code_rate fec_inner; 0600 enum fe_transmit_mode transmission_mode; 0601 u32 bandwidth_hz; /* 0 = AUTO */ 0602 enum fe_guard_interval guard_interval; 0603 enum fe_hierarchy hierarchy; 0604 u32 symbol_rate; 0605 enum fe_code_rate code_rate_HP; 0606 enum fe_code_rate code_rate_LP; 0607 0608 enum fe_pilot pilot; 0609 enum fe_rolloff rolloff; 0610 0611 enum fe_delivery_system delivery_system; 0612 0613 enum fe_interleaving interleaving; 0614 0615 /* ISDB-T specifics */ 0616 u8 isdbt_partial_reception; 0617 u8 isdbt_sb_mode; 0618 u8 isdbt_sb_subchannel; 0619 u32 isdbt_sb_segment_idx; 0620 u32 isdbt_sb_segment_count; 0621 u8 isdbt_layer_enabled; 0622 struct { 0623 u8 segment_count; 0624 enum fe_code_rate fec; 0625 enum fe_modulation modulation; 0626 u8 interleaving; 0627 } layer[3]; 0628 0629 /* Multistream specifics */ 0630 u32 stream_id; 0631 0632 /* Physical Layer Scrambling specifics */ 0633 u32 scrambling_sequence_index; 0634 0635 /* ATSC-MH specifics */ 0636 u8 atscmh_fic_ver; 0637 u8 atscmh_parade_id; 0638 u8 atscmh_nog; 0639 u8 atscmh_tnog; 0640 u8 atscmh_sgn; 0641 u8 atscmh_prc; 0642 0643 u8 atscmh_rs_frame_mode; 0644 u8 atscmh_rs_frame_ensemble; 0645 u8 atscmh_rs_code_mode_pri; 0646 u8 atscmh_rs_code_mode_sec; 0647 u8 atscmh_sccc_block_mode; 0648 u8 atscmh_sccc_code_mode_a; 0649 u8 atscmh_sccc_code_mode_b; 0650 u8 atscmh_sccc_code_mode_c; 0651 u8 atscmh_sccc_code_mode_d; 0652 0653 u32 lna; 0654 0655 /* statistics data */ 0656 struct dtv_fe_stats strength; 0657 struct dtv_fe_stats cnr; 0658 struct dtv_fe_stats pre_bit_error; 0659 struct dtv_fe_stats pre_bit_count; 0660 struct dtv_fe_stats post_bit_error; 0661 struct dtv_fe_stats post_bit_count; 0662 struct dtv_fe_stats block_error; 0663 struct dtv_fe_stats block_count; 0664 }; 0665 0666 #define DVB_FE_NO_EXIT 0 0667 #define DVB_FE_NORMAL_EXIT 1 0668 #define DVB_FE_DEVICE_REMOVED 2 0669 #define DVB_FE_DEVICE_RESUME 3 0670 0671 /** 0672 * struct dvb_frontend - Frontend structure to be used on drivers. 0673 * 0674 * @refcount: refcount to keep track of &struct dvb_frontend 0675 * references 0676 * @ops: embedded &struct dvb_frontend_ops 0677 * @dvb: pointer to &struct dvb_adapter 0678 * @demodulator_priv: demod private data 0679 * @tuner_priv: tuner private data 0680 * @frontend_priv: frontend private data 0681 * @sec_priv: SEC private data 0682 * @analog_demod_priv: Analog demod private data 0683 * @dtv_property_cache: embedded &struct dtv_frontend_properties 0684 * @callback: callback function used on some drivers to call 0685 * either the tuner or the demodulator. 0686 * @id: Frontend ID 0687 * @exit: Used to inform the DVB core that the frontend 0688 * thread should exit (usually, means that the hardware 0689 * got disconnected. 0690 */ 0691 0692 struct dvb_frontend { 0693 struct kref refcount; 0694 struct dvb_frontend_ops ops; 0695 struct dvb_adapter *dvb; 0696 void *demodulator_priv; 0697 void *tuner_priv; 0698 void *frontend_priv; 0699 void *sec_priv; 0700 void *analog_demod_priv; 0701 struct dtv_frontend_properties dtv_property_cache; 0702 #define DVB_FRONTEND_COMPONENT_TUNER 0 0703 #define DVB_FRONTEND_COMPONENT_DEMOD 1 0704 int (*callback)(void *adapter_priv, int component, int cmd, int arg); 0705 int id; 0706 unsigned int exit; 0707 }; 0708 0709 /** 0710 * dvb_register_frontend() - Registers a DVB frontend at the adapter 0711 * 0712 * @dvb: pointer to &struct dvb_adapter 0713 * @fe: pointer to &struct dvb_frontend 0714 * 0715 * Allocate and initialize the private data needed by the frontend core to 0716 * manage the frontend and calls dvb_register_device() to register a new 0717 * frontend. It also cleans the property cache that stores the frontend 0718 * parameters and selects the first available delivery system. 0719 */ 0720 int dvb_register_frontend(struct dvb_adapter *dvb, 0721 struct dvb_frontend *fe); 0722 0723 /** 0724 * dvb_unregister_frontend() - Unregisters a DVB frontend 0725 * 0726 * @fe: pointer to &struct dvb_frontend 0727 * 0728 * Stops the frontend kthread, calls dvb_unregister_device() and frees the 0729 * private frontend data allocated by dvb_register_frontend(). 0730 * 0731 * NOTE: This function doesn't frees the memory allocated by the demod, 0732 * by the SEC driver and by the tuner. In order to free it, an explicit call to 0733 * dvb_frontend_detach() is needed, after calling this function. 0734 */ 0735 int dvb_unregister_frontend(struct dvb_frontend *fe); 0736 0737 /** 0738 * dvb_frontend_detach() - Detaches and frees frontend specific data 0739 * 0740 * @fe: pointer to &struct dvb_frontend 0741 * 0742 * This function should be called after dvb_unregister_frontend(). It 0743 * calls the SEC, tuner and demod release functions: 0744 * &dvb_frontend_ops.release_sec, &dvb_frontend_ops.tuner_ops.release, 0745 * &dvb_frontend_ops.analog_ops.release and &dvb_frontend_ops.release. 0746 * 0747 * If the driver is compiled with %CONFIG_MEDIA_ATTACH, it also decreases 0748 * the module reference count, needed to allow userspace to remove the 0749 * previously used DVB frontend modules. 0750 */ 0751 void dvb_frontend_detach(struct dvb_frontend *fe); 0752 0753 /** 0754 * dvb_frontend_suspend() - Suspends a Digital TV frontend 0755 * 0756 * @fe: pointer to &struct dvb_frontend 0757 * 0758 * This function prepares a Digital TV frontend to suspend. 0759 * 0760 * In order to prepare the tuner to suspend, if 0761 * &dvb_frontend_ops.tuner_ops.suspend\(\) is available, it calls it. Otherwise, 0762 * it will call &dvb_frontend_ops.tuner_ops.sleep\(\), if available. 0763 * 0764 * It will also call &dvb_frontend_ops.suspend\(\) to put the demod to suspend, 0765 * if available. Otherwise it will call &dvb_frontend_ops.sleep\(\). 0766 * 0767 * The drivers should also call dvb_frontend_suspend\(\) as part of their 0768 * handler for the &device_driver.suspend\(\). 0769 */ 0770 int dvb_frontend_suspend(struct dvb_frontend *fe); 0771 0772 /** 0773 * dvb_frontend_resume() - Resumes a Digital TV frontend 0774 * 0775 * @fe: pointer to &struct dvb_frontend 0776 * 0777 * This function resumes the usual operation of the tuner after resume. 0778 * 0779 * In order to resume the frontend, it calls the demod 0780 * &dvb_frontend_ops.resume\(\) if available. Otherwise it calls demod 0781 * &dvb_frontend_ops.init\(\). 0782 * 0783 * If &dvb_frontend_ops.tuner_ops.resume\(\) is available, It, it calls it. 0784 * Otherwise,t will call &dvb_frontend_ops.tuner_ops.init\(\), if available. 0785 * 0786 * Once tuner and demods are resumed, it will enforce that the SEC voltage and 0787 * tone are restored to their previous values and wake up the frontend's 0788 * kthread in order to retune the frontend. 0789 * 0790 * The drivers should also call dvb_frontend_resume() as part of their 0791 * handler for the &device_driver.resume\(\). 0792 */ 0793 int dvb_frontend_resume(struct dvb_frontend *fe); 0794 0795 /** 0796 * dvb_frontend_reinitialise() - forces a reinitialisation at the frontend 0797 * 0798 * @fe: pointer to &struct dvb_frontend 0799 * 0800 * Calls &dvb_frontend_ops.init\(\) and &dvb_frontend_ops.tuner_ops.init\(\), 0801 * and resets SEC tone and voltage (for Satellite systems). 0802 * 0803 * NOTE: Currently, this function is used only by one driver (budget-av). 0804 * It seems to be due to address some special issue with that specific 0805 * frontend. 0806 */ 0807 void dvb_frontend_reinitialise(struct dvb_frontend *fe); 0808 0809 /** 0810 * dvb_frontend_sleep_until() - Sleep for the amount of time given by 0811 * add_usec parameter 0812 * 0813 * @waketime: pointer to &struct ktime_t 0814 * @add_usec: time to sleep, in microseconds 0815 * 0816 * This function is used to measure the time required for the 0817 * FE_DISHNETWORK_SEND_LEGACY_CMD() ioctl to work. It needs to be as precise 0818 * as possible, as it affects the detection of the dish tone command at the 0819 * satellite subsystem. 0820 * 0821 * Its used internally by the DVB frontend core, in order to emulate 0822 * FE_DISHNETWORK_SEND_LEGACY_CMD() using the &dvb_frontend_ops.set_voltage\(\) 0823 * callback. 0824 * 0825 * NOTE: it should not be used at the drivers, as the emulation for the 0826 * legacy callback is provided by the Kernel. The only situation where this 0827 * should be at the drivers is when there are some bugs at the hardware that 0828 * would prevent the core emulation to work. On such cases, the driver would 0829 * be writing a &dvb_frontend_ops.dishnetwork_send_legacy_command\(\) and 0830 * calling this function directly. 0831 */ 0832 void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec); 0833 0834 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |