blob: a74ac0ddb83310ab619870a0f465771ca451eb7a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -03002 Driver for Zarlink VP310/MT312/ZL10313 Satellite Channel Decoder
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
4 Copyright (C) 2003 Andreas Oberritter <obi@linuxtv.org>
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -03005 Copyright (C) 2008 Matthias Schwarzott <zzam@gentoo.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 References:
23 http://products.zarlink.com/product_profiles/MT312.htm
24 http://products.zarlink.com/product_profiles/SL1935.htm
25*/
26
27#include <linux/delay.h>
28#include <linux/errno.h>
29#include <linux/init.h>
30#include <linux/kernel.h>
31#include <linux/module.h>
Tim Schmielau4e57b682005-10-30 15:03:48 -080032#include <linux/string.h>
33#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
35#include "dvb_frontend.h"
36#include "mt312_priv.h"
37#include "mt312.h"
38
Mauro Carvalho Chehab83937962013-11-02 05:05:18 -030039/* Max transfer size done by I2C transfer functions */
40#define MAX_XFER_SIZE 64
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42struct mt312_state {
Matthias Schwarzott89f64752007-12-21 08:56:44 -030043 struct i2c_adapter *i2c;
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 /* configuration settings */
Matthias Schwarzott89f64752007-12-21 08:56:44 -030045 const struct mt312_config *config;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 struct dvb_frontend frontend;
47
48 u8 id;
Matthias Schwarzott111221f2008-04-12 15:04:48 -030049 unsigned long xtal;
50 u8 freq_mult;
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
53static int debug;
54#define dprintk(args...) \
55 do { \
Matthias Schwarzott89f64752007-12-21 08:56:44 -030056 if (debug) \
57 printk(KERN_DEBUG "mt312: " args); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 } while (0)
59
Linus Torvalds1da177e2005-04-16 15:20:36 -070060#define MT312_PLL_CLK 10000000UL /* 10 MHz */
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -030061#define MT312_PLL_CLK_10_111 10111000UL /* 10.111 MHz */
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
Matthias Schwarzott89f64752007-12-21 08:56:44 -030063static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg,
Matthias Schwarzott1881ee82008-04-12 15:04:46 -030064 u8 *buf, const size_t count)
Linus Torvalds1da177e2005-04-16 15:20:36 -070065{
66 int ret;
67 struct i2c_msg msg[2];
68 u8 regbuf[1] = { reg };
69
70 msg[0].addr = state->config->demod_address;
71 msg[0].flags = 0;
72 msg[0].buf = regbuf;
73 msg[0].len = 1;
74 msg[1].addr = state->config->demod_address;
75 msg[1].flags = I2C_M_RD;
76 msg[1].buf = buf;
77 msg[1].len = count;
78
79 ret = i2c_transfer(state->i2c, msg, 2);
80
81 if (ret != 2) {
Matthias Schwarzott302e8ac2009-05-20 04:57:10 -030082 printk(KERN_DEBUG "%s: ret == %d\n", __func__, ret);
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 return -EREMOTEIO;
84 }
85
Matthias Schwarzott89f64752007-12-21 08:56:44 -030086 if (debug) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 int i;
88 dprintk("R(%d):", reg & 0x7f);
89 for (i = 0; i < count; i++)
Matthias Schwarzott0389b342009-07-02 16:17:28 -030090 printk(KERN_CONT " %02x", buf[i]);
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 printk("\n");
92 }
93
94 return 0;
95}
96
Matthias Schwarzott89f64752007-12-21 08:56:44 -030097static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg,
Matthias Schwarzott1881ee82008-04-12 15:04:46 -030098 const u8 *src, const size_t count)
Linus Torvalds1da177e2005-04-16 15:20:36 -070099{
100 int ret;
Mauro Carvalho Chehab83937962013-11-02 05:05:18 -0300101 u8 buf[MAX_XFER_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 struct i2c_msg msg;
103
Mauro Carvalho Chehab83937962013-11-02 05:05:18 -0300104 if (1 + count > sizeof(buf)) {
105 printk(KERN_WARNING
106 "mt312: write: len=%zd is too big!\n", count);
107 return -EINVAL;
108 }
109
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300110 if (debug) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 int i;
112 dprintk("W(%d):", reg & 0x7f);
113 for (i = 0; i < count; i++)
Matthias Schwarzott0389b342009-07-02 16:17:28 -0300114 printk(KERN_CONT " %02x", src[i]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 printk("\n");
116 }
117
118 buf[0] = reg;
119 memcpy(&buf[1], src, count);
120
121 msg.addr = state->config->demod_address;
122 msg.flags = 0;
123 msg.buf = buf;
124 msg.len = count + 1;
125
126 ret = i2c_transfer(state->i2c, &msg, 1);
127
128 if (ret != 1) {
Harvey Harrison271ddbf2008-04-08 23:20:00 -0300129 dprintk("%s: ret == %d\n", __func__, ret);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 return -EREMOTEIO;
131 }
132
133 return 0;
134}
135
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300136static inline int mt312_readreg(struct mt312_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 const enum mt312_reg_addr reg, u8 *val)
138{
139 return mt312_read(state, reg, val, 1);
140}
141
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300142static inline int mt312_writereg(struct mt312_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 const enum mt312_reg_addr reg, const u8 val)
144{
145 return mt312_write(state, reg, &val, 1);
146}
147
148static inline u32 mt312_div(u32 a, u32 b)
149{
150 return (a + (b / 2)) / b;
151}
152
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300153static int mt312_reset(struct mt312_state *state, const u8 full)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154{
155 return mt312_writereg(state, RESET, full ? 0x80 : 0x40);
156}
157
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300158static int mt312_get_inversion(struct mt312_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 fe_spectral_inversion_t *i)
160{
161 int ret;
162 u8 vit_mode;
163
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300164 ret = mt312_readreg(state, VIT_MODE, &vit_mode);
165 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 return ret;
167
168 if (vit_mode & 0x80) /* auto inversion was used */
169 *i = (vit_mode & 0x40) ? INVERSION_ON : INVERSION_OFF;
170
171 return 0;
172}
173
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300174static int mt312_get_symbol_rate(struct mt312_state *state, u32 *sr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175{
176 int ret;
177 u8 sym_rate_h;
178 u8 dec_ratio;
179 u16 sym_rat_op;
180 u16 monitor;
181 u8 buf[2];
182
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300183 ret = mt312_readreg(state, SYM_RATE_H, &sym_rate_h);
184 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 return ret;
186
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300187 if (sym_rate_h & 0x80) {
188 /* symbol rate search was used */
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300189 ret = mt312_writereg(state, MON_CTRL, 0x03);
190 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191 return ret;
192
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300193 ret = mt312_read(state, MONITOR_H, buf, sizeof(buf));
194 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 return ret;
196
197 monitor = (buf[0] << 8) | buf[1];
198
Matthias Schwarzott0b6a3342007-12-21 08:58:09 -0300199 dprintk("sr(auto) = %u\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 mt312_div(monitor * 15625, 4));
201 } else {
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300202 ret = mt312_writereg(state, MON_CTRL, 0x05);
203 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204 return ret;
205
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300206 ret = mt312_read(state, MONITOR_H, buf, sizeof(buf));
207 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 return ret;
209
210 dec_ratio = ((buf[0] >> 5) & 0x07) * 32;
211
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300212 ret = mt312_read(state, SYM_RAT_OP_H, buf, sizeof(buf));
213 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 return ret;
215
216 sym_rat_op = (buf[0] << 8) | buf[1];
217
Matthias Schwarzott0b6a3342007-12-21 08:58:09 -0300218 dprintk("sym_rat_op=%d dec_ratio=%d\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 sym_rat_op, dec_ratio);
Matthias Schwarzott0b6a3342007-12-21 08:58:09 -0300220 dprintk("*sr(manual) = %lu\n",
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300221 (((state->xtal * 8192) / (sym_rat_op + 8192)) *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 2) - dec_ratio);
223 }
224
225 return 0;
226}
227
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300228static int mt312_get_code_rate(struct mt312_state *state, fe_code_rate_t *cr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229{
230 const fe_code_rate_t fec_tab[8] =
231 { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_6_7, FEC_7_8,
232 FEC_AUTO, FEC_AUTO };
233
234 int ret;
235 u8 fec_status;
236
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300237 ret = mt312_readreg(state, FEC_STATUS, &fec_status);
238 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 return ret;
240
241 *cr = fec_tab[(fec_status >> 4) & 0x07];
242
243 return 0;
244}
245
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300246static int mt312_initfe(struct dvb_frontend *fe)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700248 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 int ret;
250 u8 buf[2];
251
252 /* wake up */
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300253 ret = mt312_writereg(state, CONFIG,
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300254 (state->freq_mult == 6 ? 0x88 : 0x8c));
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300255 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 return ret;
257
258 /* wait at least 150 usec */
259 udelay(150);
260
261 /* full reset */
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300262 ret = mt312_reset(state, 1);
263 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 return ret;
265
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300266/* Per datasheet, write correct values. 09/28/03 ACCJr.
267 * If we don't do this, we won't get FE_HAS_VITERBI in the VP310. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 {
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300269 u8 buf_def[8] = { 0x14, 0x12, 0x03, 0x02,
270 0x01, 0x00, 0x00, 0x00 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300272 ret = mt312_write(state, VIT_SETUP, buf_def, sizeof(buf_def));
273 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 return ret;
275 }
276
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300277 switch (state->id) {
278 case ID_ZL10313:
279 /* enable ADC */
280 ret = mt312_writereg(state, GPP_CTRL, 0x80);
281 if (ret < 0)
282 return ret;
283
284 /* configure ZL10313 for optimal ADC performance */
285 buf[0] = 0x80;
286 buf[1] = 0xB0;
287 ret = mt312_write(state, HW_CTRL, buf, 2);
288 if (ret < 0)
289 return ret;
290
291 /* enable MPEG output and ADCs */
292 ret = mt312_writereg(state, HW_CTRL, 0x00);
293 if (ret < 0)
294 return ret;
295
296 ret = mt312_writereg(state, MPEG_CTRL, 0x00);
297 if (ret < 0)
298 return ret;
299
300 break;
301 }
302
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 /* SYS_CLK */
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300304 buf[0] = mt312_div(state->xtal * state->freq_mult * 2, 1000000);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305
306 /* DISEQC_RATIO */
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300307 buf[1] = mt312_div(state->xtal, 22000 * 4);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300309 ret = mt312_write(state, SYS_CLK, buf, sizeof(buf));
310 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311 return ret;
312
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300313 ret = mt312_writereg(state, SNR_THS_HIGH, 0x32);
314 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 return ret;
316
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300317 /* different MOCLK polarity */
318 switch (state->id) {
319 case ID_ZL10313:
320 buf[0] = 0x33;
321 break;
322 default:
323 buf[0] = 0x53;
324 break;
325 }
326
327 ret = mt312_writereg(state, OP_CTRL, buf[0]);
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300328 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 return ret;
330
331 /* TS_SW_LIM */
332 buf[0] = 0x8c;
333 buf[1] = 0x98;
334
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300335 ret = mt312_write(state, TS_SW_LIM_L, buf, sizeof(buf));
336 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 return ret;
338
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300339 ret = mt312_writereg(state, CS_SW_LIM, 0x69);
340 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 return ret;
342
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 return 0;
344}
345
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300346static int mt312_send_master_cmd(struct dvb_frontend *fe,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 struct dvb_diseqc_master_cmd *c)
348{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700349 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 int ret;
351 u8 diseqc_mode;
352
353 if ((c->msg_len == 0) || (c->msg_len > sizeof(c->msg)))
354 return -EINVAL;
355
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300356 ret = mt312_readreg(state, DISEQC_MODE, &diseqc_mode);
357 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 return ret;
359
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300360 ret = mt312_write(state, (0x80 | DISEQC_INSTR), c->msg, c->msg_len);
361 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 return ret;
363
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300364 ret = mt312_writereg(state, DISEQC_MODE,
365 (diseqc_mode & 0x40) | ((c->msg_len - 1) << 3)
366 | 0x04);
367 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 return ret;
369
Matthias Schwarzott82cd2df2008-04-12 15:04:47 -0300370 /* is there a better way to wait for message to be transmitted */
371 msleep(100);
372
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 /* set DISEQC_MODE[2:0] to zero if a return message is expected */
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300374 if (c->msg[0] & 0x02) {
375 ret = mt312_writereg(state, DISEQC_MODE, (diseqc_mode & 0x40));
376 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 return ret;
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300378 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379
380 return 0;
381}
382
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300383static int mt312_send_burst(struct dvb_frontend *fe, const fe_sec_mini_cmd_t c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700385 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 const u8 mini_tab[2] = { 0x02, 0x03 };
387
388 int ret;
389 u8 diseqc_mode;
390
391 if (c > SEC_MINI_B)
392 return -EINVAL;
393
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300394 ret = mt312_readreg(state, DISEQC_MODE, &diseqc_mode);
395 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 return ret;
397
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300398 ret = mt312_writereg(state, DISEQC_MODE,
399 (diseqc_mode & 0x40) | mini_tab[c]);
400 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 return ret;
402
403 return 0;
404}
405
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300406static int mt312_set_tone(struct dvb_frontend *fe, const fe_sec_tone_mode_t t)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700408 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 const u8 tone_tab[2] = { 0x01, 0x00 };
410
411 int ret;
412 u8 diseqc_mode;
413
414 if (t > SEC_TONE_OFF)
415 return -EINVAL;
416
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300417 ret = mt312_readreg(state, DISEQC_MODE, &diseqc_mode);
418 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 return ret;
420
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300421 ret = mt312_writereg(state, DISEQC_MODE,
422 (diseqc_mode & 0x40) | tone_tab[t]);
423 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 return ret;
425
426 return 0;
427}
428
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300429static int mt312_set_voltage(struct dvb_frontend *fe, const fe_sec_voltage_t v)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700431 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 const u8 volt_tab[3] = { 0x00, 0x40, 0x00 };
Matthias Schwarzott11d3f322008-04-12 15:04:50 -0300433 u8 val;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434
435 if (v > SEC_VOLTAGE_OFF)
436 return -EINVAL;
437
Matthias Schwarzott11d3f322008-04-12 15:04:50 -0300438 val = volt_tab[v];
439 if (state->config->voltage_inverted)
440 val ^= 0x40;
441
442 return mt312_writereg(state, DISEQC_MODE, val);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443}
444
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300445static int mt312_read_status(struct dvb_frontend *fe, fe_status_t *s)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700447 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700448 int ret;
449 u8 status[3];
450
451 *s = 0;
452
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300453 ret = mt312_read(state, QPSK_STAT_H, status, sizeof(status));
454 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 return ret;
456
Matthias Schwarzott0b6a3342007-12-21 08:58:09 -0300457 dprintk("QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x,"
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300458 " FEC_STATUS: 0x%02x\n", status[0], status[1], status[2]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459
460 if (status[0] & 0xc0)
461 *s |= FE_HAS_SIGNAL; /* signal noise ratio */
462 if (status[0] & 0x04)
463 *s |= FE_HAS_CARRIER; /* qpsk carrier lock */
464 if (status[2] & 0x02)
465 *s |= FE_HAS_VITERBI; /* viterbi lock */
466 if (status[2] & 0x04)
467 *s |= FE_HAS_SYNC; /* byte align lock */
468 if (status[0] & 0x01)
469 *s |= FE_HAS_LOCK; /* qpsk lock */
470
471 return 0;
472}
473
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300474static int mt312_read_ber(struct dvb_frontend *fe, u32 *ber)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700476 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 int ret;
478 u8 buf[3];
479
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300480 ret = mt312_read(state, RS_BERCNT_H, buf, 3);
481 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 return ret;
483
484 *ber = ((buf[0] << 16) | (buf[1] << 8) | buf[2]) * 64;
485
486 return 0;
487}
488
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300489static int mt312_read_signal_strength(struct dvb_frontend *fe,
490 u16 *signal_strength)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700492 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493 int ret;
494 u8 buf[3];
495 u16 agc;
496 s16 err_db;
497
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300498 ret = mt312_read(state, AGC_H, buf, sizeof(buf));
499 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500 return ret;
501
502 agc = (buf[0] << 6) | (buf[1] >> 2);
503 err_db = (s16) (((buf[1] & 0x03) << 14) | buf[2] << 6) >> 6;
504
505 *signal_strength = agc;
506
Matthias Schwarzott0b6a3342007-12-21 08:58:09 -0300507 dprintk("agc=%08x err_db=%hd\n", agc, err_db);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508
509 return 0;
510}
511
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300512static int mt312_read_snr(struct dvb_frontend *fe, u16 *snr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700514 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 int ret;
516 u8 buf[2];
517
Matthias Schwarzott1881ee82008-04-12 15:04:46 -0300518 ret = mt312_read(state, M_SNR_H, buf, sizeof(buf));
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300519 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 return ret;
521
522 *snr = 0xFFFF - ((((buf[0] & 0x7f) << 8) | buf[1]) << 1);
523
524 return 0;
525}
526
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300527static int mt312_read_ucblocks(struct dvb_frontend *fe, u32 *ubc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700529 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530 int ret;
531 u8 buf[2];
532
Matthias Schwarzott1881ee82008-04-12 15:04:46 -0300533 ret = mt312_read(state, RS_UBC_H, buf, sizeof(buf));
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300534 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 return ret;
536
537 *ubc = (buf[0] << 8) | buf[1];
538
539 return 0;
540}
541
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300542static int mt312_set_frontend(struct dvb_frontend *fe)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543{
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300544 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700545 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546 int ret;
547 u8 buf[5], config_val;
548 u16 sr;
549
550 const u8 fec_tab[10] =
551 { 0x00, 0x01, 0x02, 0x04, 0x3f, 0x08, 0x10, 0x20, 0x3f, 0x3f };
552 const u8 inv_tab[3] = { 0x00, 0x40, 0x80 };
553
Harvey Harrison271ddbf2008-04-08 23:20:00 -0300554 dprintk("%s: Freq %d\n", __func__, p->frequency);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555
Patrick Boettcherdea74862006-05-14 05:01:31 -0300556 if ((p->frequency < fe->ops.info.frequency_min)
557 || (p->frequency > fe->ops.info.frequency_max))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 return -EINVAL;
559
Mauro Carvalho Chehab830e4b52012-10-27 16:14:01 -0300560 if (((int)p->inversion < INVERSION_OFF)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 || (p->inversion > INVERSION_ON))
562 return -EINVAL;
563
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300564 if ((p->symbol_rate < fe->ops.info.symbol_rate_min)
565 || (p->symbol_rate > fe->ops.info.symbol_rate_max))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 return -EINVAL;
567
Mauro Carvalho Chehab830e4b52012-10-27 16:14:01 -0300568 if (((int)p->fec_inner < FEC_NONE)
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300569 || (p->fec_inner > FEC_AUTO))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 return -EINVAL;
571
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300572 if ((p->fec_inner == FEC_4_5)
573 || (p->fec_inner == FEC_8_9))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 return -EINVAL;
575
576 switch (state->id) {
577 case ID_VP310:
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300578 /* For now we will do this only for the VP310.
579 * It should be better for the mt312 as well,
580 * but tuning will be slower. ACCJr 09/29/03
581 */
Alexey Dobriyan682e8522006-01-10 00:09:16 +0300582 ret = mt312_readreg(state, CONFIG, &config_val);
583 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584 return ret;
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300585 if (p->symbol_rate >= 30000000) {
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300586 /* Note that 30MS/s should use 90MHz */
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300587 if (state->freq_mult == 6) {
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300588 /* We are running 60MHz */
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300589 state->freq_mult = 9;
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300590 ret = mt312_initfe(fe);
591 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 return ret;
593 }
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300594 } else {
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300595 if (state->freq_mult == 9) {
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300596 /* We are running 90MHz */
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300597 state->freq_mult = 6;
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300598 ret = mt312_initfe(fe);
599 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 return ret;
601 }
602 }
603 break;
604
605 case ID_MT312:
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300606 case ID_ZL10313:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 break;
608
609 default:
610 return -EINVAL;
611 }
612
Patrick Boettcherdea74862006-05-14 05:01:31 -0300613 if (fe->ops.tuner_ops.set_params) {
Mauro Carvalho Chehab14d24d12011-12-24 12:24:33 -0300614 fe->ops.tuner_ops.set_params(fe);
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300615 if (fe->ops.i2c_gate_ctrl)
616 fe->ops.i2c_gate_ctrl(fe, 0);
Andrew de Quinceya81870e2006-04-18 17:47:09 -0300617 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618
619 /* sr = (u16)(sr * 256.0 / 1000000.0) */
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300620 sr = mt312_div(p->symbol_rate * 4, 15625);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621
622 /* SYM_RATE */
623 buf[0] = (sr >> 8) & 0x3f;
624 buf[1] = (sr >> 0) & 0xff;
625
626 /* VIT_MODE */
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300627 buf[2] = inv_tab[p->inversion] | fec_tab[p->fec_inner];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628
629 /* QPSK_CTRL */
630 buf[3] = 0x40; /* swap I and Q before QPSK demodulation */
631
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300632 if (p->symbol_rate < 10000000)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 buf[3] |= 0x04; /* use afc mode */
634
635 /* GO */
636 buf[4] = 0x01;
637
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300638 ret = mt312_write(state, SYM_RATE_H, buf, sizeof(buf));
639 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 return ret;
641
Mauro Carvalho Chehab9101e622005-12-12 00:37:24 -0800642 mt312_reset(state, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643
644 return 0;
645}
646
Mauro Carvalho Chehab7c61d802011-12-30 11:30:21 -0300647static int mt312_get_frontend(struct dvb_frontend *fe)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648{
Mauro Carvalho Chehab7c61d802011-12-30 11:30:21 -0300649 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700650 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 int ret;
652
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300653 ret = mt312_get_inversion(state, &p->inversion);
654 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 return ret;
656
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300657 ret = mt312_get_symbol_rate(state, &p->symbol_rate);
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300658 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659 return ret;
660
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300661 ret = mt312_get_code_rate(state, &p->fec_inner);
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300662 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 return ret;
664
665 return 0;
666}
667
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300668static int mt312_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
Andrew de Quinceya81870e2006-04-18 17:47:09 -0300669{
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300670 struct mt312_state *state = fe->demodulator_priv;
Andrew de Quinceya81870e2006-04-18 17:47:09 -0300671
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300672 u8 val = 0x00;
673 int ret;
674
675 switch (state->id) {
676 case ID_ZL10313:
677 ret = mt312_readreg(state, GPP_CTRL, &val);
678 if (ret < 0)
679 goto error;
680
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300681 /* preserve this bit to not accidentally shutdown ADC */
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300682 val &= 0x80;
683 break;
Andrew de Quinceya81870e2006-04-18 17:47:09 -0300684 }
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300685
686 if (enable)
687 val |= 0x40;
688 else
689 val &= ~0x40;
690
691 ret = mt312_writereg(state, GPP_CTRL, val);
692
693error:
694 return ret;
Andrew de Quinceya81870e2006-04-18 17:47:09 -0300695}
696
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300697static int mt312_sleep(struct dvb_frontend *fe)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698{
Johannes Stezenbachb8742702005-05-16 21:54:31 -0700699 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700700 int ret;
701 u8 config;
702
703 /* reset all registers to defaults */
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300704 ret = mt312_reset(state, 1);
705 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 return ret;
707
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300708 if (state->id == ID_ZL10313) {
709 /* reset ADC */
710 ret = mt312_writereg(state, GPP_CTRL, 0x00);
711 if (ret < 0)
712 return ret;
713
714 /* full shutdown of ADCs, mpeg bus tristated */
715 ret = mt312_writereg(state, HW_CTRL, 0x0d);
716 if (ret < 0)
717 return ret;
718 }
719
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300720 ret = mt312_readreg(state, CONFIG, &config);
721 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 return ret;
723
724 /* enter standby */
Matthias Schwarzott994fc28b2007-12-24 07:12:55 -0300725 ret = mt312_writereg(state, CONFIG, config & 0x7f);
726 if (ret < 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 return ret;
728
729 return 0;
730}
731
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300732static int mt312_get_tune_settings(struct dvb_frontend *fe,
733 struct dvb_frontend_tune_settings *fesettings)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734{
735 fesettings->min_delay_ms = 50;
736 fesettings->step_size = 0;
737 fesettings->max_drift = 0;
738 return 0;
739}
740
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300741static void mt312_release(struct dvb_frontend *fe)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742{
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300743 struct mt312_state *state = fe->demodulator_priv;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700744 kfree(state);
745}
746
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300747#define MT312_SYS_CLK 90000000UL /* 90 MHz */
Matthias Schwarzotte4671b62008-04-30 12:21:04 -0300748static struct dvb_frontend_ops mt312_ops = {
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300749 .delsys = { SYS_DVBS },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750 .info = {
751 .name = "Zarlink ???? DVB-S",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 .frequency_min = 950000,
753 .frequency_max = 2150000,
Matthias Schwarzott0389b342009-07-02 16:17:28 -0300754 /* FIXME: adjust freq to real used xtal */
755 .frequency_stepsize = (MT312_PLL_CLK / 1000) / 128,
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300756 .symbol_rate_min = MT312_SYS_CLK / 128, /* FIXME as above */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757 .symbol_rate_max = MT312_SYS_CLK / 2,
758 .caps =
759 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 |
760 FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 |
761 FE_CAN_FEC_AUTO | FE_CAN_QPSK | FE_CAN_MUTE_TS |
Mauro Carvalho Chehab9101e622005-12-12 00:37:24 -0800762 FE_CAN_RECOVER
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 },
764
765 .release = mt312_release,
766
767 .init = mt312_initfe,
768 .sleep = mt312_sleep,
Andrew de Quinceya81870e2006-04-18 17:47:09 -0300769 .i2c_gate_ctrl = mt312_i2c_gate_ctrl,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770
Mauro Carvalho Chehab827b5f32011-12-26 13:50:05 -0300771 .set_frontend = mt312_set_frontend,
772 .get_frontend = mt312_get_frontend,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773 .get_tune_settings = mt312_get_tune_settings,
774
775 .read_status = mt312_read_status,
776 .read_ber = mt312_read_ber,
777 .read_signal_strength = mt312_read_signal_strength,
778 .read_snr = mt312_read_snr,
779 .read_ucblocks = mt312_read_ucblocks,
780
781 .diseqc_send_master_cmd = mt312_send_master_cmd,
782 .diseqc_send_burst = mt312_send_burst,
783 .set_tone = mt312_set_tone,
784 .set_voltage = mt312_set_voltage,
785};
786
Matthias Schwarzotte4671b62008-04-30 12:21:04 -0300787struct dvb_frontend *mt312_attach(const struct mt312_config *config,
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300788 struct i2c_adapter *i2c)
Adrian Bunk805e6602006-02-27 00:07:49 -0300789{
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300790 struct mt312_state *state = NULL;
Adrian Bunk805e6602006-02-27 00:07:49 -0300791
792 /* allocate memory for the internal state */
Matthias Schwarzott084e24a2009-08-10 22:51:01 -0300793 state = kzalloc(sizeof(struct mt312_state), GFP_KERNEL);
Adrian Bunk805e6602006-02-27 00:07:49 -0300794 if (state == NULL)
795 goto error;
796
797 /* setup the state */
798 state->config = config;
799 state->i2c = i2c;
Adrian Bunk805e6602006-02-27 00:07:49 -0300800
801 /* check if the demod is there */
802 if (mt312_readreg(state, ID, &state->id) < 0)
803 goto error;
804
Patrick Boettcherdea74862006-05-14 05:01:31 -0300805 /* create dvb_frontend */
Matthias Schwarzotte4671b62008-04-30 12:21:04 -0300806 memcpy(&state->frontend.ops, &mt312_ops,
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300807 sizeof(struct dvb_frontend_ops));
Patrick Boettcherdea74862006-05-14 05:01:31 -0300808 state->frontend.demodulator_priv = state;
809
Adrian Bunk805e6602006-02-27 00:07:49 -0300810 switch (state->id) {
811 case ID_VP310:
Patrick Boettcherdea74862006-05-14 05:01:31 -0300812 strcpy(state->frontend.ops.info.name, "Zarlink VP310 DVB-S");
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300813 state->xtal = MT312_PLL_CLK;
814 state->freq_mult = 9;
Adrian Bunk805e6602006-02-27 00:07:49 -0300815 break;
816 case ID_MT312:
Patrick Boettcherdea74862006-05-14 05:01:31 -0300817 strcpy(state->frontend.ops.info.name, "Zarlink MT312 DVB-S");
Matthias Schwarzott111221f2008-04-12 15:04:48 -0300818 state->xtal = MT312_PLL_CLK;
819 state->freq_mult = 6;
Adrian Bunk805e6602006-02-27 00:07:49 -0300820 break;
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300821 case ID_ZL10313:
822 strcpy(state->frontend.ops.info.name, "Zarlink ZL10313 DVB-S");
823 state->xtal = MT312_PLL_CLK_10_111;
824 state->freq_mult = 9;
825 break;
Adrian Bunk805e6602006-02-27 00:07:49 -0300826 default:
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300827 printk(KERN_WARNING "Only Zarlink VP310/MT312/ZL10313"
Matthias Schwarzott89f64752007-12-21 08:56:44 -0300828 " are supported chips.\n");
Adrian Bunk805e6602006-02-27 00:07:49 -0300829 goto error;
830 }
831
Adrian Bunk805e6602006-02-27 00:07:49 -0300832 return &state->frontend;
833
834error:
835 kfree(state);
836 return NULL;
837}
Matthias Schwarzotte4671b62008-04-30 12:21:04 -0300838EXPORT_SYMBOL(mt312_attach);
Adrian Bunk805e6602006-02-27 00:07:49 -0300839
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840module_param(debug, int, 0644);
841MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
842
Matthias Schwarzott6a5cbd52008-04-12 15:04:49 -0300843MODULE_DESCRIPTION("Zarlink VP310/MT312/ZL10313 DVB-S Demodulator driver");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>");
Matthias Schwarzotte4671b62008-04-30 12:21:04 -0300845MODULE_AUTHOR("Matthias Schwarzott <zzam@gentoo.org>");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846MODULE_LICENSE("GPL");
847