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