4 Copyright (C) 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.
21 #include <linux/signal.h>
22 #include <linux/sched.h>
23 #include <linux/interrupt.h>
27 #include "dvb_demux.h"
28 #include "dvb_frontend.h"
32 #include "mantis_common.h"
33 #include "mantis_ioc.h"
34 #include "mantis_dvb.h"
35 #include "mantis_vp1033.h"
36 #include "mantis_reg.h"
38 u8 lgtdqcs001f_inittab
[] = {
83 #define MANTIS_MODEL_NAME "VP-1033"
84 #define MANTIS_DEV_TYPE "DVB-S/DSS"
86 int lgtdqcs001f_tuner_set(struct dvb_frontend
*fe
,
87 struct dvb_frontend_parameters
*params
)
89 struct mantis_pci
*mantis
= fe
->dvb
->priv
;
90 struct i2c_adapter
*adapter
= &mantis
->adapter
;
96 struct i2c_msg msg
= {.addr
= 0x61, .flags
= 0, .buf
= buf
, .len
= sizeof(buf
)};
98 div
= params
->frequency
/ 250;
100 buf
[0] = (div
>> 8) & 0x7f;
105 if (params
->frequency
< 1531000)
109 if (i2c_transfer(adapter
, &msg
, 1) < 0) {
110 dprintk(MANTIS_ERROR
, 1, "Write: I2C Transfer failed");
113 msleep_interruptible(100);
118 int lgtdqcs001f_set_symbol_rate(struct dvb_frontend
*fe
,
119 u32 srate
, u32 ratio
)
124 if (srate
< 1500000) {
127 } else if (srate
< 3000000) {
130 } else if (srate
< 7000000) {
133 } else if (srate
< 14000000) {
136 } else if (srate
< 30000000) {
139 } else if (srate
< 45000000) {
143 stv0299_writereg(fe
, 0x13, aclk
);
144 stv0299_writereg(fe
, 0x14, bclk
);
146 stv0299_writereg(fe
, 0x1f, (ratio
>> 16) & 0xff);
147 stv0299_writereg(fe
, 0x20, (ratio
>> 8) & 0xff);
148 stv0299_writereg(fe
, 0x21, ratio
& 0xf0);
153 struct stv0299_config lgtdqcs001f_config
= {
154 .demod_address
= 0x68,
155 .inittab
= lgtdqcs001f_inittab
,
159 .volt13_op0_op1
= STV0299_VOLT13_OP0
,
161 .set_symbol_rate
= lgtdqcs001f_set_symbol_rate
,
164 static int vp1033_frontend_init(struct mantis_pci
*mantis
, struct dvb_frontend
*fe
)
166 struct i2c_adapter
*adapter
= &mantis
->adapter
;
170 err
= mantis_frontend_power(mantis
, POWER_ON
);
172 mantis_frontend_soft_reset(mantis
);
175 dprintk(MANTIS_ERROR
, 1, "Probing for STV0299 (DVB-S)");
176 fe
= stv0299_attach(&lgtdqcs001f_config
, adapter
);
179 fe
->ops
.tuner_ops
.set_params
= lgtdqcs001f_tuner_set
;
180 dprintk(MANTIS_ERROR
, 1, "found STV0299 DVB-S frontend @ 0x%02x",
181 lgtdqcs001f_config
.demod_address
);
183 dprintk(MANTIS_ERROR
, 1, "Mantis DVB-S STV0299 frontend attach success");
188 dprintk(MANTIS_ERROR
, 1, "Frontend on <%s> POWER ON failed! <%d>",
195 dprintk(MANTIS_ERROR
, 1, "Done!");
200 struct mantis_hwconfig vp1033_config
= {
201 .model_name
= MANTIS_MODEL_NAME
,
202 .dev_type
= MANTIS_DEV_TYPE
,
203 .ts_size
= MANTIS_TS_204
,
205 .baud_rate
= MANTIS_BAUD_9600
,
206 .parity
= MANTIS_PARITY_NONE
,
209 .frontend_init
= vp1033_frontend_init
,