[ARM] Support register switch in nommu mode
[linux-2.6/verdex.git] / drivers / media / dvb / frontends / dvb_dummy_fe.c
blob645946a992d94b1dda65bf33e14561238ee6329f
1 /*
2 * Driver for Dummy Frontend
4 * Written by Emard <emard@softhome.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
22 #include <linux/module.h>
23 #include <linux/moduleparam.h>
24 #include <linux/init.h>
25 #include <linux/string.h>
26 #include <linux/slab.h>
28 #include "dvb_frontend.h"
29 #include "dvb_dummy_fe.h"
32 struct dvb_dummy_fe_state {
33 struct dvb_frontend_ops ops;
34 struct dvb_frontend frontend;
38 static int dvb_dummy_fe_read_status(struct dvb_frontend* fe, fe_status_t* status)
40 *status = FE_HAS_SIGNAL
41 | FE_HAS_CARRIER
42 | FE_HAS_VITERBI
43 | FE_HAS_SYNC
44 | FE_HAS_LOCK;
46 return 0;
49 static int dvb_dummy_fe_read_ber(struct dvb_frontend* fe, u32* ber)
51 *ber = 0;
52 return 0;
55 static int dvb_dummy_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength)
57 *strength = 0;
58 return 0;
61 static int dvb_dummy_fe_read_snr(struct dvb_frontend* fe, u16* snr)
63 *snr = 0;
64 return 0;
67 static int dvb_dummy_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
69 *ucblocks = 0;
70 return 0;
73 static int dvb_dummy_fe_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
75 return 0;
78 static int dvb_dummy_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
80 return 0;
83 static int dvb_dummy_fe_sleep(struct dvb_frontend* fe)
85 return 0;
88 static int dvb_dummy_fe_init(struct dvb_frontend* fe)
90 return 0;
93 static int dvb_dummy_fe_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
95 return 0;
98 static int dvb_dummy_fe_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
100 return 0;
103 static void dvb_dummy_fe_release(struct dvb_frontend* fe)
105 struct dvb_dummy_fe_state* state = fe->demodulator_priv;
106 kfree(state);
109 static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops;
111 struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
113 struct dvb_dummy_fe_state* state = NULL;
115 /* allocate memory for the internal state */
116 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
117 if (state == NULL) goto error;
119 /* setup the state */
120 memcpy(&state->ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
122 /* create dvb_frontend */
123 state->frontend.ops = &state->ops;
124 state->frontend.demodulator_priv = state;
125 return &state->frontend;
127 error:
128 kfree(state);
129 return NULL;
132 static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops;
134 struct dvb_frontend* dvb_dummy_fe_qpsk_attach()
136 struct dvb_dummy_fe_state* state = NULL;
138 /* allocate memory for the internal state */
139 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
140 if (state == NULL) goto error;
142 /* setup the state */
143 memcpy(&state->ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
145 /* create dvb_frontend */
146 state->frontend.ops = &state->ops;
147 state->frontend.demodulator_priv = state;
148 return &state->frontend;
150 error:
151 kfree(state);
152 return NULL;
155 static struct dvb_frontend_ops dvb_dummy_fe_qam_ops;
157 struct dvb_frontend* dvb_dummy_fe_qam_attach()
159 struct dvb_dummy_fe_state* state = NULL;
161 /* allocate memory for the internal state */
162 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
163 if (state == NULL) goto error;
165 /* setup the state */
166 memcpy(&state->ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
168 /* create dvb_frontend */
169 state->frontend.ops = &state->ops;
170 state->frontend.demodulator_priv = state;
171 return &state->frontend;
173 error:
174 kfree(state);
175 return NULL;
178 static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = {
180 .info = {
181 .name = "Dummy DVB-T",
182 .type = FE_OFDM,
183 .frequency_min = 0,
184 .frequency_max = 863250000,
185 .frequency_stepsize = 62500,
186 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
187 FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
188 FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |
189 FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
190 FE_CAN_TRANSMISSION_MODE_AUTO |
191 FE_CAN_GUARD_INTERVAL_AUTO |
192 FE_CAN_HIERARCHY_AUTO,
195 .release = dvb_dummy_fe_release,
197 .init = dvb_dummy_fe_init,
198 .sleep = dvb_dummy_fe_sleep,
200 .set_frontend = dvb_dummy_fe_set_frontend,
201 .get_frontend = dvb_dummy_fe_get_frontend,
203 .read_status = dvb_dummy_fe_read_status,
204 .read_ber = dvb_dummy_fe_read_ber,
205 .read_signal_strength = dvb_dummy_fe_read_signal_strength,
206 .read_snr = dvb_dummy_fe_read_snr,
207 .read_ucblocks = dvb_dummy_fe_read_ucblocks,
210 static struct dvb_frontend_ops dvb_dummy_fe_qam_ops = {
212 .info = {
213 .name = "Dummy DVB-C",
214 .type = FE_QAM,
215 .frequency_stepsize = 62500,
216 .frequency_min = 51000000,
217 .frequency_max = 858000000,
218 .symbol_rate_min = (57840000/2)/64, /* SACLK/64 == (XIN/2)/64 */
219 .symbol_rate_max = (57840000/2)/4, /* SACLK/4 */
220 .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 |
221 FE_CAN_QAM_128 | FE_CAN_QAM_256 |
222 FE_CAN_FEC_AUTO | FE_CAN_INVERSION_AUTO
225 .release = dvb_dummy_fe_release,
227 .init = dvb_dummy_fe_init,
228 .sleep = dvb_dummy_fe_sleep,
230 .set_frontend = dvb_dummy_fe_set_frontend,
231 .get_frontend = dvb_dummy_fe_get_frontend,
233 .read_status = dvb_dummy_fe_read_status,
234 .read_ber = dvb_dummy_fe_read_ber,
235 .read_signal_strength = dvb_dummy_fe_read_signal_strength,
236 .read_snr = dvb_dummy_fe_read_snr,
237 .read_ucblocks = dvb_dummy_fe_read_ucblocks,
240 static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = {
242 .info = {
243 .name = "Dummy DVB-S",
244 .type = FE_QPSK,
245 .frequency_min = 950000,
246 .frequency_max = 2150000,
247 .frequency_stepsize = 250, /* kHz for QPSK frontends */
248 .frequency_tolerance = 29500,
249 .symbol_rate_min = 1000000,
250 .symbol_rate_max = 45000000,
251 .caps = FE_CAN_INVERSION_AUTO |
252 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
253 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
254 FE_CAN_QPSK
257 .release = dvb_dummy_fe_release,
259 .init = dvb_dummy_fe_init,
260 .sleep = dvb_dummy_fe_sleep,
262 .set_frontend = dvb_dummy_fe_set_frontend,
263 .get_frontend = dvb_dummy_fe_get_frontend,
265 .read_status = dvb_dummy_fe_read_status,
266 .read_ber = dvb_dummy_fe_read_ber,
267 .read_signal_strength = dvb_dummy_fe_read_signal_strength,
268 .read_snr = dvb_dummy_fe_read_snr,
269 .read_ucblocks = dvb_dummy_fe_read_ucblocks,
271 .set_voltage = dvb_dummy_fe_set_voltage,
272 .set_tone = dvb_dummy_fe_set_tone,
275 MODULE_DESCRIPTION("DVB DUMMY Frontend");
276 MODULE_AUTHOR("Emard");
277 MODULE_LICENSE("GPL");
279 EXPORT_SYMBOL(dvb_dummy_fe_ofdm_attach);
280 EXPORT_SYMBOL(dvb_dummy_fe_qam_attach);
281 EXPORT_SYMBOL(dvb_dummy_fe_qpsk_attach);