4 Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
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
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <linux/signal.h>
23 #include <linux/sched.h>
24 #include <linux/interrupt.h>
28 #include "dvb_demux.h"
29 #include "dvb_frontend.h"
33 #include "mantis_common.h"
34 #include "mantis_vp1033.h"
36 u8 lgtdqcs001f_inittab[] = {
81 #define MANTIS_MODEL_NAME "VP-1033"
82 #define MANTIS_DEV_TYPE "DVB-S/DSS"
84 int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
85 struct dvb_frontend_parameters *params)
87 struct mantis_pci *mantis = fe->dvb->priv;
88 struct i2c_adapter *adapter = &mantis->adapter;
94 struct i2c_msg msg = {.addr = 0x61, .flags = 0, .buf = buf, .len = sizeof (buf) };
96 div = params->frequency / 250;
98 buf[0] = (div >> 8) & 0x7f;
103 if (params->frequency < 1531000)
107 if (i2c_transfer(adapter, &msg, 1) < 0) {
108 dprintk(MANTIS_ERROR, 1, "Write: I2C Transfer failed");
111 msleep_interruptible(100);
116 int lgtdqcs001f_set_symbol_rate(struct dvb_frontend *fe,
117 u32 srate, u32 ratio)
122 if (srate < 1500000) {
125 } else if (srate < 3000000) {
128 } else if (srate < 7000000) {
131 } else if (srate < 14000000) {
134 } else if (srate < 30000000) {
137 } else if (srate < 45000000) {
141 stv0299_writereg (fe, 0x13, aclk);
142 stv0299_writereg (fe, 0x14, bclk);
144 stv0299_writereg (fe, 0x1f, (ratio >> 16) & 0xff);
145 stv0299_writereg (fe, 0x20, (ratio >> 8) & 0xff);
146 stv0299_writereg (fe, 0x21, (ratio ) & 0xf0);
151 struct stv0299_config lgtdqcs001f_config = {
152 .demod_address = 0x68,
153 .inittab = lgtdqcs001f_inittab,
157 .volt13_op0_op1 = STV0299_VOLT13_OP0,
159 .set_symbol_rate = lgtdqcs001f_set_symbol_rate,
162 static int vp1033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
164 struct i2c_adapter *adapter = &mantis->adapter;
166 dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
167 fe = stv0299_attach(&lgtdqcs001f_config, adapter);
170 fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set;
171 dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x",
172 lgtdqcs001f_config.demod_address);
174 dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success");
180 dprintk(MANTIS_ERROR, 1, "Done!");
185 struct mantis_hwconfig vp1033_config = {
186 .model_name = MANTIS_MODEL_NAME,
187 .dev_type = MANTIS_DEV_TYPE,
188 .ts_size = MANTIS_TS_204,
190 .baud_rate = MANTIS_BAUD_9600,
191 .parity = MANTIS_PARITY_NONE,
194 .frontend_init = vp1033_frontend_init,