V4L/DVB (6715): ivtv: Remove unnecessary register update
[linux-2.6/verdex.git] / drivers / media / dvb / dvb-core / dvb_frontend.h
blob50dc5568efaadc8e356c95083dd9cc73a9955b7e
1 /*
2 * dvb_frontend.h
4 * Copyright (C) 2001 convergence integrated media GmbH
5 * Copyright (C) 2004 convergence GmbH
7 * Written by Ralph Metzler
8 * Overhauled by Holger Waechtler
9 * Kernel I2C stuff by Michael Hunold <hunold@convergence.de>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #ifndef _DVB_FRONTEND_H_
29 #define _DVB_FRONTEND_H_
31 #include <linux/types.h>
32 #include <linux/sched.h>
33 #include <linux/ioctl.h>
34 #include <linux/i2c.h>
35 #include <linux/module.h>
36 #include <linux/errno.h>
37 #include <linux/delay.h>
38 #include <linux/mutex.h>
40 #include <linux/dvb/frontend.h>
42 #include "dvbdev.h"
44 struct dvb_frontend_tune_settings {
45 int min_delay_ms;
46 int step_size;
47 int max_drift;
48 struct dvb_frontend_parameters parameters;
51 struct dvb_frontend;
53 struct dvb_tuner_info {
54 char name[128];
56 u32 frequency_min;
57 u32 frequency_max;
58 u32 frequency_step;
60 u32 bandwidth_min;
61 u32 bandwidth_max;
62 u32 bandwidth_step;
65 struct analog_tuner_ops;
67 struct analog_parameters {
68 unsigned int frequency;
69 unsigned int mode;
70 unsigned int audmode;
71 u64 std;
74 struct dvb_tuner_ops {
76 struct dvb_tuner_info info;
78 int (*release)(struct dvb_frontend *fe);
79 int (*init)(struct dvb_frontend *fe);
80 int (*sleep)(struct dvb_frontend *fe);
82 /** This is for simple PLLs - set all parameters in one go. */
83 int (*set_params)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p);
84 int (*set_analog_params)(struct dvb_frontend *fe, struct analog_parameters *p);
86 /** This is support for demods like the mt352 - fills out the supplied buffer with what to write. */
87 int (*calc_regs)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p, u8 *buf, int buf_len);
89 /** This is to allow setting tuner-specific configs */
90 int (*set_config)(struct dvb_frontend *fe, void *priv_cfg);
92 int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency);
93 int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
95 #define TUNER_STATUS_LOCKED 1
96 #define TUNER_STATUS_STEREO 2
97 int (*get_status)(struct dvb_frontend *fe, u32 *status);
98 int (*get_rf_strength)(struct dvb_frontend *fe, u16 *strength);
100 /** These are provided seperately from set_params in order to facilitate silicon
101 * tuners which require sophisticated tuning loops, controlling each parameter seperately. */
102 int (*set_frequency)(struct dvb_frontend *fe, u32 frequency);
103 int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth);
106 struct dvb_frontend_ops {
108 struct dvb_frontend_info info;
110 void (*release)(struct dvb_frontend* fe);
111 void (*release_sec)(struct dvb_frontend* fe);
113 int (*init)(struct dvb_frontend* fe);
114 int (*sleep)(struct dvb_frontend* fe);
116 int (*write)(struct dvb_frontend* fe, u8* buf, int len);
118 /* if this is set, it overrides the default swzigzag */
119 int (*tune)(struct dvb_frontend* fe,
120 struct dvb_frontend_parameters* params,
121 unsigned int mode_flags,
122 unsigned int *delay,
123 fe_status_t *status);
124 /* get frontend tuning algorithm from the module */
125 int (*get_frontend_algo)(struct dvb_frontend *fe);
127 /* these two are only used for the swzigzag code */
128 int (*set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
129 int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);
131 int (*get_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
133 int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
134 int (*read_ber)(struct dvb_frontend* fe, u32* ber);
135 int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength);
136 int (*read_snr)(struct dvb_frontend* fe, u16* snr);
137 int (*read_ucblocks)(struct dvb_frontend* fe, u32* ucblocks);
139 int (*diseqc_reset_overload)(struct dvb_frontend* fe);
140 int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
141 int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply);
142 int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
143 int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
144 int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
145 int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg);
146 int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
147 int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
148 int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire);
150 struct dvb_tuner_ops tuner_ops;
151 struct analog_tuner_ops *analog_demod_ops;
154 #define MAX_EVENT 8
156 struct dvb_fe_events {
157 struct dvb_frontend_event events[MAX_EVENT];
158 int eventw;
159 int eventr;
160 int overflow;
161 wait_queue_head_t wait_queue;
162 struct mutex mtx;
165 struct dvb_frontend {
166 struct dvb_frontend_ops ops;
167 struct dvb_adapter *dvb;
168 void *demodulator_priv;
169 void *tuner_priv;
170 void *frontend_priv;
171 void *sec_priv;
172 void *analog_demod_priv;
175 extern int dvb_register_frontend(struct dvb_adapter *dvb,
176 struct dvb_frontend *fe);
178 extern int dvb_unregister_frontend(struct dvb_frontend *fe);
180 extern void dvb_frontend_detach(struct dvb_frontend *fe);
182 extern void dvb_frontend_reinitialise(struct dvb_frontend *fe);
184 extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec);
185 extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime);
187 #endif