d2b021792791e1760bda63f00071bafcc64694c8
[linux-2.6.git] / drivers / media / dvb / dvb-core / dvb_frontend.h
1 /*
2  * dvb_frontend.h
3  *
4  * Copyright (C) 2001 convergence integrated media GmbH
5  * Copyright (C) 2004 convergence GmbH
6  *
7  * Written by Ralph Metzler
8  * Overhauled by Holger Waechtler
9  * Kernel I2C stuff by Michael Hunold <hunold@convergence.de>
10  *
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.
15  *
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.
20  *
21
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.
25  *
26  */
27
28 #ifndef _DVB_FRONTEND_H_
29 #define _DVB_FRONTEND_H_
30
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
39 #include <linux/dvb/frontend.h>
40
41 #include "dvbdev.h"
42
43 /* FIXME: Move to i2c-id.h */
44 #define I2C_DRIVERID_DVBFE_SP8870       I2C_DRIVERID_EXP2
45 #define I2C_DRIVERID_DVBFE_CX22700      I2C_DRIVERID_EXP2
46 #define I2C_DRIVERID_DVBFE_AT76C651     I2C_DRIVERID_EXP2
47 #define I2C_DRIVERID_DVBFE_CX24110      I2C_DRIVERID_EXP2
48 #define I2C_DRIVERID_DVBFE_CX22702      I2C_DRIVERID_EXP2
49 #define I2C_DRIVERID_DVBFE_DIB3000MB    I2C_DRIVERID_EXP2
50 #define I2C_DRIVERID_DVBFE_DST          I2C_DRIVERID_EXP2
51 #define I2C_DRIVERID_DVBFE_DUMMY        I2C_DRIVERID_EXP2
52 #define I2C_DRIVERID_DVBFE_L64781       I2C_DRIVERID_EXP2
53 #define I2C_DRIVERID_DVBFE_MT312        I2C_DRIVERID_EXP2
54 #define I2C_DRIVERID_DVBFE_MT352        I2C_DRIVERID_EXP2
55 #define I2C_DRIVERID_DVBFE_NXT6000      I2C_DRIVERID_EXP2
56 #define I2C_DRIVERID_DVBFE_SP887X       I2C_DRIVERID_EXP2
57 #define I2C_DRIVERID_DVBFE_STV0299      I2C_DRIVERID_EXP2
58 #define I2C_DRIVERID_DVBFE_TDA1004X     I2C_DRIVERID_EXP2
59 #define I2C_DRIVERID_DVBFE_TDA8083      I2C_DRIVERID_EXP2
60 #define I2C_DRIVERID_DVBFE_VES1820      I2C_DRIVERID_EXP2
61 #define I2C_DRIVERID_DVBFE_VES1X93      I2C_DRIVERID_EXP2
62 #define I2C_DRIVERID_DVBFE_TDA80XX      I2C_DRIVERID_EXP2
63
64
65 struct dvb_frontend_tune_settings {
66         int min_delay_ms;
67         int step_size;
68         int max_drift;
69         struct dvb_frontend_parameters parameters;
70 };
71
72 struct dvb_frontend;
73
74 struct dvb_frontend_ops {
75
76         struct dvb_frontend_info info;
77
78         void (*release)(struct dvb_frontend* fe);
79
80         int (*init)(struct dvb_frontend* fe);
81         int (*sleep)(struct dvb_frontend* fe);
82
83         int (*set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
84         int (*get_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
85         int (*get_tune_settings)(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* settings);
86
87         int (*read_status)(struct dvb_frontend* fe, fe_status_t* status);
88         int (*read_ber)(struct dvb_frontend* fe, u32* ber);
89         int (*read_signal_strength)(struct dvb_frontend* fe, u16* strength);
90         int (*read_snr)(struct dvb_frontend* fe, u16* snr);
91         int (*read_ucblocks)(struct dvb_frontend* fe, u32* ucblocks);
92
93         int (*diseqc_reset_overload)(struct dvb_frontend* fe);
94         int (*diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
95         int (*diseqc_recv_slave_reply)(struct dvb_frontend* fe, struct dvb_diseqc_slave_reply* reply);
96         int (*diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
97         int (*set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
98         int (*set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
99         int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, int arg);
100         int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned int cmd);
101 };
102
103 #define MAX_EVENT 8
104
105 struct dvb_fe_events {
106         struct dvb_frontend_event events[MAX_EVENT];
107         int                       eventw;
108         int                       eventr;
109         int                       overflow;
110         wait_queue_head_t         wait_queue;
111         struct semaphore          sem;
112 };
113
114 struct dvb_frontend {
115         struct dvb_frontend_ops* ops;
116         struct dvb_adapter *dvb;
117         void* demodulator_priv;
118         void* frontend_priv;
119 };
120
121 extern int dvb_register_frontend(struct dvb_adapter* dvb,
122                                  struct dvb_frontend* fe);
123
124 extern int dvb_unregister_frontend(struct dvb_frontend* fe);
125
126 #endif