1 /* 1 /* 2 * dvb_frontend.h 2 * dvb_frontend.h 3 * 3 * 4 * The Digital TV Frontend kABI defines a driv 4 * The Digital TV Frontend kABI defines a driver-internal interface for 5 * registering low-level, hardware specific dr 5 * registering low-level, hardware specific driver to a hardware independent 6 * frontend layer. 6 * frontend layer. 7 * 7 * 8 * Copyright (C) 2001 convergence integrated m 8 * Copyright (C) 2001 convergence integrated media GmbH 9 * Copyright (C) 2004 convergence GmbH 9 * Copyright (C) 2004 convergence GmbH 10 * 10 * 11 * Written by Ralph Metzler 11 * Written by Ralph Metzler 12 * Overhauled by Holger Waechtler 12 * Overhauled by Holger Waechtler 13 * Kernel I2C stuff by Michael Hunold <hunold@ 13 * Kernel I2C stuff by Michael Hunold <hunold@convergence.de> 14 * 14 * 15 * This program is free software; you can redi 15 * This program is free software; you can redistribute it and/or 16 * modify it under the terms of the GNU Lesser 16 * modify it under the terms of the GNU Lesser General Public License 17 * as published by the Free Software Foundatio 17 * as published by the Free Software Foundation; either version 2.1 18 * of the License, or (at your option) any lat 18 * of the License, or (at your option) any later version. 19 * 19 * 20 * This program is distributed in the hope tha 20 * This program is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details 23 * GNU General Public License for more details. 24 * 24 * 25 25 26 * You should have received a copy of the GNU 26 * You should have received a copy of the GNU Lesser General Public License 27 * along with this program; if not, write to t 27 * along with this program; if not, write to the Free Software 28 * Foundation, Inc., 59 Temple Place - Suite 3 28 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 29 * 29 * 30 */ 30 */ 31 31 32 #ifndef _DVB_FRONTEND_H_ 32 #ifndef _DVB_FRONTEND_H_ 33 #define _DVB_FRONTEND_H_ 33 #define _DVB_FRONTEND_H_ 34 34 35 #include <linux/types.h> 35 #include <linux/types.h> 36 #include <linux/sched.h> 36 #include <linux/sched.h> 37 #include <linux/ioctl.h> 37 #include <linux/ioctl.h> 38 #include <linux/i2c.h> 38 #include <linux/i2c.h> 39 #include <linux/module.h> 39 #include <linux/module.h> 40 #include <linux/errno.h> 40 #include <linux/errno.h> 41 #include <linux/delay.h> 41 #include <linux/delay.h> 42 #include <linux/mutex.h> 42 #include <linux/mutex.h> 43 #include <linux/slab.h> 43 #include <linux/slab.h> 44 #include <linux/bitops.h> 44 #include <linux/bitops.h> 45 45 46 #include <linux/dvb/frontend.h> 46 #include <linux/dvb/frontend.h> 47 47 48 #include <media/dvbdev.h> 48 #include <media/dvbdev.h> 49 49 50 /* 50 /* 51 * Maximum number of Delivery systems per fron 51 * Maximum number of Delivery systems per frontend. It 52 * should be smaller or equal to 32 52 * should be smaller or equal to 32 53 */ 53 */ 54 #define MAX_DELSYS 8 54 #define MAX_DELSYS 8 55 55 56 /* Helper definitions to be used at frontend d 56 /* Helper definitions to be used at frontend drivers */ 57 #define kHz 1000UL 57 #define kHz 1000UL 58 #define MHz 1000000UL 58 #define MHz 1000000UL 59 59 60 /** 60 /** 61 * struct dvb_frontend_tune_settings - paramet 61 * struct dvb_frontend_tune_settings - parameters to adjust frontend tuning 62 * 62 * 63 * @min_delay_ms: minimum delay for tuni 63 * @min_delay_ms: minimum delay for tuning, in ms 64 * @step_size: step size between two 64 * @step_size: step size between two consecutive frequencies 65 * @max_drift: maximum drift 65 * @max_drift: maximum drift 66 * 66 * 67 * NOTE: step_size is in Hz, for terrestrial/c 67 * NOTE: step_size is in Hz, for terrestrial/cable or kHz for satellite 68 */ 68 */ 69 struct dvb_frontend_tune_settings { 69 struct dvb_frontend_tune_settings { 70 int min_delay_ms; 70 int min_delay_ms; 71 int step_size; 71 int step_size; 72 int max_drift; 72 int max_drift; 73 }; 73 }; 74 74 75 struct dvb_frontend; 75 struct dvb_frontend; 76 76 77 /** 77 /** 78 * struct dvb_tuner_info - Frontend name and m 78 * struct dvb_tuner_info - Frontend name and min/max ranges/bandwidths 79 * 79 * 80 * @name: name of the Frontend 80 * @name: name of the Frontend 81 * @frequency_min_hz: minimal frequency supp 81 * @frequency_min_hz: minimal frequency supported in Hz 82 * @frequency_max_hz: maximum frequency supp 82 * @frequency_max_hz: maximum frequency supported in Hz 83 * @frequency_step_hz: frequency step in Hz 83 * @frequency_step_hz: frequency step in Hz 84 * @bandwidth_min: minimal frontend bandw 84 * @bandwidth_min: minimal frontend bandwidth supported 85 * @bandwidth_max: maximum frontend bandw 85 * @bandwidth_max: maximum frontend bandwidth supported 86 * @bandwidth_step: frontend bandwidth ste 86 * @bandwidth_step: frontend bandwidth step 87 */ 87 */ 88 struct dvb_tuner_info { 88 struct dvb_tuner_info { 89 char name[128]; 89 char name[128]; 90 90 91 u32 frequency_min_hz; 91 u32 frequency_min_hz; 92 u32 frequency_max_hz; 92 u32 frequency_max_hz; 93 u32 frequency_step_hz; 93 u32 frequency_step_hz; 94 94 95 u32 bandwidth_min; 95 u32 bandwidth_min; 96 u32 bandwidth_max; 96 u32 bandwidth_max; 97 u32 bandwidth_step; 97 u32 bandwidth_step; 98 }; 98 }; 99 99 100 /** 100 /** 101 * struct analog_parameters - Parameters to tu 101 * struct analog_parameters - Parameters to tune into an analog/radio channel 102 * 102 * 103 * @frequency: Frequency used by analog TV tu 103 * @frequency: Frequency used by analog TV tuner (either in 62.5 kHz step, 104 * for TV, or 62.5 Hz for radio) 104 * for TV, or 62.5 Hz for radio) 105 * @mode: Tuner mode, as defined on enum 105 * @mode: Tuner mode, as defined on enum v4l2_tuner_type 106 * @audmode: Audio mode as defined for the 106 * @audmode: Audio mode as defined for the rxsubchans field at videodev2.h, 107 * e. g. V4L2_TUNER_MODE_* 107 * e. g. V4L2_TUNER_MODE_* 108 * @std: TV standard bitmap as defined 108 * @std: TV standard bitmap as defined at videodev2.h, e. g. V4L2_STD_* 109 * 109 * 110 * Hybrid tuners should be supported by both V 110 * Hybrid tuners should be supported by both V4L2 and DVB APIs. This 111 * struct contains the data that are used by t 111 * struct contains the data that are used by the V4L2 side. To avoid 112 * dependencies from V4L2 headers, all enums h 112 * dependencies from V4L2 headers, all enums here are declared as integers. 113 */ 113 */ 114 struct analog_parameters { 114 struct analog_parameters { 115 unsigned int frequency; 115 unsigned int frequency; 116 unsigned int mode; 116 unsigned int mode; 117 unsigned int audmode; 117 unsigned int audmode; 118 u64 std; 118 u64 std; 119 }; 119 }; 120 120 121 /** 121 /** 122 * enum dvbfe_algo - defines the algorithm use 122 * enum dvbfe_algo - defines the algorithm used to tune into a channel 123 * 123 * 124 * @DVBFE_ALGO_HW: Hardware Algorithm - 124 * @DVBFE_ALGO_HW: Hardware Algorithm - 125 * Devices that support this algorithm do 125 * Devices that support this algorithm do everything in hardware 126 * and no software support is needed to h 126 * and no software support is needed to handle them. 127 * Requesting these devices to LOCK is th 127 * Requesting these devices to LOCK is the only thing required, 128 * device is supposed to do everything in 128 * device is supposed to do everything in the hardware. 129 * 129 * 130 * @DVBFE_ALGO_SW: Software Algorithm - 130 * @DVBFE_ALGO_SW: Software Algorithm - 131 * These are dumb devices, that require softwa 131 * These are dumb devices, that require software to do everything 132 * 132 * 133 * @DVBFE_ALGO_CUSTOM: Customizable Agorithm - 133 * @DVBFE_ALGO_CUSTOM: Customizable Agorithm - 134 * Devices having this algorithm can be c 134 * Devices having this algorithm can be customized to have specific 135 * algorithms in the frontend driver, rat 135 * algorithms in the frontend driver, rather than simply doing a 136 * software zig-zag. In this case the zig 136 * software zig-zag. In this case the zigzag maybe hardware assisted 137 * or it maybe completely done in hardwar 137 * or it maybe completely done in hardware. In all cases, usage of 138 * this algorithm, in conjunction with th 138 * this algorithm, in conjunction with the search and track 139 * callbacks, utilizes the driver specifi 139 * callbacks, utilizes the driver specific algorithm. 140 * 140 * 141 * @DVBFE_ALGO_RECOVERY: Recovery Algorithm - 141 * @DVBFE_ALGO_RECOVERY: Recovery Algorithm - 142 * These devices have AUTO recovery capab 142 * These devices have AUTO recovery capabilities from LOCK failure 143 */ 143 */ 144 enum dvbfe_algo { 144 enum dvbfe_algo { 145 DVBFE_ALGO_HW = BIT( 145 DVBFE_ALGO_HW = BIT(0), 146 DVBFE_ALGO_SW = BIT( 146 DVBFE_ALGO_SW = BIT(1), 147 DVBFE_ALGO_CUSTOM = BIT( 147 DVBFE_ALGO_CUSTOM = BIT(2), 148 DVBFE_ALGO_RECOVERY = BIT( 148 DVBFE_ALGO_RECOVERY = BIT(31), 149 }; 149 }; 150 150 151 /** 151 /** 152 * enum dvbfe_search - search callback possibl 152 * enum dvbfe_search - search callback possible return status 153 * 153 * 154 * @DVBFE_ALGO_SEARCH_SUCCESS: 154 * @DVBFE_ALGO_SEARCH_SUCCESS: 155 * The frontend search algorithm complete 155 * The frontend search algorithm completed and returned successfully 156 * 156 * 157 * @DVBFE_ALGO_SEARCH_ASLEEP: 157 * @DVBFE_ALGO_SEARCH_ASLEEP: 158 * The frontend search algorithm is sleep 158 * The frontend search algorithm is sleeping 159 * 159 * 160 * @DVBFE_ALGO_SEARCH_FAILED: 160 * @DVBFE_ALGO_SEARCH_FAILED: 161 * The frontend search for a signal faile 161 * The frontend search for a signal failed 162 * 162 * 163 * @DVBFE_ALGO_SEARCH_INVALID: 163 * @DVBFE_ALGO_SEARCH_INVALID: 164 * The frontend search algorithm was prob 164 * The frontend search algorithm was probably supplied with invalid 165 * parameters and the search is an invali 165 * parameters and the search is an invalid one 166 * 166 * 167 * @DVBFE_ALGO_SEARCH_ERROR: 167 * @DVBFE_ALGO_SEARCH_ERROR: 168 * The frontend search algorithm failed d 168 * The frontend search algorithm failed due to some error 169 * 169 * 170 * @DVBFE_ALGO_SEARCH_AGAIN: 170 * @DVBFE_ALGO_SEARCH_AGAIN: 171 * The frontend search algorithm was requ 171 * The frontend search algorithm was requested to search again 172 */ 172 */ 173 enum dvbfe_search { 173 enum dvbfe_search { 174 DVBFE_ALGO_SEARCH_SUCCESS = BIT( 174 DVBFE_ALGO_SEARCH_SUCCESS = BIT(0), 175 DVBFE_ALGO_SEARCH_ASLEEP = BIT( 175 DVBFE_ALGO_SEARCH_ASLEEP = BIT(1), 176 DVBFE_ALGO_SEARCH_FAILED = BIT( 176 DVBFE_ALGO_SEARCH_FAILED = BIT(2), 177 DVBFE_ALGO_SEARCH_INVALID = BIT( 177 DVBFE_ALGO_SEARCH_INVALID = BIT(3), 178 DVBFE_ALGO_SEARCH_AGAIN = BIT( 178 DVBFE_ALGO_SEARCH_AGAIN = BIT(4), 179 DVBFE_ALGO_SEARCH_ERROR = BIT( 179 DVBFE_ALGO_SEARCH_ERROR = BIT(31), 180 }; 180 }; 181 181 182 /** 182 /** 183 * struct dvb_tuner_ops - Tuner information an 183 * struct dvb_tuner_ops - Tuner information and callbacks 184 * 184 * 185 * @info: embedded &struct dvb_t 185 * @info: embedded &struct dvb_tuner_info with tuner properties 186 * @release: callback function call 186 * @release: callback function called when frontend is detached. 187 * drivers should free an 187 * drivers should free any allocated memory. 188 * @init: callback function used 188 * @init: callback function used to initialize the tuner device. 189 * @sleep: callback function used 189 * @sleep: callback function used to put the tuner to sleep. 190 * @suspend: callback function used 190 * @suspend: callback function used to inform that the Kernel will 191 * suspend. 191 * suspend. 192 * @resume: callback function used 192 * @resume: callback function used to inform that the Kernel is 193 * resuming from suspend. 193 * resuming from suspend. 194 * @set_params: callback function used 194 * @set_params: callback function used to inform the tuner to tune 195 * into a digital TV chan 195 * into a digital TV channel. The properties to be used 196 * are stored at &struct 196 * are stored at &struct dvb_frontend.dtv_property_cache. 197 * The tuner demod can ch 197 * The tuner demod can change the parameters to reflect 198 * the changes needed for 198 * the changes needed for the channel to be tuned, and 199 * update statistics. Thi 199 * update statistics. This is the recommended way to set 200 * the tuner parameters a 200 * the tuner parameters and should be used on newer 201 * drivers. 201 * drivers. 202 * @set_analog_params: callback function used 202 * @set_analog_params: callback function used to tune into an analog TV 203 * channel on hybrid tune 203 * channel on hybrid tuners. It passes @analog_parameters 204 * to the driver. 204 * to the driver. 205 * @set_config: callback function used 205 * @set_config: callback function used to send some tuner-specific 206 * parameters. 206 * parameters. 207 * @get_frequency: get the actual tuned f 207 * @get_frequency: get the actual tuned frequency 208 * @get_bandwidth: get the bandwidth used 208 * @get_bandwidth: get the bandwidth used by the low pass filters 209 * @get_if_frequency: get the Intermediate F 209 * @get_if_frequency: get the Intermediate Frequency, in Hz. For baseband, 210 * should return 0. 210 * should return 0. 211 * @get_status: returns the frontend l 211 * @get_status: returns the frontend lock status 212 * @get_rf_strength: returns the RF signal 212 * @get_rf_strength: returns the RF signal strength. Used mostly to support 213 * analog TV and radio. D 213 * analog TV and radio. Digital TV should report, instead, 214 * via DVBv5 API (&struct 214 * via DVBv5 API (&struct dvb_frontend.dtv_property_cache). 215 * @get_afc: Used only by analog TV 215 * @get_afc: Used only by analog TV core. Reports the frequency 216 * drift due to AFC. 216 * drift due to AFC. 217 * @calc_regs: callback function used 217 * @calc_regs: callback function used to pass register data settings 218 * for simple tuners. Sh 218 * for simple tuners. Shouldn't be used on newer drivers. 219 * @set_frequency: Set a new frequency. S 219 * @set_frequency: Set a new frequency. Shouldn't be used on newer drivers. 220 * @set_bandwidth: Set a new frequency. S 220 * @set_bandwidth: Set a new frequency. Shouldn't be used on newer drivers. 221 * 221 * 222 * NOTE: frequencies used on @get_frequency an 222 * NOTE: frequencies used on @get_frequency and @set_frequency are in Hz for 223 * terrestrial/cable or kHz for satellite. 223 * terrestrial/cable or kHz for satellite. 224 * 224 * 225 */ 225 */ 226 struct dvb_tuner_ops { 226 struct dvb_tuner_ops { 227 227 228 struct dvb_tuner_info info; 228 struct dvb_tuner_info info; 229 229 230 void (*release)(struct dvb_frontend *f 230 void (*release)(struct dvb_frontend *fe); 231 int (*init)(struct dvb_frontend *fe); 231 int (*init)(struct dvb_frontend *fe); 232 int (*sleep)(struct dvb_frontend *fe); 232 int (*sleep)(struct dvb_frontend *fe); 233 int (*suspend)(struct dvb_frontend *fe 233 int (*suspend)(struct dvb_frontend *fe); 234 int (*resume)(struct dvb_frontend *fe) 234 int (*resume)(struct dvb_frontend *fe); 235 235 236 /* This is the recommended way to set 236 /* This is the recommended way to set the tuner */ 237 int (*set_params)(struct dvb_frontend 237 int (*set_params)(struct dvb_frontend *fe); 238 int (*set_analog_params)(struct dvb_fr 238 int (*set_analog_params)(struct dvb_frontend *fe, struct analog_parameters *p); 239 239 240 int (*set_config)(struct dvb_frontend 240 int (*set_config)(struct dvb_frontend *fe, void *priv_cfg); 241 241 242 int (*get_frequency)(struct dvb_fronte 242 int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency); 243 int (*get_bandwidth)(struct dvb_fronte 243 int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth); 244 int (*get_if_frequency)(struct dvb_fro 244 int (*get_if_frequency)(struct dvb_frontend *fe, u32 *frequency); 245 245 246 #define TUNER_STATUS_LOCKED 1 246 #define TUNER_STATUS_LOCKED 1 247 #define TUNER_STATUS_STEREO 2 247 #define TUNER_STATUS_STEREO 2 248 int (*get_status)(struct dvb_frontend 248 int (*get_status)(struct dvb_frontend *fe, u32 *status); 249 int (*get_rf_strength)(struct dvb_fron 249 int (*get_rf_strength)(struct dvb_frontend *fe, u16 *strength); 250 int (*get_afc)(struct dvb_frontend *fe 250 int (*get_afc)(struct dvb_frontend *fe, s32 *afc); 251 251 252 /* 252 /* 253 * This is support for demods like the 253 * This is support for demods like the mt352 - fills out the supplied 254 * buffer with what to write. 254 * buffer with what to write. 255 * 255 * 256 * Don't use on newer drivers. 256 * Don't use on newer drivers. 257 */ 257 */ 258 int (*calc_regs)(struct dvb_frontend * 258 int (*calc_regs)(struct dvb_frontend *fe, u8 *buf, int buf_len); 259 259 260 /* 260 /* 261 * These are provided separately from 261 * These are provided separately from set_params in order to 262 * facilitate silicon tuners which req 262 * facilitate silicon tuners which require sophisticated tuning loops, 263 * controlling each parameter separate 263 * controlling each parameter separately. 264 * 264 * 265 * Don't use on newer drivers. 265 * Don't use on newer drivers. 266 */ 266 */ 267 int (*set_frequency)(struct dvb_fronte 267 int (*set_frequency)(struct dvb_frontend *fe, u32 frequency); 268 int (*set_bandwidth)(struct dvb_fronte 268 int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); 269 }; 269 }; 270 270 271 /** 271 /** 272 * struct analog_demod_info - Information stru 272 * struct analog_demod_info - Information struct for analog TV part of the demod 273 * 273 * 274 * @name: Name of the analog TV demodula 274 * @name: Name of the analog TV demodulator 275 */ 275 */ 276 struct analog_demod_info { 276 struct analog_demod_info { 277 char *name; 277 char *name; 278 }; 278 }; 279 279 280 /** 280 /** 281 * struct analog_demod_ops - Demodulation inf 281 * struct analog_demod_ops - Demodulation information and callbacks for 282 * analog TV and ra 282 * analog TV and radio 283 * 283 * 284 * @info: pointer to struct anal 284 * @info: pointer to struct analog_demod_info 285 * @set_params: callback function used 285 * @set_params: callback function used to inform the demod to set the 286 * demodulator parameters 286 * demodulator parameters needed to decode an analog or 287 * radio channel. The pro 287 * radio channel. The properties are passed via 288 * &struct analog_params. 288 * &struct analog_params. 289 * @has_signal: returns 0xffff if has 289 * @has_signal: returns 0xffff if has signal, or 0 if it doesn't. 290 * @get_afc: Used only by analog TV 290 * @get_afc: Used only by analog TV core. Reports the frequency 291 * drift due to AFC. 291 * drift due to AFC. 292 * @tuner_status: callback function that 292 * @tuner_status: callback function that returns tuner status bits, e. g. 293 * %TUNER_STATUS_LOCKED a 293 * %TUNER_STATUS_LOCKED and %TUNER_STATUS_STEREO. 294 * @standby: set the tuner to stand 294 * @standby: set the tuner to standby mode. 295 * @release: callback function call 295 * @release: callback function called when frontend is detached. 296 * drivers should free an 296 * drivers should free any allocated memory. 297 * @i2c_gate_ctrl: controls the I2C gate. 297 * @i2c_gate_ctrl: controls the I2C gate. Newer drivers should use I2C 298 * mux support instead. 298 * mux support instead. 299 * @set_config: callback function used 299 * @set_config: callback function used to send some tuner-specific 300 * parameters. 300 * parameters. 301 */ 301 */ 302 struct analog_demod_ops { 302 struct analog_demod_ops { 303 303 304 struct analog_demod_info info; 304 struct analog_demod_info info; 305 305 306 void (*set_params)(struct dvb_frontend 306 void (*set_params)(struct dvb_frontend *fe, 307 struct analog_param 307 struct analog_parameters *params); 308 int (*has_signal)(struct dvb_frontend 308 int (*has_signal)(struct dvb_frontend *fe, u16 *signal); 309 int (*get_afc)(struct dvb_frontend *f 309 int (*get_afc)(struct dvb_frontend *fe, s32 *afc); 310 void (*tuner_status)(struct dvb_fronte 310 void (*tuner_status)(struct dvb_frontend *fe); 311 void (*standby)(struct dvb_frontend *f 311 void (*standby)(struct dvb_frontend *fe); 312 void (*release)(struct dvb_frontend *f 312 void (*release)(struct dvb_frontend *fe); 313 int (*i2c_gate_ctrl)(struct dvb_front 313 int (*i2c_gate_ctrl)(struct dvb_frontend *fe, int enable); 314 314 315 /** This is to allow setting tuner-spe 315 /** This is to allow setting tuner-specific configuration */ 316 int (*set_config)(struct dvb_frontend 316 int (*set_config)(struct dvb_frontend *fe, void *priv_cfg); 317 }; 317 }; 318 318 319 struct dtv_frontend_properties; 319 struct dtv_frontend_properties; 320 320 321 /** 321 /** 322 * struct dvb_frontend_internal_info - Fronten 322 * struct dvb_frontend_internal_info - Frontend properties and capabilities 323 * 323 * 324 * @name: Name of the fr 324 * @name: Name of the frontend 325 * @frequency_min_hz: Minimal freque 325 * @frequency_min_hz: Minimal frequency supported by the frontend. 326 * @frequency_max_hz: Minimal freque 326 * @frequency_max_hz: Minimal frequency supported by the frontend. 327 * @frequency_stepsize_hz: All frequencie 327 * @frequency_stepsize_hz: All frequencies are multiple of this value. 328 * @frequency_tolerance_hz: Frequency tole 328 * @frequency_tolerance_hz: Frequency tolerance. 329 * @symbol_rate_min: Minimal symbol 329 * @symbol_rate_min: Minimal symbol rate, in bauds 330 * (for Cable/Sat 330 * (for Cable/Satellite systems). 331 * @symbol_rate_max: Maximal symbol 331 * @symbol_rate_max: Maximal symbol rate, in bauds 332 * (for Cable/Sat 332 * (for Cable/Satellite systems). 333 * @symbol_rate_tolerance: Maximal symbol 333 * @symbol_rate_tolerance: Maximal symbol rate tolerance, in ppm 334 * (for Cable/Sat 334 * (for Cable/Satellite systems). 335 * @caps: Capabilities s 335 * @caps: Capabilities supported by the frontend, 336 * as specified i 336 * as specified in &enum fe_caps. 337 */ 337 */ 338 struct dvb_frontend_internal_info { 338 struct dvb_frontend_internal_info { 339 char name[128]; 339 char name[128]; 340 u32 frequency_min_hz; 340 u32 frequency_min_hz; 341 u32 frequency_max_hz; 341 u32 frequency_max_hz; 342 u32 frequency_stepsize_hz; 342 u32 frequency_stepsize_hz; 343 u32 frequency_tolerance_hz; 343 u32 frequency_tolerance_hz; 344 u32 symbol_rate_min; 344 u32 symbol_rate_min; 345 u32 symbol_rate_max; 345 u32 symbol_rate_max; 346 u32 symbol_rate_tolerance; 346 u32 symbol_rate_tolerance; 347 enum fe_caps caps; 347 enum fe_caps caps; 348 }; 348 }; 349 349 350 /** 350 /** 351 * struct dvb_frontend_ops - Demodulation info 351 * struct dvb_frontend_ops - Demodulation information and callbacks for 352 * ditialt TV 352 * ditialt TV 353 * 353 * 354 * @info: embedded &struct dvb_t 354 * @info: embedded &struct dvb_tuner_info with tuner properties 355 * @delsys: Delivery systems suppo 355 * @delsys: Delivery systems supported by the frontend 356 * @detach: callback function call 356 * @detach: callback function called when frontend is detached. 357 * drivers should clean u 357 * drivers should clean up, but not yet free the &struct 358 * dvb_frontend allocatio 358 * dvb_frontend allocation. 359 * @release: callback function call 359 * @release: callback function called when frontend is ready to be 360 * freed. 360 * freed. 361 * drivers should free an 361 * drivers should free any allocated memory. 362 * @release_sec: callback function requ 362 * @release_sec: callback function requesting that the Satellite Equipment 363 * Control (SEC) driver t 363 * Control (SEC) driver to release and free any memory 364 * allocated by the drive 364 * allocated by the driver. 365 * @init: callback function used 365 * @init: callback function used to initialize the tuner device. 366 * @sleep: callback function used 366 * @sleep: callback function used to put the tuner to sleep. 367 * @suspend: callback function used << 368 * suspend. << 369 * @resume: callback function used << 370 * resuming from suspend. << 371 * @write: callback function used 367 * @write: callback function used by some demod legacy drivers to 372 * allow other drivers to 368 * allow other drivers to write data into their registers. 373 * Should not be used on 369 * Should not be used on new drivers. 374 * @tune: callback function used 370 * @tune: callback function used by demod drivers that use 375 * @DVBFE_ALGO_HW to tune 371 * @DVBFE_ALGO_HW to tune into a frequency. 376 * @get_frontend_algo: returns the desired ha 372 * @get_frontend_algo: returns the desired hardware algorithm. 377 * @set_frontend: callback function used 373 * @set_frontend: callback function used to inform the demod to set the 378 * parameters for demodul 374 * parameters for demodulating a digital TV channel. 379 * The properties to be u 375 * The properties to be used are stored at &struct 380 * dvb_frontend.dtv_prope 376 * dvb_frontend.dtv_property_cache. The demod can change 381 * the parameters to refl 377 * the parameters to reflect the changes needed for the 382 * channel to be decoded, 378 * channel to be decoded, and update statistics. 383 * @get_tune_settings: callback function 379 * @get_tune_settings: callback function 384 * @get_frontend: callback function used 380 * @get_frontend: callback function used to inform the parameters 385 * actuall in use. The pr 381 * actuall in use. The properties to be used are stored at 386 * &struct dvb_frontend.d 382 * &struct dvb_frontend.dtv_property_cache and update 387 * statistics. Please not 383 * statistics. Please notice that it should not return 388 * an error code if the s 384 * an error code if the statistics are not available 389 * because the demog is n 385 * because the demog is not locked. 390 * @read_status: returns the locking st 386 * @read_status: returns the locking status of the frontend. 391 * @read_ber: legacy callback functi 387 * @read_ber: legacy callback function to return the bit error rate. 392 * Newer drivers should p 388 * Newer drivers should provide such info via DVBv5 API, 393 * e. g. @set_frontend;/@ 389 * e. g. @set_frontend;/@get_frontend, implementing this 394 * callback only if DVBv3 390 * callback only if DVBv3 API compatibility is wanted. 395 * @read_signal_strength: legacy callback func 391 * @read_signal_strength: legacy callback function to return the signal 396 * strength. Newer driver 392 * strength. Newer drivers should provide such info via 397 * DVBv5 API, e. g. @set_ 393 * DVBv5 API, e. g. @set_frontend/@get_frontend, 398 * implementing this call 394 * implementing this callback only if DVBv3 API 399 * compatibility is wante 395 * compatibility is wanted. 400 * @read_snr: legacy callback functi 396 * @read_snr: legacy callback function to return the Signal/Noise 401 * rate. Newer drivers sh 397 * rate. Newer drivers should provide such info via 402 * DVBv5 API, e. g. @set_ 398 * DVBv5 API, e. g. @set_frontend/@get_frontend, 403 * implementing this call 399 * implementing this callback only if DVBv3 API 404 * compatibility is wante 400 * compatibility is wanted. 405 * @read_ucblocks: legacy callback functi 401 * @read_ucblocks: legacy callback function to return the Uncorrected Error 406 * Blocks. Newer drivers 402 * Blocks. Newer drivers should provide such info via 407 * DVBv5 API, e. g. @set_ 403 * DVBv5 API, e. g. @set_frontend/@get_frontend, 408 * implementing this call 404 * implementing this callback only if DVBv3 API 409 * compatibility is wante 405 * compatibility is wanted. 410 * @diseqc_reset_overload: callback function t 406 * @diseqc_reset_overload: callback function to implement the 411 * FE_DISEQC_RESET_OVERLO 407 * FE_DISEQC_RESET_OVERLOAD() ioctl (only Satellite) 412 * @diseqc_send_master_cmd: callback function 408 * @diseqc_send_master_cmd: callback function to implement the 413 * FE_DISEQC_SEND_MASTER_ 409 * FE_DISEQC_SEND_MASTER_CMD() ioctl (only Satellite). 414 * @diseqc_recv_slave_reply: callback function 410 * @diseqc_recv_slave_reply: callback function to implement the 415 * FE_DISEQC_RECV_SLAVE_R 411 * FE_DISEQC_RECV_SLAVE_REPLY() ioctl (only Satellite) 416 * @diseqc_send_burst: callback function to i 412 * @diseqc_send_burst: callback function to implement the 417 * FE_DISEQC_SEND_BURST() 413 * FE_DISEQC_SEND_BURST() ioctl (only Satellite). 418 * @set_tone: callback function to i 414 * @set_tone: callback function to implement the 419 * FE_SET_TONE() ioctl (o 415 * FE_SET_TONE() ioctl (only Satellite). 420 * @set_voltage: callback function to i 416 * @set_voltage: callback function to implement the 421 * FE_SET_VOLTAGE() ioctl 417 * FE_SET_VOLTAGE() ioctl (only Satellite). 422 * @enable_high_lnb_voltage: callback function 418 * @enable_high_lnb_voltage: callback function to implement the 423 * FE_ENABLE_HIGH_LNB_VOL 419 * FE_ENABLE_HIGH_LNB_VOLTAGE() ioctl (only Satellite). 424 * @dishnetwork_send_legacy_command: callback 420 * @dishnetwork_send_legacy_command: callback function to implement the 425 * FE_DISHNETWORK_SEND_LE 421 * FE_DISHNETWORK_SEND_LEGACY_CMD() ioctl (only Satellite). 426 * Drivers should not use 422 * Drivers should not use this, except when the DVB 427 * core emulation fails t 423 * core emulation fails to provide proper support (e.g. 428 * if @set_voltage takes 424 * if @set_voltage takes more than 8ms to work), and 429 * when backward compatib 425 * when backward compatibility with this legacy API is 430 * required. 426 * required. 431 * @i2c_gate_ctrl: controls the I2C gate. 427 * @i2c_gate_ctrl: controls the I2C gate. Newer drivers should use I2C 432 * mux support instead. 428 * mux support instead. 433 * @ts_bus_ctrl: callback function used 429 * @ts_bus_ctrl: callback function used to take control of the TS bus. 434 * @set_lna: callback function to p 430 * @set_lna: callback function to power on/off/auto the LNA. 435 * @search: callback function used 431 * @search: callback function used on some custom algo search algos. 436 * @tuner_ops: pointer to &struct dvb 432 * @tuner_ops: pointer to &struct dvb_tuner_ops 437 * @analog_ops: pointer to &struct ana 433 * @analog_ops: pointer to &struct analog_demod_ops 438 */ 434 */ 439 struct dvb_frontend_ops { 435 struct dvb_frontend_ops { 440 struct dvb_frontend_internal_info info 436 struct dvb_frontend_internal_info info; 441 437 442 u8 delsys[MAX_DELSYS]; 438 u8 delsys[MAX_DELSYS]; 443 439 444 void (*detach)(struct dvb_frontend *fe 440 void (*detach)(struct dvb_frontend *fe); 445 void (*release)(struct dvb_frontend* f 441 void (*release)(struct dvb_frontend* fe); 446 void (*release_sec)(struct dvb_fronten 442 void (*release_sec)(struct dvb_frontend* fe); 447 443 448 int (*init)(struct dvb_frontend* fe); 444 int (*init)(struct dvb_frontend* fe); 449 int (*sleep)(struct dvb_frontend* fe); 445 int (*sleep)(struct dvb_frontend* fe); 450 int (*suspend)(struct dvb_frontend *fe << 451 int (*resume)(struct dvb_frontend *fe) << 452 446 453 int (*write)(struct dvb_frontend* fe, 447 int (*write)(struct dvb_frontend* fe, const u8 buf[], int len); 454 448 455 /* if this is set, it overrides the de 449 /* if this is set, it overrides the default swzigzag */ 456 int (*tune)(struct dvb_frontend* fe, 450 int (*tune)(struct dvb_frontend* fe, 457 bool re_tune, 451 bool re_tune, 458 unsigned int mode_flags, 452 unsigned int mode_flags, 459 unsigned int *delay, 453 unsigned int *delay, 460 enum fe_status *status); 454 enum fe_status *status); 461 455 462 /* get frontend tuning algorithm from 456 /* get frontend tuning algorithm from the module */ 463 enum dvbfe_algo (*get_frontend_algo)(s 457 enum dvbfe_algo (*get_frontend_algo)(struct dvb_frontend *fe); 464 458 465 /* these two are only used for the swz 459 /* these two are only used for the swzigzag code */ 466 int (*set_frontend)(struct dvb_fronten 460 int (*set_frontend)(struct dvb_frontend *fe); 467 int (*get_tune_settings)(struct dvb_fr 461 int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings); 468 462 469 int (*get_frontend)(struct dvb_fronten 463 int (*get_frontend)(struct dvb_frontend *fe, 470 struct dtv_fronten 464 struct dtv_frontend_properties *props); 471 465 472 int (*read_status)(struct dvb_frontend 466 int (*read_status)(struct dvb_frontend *fe, enum fe_status *status); 473 int (*read_ber)(struct dvb_frontend* f 467 int (*read_ber)(struct dvb_frontend* fe, u32* ber); 474 int (*read_signal_strength)(struct dvb 468 int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength); 475 int (*read_snr)(struct dvb_frontend* f 469 int (*read_snr)(struct dvb_frontend* fe, u16* snr); 476 int (*read_ucblocks)(struct dvb_fronte 470 int (*read_ucblocks)(struct dvb_frontend* fe, u32* ucblocks); 477 471 478 int (*diseqc_reset_overload)(struct dv 472 int (*diseqc_reset_overload)(struct dvb_frontend* fe); 479 int (*diseqc_send_master_cmd)(struct d 473 int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd); 480 int (*diseqc_recv_slave_reply)(struct 474 int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply); 481 int (*diseqc_send_burst)(struct dvb_fr 475 int (*diseqc_send_burst)(struct dvb_frontend *fe, 482 enum fe_sec_m 476 enum fe_sec_mini_cmd minicmd); 483 int (*set_tone)(struct dvb_frontend *f 477 int (*set_tone)(struct dvb_frontend *fe, enum fe_sec_tone_mode tone); 484 int (*set_voltage)(struct dvb_frontend 478 int (*set_voltage)(struct dvb_frontend *fe, 485 enum fe_sec_voltage 479 enum fe_sec_voltage voltage); 486 int (*enable_high_lnb_voltage)(struct 480 int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg); 487 int (*dishnetwork_send_legacy_command) 481 int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); 488 int (*i2c_gate_ctrl)(struct dvb_fronte 482 int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); 489 int (*ts_bus_ctrl)(struct dvb_frontend 483 int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire); 490 int (*set_lna)(struct dvb_frontend *); 484 int (*set_lna)(struct dvb_frontend *); 491 485 492 /* 486 /* 493 * These callbacks are for devices tha 487 * These callbacks are for devices that implement their own 494 * tuning algorithms, rather than a si 488 * tuning algorithms, rather than a simple swzigzag 495 */ 489 */ 496 enum dvbfe_search (*search)(struct dvb 490 enum dvbfe_search (*search)(struct dvb_frontend *fe); 497 491 498 struct dvb_tuner_ops tuner_ops; 492 struct dvb_tuner_ops tuner_ops; 499 struct analog_demod_ops analog_ops; 493 struct analog_demod_ops analog_ops; 500 }; 494 }; 501 495 502 #ifdef __DVB_CORE__ 496 #ifdef __DVB_CORE__ 503 #define MAX_EVENT 8 497 #define MAX_EVENT 8 504 498 505 /* Used only internally at dvb_frontend.c */ 499 /* Used only internally at dvb_frontend.c */ 506 struct dvb_fe_events { 500 struct dvb_fe_events { 507 struct dvb_frontend_event events[MAX_E 501 struct dvb_frontend_event events[MAX_EVENT]; 508 int eventw; 502 int eventw; 509 int eventr; 503 int eventr; 510 int overflow; 504 int overflow; 511 wait_queue_head_t wait_queue; 505 wait_queue_head_t wait_queue; 512 struct mutex mtx; 506 struct mutex mtx; 513 }; 507 }; 514 #endif 508 #endif 515 509 516 /** 510 /** 517 * struct dtv_frontend_properties - contains a 511 * struct dtv_frontend_properties - contains a list of properties that are 518 * specific t 512 * specific to a digital TV standard. 519 * 513 * 520 * @frequency: frequency in Hz for te 514 * @frequency: frequency in Hz for terrestrial/cable or in kHz for 521 * Satellite 515 * Satellite 522 * @modulation: Frontend modulation ty 516 * @modulation: Frontend modulation type 523 * @voltage: SEC voltage (only Sate 517 * @voltage: SEC voltage (only Satellite) 524 * @sectone: SEC tone mode (only Sa 518 * @sectone: SEC tone mode (only Satellite) 525 * @inversion: Spectral inversion 519 * @inversion: Spectral inversion 526 * @fec_inner: Forward error correcti 520 * @fec_inner: Forward error correction inner Code Rate 527 * @transmission_mode: Transmission Mode 521 * @transmission_mode: Transmission Mode 528 * @bandwidth_hz: Bandwidth, in Hz. A ze 522 * @bandwidth_hz: Bandwidth, in Hz. A zero value means that userspace 529 * wants to autodetect. 523 * wants to autodetect. 530 * @guard_interval: Guard Interval 524 * @guard_interval: Guard Interval 531 * @hierarchy: Hierarchy 525 * @hierarchy: Hierarchy 532 * @symbol_rate: Symbol Rate 526 * @symbol_rate: Symbol Rate 533 * @code_rate_HP: high priority stream c 527 * @code_rate_HP: high priority stream code rate 534 * @code_rate_LP: low priority stream co 528 * @code_rate_LP: low priority stream code rate 535 * @pilot: Enable/disable/autodet 529 * @pilot: Enable/disable/autodetect pilot tones 536 * @rolloff: Rolloff factor (alpha) 530 * @rolloff: Rolloff factor (alpha) 537 * @delivery_system: FE delivery system (e. 531 * @delivery_system: FE delivery system (e. g. digital TV standard) 538 * @interleaving: interleaving 532 * @interleaving: interleaving 539 * @isdbt_partial_reception: ISDB-T partial re 533 * @isdbt_partial_reception: ISDB-T partial reception (only ISDB standard) 540 * @isdbt_sb_mode: ISDB-T Sound Broadcast 534 * @isdbt_sb_mode: ISDB-T Sound Broadcast (SB) mode (only ISDB standard) 541 * @isdbt_sb_subchannel: ISDB-T SB subc 535 * @isdbt_sb_subchannel: ISDB-T SB subchannel (only ISDB standard) 542 * @isdbt_sb_segment_idx: ISDB-T SB segm 536 * @isdbt_sb_segment_idx: ISDB-T SB segment index (only ISDB standard) 543 * @isdbt_sb_segment_count: ISDB-T SB segm 537 * @isdbt_sb_segment_count: ISDB-T SB segment count (only ISDB standard) 544 * @isdbt_layer_enabled: ISDB Layer ena 538 * @isdbt_layer_enabled: ISDB Layer enabled (only ISDB standard) 545 * @layer: ISDB per-layer data (o 539 * @layer: ISDB per-layer data (only ISDB standard) 546 * @layer.segment_count: Segment Count; 540 * @layer.segment_count: Segment Count; 547 * @layer.fec: per layer code rate; 541 * @layer.fec: per layer code rate; 548 * @layer.modulation: per layer modulation; 542 * @layer.modulation: per layer modulation; 549 * @layer.interleaving: per layer interleavin 543 * @layer.interleaving: per layer interleaving. 550 * @stream_id: If different than zero 544 * @stream_id: If different than zero, enable substream filtering, if 551 * hardware supports (DVB 545 * hardware supports (DVB-S2 and DVB-T2). 552 * @scrambling_sequence_index: Carries the in 546 * @scrambling_sequence_index: Carries the index of the DVB-S2 physical layer 553 * scrambling seq 547 * scrambling sequence. 554 * @atscmh_fic_ver: Version number of the 548 * @atscmh_fic_ver: Version number of the FIC (Fast Information Channel) 555 * signaling data (only A 549 * signaling data (only ATSC-M/H) 556 * @atscmh_parade_id: Parade identification 550 * @atscmh_parade_id: Parade identification number (only ATSC-M/H) 557 * @atscmh_nog: Number of MH groups pe 551 * @atscmh_nog: Number of MH groups per MH subframe for a designated 558 * parade (only ATSC-M/H) 552 * parade (only ATSC-M/H) 559 * @atscmh_tnog: Total number of MH gro 553 * @atscmh_tnog: Total number of MH groups including all MH groups 560 * belonging to all MH pa 554 * belonging to all MH parades in one MH subframe 561 * (only ATSC-M/H) 555 * (only ATSC-M/H) 562 * @atscmh_sgn: Start group number (on 556 * @atscmh_sgn: Start group number (only ATSC-M/H) 563 * @atscmh_prc: Parade repetition cycl 557 * @atscmh_prc: Parade repetition cycle (only ATSC-M/H) 564 * @atscmh_rs_frame_mode: Reed Solomon ( 558 * @atscmh_rs_frame_mode: Reed Solomon (RS) frame mode (only ATSC-M/H) 565 * @atscmh_rs_frame_ensemble: RS frame ensem 559 * @atscmh_rs_frame_ensemble: RS frame ensemble (only ATSC-M/H) 566 * @atscmh_rs_code_mode_pri: RS code mode p 560 * @atscmh_rs_code_mode_pri: RS code mode pri (only ATSC-M/H) 567 * @atscmh_rs_code_mode_sec: RS code mode s 561 * @atscmh_rs_code_mode_sec: RS code mode sec (only ATSC-M/H) 568 * @atscmh_sccc_block_mode: Series Concate 562 * @atscmh_sccc_block_mode: Series Concatenated Convolutional Code (SCCC) 569 * Block Mode (on 563 * Block Mode (only ATSC-M/H) 570 * @atscmh_sccc_code_mode_a: SCCC code mode 564 * @atscmh_sccc_code_mode_a: SCCC code mode A (only ATSC-M/H) 571 * @atscmh_sccc_code_mode_b: SCCC code mode 565 * @atscmh_sccc_code_mode_b: SCCC code mode B (only ATSC-M/H) 572 * @atscmh_sccc_code_mode_c: SCCC code mode 566 * @atscmh_sccc_code_mode_c: SCCC code mode C (only ATSC-M/H) 573 * @atscmh_sccc_code_mode_d: SCCC code mode 567 * @atscmh_sccc_code_mode_d: SCCC code mode D (only ATSC-M/H) 574 * @lna: Power ON/OFF/AUTO the 568 * @lna: Power ON/OFF/AUTO the Linear Now-noise Amplifier (LNA) 575 * @strength: DVBv5 API statistics: 569 * @strength: DVBv5 API statistics: Signal Strength 576 * @cnr: DVBv5 API statistics: 570 * @cnr: DVBv5 API statistics: Signal to Noise ratio of the 577 * (main) carrier 571 * (main) carrier 578 * @pre_bit_error: DVBv5 API statistics: 572 * @pre_bit_error: DVBv5 API statistics: pre-Viterbi bit error count 579 * @pre_bit_count: DVBv5 API statistics: 573 * @pre_bit_count: DVBv5 API statistics: pre-Viterbi bit count 580 * @post_bit_error: DVBv5 API statistics: 574 * @post_bit_error: DVBv5 API statistics: post-Viterbi bit error count 581 * @post_bit_count: DVBv5 API statistics: 575 * @post_bit_count: DVBv5 API statistics: post-Viterbi bit count 582 * @block_error: DVBv5 API statistics: 576 * @block_error: DVBv5 API statistics: block error count 583 * @block_count: DVBv5 API statistics: 577 * @block_count: DVBv5 API statistics: block count 584 * 578 * 585 * NOTE: derivated statistics like Uncorrected 579 * NOTE: derivated statistics like Uncorrected Error blocks (UCE) are 586 * calculated on userspace. 580 * calculated on userspace. 587 * 581 * 588 * Only a subset of the properties are needed 582 * Only a subset of the properties are needed for a given delivery system. 589 * For more info, consult the media_api.html w 583 * For more info, consult the media_api.html with the documentation of the 590 * Userspace API. 584 * Userspace API. 591 */ 585 */ 592 struct dtv_frontend_properties { 586 struct dtv_frontend_properties { 593 u32 frequency; 587 u32 frequency; 594 enum fe_modulation modulation; 588 enum fe_modulation modulation; 595 589 596 enum fe_sec_voltage voltage; 590 enum fe_sec_voltage voltage; 597 enum fe_sec_tone_mode sectone; 591 enum fe_sec_tone_mode sectone; 598 enum fe_spectral_inversion inversion; 592 enum fe_spectral_inversion inversion; 599 enum fe_code_rate fec_inner; 593 enum fe_code_rate fec_inner; 600 enum fe_transmit_mode transmission_m 594 enum fe_transmit_mode transmission_mode; 601 u32 bandwidth_hz; 595 u32 bandwidth_hz; /* 0 = AUTO */ 602 enum fe_guard_interval guard_interval 596 enum fe_guard_interval guard_interval; 603 enum fe_hierarchy hierarchy; 597 enum fe_hierarchy hierarchy; 604 u32 symbol_rate; 598 u32 symbol_rate; 605 enum fe_code_rate code_rate_HP; 599 enum fe_code_rate code_rate_HP; 606 enum fe_code_rate code_rate_LP; 600 enum fe_code_rate code_rate_LP; 607 601 608 enum fe_pilot pilot; 602 enum fe_pilot pilot; 609 enum fe_rolloff rolloff; 603 enum fe_rolloff rolloff; 610 604 611 enum fe_delivery_system delivery_syste 605 enum fe_delivery_system delivery_system; 612 606 613 enum fe_interleaving interleaving; 607 enum fe_interleaving interleaving; 614 608 615 /* ISDB-T specifics */ 609 /* ISDB-T specifics */ 616 u8 isdbt_partial_ 610 u8 isdbt_partial_reception; 617 u8 isdbt_sb_mode; 611 u8 isdbt_sb_mode; 618 u8 isdbt_sb_subch 612 u8 isdbt_sb_subchannel; 619 u32 isdbt_sb_segme 613 u32 isdbt_sb_segment_idx; 620 u32 isdbt_sb_segme 614 u32 isdbt_sb_segment_count; 621 u8 isdbt_layer_en 615 u8 isdbt_layer_enabled; 622 struct { 616 struct { 623 u8 segment_count; 617 u8 segment_count; 624 enum fe_code_rate fec; 618 enum fe_code_rate fec; 625 enum fe_modulation modulation; 619 enum fe_modulation modulation; 626 u8 interleaving; 620 u8 interleaving; 627 } layer[3]; 621 } layer[3]; 628 622 629 /* Multistream specifics */ 623 /* Multistream specifics */ 630 u32 stream_id; 624 u32 stream_id; 631 625 632 /* Physical Layer Scrambling specifics 626 /* Physical Layer Scrambling specifics */ 633 u32 scrambling_seq 627 u32 scrambling_sequence_index; 634 628 635 /* ATSC-MH specifics */ 629 /* ATSC-MH specifics */ 636 u8 atscmh_fic_ver 630 u8 atscmh_fic_ver; 637 u8 atscmh_parade_ 631 u8 atscmh_parade_id; 638 u8 atscmh_nog; 632 u8 atscmh_nog; 639 u8 atscmh_tnog; 633 u8 atscmh_tnog; 640 u8 atscmh_sgn; 634 u8 atscmh_sgn; 641 u8 atscmh_prc; 635 u8 atscmh_prc; 642 636 643 u8 atscmh_rs_fram 637 u8 atscmh_rs_frame_mode; 644 u8 atscmh_rs_fram 638 u8 atscmh_rs_frame_ensemble; 645 u8 atscmh_rs_code 639 u8 atscmh_rs_code_mode_pri; 646 u8 atscmh_rs_code 640 u8 atscmh_rs_code_mode_sec; 647 u8 atscmh_sccc_bl 641 u8 atscmh_sccc_block_mode; 648 u8 atscmh_sccc_co 642 u8 atscmh_sccc_code_mode_a; 649 u8 atscmh_sccc_co 643 u8 atscmh_sccc_code_mode_b; 650 u8 atscmh_sccc_co 644 u8 atscmh_sccc_code_mode_c; 651 u8 atscmh_sccc_co 645 u8 atscmh_sccc_code_mode_d; 652 646 653 u32 lna; 647 u32 lna; 654 648 655 /* statistics data */ 649 /* statistics data */ 656 struct dtv_fe_stats strength; 650 struct dtv_fe_stats strength; 657 struct dtv_fe_stats cnr; 651 struct dtv_fe_stats cnr; 658 struct dtv_fe_stats pre_bit_error; 652 struct dtv_fe_stats pre_bit_error; 659 struct dtv_fe_stats pre_bit_count; 653 struct dtv_fe_stats pre_bit_count; 660 struct dtv_fe_stats post_bit_error 654 struct dtv_fe_stats post_bit_error; 661 struct dtv_fe_stats post_bit_count 655 struct dtv_fe_stats post_bit_count; 662 struct dtv_fe_stats block_error; 656 struct dtv_fe_stats block_error; 663 struct dtv_fe_stats block_count; 657 struct dtv_fe_stats block_count; 664 }; 658 }; 665 659 666 #define DVB_FE_NO_EXIT 0 660 #define DVB_FE_NO_EXIT 0 667 #define DVB_FE_NORMAL_EXIT 1 661 #define DVB_FE_NORMAL_EXIT 1 668 #define DVB_FE_DEVICE_REMOVED 2 662 #define DVB_FE_DEVICE_REMOVED 2 669 #define DVB_FE_DEVICE_RESUME 3 663 #define DVB_FE_DEVICE_RESUME 3 670 664 671 /** 665 /** 672 * struct dvb_frontend - Frontend structure to 666 * struct dvb_frontend - Frontend structure to be used on drivers. 673 * 667 * 674 * @refcount: refcount to keep track 668 * @refcount: refcount to keep track of &struct dvb_frontend 675 * references 669 * references 676 * @ops: embedded &struct dvb_f 670 * @ops: embedded &struct dvb_frontend_ops 677 * @dvb: pointer to &struct dvb 671 * @dvb: pointer to &struct dvb_adapter 678 * @demodulator_priv: demod private data 672 * @demodulator_priv: demod private data 679 * @tuner_priv: tuner private data 673 * @tuner_priv: tuner private data 680 * @frontend_priv: frontend private data 674 * @frontend_priv: frontend private data 681 * @sec_priv: SEC private data 675 * @sec_priv: SEC private data 682 * @analog_demod_priv: Analog demod private d 676 * @analog_demod_priv: Analog demod private data 683 * @dtv_property_cache: embedded &struct dtv_f 677 * @dtv_property_cache: embedded &struct dtv_frontend_properties 684 * @callback: callback function used 678 * @callback: callback function used on some drivers to call 685 * either the tuner or th 679 * either the tuner or the demodulator. 686 * @id: Frontend ID 680 * @id: Frontend ID 687 * @exit: Used to inform the DVB 681 * @exit: Used to inform the DVB core that the frontend 688 * thread should exit (us 682 * thread should exit (usually, means that the hardware 689 * got disconnected. 683 * got disconnected. 690 */ 684 */ 691 685 692 struct dvb_frontend { 686 struct dvb_frontend { 693 struct kref refcount; 687 struct kref refcount; 694 struct dvb_frontend_ops ops; 688 struct dvb_frontend_ops ops; 695 struct dvb_adapter *dvb; 689 struct dvb_adapter *dvb; 696 void *demodulator_priv; 690 void *demodulator_priv; 697 void *tuner_priv; 691 void *tuner_priv; 698 void *frontend_priv; 692 void *frontend_priv; 699 void *sec_priv; 693 void *sec_priv; 700 void *analog_demod_priv; 694 void *analog_demod_priv; 701 struct dtv_frontend_properties dtv_pro 695 struct dtv_frontend_properties dtv_property_cache; 702 #define DVB_FRONTEND_COMPONENT_TUNER 0 696 #define DVB_FRONTEND_COMPONENT_TUNER 0 703 #define DVB_FRONTEND_COMPONENT_DEMOD 1 697 #define DVB_FRONTEND_COMPONENT_DEMOD 1 704 int (*callback)(void *adapter_priv, in 698 int (*callback)(void *adapter_priv, int component, int cmd, int arg); 705 int id; 699 int id; 706 unsigned int exit; 700 unsigned int exit; 707 }; 701 }; 708 702 709 /** 703 /** 710 * dvb_register_frontend() - Registers a DVB f 704 * dvb_register_frontend() - Registers a DVB frontend at the adapter 711 * 705 * 712 * @dvb: pointer to &struct dvb_adapter 706 * @dvb: pointer to &struct dvb_adapter 713 * @fe: pointer to &struct dvb_frontend 707 * @fe: pointer to &struct dvb_frontend 714 * 708 * 715 * Allocate and initialize the private data ne 709 * Allocate and initialize the private data needed by the frontend core to 716 * manage the frontend and calls dvb_register_ 710 * manage the frontend and calls dvb_register_device() to register a new 717 * frontend. It also cleans the property cache 711 * frontend. It also cleans the property cache that stores the frontend 718 * parameters and selects the first available 712 * parameters and selects the first available delivery system. 719 */ 713 */ 720 int dvb_register_frontend(struct dvb_adapter * 714 int dvb_register_frontend(struct dvb_adapter *dvb, 721 struct dvb_fr 715 struct dvb_frontend *fe); 722 716 723 /** 717 /** 724 * dvb_unregister_frontend() - Unregisters a D 718 * dvb_unregister_frontend() - Unregisters a DVB frontend 725 * 719 * 726 * @fe: pointer to &struct dvb_frontend 720 * @fe: pointer to &struct dvb_frontend 727 * 721 * 728 * Stops the frontend kthread, calls dvb_unreg 722 * Stops the frontend kthread, calls dvb_unregister_device() and frees the 729 * private frontend data allocated by dvb_regi 723 * private frontend data allocated by dvb_register_frontend(). 730 * 724 * 731 * NOTE: This function doesn't frees the memor 725 * NOTE: This function doesn't frees the memory allocated by the demod, 732 * by the SEC driver and by the tuner. In orde 726 * by the SEC driver and by the tuner. In order to free it, an explicit call to 733 * dvb_frontend_detach() is needed, after call 727 * dvb_frontend_detach() is needed, after calling this function. 734 */ 728 */ 735 int dvb_unregister_frontend(struct dvb_fronten 729 int dvb_unregister_frontend(struct dvb_frontend *fe); 736 730 737 /** 731 /** 738 * dvb_frontend_detach() - Detaches and frees 732 * dvb_frontend_detach() - Detaches and frees frontend specific data 739 * 733 * 740 * @fe: pointer to &struct dvb_frontend 734 * @fe: pointer to &struct dvb_frontend 741 * 735 * 742 * This function should be called after dvb_un 736 * This function should be called after dvb_unregister_frontend(). It 743 * calls the SEC, tuner and demod release func 737 * calls the SEC, tuner and demod release functions: 744 * &dvb_frontend_ops.release_sec, &dvb_fronten 738 * &dvb_frontend_ops.release_sec, &dvb_frontend_ops.tuner_ops.release, 745 * &dvb_frontend_ops.analog_ops.release and &d 739 * &dvb_frontend_ops.analog_ops.release and &dvb_frontend_ops.release. 746 * 740 * 747 * If the driver is compiled with %CONFIG_MEDI 741 * If the driver is compiled with %CONFIG_MEDIA_ATTACH, it also decreases 748 * the module reference count, needed to allow 742 * the module reference count, needed to allow userspace to remove the 749 * previously used DVB frontend modules. 743 * previously used DVB frontend modules. 750 */ 744 */ 751 void dvb_frontend_detach(struct dvb_frontend * 745 void dvb_frontend_detach(struct dvb_frontend *fe); 752 746 753 /** 747 /** 754 * dvb_frontend_suspend() - Suspends a Digital 748 * dvb_frontend_suspend() - Suspends a Digital TV frontend 755 * 749 * 756 * @fe: pointer to &struct dvb_frontend 750 * @fe: pointer to &struct dvb_frontend 757 * 751 * 758 * This function prepares a Digital TV fronten 752 * This function prepares a Digital TV frontend to suspend. 759 * 753 * 760 * In order to prepare the tuner to suspend, i 754 * In order to prepare the tuner to suspend, if 761 * &dvb_frontend_ops.tuner_ops.suspend\(\) is 755 * &dvb_frontend_ops.tuner_ops.suspend\(\) is available, it calls it. Otherwise, 762 * it will call &dvb_frontend_ops.tuner_ops.sl 756 * it will call &dvb_frontend_ops.tuner_ops.sleep\(\), if available. 763 * 757 * 764 * It will also call &dvb_frontend_ops.suspend !! 758 * It will also call &dvb_frontend_ops.sleep\(\) to put the demod to suspend. 765 * if available. Otherwise it will call &dvb_f << 766 * 759 * 767 * The drivers should also call dvb_frontend_s 760 * The drivers should also call dvb_frontend_suspend\(\) as part of their 768 * handler for the &device_driver.suspend\(\). 761 * handler for the &device_driver.suspend\(\). 769 */ 762 */ 770 int dvb_frontend_suspend(struct dvb_frontend * 763 int dvb_frontend_suspend(struct dvb_frontend *fe); 771 764 772 /** 765 /** 773 * dvb_frontend_resume() - Resumes a Digital T 766 * dvb_frontend_resume() - Resumes a Digital TV frontend 774 * 767 * 775 * @fe: pointer to &struct dvb_frontend 768 * @fe: pointer to &struct dvb_frontend 776 * 769 * 777 * This function resumes the usual operation o 770 * This function resumes the usual operation of the tuner after resume. 778 * 771 * 779 * In order to resume the frontend, it calls t !! 772 * In order to resume the frontend, it calls the demod &dvb_frontend_ops.init\(\). 780 * &dvb_frontend_ops.resume\(\) if available. << 781 * &dvb_frontend_ops.init\(\). << 782 * 773 * 783 * If &dvb_frontend_ops.tuner_ops.resume\(\) i 774 * If &dvb_frontend_ops.tuner_ops.resume\(\) is available, It, it calls it. 784 * Otherwise,t will call &dvb_frontend_ops.tun 775 * Otherwise,t will call &dvb_frontend_ops.tuner_ops.init\(\), if available. 785 * 776 * 786 * Once tuner and demods are resumed, it will 777 * Once tuner and demods are resumed, it will enforce that the SEC voltage and 787 * tone are restored to their previous values 778 * tone are restored to their previous values and wake up the frontend's 788 * kthread in order to retune the frontend. 779 * kthread in order to retune the frontend. 789 * 780 * 790 * The drivers should also call dvb_frontend_r 781 * The drivers should also call dvb_frontend_resume() as part of their 791 * handler for the &device_driver.resume\(\). 782 * handler for the &device_driver.resume\(\). 792 */ 783 */ 793 int dvb_frontend_resume(struct dvb_frontend *f 784 int dvb_frontend_resume(struct dvb_frontend *fe); 794 785 795 /** 786 /** 796 * dvb_frontend_reinitialise() - forces a rein 787 * dvb_frontend_reinitialise() - forces a reinitialisation at the frontend 797 * 788 * 798 * @fe: pointer to &struct dvb_frontend 789 * @fe: pointer to &struct dvb_frontend 799 * 790 * 800 * Calls &dvb_frontend_ops.init\(\) and &dvb_f 791 * Calls &dvb_frontend_ops.init\(\) and &dvb_frontend_ops.tuner_ops.init\(\), 801 * and resets SEC tone and voltage (for Satell 792 * and resets SEC tone and voltage (for Satellite systems). 802 * 793 * 803 * NOTE: Currently, this function is used only 794 * NOTE: Currently, this function is used only by one driver (budget-av). 804 * It seems to be due to address some special 795 * It seems to be due to address some special issue with that specific 805 * frontend. 796 * frontend. 806 */ 797 */ 807 void dvb_frontend_reinitialise(struct dvb_fron 798 void dvb_frontend_reinitialise(struct dvb_frontend *fe); 808 799 809 /** 800 /** 810 * dvb_frontend_sleep_until() - Sleep for the 801 * dvb_frontend_sleep_until() - Sleep for the amount of time given by 811 * add_usec parameter 802 * add_usec parameter 812 * 803 * 813 * @waketime: pointer to &struct ktime_t 804 * @waketime: pointer to &struct ktime_t 814 * @add_usec: time to sleep, in microseconds 805 * @add_usec: time to sleep, in microseconds 815 * 806 * 816 * This function is used to measure the time r 807 * This function is used to measure the time required for the 817 * FE_DISHNETWORK_SEND_LEGACY_CMD() ioctl to w 808 * FE_DISHNETWORK_SEND_LEGACY_CMD() ioctl to work. It needs to be as precise 818 * as possible, as it affects the detection of 809 * as possible, as it affects the detection of the dish tone command at the 819 * satellite subsystem. 810 * satellite subsystem. 820 * 811 * 821 * Its used internally by the DVB frontend cor 812 * Its used internally by the DVB frontend core, in order to emulate 822 * FE_DISHNETWORK_SEND_LEGACY_CMD() using the 813 * FE_DISHNETWORK_SEND_LEGACY_CMD() using the &dvb_frontend_ops.set_voltage\(\) 823 * callback. 814 * callback. 824 * 815 * 825 * NOTE: it should not be used at the drivers, 816 * NOTE: it should not be used at the drivers, as the emulation for the 826 * legacy callback is provided by the Kernel. 817 * legacy callback is provided by the Kernel. The only situation where this 827 * should be at the drivers is when there are 818 * should be at the drivers is when there are some bugs at the hardware that 828 * would prevent the core emulation to work. O 819 * would prevent the core emulation to work. On such cases, the driver would 829 * be writing a &dvb_frontend_ops.dishnetwork_ 820 * be writing a &dvb_frontend_ops.dishnetwork_send_legacy_command\(\) and 830 * calling this function directly. 821 * calling this function directly. 831 */ 822 */ 832 void dvb_frontend_sleep_until(ktime_t *waketim 823 void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec); 833 824 834 #endif 825 #endif 835 826
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.