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