aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/mantis/mantis_vp1033.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/mantis/mantis_vp1033.c')
-rw-r--r--drivers/media/dvb/mantis/mantis_vp1033.c98
1 files changed, 65 insertions, 33 deletions
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
index 64cdfb8b709b..f2092ce9c4be 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -18,6 +18,18 @@
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/ 19*/
20 20
21#include <asm/irq.h>
22#include <linux/signal.h>
23#include <linux/sched.h>
24#include <linux/interrupt.h>
25
26#include "dmxdev.h"
27#include "dvbdev.h"
28#include "dvb_demux.h"
29#include "dvb_frontend.h"
30#include "dvb_net.h"
31
32#include "stv0299.h"
21#include "mantis_common.h" 33#include "mantis_common.h"
22#include "mantis_vp1033.h" 34#include "mantis_vp1033.h"
23 35
@@ -66,47 +78,21 @@ u8 lgtdqcs001f_inittab[] = {
66 0xff, 0xff, 78 0xff, 0xff,
67}; 79};
68 80
69struct stv0299_config lgtdqcs001f_config = {
70 .demod_address = 0x68,
71 .inittab = lgtdqcs001f_inittab,
72 .mclk = 88000000UL,
73// .invert = 0,
74 .invert = 1,
75// .enhanced_tuning = 0,
76 .skip_reinit = 0,
77// .lock_output = STV0229_LOCKOUTPUT_0,
78 .volt13_op0_op1 = STV0299_VOLT13_OP0,
79 .min_delay_ms = 100,
80 .set_symbol_rate = lgtdqcs001f_set_symbol_rate,
81// .pll_set = lgtdqcs001f_pll_set,
82};
83
84#define MANTIS_MODEL_NAME "VP-1033" 81#define MANTIS_MODEL_NAME "VP-1033"
85#define MANTIS_DEV_TYPE "DVB-S/DSS" 82#define MANTIS_DEV_TYPE "DVB-S/DSS"
86 83
87struct mantis_hwconfig vp1033_mantis_config = {
88 .model_name = MANTIS_MODEL_NAME,
89 .dev_type = MANTIS_DEV_TYPE,
90 .ts_size = MANTIS_TS_204,
91 .baud_rate = MANTIS_BAUD_9600,
92 .parity = MANTIS_PARITY_NONE,
93 .bytes = 0,
94};
95
96int lgtdqcs001f_tuner_set(struct dvb_frontend *fe, 84int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
97 struct dvb_frontend_parameters *params) 85 struct dvb_frontend_parameters *params)
98{ 86{
87 struct mantis_pci *mantis = fe->dvb->priv;
88 struct i2c_adapter *adapter = &mantis->adapter;
89
99 u8 buf[4]; 90 u8 buf[4];
100 u32 div; 91 u32 div;
101 92
102 struct mantis_pci *mantis = fe->dvb->priv;
103 93
104 struct i2c_msg msg = { 94 struct i2c_msg msg = {.addr = 0x61, .flags = 0, .buf = buf, .len = sizeof (buf) };
105 .addr = 0x61, 95
106 .flags = 0,
107 .buf = buf,
108 .len = sizeof (buf)
109 };
110 div = params->frequency / 250; 96 div = params->frequency / 250;
111 97
112 buf[0] = (div >> 8) & 0x7f; 98 buf[0] = (div >> 8) & 0x7f;
@@ -118,8 +104,8 @@ int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
118 buf[3] |= 0x04; 104 buf[3] |= 0x04;
119 else 105 else
120 buf[3] &= ~0x04; 106 buf[3] &= ~0x04;
121 if (i2c_transfer(&mantis->adapter, &msg, 1) < 0) { 107 if (i2c_transfer(adapter, &msg, 1) < 0) {
122 dprintk(verbose, MANTIS_ERROR, 1, "Write: I2C Transfer failed"); 108 dprintk(MANTIS_ERROR, 1, "Write: I2C Transfer failed");
123 return -EIO; 109 return -EIO;
124 } 110 }
125 msleep_interruptible(100); 111 msleep_interruptible(100);
@@ -161,3 +147,49 @@ int lgtdqcs001f_set_symbol_rate(struct dvb_frontend *fe,
161 147
162 return 0; 148 return 0;
163} 149}
150
151struct stv0299_config lgtdqcs001f_config = {
152 .demod_address = 0x68,
153 .inittab = lgtdqcs001f_inittab,
154 .mclk = 88000000UL,
155 .invert = 0,
156 .skip_reinit = 0,
157 .volt13_op0_op1 = STV0299_VOLT13_OP0,
158 .min_delay_ms = 100,
159 .set_symbol_rate = lgtdqcs001f_set_symbol_rate,
160};
161
162static int vp1033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
163{
164 struct i2c_adapter *adapter = &mantis->adapter;
165
166 dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
167 fe = stv0299_attach(&lgtdqcs001f_config, adapter);
168
169 if (fe) {
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);
173
174 dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success");
175 } else {
176 return -1;
177 }
178
179 mantis->fe = fe;
180 dprintk(MANTIS_ERROR, 1, "Done!");
181
182 return 0;
183}
184
185struct mantis_hwconfig vp1033_config = {
186 .model_name = MANTIS_MODEL_NAME,
187 .dev_type = MANTIS_DEV_TYPE,
188 .ts_size = MANTIS_TS_204,
189
190 .baud_rate = MANTIS_BAUD_9600,
191 .parity = MANTIS_PARITY_NONE,
192 .bytes = 0,
193
194 .frontend_init = vp1033_frontend_init,
195};