V4L/DVB (8734): Initial support for AME DTV-5100 USB2.0 DVB-T
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / media / dvb / dvb-usb / dtv5100-fe.c
blob08fe33bcc5d60b090fe53c897131d75eaf071097
1 /*
2 * DVB USB Linux driver for AME DTV-5100 USB2.0 DVB-T
4 * Copyright (C) 2008 Antoine Jacquet <royale@zerezo.com>
5 * http://royale.zerezo.com/dtv5100/
7 * Inspired by dvb_dummy_fe.c
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "dvb-usb.h"
25 #include "qt1010_priv.h"
27 struct dtv5100_fe_state {
28 struct dvb_frontend frontend;
31 static int dtv5100_fe_read_status(struct dvb_frontend* fe, fe_status_t* status)
33 *status = FE_HAS_SIGNAL
34 | FE_HAS_CARRIER
35 | FE_HAS_VITERBI
36 | FE_HAS_SYNC
37 | FE_HAS_LOCK;
39 return 0;
42 static int dtv5100_fe_read_ber(struct dvb_frontend* fe, u32* ber)
44 *ber = 0;
45 return 0;
48 static int dtv5100_fe_read_signal_strength(struct dvb_frontend* fe, u16* strength)
50 *strength = 0;
51 return 0;
54 static int dtv5100_fe_read_snr(struct dvb_frontend* fe, u16* snr)
56 *snr = 0;
57 return 0;
60 static int dtv5100_fe_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
62 *ucblocks = 0;
63 return 0;
66 static int dtv5100_fe_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
68 return 0;
71 static int dtv5100_fe_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
73 if (fe->ops.tuner_ops.set_params) {
74 fe->ops.tuner_ops.set_params(fe, p);
75 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
78 return 0;
81 static int dtv5100_fe_sleep(struct dvb_frontend* fe)
83 return 0;
86 static int dtv5100_fe_init(struct dvb_frontend* fe)
88 return 0;
91 static void dtv5100_fe_release(struct dvb_frontend* fe)
93 struct dtv5100_fe_state* state = fe->demodulator_priv;
94 kfree(state);
97 static struct dvb_frontend_ops dtv5100_fe_ops;
99 struct dvb_frontend* dtv5100_fe_attach(void)
101 struct dtv5100_fe_state* state = NULL;
103 /* allocate memory for the internal state */
104 state = kmalloc(sizeof(struct dtv5100_fe_state), GFP_KERNEL);
105 if (state == NULL) goto error;
107 /* create dvb_frontend */
108 memcpy(&state->frontend.ops, &dtv5100_fe_ops, sizeof(struct dvb_frontend_ops));
109 state->frontend.demodulator_priv = state;
110 return &state->frontend;
112 error:
113 kfree(state);
114 return NULL;
117 static struct dvb_frontend_ops dtv5100_fe_ops = {
119 .info = {
120 .name = "Dummy DVB-T",
121 .type = FE_OFDM,
122 .frequency_min = QT1010_MIN_FREQ,
123 .frequency_max = QT1010_MAX_FREQ,
124 .frequency_stepsize = QT1010_STEP,
125 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
126 FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
127 FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 | FE_CAN_FEC_AUTO |
128 FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
129 FE_CAN_TRANSMISSION_MODE_AUTO |
130 FE_CAN_GUARD_INTERVAL_AUTO |
131 FE_CAN_HIERARCHY_AUTO,
134 .release = dtv5100_fe_release,
136 .init = dtv5100_fe_init,
137 .sleep = dtv5100_fe_sleep,
139 .set_frontend = dtv5100_fe_set_frontend,
140 .get_frontend = dtv5100_fe_get_frontend,
142 .read_status = dtv5100_fe_read_status,
143 .read_ber = dtv5100_fe_read_ber,
144 .read_signal_strength = dtv5100_fe_read_signal_strength,
145 .read_snr = dtv5100_fe_read_snr,
146 .read_ucblocks = dtv5100_fe_read_ucblocks,