V4L/DVB (7574): mt312: Add support for zl10313 demod
[linux-2.6/openmoko-kernel/knife-kernel.git] / drivers / media / dvb / frontends / mt312.c
blobe17a36180f9c2160f1f077eefc0eef77499c961e
1 /*
2 Driver for Zarlink VP310/MT312/ZL10313 Satellite Channel Decoder
4 Copyright (C) 2003 Andreas Oberritter <obi@linuxtv.org>
5 Copyright (C) 2008 Matthias Schwarzott <zzam@gentoo.org>
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.
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
16 GNU General Public License for more details.
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.
22 References:
23 http://products.zarlink.com/product_profiles/MT312.htm
24 http://products.zarlink.com/product_profiles/SL1935.htm
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>
32 #include <linux/string.h>
33 #include <linux/slab.h>
35 #include "dvb_frontend.h"
36 #include "mt312_priv.h"
37 #include "mt312.h"
40 struct mt312_state {
41 struct i2c_adapter *i2c;
42 /* configuration settings */
43 const struct mt312_config *config;
44 struct dvb_frontend frontend;
46 u8 id;
47 unsigned long xtal;
48 u8 freq_mult;
51 static int debug;
52 #define dprintk(args...) \
53 do { \
54 if (debug) \
55 printk(KERN_DEBUG "mt312: " args); \
56 } while (0)
58 #define MT312_PLL_CLK 10000000UL /* 10 MHz */
59 #define MT312_PLL_CLK_10_111 10111000UL /* 10.111 MHz */
61 static int mt312_read(struct mt312_state *state, const enum mt312_reg_addr reg,
62 u8 *buf, const size_t count)
64 int ret;
65 struct i2c_msg msg[2];
66 u8 regbuf[1] = { reg };
68 msg[0].addr = state->config->demod_address;
69 msg[0].flags = 0;
70 msg[0].buf = regbuf;
71 msg[0].len = 1;
72 msg[1].addr = state->config->demod_address;
73 msg[1].flags = I2C_M_RD;
74 msg[1].buf = buf;
75 msg[1].len = count;
77 ret = i2c_transfer(state->i2c, msg, 2);
79 if (ret != 2) {
80 printk(KERN_ERR "%s: ret == %d\n", __func__, ret);
81 return -EREMOTEIO;
84 if (debug) {
85 int i;
86 dprintk("R(%d):", reg & 0x7f);
87 for (i = 0; i < count; i++)
88 printk(" %02x", buf[i]);
89 printk("\n");
92 return 0;
95 static int mt312_write(struct mt312_state *state, const enum mt312_reg_addr reg,
96 const u8 *src, const size_t count)
98 int ret;
99 u8 buf[count + 1];
100 struct i2c_msg msg;
102 if (debug) {
103 int i;
104 dprintk("W(%d):", reg & 0x7f);
105 for (i = 0; i < count; i++)
106 printk(" %02x", src[i]);
107 printk("\n");
110 buf[0] = reg;
111 memcpy(&buf[1], src, count);
113 msg.addr = state->config->demod_address;
114 msg.flags = 0;
115 msg.buf = buf;
116 msg.len = count + 1;
118 ret = i2c_transfer(state->i2c, &msg, 1);
120 if (ret != 1) {
121 dprintk("%s: ret == %d\n", __func__, ret);
122 return -EREMOTEIO;
125 return 0;
128 static inline int mt312_readreg(struct mt312_state *state,
129 const enum mt312_reg_addr reg, u8 *val)
131 return mt312_read(state, reg, val, 1);
134 static inline int mt312_writereg(struct mt312_state *state,
135 const enum mt312_reg_addr reg, const u8 val)
137 return mt312_write(state, reg, &val, 1);
140 static inline u32 mt312_div(u32 a, u32 b)
142 return (a + (b / 2)) / b;
145 static int mt312_reset(struct mt312_state *state, const u8 full)
147 return mt312_writereg(state, RESET, full ? 0x80 : 0x40);
150 static int mt312_get_inversion(struct mt312_state *state,
151 fe_spectral_inversion_t *i)
153 int ret;
154 u8 vit_mode;
156 ret = mt312_readreg(state, VIT_MODE, &vit_mode);
157 if (ret < 0)
158 return ret;
160 if (vit_mode & 0x80) /* auto inversion was used */
161 *i = (vit_mode & 0x40) ? INVERSION_ON : INVERSION_OFF;
163 return 0;
166 static int mt312_get_symbol_rate(struct mt312_state *state, u32 *sr)
168 int ret;
169 u8 sym_rate_h;
170 u8 dec_ratio;
171 u16 sym_rat_op;
172 u16 monitor;
173 u8 buf[2];
175 ret = mt312_readreg(state, SYM_RATE_H, &sym_rate_h);
176 if (ret < 0)
177 return ret;
179 if (sym_rate_h & 0x80) {
180 /* symbol rate search was used */
181 ret = mt312_writereg(state, MON_CTRL, 0x03);
182 if (ret < 0)
183 return ret;
185 ret = mt312_read(state, MONITOR_H, buf, sizeof(buf));
186 if (ret < 0)
187 return ret;
189 monitor = (buf[0] << 8) | buf[1];
191 dprintk("sr(auto) = %u\n",
192 mt312_div(monitor * 15625, 4));
193 } else {
194 ret = mt312_writereg(state, MON_CTRL, 0x05);
195 if (ret < 0)
196 return ret;
198 ret = mt312_read(state, MONITOR_H, buf, sizeof(buf));
199 if (ret < 0)
200 return ret;
202 dec_ratio = ((buf[0] >> 5) & 0x07) * 32;
204 ret = mt312_read(state, SYM_RAT_OP_H, buf, sizeof(buf));
205 if (ret < 0)
206 return ret;
208 sym_rat_op = (buf[0] << 8) | buf[1];
210 dprintk("sym_rat_op=%d dec_ratio=%d\n",
211 sym_rat_op, dec_ratio);
212 dprintk("*sr(manual) = %lu\n",
213 (((state->xtal * 8192) / (sym_rat_op + 8192)) *
214 2) - dec_ratio);
217 return 0;
220 static int mt312_get_code_rate(struct mt312_state *state, fe_code_rate_t *cr)
222 const fe_code_rate_t fec_tab[8] =
223 { FEC_1_2, FEC_2_3, FEC_3_4, FEC_5_6, FEC_6_7, FEC_7_8,
224 FEC_AUTO, FEC_AUTO };
226 int ret;
227 u8 fec_status;
229 ret = mt312_readreg(state, FEC_STATUS, &fec_status);
230 if (ret < 0)
231 return ret;
233 *cr = fec_tab[(fec_status >> 4) & 0x07];
235 return 0;
238 static int mt312_initfe(struct dvb_frontend *fe)
240 struct mt312_state *state = fe->demodulator_priv;
241 int ret;
242 u8 buf[2];
244 /* wake up */
245 ret = mt312_writereg(state, CONFIG,
246 (state->freq_mult == 6 ? 0x88 : 0x8c));
247 if (ret < 0)
248 return ret;
250 /* wait at least 150 usec */
251 udelay(150);
253 /* full reset */
254 ret = mt312_reset(state, 1);
255 if (ret < 0)
256 return ret;
258 /* Per datasheet, write correct values. 09/28/03 ACCJr.
259 * If we don't do this, we won't get FE_HAS_VITERBI in the VP310. */
261 u8 buf_def[8] = { 0x14, 0x12, 0x03, 0x02,
262 0x01, 0x00, 0x00, 0x00 };
264 ret = mt312_write(state, VIT_SETUP, buf_def, sizeof(buf_def));
265 if (ret < 0)
266 return ret;
269 switch (state->id) {
270 case ID_ZL10313:
271 /* enable ADC */
272 ret = mt312_writereg(state, GPP_CTRL, 0x80);
273 if (ret < 0)
274 return ret;
276 /* configure ZL10313 for optimal ADC performance */
277 buf[0] = 0x80;
278 buf[1] = 0xB0;
279 ret = mt312_write(state, HW_CTRL, buf, 2);
280 if (ret < 0)
281 return ret;
283 /* enable MPEG output and ADCs */
284 ret = mt312_writereg(state, HW_CTRL, 0x00);
285 if (ret < 0)
286 return ret;
288 ret = mt312_writereg(state, MPEG_CTRL, 0x00);
289 if (ret < 0)
290 return ret;
292 break;
295 /* SYS_CLK */
296 buf[0] = mt312_div(state->xtal * state->freq_mult * 2, 1000000);
298 /* DISEQC_RATIO */
299 buf[1] = mt312_div(state->xtal, 22000 * 4);
301 ret = mt312_write(state, SYS_CLK, buf, sizeof(buf));
302 if (ret < 0)
303 return ret;
305 ret = mt312_writereg(state, SNR_THS_HIGH, 0x32);
306 if (ret < 0)
307 return ret;
309 /* different MOCLK polarity */
310 switch (state->id) {
311 case ID_ZL10313:
312 buf[0] = 0x33;
313 break;
314 default:
315 buf[0] = 0x53;
316 break;
319 ret = mt312_writereg(state, OP_CTRL, buf[0]);
320 if (ret < 0)
321 return ret;
323 /* TS_SW_LIM */
324 buf[0] = 0x8c;
325 buf[1] = 0x98;
327 ret = mt312_write(state, TS_SW_LIM_L, buf, sizeof(buf));
328 if (ret < 0)
329 return ret;
331 ret = mt312_writereg(state, CS_SW_LIM, 0x69);
332 if (ret < 0)
333 return ret;
335 return 0;
338 static int mt312_send_master_cmd(struct dvb_frontend *fe,
339 struct dvb_diseqc_master_cmd *c)
341 struct mt312_state *state = fe->demodulator_priv;
342 int ret;
343 u8 diseqc_mode;
345 if ((c->msg_len == 0) || (c->msg_len > sizeof(c->msg)))
346 return -EINVAL;
348 ret = mt312_readreg(state, DISEQC_MODE, &diseqc_mode);
349 if (ret < 0)
350 return ret;
352 ret = mt312_write(state, (0x80 | DISEQC_INSTR), c->msg, c->msg_len);
353 if (ret < 0)
354 return ret;
356 ret = mt312_writereg(state, DISEQC_MODE,
357 (diseqc_mode & 0x40) | ((c->msg_len - 1) << 3)
358 | 0x04);
359 if (ret < 0)
360 return ret;
362 /* is there a better way to wait for message to be transmitted */
363 msleep(100);
365 /* set DISEQC_MODE[2:0] to zero if a return message is expected */
366 if (c->msg[0] & 0x02) {
367 ret = mt312_writereg(state, DISEQC_MODE, (diseqc_mode & 0x40));
368 if (ret < 0)
369 return ret;
372 return 0;
375 static int mt312_send_burst(struct dvb_frontend *fe, const fe_sec_mini_cmd_t c)
377 struct mt312_state *state = fe->demodulator_priv;
378 const u8 mini_tab[2] = { 0x02, 0x03 };
380 int ret;
381 u8 diseqc_mode;
383 if (c > SEC_MINI_B)
384 return -EINVAL;
386 ret = mt312_readreg(state, DISEQC_MODE, &diseqc_mode);
387 if (ret < 0)
388 return ret;
390 ret = mt312_writereg(state, DISEQC_MODE,
391 (diseqc_mode & 0x40) | mini_tab[c]);
392 if (ret < 0)
393 return ret;
395 return 0;
398 static int mt312_set_tone(struct dvb_frontend *fe, const fe_sec_tone_mode_t t)
400 struct mt312_state *state = fe->demodulator_priv;
401 const u8 tone_tab[2] = { 0x01, 0x00 };
403 int ret;
404 u8 diseqc_mode;
406 if (t > SEC_TONE_OFF)
407 return -EINVAL;
409 ret = mt312_readreg(state, DISEQC_MODE, &diseqc_mode);
410 if (ret < 0)
411 return ret;
413 ret = mt312_writereg(state, DISEQC_MODE,
414 (diseqc_mode & 0x40) | tone_tab[t]);
415 if (ret < 0)
416 return ret;
418 return 0;
421 static int mt312_set_voltage(struct dvb_frontend *fe, const fe_sec_voltage_t v)
423 struct mt312_state *state = fe->demodulator_priv;
424 const u8 volt_tab[3] = { 0x00, 0x40, 0x00 };
426 if (v > SEC_VOLTAGE_OFF)
427 return -EINVAL;
429 return mt312_writereg(state, DISEQC_MODE, volt_tab[v]);
432 static int mt312_read_status(struct dvb_frontend *fe, fe_status_t *s)
434 struct mt312_state *state = fe->demodulator_priv;
435 int ret;
436 u8 status[3];
438 *s = 0;
440 ret = mt312_read(state, QPSK_STAT_H, status, sizeof(status));
441 if (ret < 0)
442 return ret;
444 dprintk("QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x,"
445 " FEC_STATUS: 0x%02x\n", status[0], status[1], status[2]);
447 if (status[0] & 0xc0)
448 *s |= FE_HAS_SIGNAL; /* signal noise ratio */
449 if (status[0] & 0x04)
450 *s |= FE_HAS_CARRIER; /* qpsk carrier lock */
451 if (status[2] & 0x02)
452 *s |= FE_HAS_VITERBI; /* viterbi lock */
453 if (status[2] & 0x04)
454 *s |= FE_HAS_SYNC; /* byte align lock */
455 if (status[0] & 0x01)
456 *s |= FE_HAS_LOCK; /* qpsk lock */
458 return 0;
461 static int mt312_read_ber(struct dvb_frontend *fe, u32 *ber)
463 struct mt312_state *state = fe->demodulator_priv;
464 int ret;
465 u8 buf[3];
467 ret = mt312_read(state, RS_BERCNT_H, buf, 3);
468 if (ret < 0)
469 return ret;
471 *ber = ((buf[0] << 16) | (buf[1] << 8) | buf[2]) * 64;
473 return 0;
476 static int mt312_read_signal_strength(struct dvb_frontend *fe,
477 u16 *signal_strength)
479 struct mt312_state *state = fe->demodulator_priv;
480 int ret;
481 u8 buf[3];
482 u16 agc;
483 s16 err_db;
485 ret = mt312_read(state, AGC_H, buf, sizeof(buf));
486 if (ret < 0)
487 return ret;
489 agc = (buf[0] << 6) | (buf[1] >> 2);
490 err_db = (s16) (((buf[1] & 0x03) << 14) | buf[2] << 6) >> 6;
492 *signal_strength = agc;
494 dprintk("agc=%08x err_db=%hd\n", agc, err_db);
496 return 0;
499 static int mt312_read_snr(struct dvb_frontend *fe, u16 *snr)
501 struct mt312_state *state = fe->demodulator_priv;
502 int ret;
503 u8 buf[2];
505 ret = mt312_read(state, M_SNR_H, buf, sizeof(buf));
506 if (ret < 0)
507 return ret;
509 *snr = 0xFFFF - ((((buf[0] & 0x7f) << 8) | buf[1]) << 1);
511 return 0;
514 static int mt312_read_ucblocks(struct dvb_frontend *fe, u32 *ubc)
516 struct mt312_state *state = fe->demodulator_priv;
517 int ret;
518 u8 buf[2];
520 ret = mt312_read(state, RS_UBC_H, buf, sizeof(buf));
521 if (ret < 0)
522 return ret;
524 *ubc = (buf[0] << 8) | buf[1];
526 return 0;
529 static int mt312_set_frontend(struct dvb_frontend *fe,
530 struct dvb_frontend_parameters *p)
532 struct mt312_state *state = fe->demodulator_priv;
533 int ret;
534 u8 buf[5], config_val;
535 u16 sr;
537 const u8 fec_tab[10] =
538 { 0x00, 0x01, 0x02, 0x04, 0x3f, 0x08, 0x10, 0x20, 0x3f, 0x3f };
539 const u8 inv_tab[3] = { 0x00, 0x40, 0x80 };
541 dprintk("%s: Freq %d\n", __func__, p->frequency);
543 if ((p->frequency < fe->ops.info.frequency_min)
544 || (p->frequency > fe->ops.info.frequency_max))
545 return -EINVAL;
547 if ((p->inversion < INVERSION_OFF)
548 || (p->inversion > INVERSION_ON))
549 return -EINVAL;
551 if ((p->u.qpsk.symbol_rate < fe->ops.info.symbol_rate_min)
552 || (p->u.qpsk.symbol_rate > fe->ops.info.symbol_rate_max))
553 return -EINVAL;
555 if ((p->u.qpsk.fec_inner < FEC_NONE)
556 || (p->u.qpsk.fec_inner > FEC_AUTO))
557 return -EINVAL;
559 if ((p->u.qpsk.fec_inner == FEC_4_5)
560 || (p->u.qpsk.fec_inner == FEC_8_9))
561 return -EINVAL;
563 switch (state->id) {
564 case ID_VP310:
565 /* For now we will do this only for the VP310.
566 * It should be better for the mt312 as well,
567 * but tuning will be slower. ACCJr 09/29/03
569 ret = mt312_readreg(state, CONFIG, &config_val);
570 if (ret < 0)
571 return ret;
572 if (p->u.qpsk.symbol_rate >= 30000000) {
573 /* Note that 30MS/s should use 90MHz */
574 if (state->freq_mult == 6) {
575 /* We are running 60MHz */
576 state->freq_mult = 9;
577 ret = mt312_initfe(fe);
578 if (ret < 0)
579 return ret;
581 } else {
582 if (state->freq_mult == 9) {
583 /* We are running 90MHz */
584 state->freq_mult = 6;
585 ret = mt312_initfe(fe);
586 if (ret < 0)
587 return ret;
590 break;
592 case ID_MT312:
593 case ID_ZL10313:
594 break;
596 default:
597 return -EINVAL;
600 if (fe->ops.tuner_ops.set_params) {
601 fe->ops.tuner_ops.set_params(fe, p);
602 if (fe->ops.i2c_gate_ctrl)
603 fe->ops.i2c_gate_ctrl(fe, 0);
606 /* sr = (u16)(sr * 256.0 / 1000000.0) */
607 sr = mt312_div(p->u.qpsk.symbol_rate * 4, 15625);
609 /* SYM_RATE */
610 buf[0] = (sr >> 8) & 0x3f;
611 buf[1] = (sr >> 0) & 0xff;
613 /* VIT_MODE */
614 buf[2] = inv_tab[p->inversion] | fec_tab[p->u.qpsk.fec_inner];
616 /* QPSK_CTRL */
617 buf[3] = 0x40; /* swap I and Q before QPSK demodulation */
619 if (p->u.qpsk.symbol_rate < 10000000)
620 buf[3] |= 0x04; /* use afc mode */
622 /* GO */
623 buf[4] = 0x01;
625 ret = mt312_write(state, SYM_RATE_H, buf, sizeof(buf));
626 if (ret < 0)
627 return ret;
629 mt312_reset(state, 0);
631 return 0;
634 static int mt312_get_frontend(struct dvb_frontend *fe,
635 struct dvb_frontend_parameters *p)
637 struct mt312_state *state = fe->demodulator_priv;
638 int ret;
640 ret = mt312_get_inversion(state, &p->inversion);
641 if (ret < 0)
642 return ret;
644 ret = mt312_get_symbol_rate(state, &p->u.qpsk.symbol_rate);
645 if (ret < 0)
646 return ret;
648 ret = mt312_get_code_rate(state, &p->u.qpsk.fec_inner);
649 if (ret < 0)
650 return ret;
652 return 0;
655 static int mt312_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
657 struct mt312_state *state = fe->demodulator_priv;
659 u8 val = 0x00;
660 int ret;
662 switch (state->id) {
663 case ID_ZL10313:
664 ret = mt312_readreg(state, GPP_CTRL, &val);
665 if (ret < 0)
666 goto error;
668 /* preserve this bit to not accidently shutdown ADC */
669 val &= 0x80;
670 break;
673 if (enable)
674 val |= 0x40;
675 else
676 val &= ~0x40;
678 ret = mt312_writereg(state, GPP_CTRL, val);
680 error:
681 return ret;
684 static int mt312_sleep(struct dvb_frontend *fe)
686 struct mt312_state *state = fe->demodulator_priv;
687 int ret;
688 u8 config;
690 /* reset all registers to defaults */
691 ret = mt312_reset(state, 1);
692 if (ret < 0)
693 return ret;
695 if (state->id == ID_ZL10313) {
696 /* reset ADC */
697 ret = mt312_writereg(state, GPP_CTRL, 0x00);
698 if (ret < 0)
699 return ret;
701 /* full shutdown of ADCs, mpeg bus tristated */
702 ret = mt312_writereg(state, HW_CTRL, 0x0d);
703 if (ret < 0)
704 return ret;
707 ret = mt312_readreg(state, CONFIG, &config);
708 if (ret < 0)
709 return ret;
711 /* enter standby */
712 ret = mt312_writereg(state, CONFIG, config & 0x7f);
713 if (ret < 0)
714 return ret;
716 return 0;
719 static int mt312_get_tune_settings(struct dvb_frontend *fe,
720 struct dvb_frontend_tune_settings *fesettings)
722 fesettings->min_delay_ms = 50;
723 fesettings->step_size = 0;
724 fesettings->max_drift = 0;
725 return 0;
728 static void mt312_release(struct dvb_frontend *fe)
730 struct mt312_state *state = fe->demodulator_priv;
731 kfree(state);
734 #define MT312_SYS_CLK 90000000UL /* 90 MHz */
735 static struct dvb_frontend_ops vp310_mt312_ops = {
737 .info = {
738 .name = "Zarlink ???? DVB-S",
739 .type = FE_QPSK,
740 .frequency_min = 950000,
741 .frequency_max = 2150000,
742 .frequency_stepsize = (MT312_PLL_CLK / 1000) / 128, /* FIXME: adjust freq to real used xtal */
743 .symbol_rate_min = MT312_SYS_CLK / 128, /* FIXME as above */
744 .symbol_rate_max = MT312_SYS_CLK / 2,
745 .caps =
746 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 |
747 FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 |
748 FE_CAN_FEC_AUTO | FE_CAN_QPSK | FE_CAN_MUTE_TS |
749 FE_CAN_RECOVER
752 .release = mt312_release,
754 .init = mt312_initfe,
755 .sleep = mt312_sleep,
756 .i2c_gate_ctrl = mt312_i2c_gate_ctrl,
758 .set_frontend = mt312_set_frontend,
759 .get_frontend = mt312_get_frontend,
760 .get_tune_settings = mt312_get_tune_settings,
762 .read_status = mt312_read_status,
763 .read_ber = mt312_read_ber,
764 .read_signal_strength = mt312_read_signal_strength,
765 .read_snr = mt312_read_snr,
766 .read_ucblocks = mt312_read_ucblocks,
768 .diseqc_send_master_cmd = mt312_send_master_cmd,
769 .diseqc_send_burst = mt312_send_burst,
770 .set_tone = mt312_set_tone,
771 .set_voltage = mt312_set_voltage,
774 struct dvb_frontend *vp310_mt312_attach(const struct mt312_config *config,
775 struct i2c_adapter *i2c)
777 struct mt312_state *state = NULL;
779 /* allocate memory for the internal state */
780 state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
781 if (state == NULL)
782 goto error;
784 /* setup the state */
785 state->config = config;
786 state->i2c = i2c;
788 /* check if the demod is there */
789 if (mt312_readreg(state, ID, &state->id) < 0)
790 goto error;
792 /* create dvb_frontend */
793 memcpy(&state->frontend.ops, &vp310_mt312_ops,
794 sizeof(struct dvb_frontend_ops));
795 state->frontend.demodulator_priv = state;
797 switch (state->id) {
798 case ID_VP310:
799 strcpy(state->frontend.ops.info.name, "Zarlink VP310 DVB-S");
800 state->xtal = MT312_PLL_CLK;
801 state->freq_mult = 9;
802 break;
803 case ID_MT312:
804 strcpy(state->frontend.ops.info.name, "Zarlink MT312 DVB-S");
805 state->xtal = MT312_PLL_CLK;
806 state->freq_mult = 6;
807 break;
808 case ID_ZL10313:
809 strcpy(state->frontend.ops.info.name, "Zarlink ZL10313 DVB-S");
810 state->xtal = MT312_PLL_CLK_10_111;
811 state->freq_mult = 9;
812 break;
813 default:
814 printk(KERN_WARNING "Only Zarlink VP310/MT312/ZL10313"
815 " are supported chips.\n");
816 goto error;
819 return &state->frontend;
821 error:
822 kfree(state);
823 return NULL;
825 EXPORT_SYMBOL(vp310_mt312_attach);
827 module_param(debug, int, 0644);
828 MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
830 MODULE_DESCRIPTION("Zarlink VP310/MT312/ZL10313 DVB-S Demodulator driver");
831 MODULE_AUTHOR("Andreas Oberritter <obi@linuxtv.org>");
832 MODULE_LICENSE("GPL");