xref: /OK3568_Linux_fs/kernel/drivers/media/tuners/mt2266.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-or-later
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *  Driver for Microtune MT2266 "Direct conversion low power broadband tuner"
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  *  Copyright (c) 2007 Olivier DANET <odanet@caramail.com>
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #include <linux/module.h>
9*4882a593Smuzhiyun #include <linux/delay.h>
10*4882a593Smuzhiyun #include <linux/dvb/frontend.h>
11*4882a593Smuzhiyun #include <linux/i2c.h>
12*4882a593Smuzhiyun #include <linux/slab.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <media/dvb_frontend.h>
15*4882a593Smuzhiyun #include "mt2266.h"
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #define I2C_ADDRESS 0x60
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #define REG_PART_REV   0
20*4882a593Smuzhiyun #define REG_TUNE       1
21*4882a593Smuzhiyun #define REG_BAND       6
22*4882a593Smuzhiyun #define REG_BANDWIDTH  8
23*4882a593Smuzhiyun #define REG_LOCK       0x12
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun #define PART_REV 0x85
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun struct mt2266_priv {
28*4882a593Smuzhiyun 	struct mt2266_config *cfg;
29*4882a593Smuzhiyun 	struct i2c_adapter   *i2c;
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun 	u32 frequency;
32*4882a593Smuzhiyun 	u32 bandwidth;
33*4882a593Smuzhiyun 	u8 band;
34*4882a593Smuzhiyun };
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun #define MT2266_VHF 1
37*4882a593Smuzhiyun #define MT2266_UHF 0
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun /* Here, frequencies are expressed in kiloHertz to avoid 32 bits overflows */
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun static int debug;
42*4882a593Smuzhiyun module_param(debug, int, 0644);
43*4882a593Smuzhiyun MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #define dprintk(args...) do { if (debug) {printk(KERN_DEBUG "MT2266: " args); printk("\n"); }} while (0)
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun // Reads a single register
mt2266_readreg(struct mt2266_priv * priv,u8 reg,u8 * val)48*4882a593Smuzhiyun static int mt2266_readreg(struct mt2266_priv *priv, u8 reg, u8 *val)
49*4882a593Smuzhiyun {
50*4882a593Smuzhiyun 	struct i2c_msg msg[2] = {
51*4882a593Smuzhiyun 		{ .addr = priv->cfg->i2c_address, .flags = 0,        .buf = &reg, .len = 1 },
52*4882a593Smuzhiyun 		{ .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, .buf = val,  .len = 1 },
53*4882a593Smuzhiyun 	};
54*4882a593Smuzhiyun 	if (i2c_transfer(priv->i2c, msg, 2) != 2) {
55*4882a593Smuzhiyun 		printk(KERN_WARNING "MT2266 I2C read failed\n");
56*4882a593Smuzhiyun 		return -EREMOTEIO;
57*4882a593Smuzhiyun 	}
58*4882a593Smuzhiyun 	return 0;
59*4882a593Smuzhiyun }
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun // Writes a single register
mt2266_writereg(struct mt2266_priv * priv,u8 reg,u8 val)62*4882a593Smuzhiyun static int mt2266_writereg(struct mt2266_priv *priv, u8 reg, u8 val)
63*4882a593Smuzhiyun {
64*4882a593Smuzhiyun 	u8 buf[2] = { reg, val };
65*4882a593Smuzhiyun 	struct i2c_msg msg = {
66*4882a593Smuzhiyun 		.addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2
67*4882a593Smuzhiyun 	};
68*4882a593Smuzhiyun 	if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
69*4882a593Smuzhiyun 		printk(KERN_WARNING "MT2266 I2C write failed\n");
70*4882a593Smuzhiyun 		return -EREMOTEIO;
71*4882a593Smuzhiyun 	}
72*4882a593Smuzhiyun 	return 0;
73*4882a593Smuzhiyun }
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun // Writes a set of consecutive registers
mt2266_writeregs(struct mt2266_priv * priv,u8 * buf,u8 len)76*4882a593Smuzhiyun static int mt2266_writeregs(struct mt2266_priv *priv,u8 *buf, u8 len)
77*4882a593Smuzhiyun {
78*4882a593Smuzhiyun 	struct i2c_msg msg = {
79*4882a593Smuzhiyun 		.addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = len
80*4882a593Smuzhiyun 	};
81*4882a593Smuzhiyun 	if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
82*4882a593Smuzhiyun 		printk(KERN_WARNING "MT2266 I2C write failed (len=%i)\n",(int)len);
83*4882a593Smuzhiyun 		return -EREMOTEIO;
84*4882a593Smuzhiyun 	}
85*4882a593Smuzhiyun 	return 0;
86*4882a593Smuzhiyun }
87*4882a593Smuzhiyun 
88*4882a593Smuzhiyun // Initialisation sequences
89*4882a593Smuzhiyun static u8 mt2266_init1[] = { REG_TUNE, 0x00, 0x00, 0x28,
90*4882a593Smuzhiyun 				 0x00, 0x52, 0x99, 0x3f };
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun static u8 mt2266_init2[] = {
93*4882a593Smuzhiyun     0x17, 0x6d, 0x71, 0x61, 0xc0, 0xbf, 0xff, 0xdc, 0x00, 0x0a, 0xd4,
94*4882a593Smuzhiyun     0x03, 0x64, 0x64, 0x64, 0x64, 0x22, 0xaa, 0xf2, 0x1e, 0x80, 0x14,
95*4882a593Smuzhiyun     0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7f, 0x5e, 0x3f, 0xff, 0xff,
96*4882a593Smuzhiyun     0xff, 0x00, 0x77, 0x0f, 0x2d
97*4882a593Smuzhiyun };
98*4882a593Smuzhiyun 
99*4882a593Smuzhiyun static u8 mt2266_init_8mhz[] = { REG_BANDWIDTH, 0x22, 0x22, 0x22, 0x22,
100*4882a593Smuzhiyun 						0x22, 0x22, 0x22, 0x22 };
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun static u8 mt2266_init_7mhz[] = { REG_BANDWIDTH, 0x32, 0x32, 0x32, 0x32,
103*4882a593Smuzhiyun 						0x32, 0x32, 0x32, 0x32 };
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun static u8 mt2266_init_6mhz[] = { REG_BANDWIDTH, 0xa7, 0xa7, 0xa7, 0xa7,
106*4882a593Smuzhiyun 						0xa7, 0xa7, 0xa7, 0xa7 };
107*4882a593Smuzhiyun 
108*4882a593Smuzhiyun static u8 mt2266_uhf[] = { 0x1d, 0xdc, 0x00, 0x0a, 0xd4, 0x03, 0x64, 0x64,
109*4882a593Smuzhiyun 			   0x64, 0x64, 0x22, 0xaa, 0xf2, 0x1e, 0x80, 0x14 };
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun static u8 mt2266_vhf[] = { 0x1d, 0xfe, 0x00, 0x00, 0xb4, 0x03, 0xa5, 0xa5,
112*4882a593Smuzhiyun 			   0xa5, 0xa5, 0x82, 0xaa, 0xf1, 0x17, 0x80, 0x1f };
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun #define FREF 30000       // Quartz oscillator 30 MHz
115*4882a593Smuzhiyun 
mt2266_set_params(struct dvb_frontend * fe)116*4882a593Smuzhiyun static int mt2266_set_params(struct dvb_frontend *fe)
117*4882a593Smuzhiyun {
118*4882a593Smuzhiyun 	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
119*4882a593Smuzhiyun 	struct mt2266_priv *priv;
120*4882a593Smuzhiyun 	int ret=0;
121*4882a593Smuzhiyun 	u32 freq;
122*4882a593Smuzhiyun 	u32 tune;
123*4882a593Smuzhiyun 	u8  lnaband;
124*4882a593Smuzhiyun 	u8  b[10];
125*4882a593Smuzhiyun 	int i;
126*4882a593Smuzhiyun 	u8 band;
127*4882a593Smuzhiyun 
128*4882a593Smuzhiyun 	priv = fe->tuner_priv;
129*4882a593Smuzhiyun 
130*4882a593Smuzhiyun 	freq = priv->frequency / 1000; /* Hz -> kHz */
131*4882a593Smuzhiyun 	if (freq < 470000 && freq > 230000)
132*4882a593Smuzhiyun 		return -EINVAL; /* Gap between VHF and UHF bands */
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun 	priv->frequency = c->frequency;
135*4882a593Smuzhiyun 	tune = 2 * freq * (8192/16) / (FREF/16);
136*4882a593Smuzhiyun 	band = (freq < 300000) ? MT2266_VHF : MT2266_UHF;
137*4882a593Smuzhiyun 	if (band == MT2266_VHF)
138*4882a593Smuzhiyun 		tune *= 2;
139*4882a593Smuzhiyun 
140*4882a593Smuzhiyun 	switch (c->bandwidth_hz) {
141*4882a593Smuzhiyun 	case 6000000:
142*4882a593Smuzhiyun 		mt2266_writeregs(priv, mt2266_init_6mhz,
143*4882a593Smuzhiyun 				 sizeof(mt2266_init_6mhz));
144*4882a593Smuzhiyun 		break;
145*4882a593Smuzhiyun 	case 8000000:
146*4882a593Smuzhiyun 		mt2266_writeregs(priv, mt2266_init_8mhz,
147*4882a593Smuzhiyun 				 sizeof(mt2266_init_8mhz));
148*4882a593Smuzhiyun 		break;
149*4882a593Smuzhiyun 	case 7000000:
150*4882a593Smuzhiyun 	default:
151*4882a593Smuzhiyun 		mt2266_writeregs(priv, mt2266_init_7mhz,
152*4882a593Smuzhiyun 				 sizeof(mt2266_init_7mhz));
153*4882a593Smuzhiyun 		break;
154*4882a593Smuzhiyun 	}
155*4882a593Smuzhiyun 	priv->bandwidth = c->bandwidth_hz;
156*4882a593Smuzhiyun 
157*4882a593Smuzhiyun 	if (band == MT2266_VHF && priv->band == MT2266_UHF) {
158*4882a593Smuzhiyun 		dprintk("Switch from UHF to VHF");
159*4882a593Smuzhiyun 		mt2266_writereg(priv, 0x05, 0x04);
160*4882a593Smuzhiyun 		mt2266_writereg(priv, 0x19, 0x61);
161*4882a593Smuzhiyun 		mt2266_writeregs(priv, mt2266_vhf, sizeof(mt2266_vhf));
162*4882a593Smuzhiyun 	} else if (band == MT2266_UHF && priv->band == MT2266_VHF) {
163*4882a593Smuzhiyun 		dprintk("Switch from VHF to UHF");
164*4882a593Smuzhiyun 		mt2266_writereg(priv, 0x05, 0x52);
165*4882a593Smuzhiyun 		mt2266_writereg(priv, 0x19, 0x61);
166*4882a593Smuzhiyun 		mt2266_writeregs(priv, mt2266_uhf, sizeof(mt2266_uhf));
167*4882a593Smuzhiyun 	}
168*4882a593Smuzhiyun 	msleep(10);
169*4882a593Smuzhiyun 
170*4882a593Smuzhiyun 	if (freq <= 495000)
171*4882a593Smuzhiyun 		lnaband = 0xEE;
172*4882a593Smuzhiyun 	else if (freq <= 525000)
173*4882a593Smuzhiyun 		lnaband = 0xDD;
174*4882a593Smuzhiyun 	else if (freq <= 550000)
175*4882a593Smuzhiyun 		lnaband = 0xCC;
176*4882a593Smuzhiyun 	else if (freq <= 580000)
177*4882a593Smuzhiyun 		lnaband = 0xBB;
178*4882a593Smuzhiyun 	else if (freq <= 605000)
179*4882a593Smuzhiyun 		lnaband = 0xAA;
180*4882a593Smuzhiyun 	else if (freq <= 630000)
181*4882a593Smuzhiyun 		lnaband = 0x99;
182*4882a593Smuzhiyun 	else if (freq <= 655000)
183*4882a593Smuzhiyun 		lnaband = 0x88;
184*4882a593Smuzhiyun 	else if (freq <= 685000)
185*4882a593Smuzhiyun 		lnaband = 0x77;
186*4882a593Smuzhiyun 	else if (freq <= 710000)
187*4882a593Smuzhiyun 		lnaband = 0x66;
188*4882a593Smuzhiyun 	else if (freq <= 735000)
189*4882a593Smuzhiyun 		lnaband = 0x55;
190*4882a593Smuzhiyun 	else if (freq <= 765000)
191*4882a593Smuzhiyun 		lnaband = 0x44;
192*4882a593Smuzhiyun 	else if (freq <= 802000)
193*4882a593Smuzhiyun 		lnaband = 0x33;
194*4882a593Smuzhiyun 	else if (freq <= 840000)
195*4882a593Smuzhiyun 		lnaband = 0x22;
196*4882a593Smuzhiyun 	else
197*4882a593Smuzhiyun 		lnaband = 0x11;
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun 	b[0] = REG_TUNE;
200*4882a593Smuzhiyun 	b[1] = (tune >> 8) & 0x1F;
201*4882a593Smuzhiyun 	b[2] = tune & 0xFF;
202*4882a593Smuzhiyun 	b[3] = tune >> 13;
203*4882a593Smuzhiyun 	mt2266_writeregs(priv,b,4);
204*4882a593Smuzhiyun 
205*4882a593Smuzhiyun 	dprintk("set_parms: tune=%d band=%d %s",
206*4882a593Smuzhiyun 		(int) tune, (int) lnaband,
207*4882a593Smuzhiyun 		(band == MT2266_UHF) ? "UHF" : "VHF");
208*4882a593Smuzhiyun 	dprintk("set_parms: [1..3]: %2x %2x %2x",
209*4882a593Smuzhiyun 		(int) b[1], (int) b[2], (int)b[3]);
210*4882a593Smuzhiyun 
211*4882a593Smuzhiyun 	if (band == MT2266_UHF) {
212*4882a593Smuzhiyun 		b[0] = 0x05;
213*4882a593Smuzhiyun 		b[1] = (priv->band == MT2266_VHF) ? 0x52 : 0x62;
214*4882a593Smuzhiyun 		b[2] = lnaband;
215*4882a593Smuzhiyun 		mt2266_writeregs(priv, b, 3);
216*4882a593Smuzhiyun 	}
217*4882a593Smuzhiyun 
218*4882a593Smuzhiyun 	/* Wait for pll lock or timeout */
219*4882a593Smuzhiyun 	i = 0;
220*4882a593Smuzhiyun 	do {
221*4882a593Smuzhiyun 		mt2266_readreg(priv,REG_LOCK,b);
222*4882a593Smuzhiyun 		if (b[0] & 0x40)
223*4882a593Smuzhiyun 			break;
224*4882a593Smuzhiyun 		msleep(10);
225*4882a593Smuzhiyun 		i++;
226*4882a593Smuzhiyun 	} while (i<10);
227*4882a593Smuzhiyun 	dprintk("Lock when i=%i",(int)i);
228*4882a593Smuzhiyun 
229*4882a593Smuzhiyun 	if (band == MT2266_UHF && priv->band == MT2266_VHF)
230*4882a593Smuzhiyun 		mt2266_writereg(priv, 0x05, 0x62);
231*4882a593Smuzhiyun 
232*4882a593Smuzhiyun 	priv->band = band;
233*4882a593Smuzhiyun 
234*4882a593Smuzhiyun 	return ret;
235*4882a593Smuzhiyun }
236*4882a593Smuzhiyun 
mt2266_calibrate(struct mt2266_priv * priv)237*4882a593Smuzhiyun static void mt2266_calibrate(struct mt2266_priv *priv)
238*4882a593Smuzhiyun {
239*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x11, 0x03);
240*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x11, 0x01);
241*4882a593Smuzhiyun 	mt2266_writeregs(priv, mt2266_init1, sizeof(mt2266_init1));
242*4882a593Smuzhiyun 	mt2266_writeregs(priv, mt2266_init2, sizeof(mt2266_init2));
243*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x33, 0x5e);
244*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x10, 0x10);
245*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x10, 0x00);
246*4882a593Smuzhiyun 	mt2266_writeregs(priv, mt2266_init_8mhz, sizeof(mt2266_init_8mhz));
247*4882a593Smuzhiyun 	msleep(25);
248*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x17, 0x6d);
249*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x1c, 0x00);
250*4882a593Smuzhiyun 	msleep(75);
251*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x17, 0x6d);
252*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x1c, 0xff);
253*4882a593Smuzhiyun }
254*4882a593Smuzhiyun 
mt2266_get_frequency(struct dvb_frontend * fe,u32 * frequency)255*4882a593Smuzhiyun static int mt2266_get_frequency(struct dvb_frontend *fe, u32 *frequency)
256*4882a593Smuzhiyun {
257*4882a593Smuzhiyun 	struct mt2266_priv *priv = fe->tuner_priv;
258*4882a593Smuzhiyun 	*frequency = priv->frequency;
259*4882a593Smuzhiyun 	return 0;
260*4882a593Smuzhiyun }
261*4882a593Smuzhiyun 
mt2266_get_bandwidth(struct dvb_frontend * fe,u32 * bandwidth)262*4882a593Smuzhiyun static int mt2266_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
263*4882a593Smuzhiyun {
264*4882a593Smuzhiyun 	struct mt2266_priv *priv = fe->tuner_priv;
265*4882a593Smuzhiyun 	*bandwidth = priv->bandwidth;
266*4882a593Smuzhiyun 	return 0;
267*4882a593Smuzhiyun }
268*4882a593Smuzhiyun 
mt2266_init(struct dvb_frontend * fe)269*4882a593Smuzhiyun static int mt2266_init(struct dvb_frontend *fe)
270*4882a593Smuzhiyun {
271*4882a593Smuzhiyun 	int ret;
272*4882a593Smuzhiyun 	struct mt2266_priv *priv = fe->tuner_priv;
273*4882a593Smuzhiyun 	ret = mt2266_writereg(priv, 0x17, 0x6d);
274*4882a593Smuzhiyun 	if (ret < 0)
275*4882a593Smuzhiyun 		return ret;
276*4882a593Smuzhiyun 	ret = mt2266_writereg(priv, 0x1c, 0xff);
277*4882a593Smuzhiyun 	if (ret < 0)
278*4882a593Smuzhiyun 		return ret;
279*4882a593Smuzhiyun 	return 0;
280*4882a593Smuzhiyun }
281*4882a593Smuzhiyun 
mt2266_sleep(struct dvb_frontend * fe)282*4882a593Smuzhiyun static int mt2266_sleep(struct dvb_frontend *fe)
283*4882a593Smuzhiyun {
284*4882a593Smuzhiyun 	struct mt2266_priv *priv = fe->tuner_priv;
285*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x17, 0x6d);
286*4882a593Smuzhiyun 	mt2266_writereg(priv, 0x1c, 0x00);
287*4882a593Smuzhiyun 	return 0;
288*4882a593Smuzhiyun }
289*4882a593Smuzhiyun 
mt2266_release(struct dvb_frontend * fe)290*4882a593Smuzhiyun static void mt2266_release(struct dvb_frontend *fe)
291*4882a593Smuzhiyun {
292*4882a593Smuzhiyun 	kfree(fe->tuner_priv);
293*4882a593Smuzhiyun 	fe->tuner_priv = NULL;
294*4882a593Smuzhiyun }
295*4882a593Smuzhiyun 
296*4882a593Smuzhiyun static const struct dvb_tuner_ops mt2266_tuner_ops = {
297*4882a593Smuzhiyun 	.info = {
298*4882a593Smuzhiyun 		.name              = "Microtune MT2266",
299*4882a593Smuzhiyun 		.frequency_min_hz  = 174 * MHz,
300*4882a593Smuzhiyun 		.frequency_max_hz  = 862 * MHz,
301*4882a593Smuzhiyun 		.frequency_step_hz =  50 * kHz,
302*4882a593Smuzhiyun 	},
303*4882a593Smuzhiyun 	.release       = mt2266_release,
304*4882a593Smuzhiyun 	.init          = mt2266_init,
305*4882a593Smuzhiyun 	.sleep         = mt2266_sleep,
306*4882a593Smuzhiyun 	.set_params    = mt2266_set_params,
307*4882a593Smuzhiyun 	.get_frequency = mt2266_get_frequency,
308*4882a593Smuzhiyun 	.get_bandwidth = mt2266_get_bandwidth
309*4882a593Smuzhiyun };
310*4882a593Smuzhiyun 
mt2266_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c,struct mt2266_config * cfg)311*4882a593Smuzhiyun struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg)
312*4882a593Smuzhiyun {
313*4882a593Smuzhiyun 	struct mt2266_priv *priv = NULL;
314*4882a593Smuzhiyun 	u8 id = 0;
315*4882a593Smuzhiyun 
316*4882a593Smuzhiyun 	priv = kzalloc(sizeof(struct mt2266_priv), GFP_KERNEL);
317*4882a593Smuzhiyun 	if (priv == NULL)
318*4882a593Smuzhiyun 		return NULL;
319*4882a593Smuzhiyun 
320*4882a593Smuzhiyun 	priv->cfg      = cfg;
321*4882a593Smuzhiyun 	priv->i2c      = i2c;
322*4882a593Smuzhiyun 	priv->band     = MT2266_UHF;
323*4882a593Smuzhiyun 
324*4882a593Smuzhiyun 	if (mt2266_readreg(priv, 0, &id)) {
325*4882a593Smuzhiyun 		kfree(priv);
326*4882a593Smuzhiyun 		return NULL;
327*4882a593Smuzhiyun 	}
328*4882a593Smuzhiyun 	if (id != PART_REV) {
329*4882a593Smuzhiyun 		kfree(priv);
330*4882a593Smuzhiyun 		return NULL;
331*4882a593Smuzhiyun 	}
332*4882a593Smuzhiyun 	printk(KERN_INFO "MT2266: successfully identified\n");
333*4882a593Smuzhiyun 	memcpy(&fe->ops.tuner_ops, &mt2266_tuner_ops, sizeof(struct dvb_tuner_ops));
334*4882a593Smuzhiyun 
335*4882a593Smuzhiyun 	fe->tuner_priv = priv;
336*4882a593Smuzhiyun 	mt2266_calibrate(priv);
337*4882a593Smuzhiyun 	return fe;
338*4882a593Smuzhiyun }
339*4882a593Smuzhiyun EXPORT_SYMBOL(mt2266_attach);
340*4882a593Smuzhiyun 
341*4882a593Smuzhiyun MODULE_AUTHOR("Olivier DANET");
342*4882a593Smuzhiyun MODULE_DESCRIPTION("Microtune MT2266 silicon tuner driver");
343*4882a593Smuzhiyun MODULE_LICENSE("GPL");
344