tda18271-fe.c 31.8 KB
Newer Older
1
/*
2
    tda18271-fe.c - driver for the Philips / NXP TDA18271 silicon tuner
3

4
    Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <linux/delay.h>
#include <linux/videodev2.h>
23
#include "tda18271-priv.h"
24

25
int tda18271_debug;
26
module_param_named(debug, tda18271_debug, int, 0644);
27
MODULE_PARM_DESC(debug, "set debug level "
28
		 "(info=1, map=2, reg=4, adv=8, cal=16 (or-able))");
29

30
static int tda18271_cal_on_startup = -1;
31 32 33
module_param_named(cal, tda18271_cal_on_startup, int, 0644);
MODULE_PARM_DESC(cal, "perform RF tracking filter calibration on startup");

34
static DEFINE_MUTEX(tda18271_list_mutex);
35
static LIST_HEAD(hybrid_tuner_instance_list);
36

37 38
/*---------------------------------------------------------------------*/

39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
static int tda18271_toggle_output(struct dvb_frontend *fe, int standby)
{
	struct tda18271_priv *priv = fe->tuner_priv;

	int ret = tda18271_set_standby_mode(fe, standby ? 1 : 0,
			priv->output_opt & TDA18271_OUTPUT_LT_OFF ? 1 : 0,
			priv->output_opt & TDA18271_OUTPUT_XT_OFF ? 1 : 0);

	if (tda_fail(ret))
		goto fail;

	tda_dbg("%s mode: xtal oscillator %s, slave tuner loop thru %s\n",
		standby ? "standby" : "active",
		priv->output_opt & TDA18271_OUTPUT_XT_OFF ? "off" : "on",
		priv->output_opt & TDA18271_OUTPUT_LT_OFF ? "off" : "on");
fail:
	return ret;
}

/*---------------------------------------------------------------------*/

60 61 62 63 64 65 66 67 68
static inline int charge_pump_source(struct dvb_frontend *fe, int force)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	return tda18271_charge_pump_source(fe,
					   (priv->role == TDA18271_SLAVE) ?
					   TDA18271_CAL_PLL :
					   TDA18271_MAIN_PLL, force);
}

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
static inline void tda18271_set_if_notch(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;

	switch (priv->mode) {
	case TDA18271_ANALOG:
		regs[R_MPD]  &= ~0x80; /* IF notch = 0 */
		break;
	case TDA18271_DIGITAL:
		regs[R_MPD]  |= 0x80; /* IF notch = 1 */
		break;
	}
}

84
static int tda18271_channel_configuration(struct dvb_frontend *fe,
85 86
					  struct tda18271_std_map_item *map,
					  u32 freq, u32 bw)
87 88 89
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
90
	int ret;
91 92 93 94 95 96
	u32 N;

	/* update TV broadcast parameters */

	/* set standard */
	regs[R_EP3]  &= ~0x1f; /* clear std bits */
97
	regs[R_EP3]  |= (map->agc_mode << 3) | map->std;
98

99 100 101 102
	if (priv->id == TDA18271HDC2) {
		/* set rfagc to high speed mode */
		regs[R_EP3] &= ~0x04;
	}
103

104 105 106
	/* set cal mode to normal */
	regs[R_EP4]  &= ~0x03;

107
	/* update IF output level */
108
	regs[R_EP4]  &= ~0x1c; /* clear if level bits */
109
	regs[R_EP4]  |= (map->if_lvl << 2);
110

111 112 113
	/* update FM_RFn */
	regs[R_EP4]  &= ~0x80;
	regs[R_EP4]  |= map->fm_rfn << 7;
114

115 116 117
	/* update rf top / if top */
	regs[R_EB22]  = 0x00;
	regs[R_EB22] |= map->rfagc_top;
118
	ret = tda18271_write_regs(fe, R_EB22, 1);
119
	if (tda_fail(ret))
120
		goto fail;
121 122 123 124 125 126

	/* --------------------------------------------------------------- */

	/* disable Power Level Indicator */
	regs[R_EP1]  |= 0x40;

127 128 129
	/* make sure thermometer is off */
	regs[R_TM]   &= ~0x10;

130 131 132 133 134 135 136 137 138 139 140 141 142 143
	/* frequency dependent parameters */

	tda18271_calc_ir_measure(fe, &freq);

	tda18271_calc_bp_filter(fe, &freq);

	tda18271_calc_rf_band(fe, &freq);

	tda18271_calc_gain_taper(fe, &freq);

	/* --------------------------------------------------------------- */

	/* dual tuner and agc1 extra configuration */

144 145 146 147 148 149 150 151
	switch (priv->role) {
	case TDA18271_MASTER:
		regs[R_EB1]  |= 0x04; /* main vco */
		break;
	case TDA18271_SLAVE:
		regs[R_EB1]  &= ~0x04; /* cal vco */
		break;
	}
152 153 154 155 156 157 158

	/* agc1 always active */
	regs[R_EB1]  &= ~0x02;

	/* agc1 has priority on agc2 */
	regs[R_EB1]  &= ~0x01;

159
	ret = tda18271_write_regs(fe, R_EB1, 1);
160
	if (tda_fail(ret))
161
		goto fail;
162 163 164

	/* --------------------------------------------------------------- */

165
	N = map->if_freq * 1000 + freq;
166

167 168 169
	switch (priv->role) {
	case TDA18271_MASTER:
		tda18271_calc_main_pll(fe, N);
170
		tda18271_set_if_notch(fe);
171 172 173 174 175 176 177
		tda18271_write_regs(fe, R_MPD, 4);
		break;
	case TDA18271_SLAVE:
		tda18271_calc_cal_pll(fe, N);
		tda18271_write_regs(fe, R_CPD, 4);

		regs[R_MPD] = regs[R_CPD] & 0x7f;
178
		tda18271_set_if_notch(fe);
179 180 181
		tda18271_write_regs(fe, R_MPD, 1);
		break;
	}
182

183
	ret = tda18271_write_regs(fe, R_TM, 7);
184
	if (tda_fail(ret))
185
		goto fail;
186

187 188
	/* force charge pump source */
	charge_pump_source(fe, 1);
189 190 191

	msleep(1);

192 193
	/* return pll to normal operation */
	charge_pump_source(fe, 0);
194

195 196
	msleep(20);

197 198 199 200 201 202 203 204
	if (priv->id == TDA18271HDC2) {
		/* set rfagc to normal speed mode */
		if (map->fm_rfn)
			regs[R_EP3] &= ~0x04;
		else
			regs[R_EP3] |= 0x04;
		ret = tda18271_write_regs(fe, R_EP3, 1);
	}
205 206
fail:
	return ret;
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
}

static int tda18271_read_thermometer(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
	int tm;

	/* switch thermometer on */
	regs[R_TM]   |= 0x10;
	tda18271_write_regs(fe, R_TM, 1);

	/* read thermometer info */
	tda18271_read_regs(fe);

	if ((((regs[R_TM] & 0x0f) == 0x00) && ((regs[R_TM] & 0x20) == 0x20)) ||
	    (((regs[R_TM] & 0x0f) == 0x08) && ((regs[R_TM] & 0x20) == 0x00))) {

		if ((regs[R_TM] & 0x20) == 0x20)
			regs[R_TM] &= ~0x20;
		else
			regs[R_TM] |= 0x20;

		tda18271_write_regs(fe, R_TM, 1);

		msleep(10); /* temperature sensing */

		/* read thermometer info */
		tda18271_read_regs(fe);
	}

	tm = tda18271_lookup_thermometer(fe);

	/* switch thermometer off */
	regs[R_TM]   &= ~0x10;
	tda18271_write_regs(fe, R_TM, 1);

	/* set CAL mode to normal */
	regs[R_EP4]  &= ~0x03;
	tda18271_write_regs(fe, R_EP4, 1);

	return tm;
}

251 252
/* ------------------------------------------------------------------ */

253 254
static int tda18271c2_rf_tracking_filters_correction(struct dvb_frontend *fe,
						     u32 freq)
255 256 257 258
{
	struct tda18271_priv *priv = fe->tuner_priv;
	struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
	unsigned char *regs = priv->tda18271_regs;
259 260 261
	int i, ret;
	u8 tm_current, dc_over_dt, rf_tab;
	s32 rfcal_comp, approx;
262 263

	/* power up */
264
	ret = tda18271_set_standby_mode(fe, 0, 0, 0);
265
	if (tda_fail(ret))
266
		goto fail;
267 268 269 270 271 272 273 274 275 276

	/* read die current temperature */
	tm_current = tda18271_read_thermometer(fe);

	/* frequency dependent parameters */

	tda18271_calc_rf_cal(fe, &freq);
	rf_tab = regs[R_EB14];

	i = tda18271_lookup_rf_band(fe, &freq, NULL);
277 278
	if (tda_fail(i))
		return i;
279 280

	if ((0 == map[i].rf3) || (freq / 1000 < map[i].rf2)) {
281 282
		approx = map[i].rf_a1 * (s32)(freq / 1000 - map[i].rf1) +
			map[i].rf_b1 + rf_tab;
283
	} else {
284 285
		approx = map[i].rf_a2 * (s32)(freq / 1000 - map[i].rf2) +
			map[i].rf_b2 + rf_tab;
286 287 288 289 290 291 292 293 294 295
	}

	if (approx < 0)
		approx = 0;
	if (approx > 255)
		approx = 255;

	tda18271_lookup_map(fe, RF_CAL_DC_OVER_DT, &freq, &dc_over_dt);

	/* calculate temperature compensation */
296
	rfcal_comp = dc_over_dt * (s32)(tm_current - priv->tm_rfcal) / 1000;
297

298
	regs[R_EB14] = (unsigned char)(approx + rfcal_comp);
299 300 301
	ret = tda18271_write_regs(fe, R_EB14, 1);
fail:
	return ret;
302 303 304 305 306 307
}

static int tda18271_por(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
308
	int ret;
309 310 311

	/* power up detector 1 */
	regs[R_EB12] &= ~0x20;
312
	ret = tda18271_write_regs(fe, R_EB12, 1);
313
	if (tda_fail(ret))
314
		goto fail;
315 316 317

	regs[R_EB18] &= ~0x80; /* turn agc1 loop on */
	regs[R_EB18] &= ~0x03; /* set agc1_gain to  6 dB */
318
	ret = tda18271_write_regs(fe, R_EB18, 1);
319
	if (tda_fail(ret))
320
		goto fail;
321 322 323 324

	regs[R_EB21] |= 0x03; /* set agc2_gain to -6 dB */

	/* POR mode */
325
	ret = tda18271_set_standby_mode(fe, 1, 0, 0);
326
	if (tda_fail(ret))
327
		goto fail;
328 329 330 331

	/* disable 1.5 MHz low pass filter */
	regs[R_EB23] &= ~0x04; /* forcelp_fc2_en = 0 */
	regs[R_EB23] &= ~0x02; /* XXX: lp_fc[2] = 0 */
332 333 334
	ret = tda18271_write_regs(fe, R_EB21, 3);
fail:
	return ret;
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
}

static int tda18271_calibrate_rf(struct dvb_frontend *fe, u32 freq)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
	u32 N;

	/* set CAL mode to normal */
	regs[R_EP4]  &= ~0x03;
	tda18271_write_regs(fe, R_EP4, 1);

	/* switch off agc1 */
	regs[R_EP3]  |= 0x40; /* sm_lt = 1 */

	regs[R_EB18] |= 0x03; /* set agc1_gain to 15 dB */
	tda18271_write_regs(fe, R_EB18, 1);

	/* frequency dependent parameters */

	tda18271_calc_bp_filter(fe, &freq);
	tda18271_calc_gain_taper(fe, &freq);
	tda18271_calc_rf_band(fe, &freq);
	tda18271_calc_km(fe, &freq);

	tda18271_write_regs(fe, R_EP1, 3);
	tda18271_write_regs(fe, R_EB13, 1);

	/* main pll charge pump source */
364
	tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 1);
365 366

	/* cal pll charge pump source */
367
	tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 1);
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385

	/* force dcdc converter to 0 V */
	regs[R_EB14] = 0x00;
	tda18271_write_regs(fe, R_EB14, 1);

	/* disable plls lock */
	regs[R_EB20] &= ~0x20;
	tda18271_write_regs(fe, R_EB20, 1);

	/* set CAL mode to RF tracking filter calibration */
	regs[R_EP4]  |= 0x03;
	tda18271_write_regs(fe, R_EP4, 2);

	/* --------------------------------------------------------------- */

	/* set the internal calibration signal */
	N = freq;

386 387
	tda18271_calc_cal_pll(fe, N);
	tda18271_write_regs(fe, R_CPD, 4);
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404

	/* downconvert internal calibration */
	N += 1000000;

	tda18271_calc_main_pll(fe, N);
	tda18271_write_regs(fe, R_MPD, 4);

	msleep(5);

	tda18271_write_regs(fe, R_EP2, 1);
	tda18271_write_regs(fe, R_EP1, 1);
	tda18271_write_regs(fe, R_EP2, 1);
	tda18271_write_regs(fe, R_EP1, 1);

	/* --------------------------------------------------------------- */

	/* normal operation for the main pll */
405
	tda18271_charge_pump_source(fe, TDA18271_MAIN_PLL, 0);
406 407

	/* normal operation for the cal pll  */
408
	tda18271_charge_pump_source(fe, TDA18271_CAL_PLL, 0);
409

410
	msleep(10); /* plls locking */
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444

	/* launch the rf tracking filters calibration */
	regs[R_EB20]  |= 0x20;
	tda18271_write_regs(fe, R_EB20, 1);

	msleep(60); /* calibration */

	/* --------------------------------------------------------------- */

	/* set CAL mode to normal */
	regs[R_EP4]  &= ~0x03;

	/* switch on agc1 */
	regs[R_EP3]  &= ~0x40; /* sm_lt = 0 */

	regs[R_EB18] &= ~0x03; /* set agc1_gain to  6 dB */
	tda18271_write_regs(fe, R_EB18, 1);

	tda18271_write_regs(fe, R_EP3, 2);

	/* synchronization */
	tda18271_write_regs(fe, R_EP1, 1);

	/* get calibration result */
	tda18271_read_extended(fe);

	return regs[R_EB14];
}

static int tda18271_powerscan(struct dvb_frontend *fe,
			      u32 *freq_in, u32 *freq_out)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
445
	int sgn, bcal, count, wait, ret;
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
	u8 cid_target;
	u16 count_limit;
	u32 freq;

	freq = *freq_in;

	tda18271_calc_rf_band(fe, &freq);
	tda18271_calc_rf_cal(fe, &freq);
	tda18271_calc_gain_taper(fe, &freq);
	tda18271_lookup_cid_target(fe, &freq, &cid_target, &count_limit);

	tda18271_write_regs(fe, R_EP2, 1);
	tda18271_write_regs(fe, R_EB14, 1);

	/* downconvert frequency */
	freq += 1000000;

	tda18271_calc_main_pll(fe, freq);
	tda18271_write_regs(fe, R_MPD, 4);

	msleep(5); /* pll locking */

	/* detection mode */
	regs[R_EP4]  &= ~0x03;
	regs[R_EP4]  |= 0x01;
	tda18271_write_regs(fe, R_EP4, 1);

	/* launch power detection measurement */
	tda18271_write_regs(fe, R_EP2, 1);

	/* read power detection info, stored in EB10 */
477
	ret = tda18271_read_extended(fe);
478
	if (tda_fail(ret))
479
		return ret;
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504

	/* algorithm initialization */
	sgn = 1;
	*freq_out = *freq_in;
	bcal = 0;
	count = 0;
	wait = false;

	while ((regs[R_EB10] & 0x3f) < cid_target) {
		/* downconvert updated freq to 1 MHz */
		freq = *freq_in + (sgn * count) + 1000000;

		tda18271_calc_main_pll(fe, freq);
		tda18271_write_regs(fe, R_MPD, 4);

		if (wait) {
			msleep(5); /* pll locking */
			wait = false;
		} else
			udelay(100); /* pll locking */

		/* launch power detection measurement */
		tda18271_write_regs(fe, R_EP2, 1);

		/* read power detection info, stored in EB10 */
505
		ret = tda18271_read_extended(fe);
506
		if (tda_fail(ret))
507
			return ret;
508 509 510

		count += 200;

511
		if (count <= count_limit)
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
			continue;

		if (sgn <= 0)
			break;

		sgn = -1 * sgn;
		count = 200;
		wait = true;
	}

	if ((regs[R_EB10] & 0x3f) >= cid_target) {
		bcal = 1;
		*freq_out = freq - 1000000;
	} else
		bcal = 0;

528
	tda_cal("bcal = %d, freq_in = %d, freq_out = %d (freq = %d)\n",
529 530 531 532 533 534 535 536 537
		bcal, *freq_in, *freq_out, freq);

	return bcal;
}

static int tda18271_powerscan_init(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
538
	int ret;
539 540 541 542 543 544 545 546

	/* set standard to digital */
	regs[R_EP3]  &= ~0x1f; /* clear std bits */
	regs[R_EP3]  |= 0x12;

	/* set cal mode to normal */
	regs[R_EP4]  &= ~0x03;

547
	/* update IF output level */
548 549
	regs[R_EP4]  &= ~0x1c; /* clear if level bits */

550
	ret = tda18271_write_regs(fe, R_EP3, 2);
551
	if (tda_fail(ret))
552
		goto fail;
553 554

	regs[R_EB18] &= ~0x03; /* set agc1_gain to   6 dB */
555
	ret = tda18271_write_regs(fe, R_EB18, 1);
556
	if (tda_fail(ret))
557
		goto fail;
558 559 560 561 562 563 564

	regs[R_EB21] &= ~0x03; /* set agc2_gain to -15 dB */

	/* 1.5 MHz low pass filter */
	regs[R_EB23] |= 0x04; /* forcelp_fc2_en = 1 */
	regs[R_EB23] |= 0x02; /* lp_fc[2] = 1 */

565 566 567
	ret = tda18271_write_regs(fe, R_EB21, 3);
fail:
	return ret;
568 569 570 571 572 573 574 575
}

static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
	unsigned char *regs = priv->tda18271_regs;
	int bcal, rf, i;
576
	s32 divisor, dividend;
577 578 579 580 581
#define RF1 0
#define RF2 1
#define RF3 2
	u32 rf_default[3];
	u32 rf_freq[3];
582 583
	s32 prog_cal[3];
	s32 prog_tab[3];
584 585 586

	i = tda18271_lookup_rf_band(fe, &freq, NULL);

587
	if (tda_fail(i))
588 589 590 591 592 593 594 595 596
		return i;

	rf_default[RF1] = 1000 * map[i].rf1_def;
	rf_default[RF2] = 1000 * map[i].rf2_def;
	rf_default[RF3] = 1000 * map[i].rf3_def;

	for (rf = RF1; rf <= RF3; rf++) {
		if (0 == rf_default[rf])
			return 0;
597
		tda_cal("freq = %d, rf = %d\n", freq, rf);
598 599 600

		/* look for optimized calibration frequency */
		bcal = tda18271_powerscan(fe, &rf_default[rf], &rf_freq[rf]);
601
		if (tda_fail(bcal))
602
			return bcal;
603 604

		tda18271_calc_rf_cal(fe, &rf_freq[rf]);
605
		prog_tab[rf] = (s32)regs[R_EB14];
606 607

		if (1 == bcal)
608 609
			prog_cal[rf] =
				(s32)tda18271_calibrate_rf(fe, rf_freq[rf]);
610 611 612 613 614 615
		else
			prog_cal[rf] = prog_tab[rf];

		switch (rf) {
		case RF1:
			map[i].rf_a1 = 0;
616
			map[i].rf_b1 = (prog_cal[RF1] - prog_tab[RF1]);
617 618 619
			map[i].rf1   = rf_freq[RF1] / 1000;
			break;
		case RF2:
620 621
			dividend = (prog_cal[RF2] - prog_tab[RF2] -
				    prog_cal[RF1] + prog_tab[RF1]);
622 623
			divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000;
			map[i].rf_a1 = (dividend / divisor);
624 625 626
			map[i].rf2   = rf_freq[RF2] / 1000;
			break;
		case RF3:
627 628
			dividend = (prog_cal[RF3] - prog_tab[RF3] -
				    prog_cal[RF2] + prog_tab[RF2]);
629 630
			divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000;
			map[i].rf_a2 = (dividend / divisor);
631
			map[i].rf_b2 = (prog_cal[RF2] - prog_tab[RF2]);
632 633 634 635 636 637 638 639 640 641
			map[i].rf3   = rf_freq[RF3] / 1000;
			break;
		default:
			BUG();
		}
	}

	return 0;
}

642
static int tda18271_calc_rf_filter_curve(struct dvb_frontend *fe)
643 644 645
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned int i;
646
	int ret;
647 648 649 650 651 652

	tda_info("tda18271: performing RF tracking filter calibration\n");

	/* wait for die temperature stabilization */
	msleep(200);

653
	ret = tda18271_powerscan_init(fe);
654
	if (tda_fail(ret))
655
		goto fail;
656 657

	/* rf band calibration */
658 659
	for (i = 0; priv->rf_cal_state[i].rfmax != 0; i++) {
		ret =
660 661
		tda18271_rf_tracking_filters_init(fe, 1000 *
						  priv->rf_cal_state[i].rfmax);
662
		if (tda_fail(ret))
663 664
			goto fail;
	}
665

666
	priv->tm_rfcal = tda18271_read_thermometer(fe);
667 668
fail:
	return ret;
669 670 671 672
}

/* ------------------------------------------------------------------ */

673
static int tda18271c2_rf_cal_init(struct dvb_frontend *fe)
674 675
{
	struct tda18271_priv *priv = fe->tuner_priv;
676
	unsigned char *regs = priv->tda18271_regs;
677
	int ret;
678 679 680 681

	/* test RF_CAL_OK to see if we need init */
	if ((regs[R_EP1] & 0x10) == 0)
		priv->cal_initialized = false;
682 683 684 685

	if (priv->cal_initialized)
		return 0;

686
	ret = tda18271_calc_rf_filter_curve(fe);
687
	if (tda_fail(ret))
688
		goto fail;
689

690
	ret = tda18271_por(fe);
691
	if (tda_fail(ret))
692
		goto fail;
693

694 695
	tda_info("tda18271: RF tracking filter calibration complete\n");

696
	priv->cal_initialized = true;
697
	goto end;
698
fail:
699 700
	tda_info("tda18271: RF tracking filter calibration failed!\n");
end:
701
	return ret;
702 703
}

704 705
static int tda18271c1_rf_tracking_filter_calibration(struct dvb_frontend *fe,
						     u32 freq, u32 bw)
706 707 708
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
709
	int ret;
710
	u32 N = 0;
711

712
	/* calculate bp filter */
713
	tda18271_calc_bp_filter(fe, &freq);
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728
	tda18271_write_regs(fe, R_EP1, 1);

	regs[R_EB4]  &= 0x07;
	regs[R_EB4]  |= 0x60;
	tda18271_write_regs(fe, R_EB4, 1);

	regs[R_EB7]   = 0x60;
	tda18271_write_regs(fe, R_EB7, 1);

	regs[R_EB14]  = 0x00;
	tda18271_write_regs(fe, R_EB14, 1);

	regs[R_EB20]  = 0xcc;
	tda18271_write_regs(fe, R_EB20, 1);

729
	/* set cal mode to RF tracking filter calibration */
730
	regs[R_EP4]  |= 0x03;
731

732
	/* calculate cal pll */
733 734 735 736 737 738 739 740 741 742

	switch (priv->mode) {
	case TDA18271_ANALOG:
		N = freq - 1250000;
		break;
	case TDA18271_DIGITAL:
		N = freq + bw / 2;
		break;
	}

743
	tda18271_calc_cal_pll(fe, N);
744

745
	/* calculate main pll */
746 747 748 749 750 751 752 753 754 755

	switch (priv->mode) {
	case TDA18271_ANALOG:
		N = freq - 250000;
		break;
	case TDA18271_DIGITAL:
		N = freq + bw / 2 + 1000000;
		break;
	}

756
	tda18271_calc_main_pll(fe, N);
757

758
	ret = tda18271_write_regs(fe, R_EP3, 11);
759
	if (tda_fail(ret))
760 761
		return ret;

762 763
	msleep(5); /* RF tracking filter calibration initialization */

764
	/* search for K,M,CO for RF calibration */
765
	tda18271_calc_km(fe, &freq);
766 767
	tda18271_write_regs(fe, R_EB13, 1);

768
	/* search for rf band */
769
	tda18271_calc_rf_band(fe, &freq);
770

771
	/* search for gain taper */
772
	tda18271_calc_gain_taper(fe, &freq);
773 774 775 776 777 778 779 780 781 782 783 784

	tda18271_write_regs(fe, R_EP2, 1);
	tda18271_write_regs(fe, R_EP1, 1);
	tda18271_write_regs(fe, R_EP2, 1);
	tda18271_write_regs(fe, R_EP1, 1);

	regs[R_EB4]  &= 0x07;
	regs[R_EB4]  |= 0x40;
	tda18271_write_regs(fe, R_EB4, 1);

	regs[R_EB7]   = 0x40;
	tda18271_write_regs(fe, R_EB7, 1);
785
	msleep(10); /* pll locking */
786 787 788 789 790 791 792 793 794 795

	regs[R_EB20]  = 0xec;
	tda18271_write_regs(fe, R_EB20, 1);
	msleep(60); /* RF tracking filter calibration completion */

	regs[R_EP4]  &= ~0x03; /* set cal mode to normal */
	tda18271_write_regs(fe, R_EP4, 1);

	tda18271_write_regs(fe, R_EP1, 1);

796 797
	/* RF tracking filter correction for VHF_Low band */
	if (0 == tda18271_calc_rf_cal(fe, &freq))
798 799
		tda18271_write_regs(fe, R_EB14, 1);

800 801 802
	return 0;
}

803 804
/* ------------------------------------------------------------------ */

805 806 807 808
static int tda18271_ir_cal_init(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
809
	int ret;
810

811
	ret = tda18271_read_regs(fe);
812
	if (tda_fail(ret))
813
		goto fail;
814 815 816

	/* test IR_CAL_OK to see if we need init */
	if ((regs[R_EP1] & 0x08) == 0)
817 818 819
		ret = tda18271_init_regs(fe);
fail:
	return ret;
820 821 822 823 824
}

static int tda18271_init(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
825
	int ret;
826 827 828

	mutex_lock(&priv->lock);

829
	/* full power up */
830
	ret = tda18271_set_standby_mode(fe, 0, 0, 0);
831
	if (tda_fail(ret))
832
		goto fail;
833 834

	/* initialization */
835
	ret = tda18271_ir_cal_init(fe);
836
	if (tda_fail(ret))
837
		goto fail;
838 839 840

	if (priv->id == TDA18271HDC2)
		tda18271c2_rf_cal_init(fe);
841
fail:
842 843
	mutex_unlock(&priv->lock);

844
	return ret;
845 846
}

847 848 849 850 851 852 853 854 855 856 857 858 859 860 861
static int tda18271_sleep(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	int ret;

	mutex_lock(&priv->lock);

	/* enter standby mode, with required output features enabled */
	ret = tda18271_toggle_output(fe, 1);

	mutex_unlock(&priv->lock);

	return ret;
}

862 863 864 865 866 867 868 869 870
/* ------------------------------------------------------------------ */

static int tda18271_agc(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	int ret = 0;

	switch (priv->config) {
	case 0:
871 872 873
		/* no external agc configuration required */
		if (tda18271_debug & DBG_ADV)
			tda_dbg("no agc configuration provided\n");
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894
		break;
	case 3:
		/* switch with GPIO of saa713x */
		tda_dbg("invoking callback\n");
		if (fe->callback)
			ret = fe->callback(priv->i2c_props.adap->algo_data,
					   DVB_FRONTEND_COMPONENT_TUNER,
					   TDA18271_CALLBACK_CMD_AGC_ENABLE,
					   priv->mode);
		break;
	case 1:
	case 2:
	default:
		/* n/a - currently not supported */
		tda_err("unsupported configuration: %d\n", priv->config);
		ret = -EINVAL;
		break;
	}
	return ret;
}

895
static int tda18271_tune(struct dvb_frontend *fe,
896
			 struct tda18271_std_map_item *map, u32 freq, u32 bw)
897 898
{
	struct tda18271_priv *priv = fe->tuner_priv;
899
	int ret;
900

901 902
	tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
		freq, map->if_freq, bw, map->agc_mode, map->std);
903

904 905 906 907
	ret = tda18271_agc(fe);
	if (tda_fail(ret))
		tda_warn("failed to configure agc\n");

908
	ret = tda18271_init(fe);
909
	if (tda_fail(ret))
910
		goto fail;
911 912 913

	mutex_lock(&priv->lock);

914 915
	switch (priv->id) {
	case TDA18271HDC1:
916
		tda18271c1_rf_tracking_filter_calibration(fe, freq, bw);
917 918
		break;
	case TDA18271HDC2:
919
		tda18271c2_rf_tracking_filters_correction(fe, freq);
920 921
		break;
	}
922
	ret = tda18271_channel_configuration(fe, map, freq, bw);
923 924

	mutex_unlock(&priv->lock);
925 926
fail:
	return ret;
927 928
}

929 930 931 932 933 934
/* ------------------------------------------------------------------ */

static int tda18271_set_params(struct dvb_frontend *fe,
			       struct dvb_frontend_parameters *params)
{
	struct tda18271_priv *priv = fe->tuner_priv;
935
	struct tda18271_std_map *std_map = &priv->std;
936
	struct tda18271_std_map_item *map;
937
	int ret;
938
	u32 bw, freq = params->frequency;
939 940 941 942 943 944 945

	priv->mode = TDA18271_DIGITAL;

	if (fe->ops.info.type == FE_ATSC) {
		switch (params->u.vsb.modulation) {
		case VSB_8:
		case VSB_16:
946
			map = &std_map->atsc_6;
947 948 949
			break;
		case QAM_64:
		case QAM_256:
950
			map = &std_map->qam_6;
951 952
			break;
		default:
953
			tda_warn("modulation not set!\n");
954 955
			return -EINVAL;
		}
956 957
#if 0
		/* userspace request is already center adjusted */
958
		freq += 1750000; /* Adjust to center (+1.75MHZ) */
959
#endif
960 961 962 963 964
		bw = 6000000;
	} else if (fe->ops.info.type == FE_OFDM) {
		switch (params->u.ofdm.bandwidth) {
		case BANDWIDTH_6_MHZ:
			bw = 6000000;
965
			map = &std_map->dvbt_6;
966 967 968
			break;
		case BANDWIDTH_7_MHZ:
			bw = 7000000;
969
			map = &std_map->dvbt_7;
970 971 972
			break;
		case BANDWIDTH_8_MHZ:
			bw = 8000000;
973
			map = &std_map->dvbt_8;
974 975
			break;
		default:
976
			tda_warn("bandwidth not set!\n");
977 978 979
			return -EINVAL;
		}
	} else {
980
		tda_warn("modulation type not supported!\n");
981 982 983
		return -EINVAL;
	}

984 985 986 987
	/* When tuning digital, the analog demod must be tri-stated */
	if (fe->ops.analog_ops.standby)
		fe->ops.analog_ops.standby(fe);

988
	ret = tda18271_tune(fe, map, freq, bw);
989

990
	if (tda_fail(ret))
991 992 993 994 995 996 997
		goto fail;

	priv->frequency = freq;
	priv->bandwidth = (fe->ops.info.type == FE_OFDM) ?
		params->u.ofdm.bandwidth : 0;
fail:
	return ret;
998 999 1000 1001 1002 1003
}

static int tda18271_set_analog_params(struct dvb_frontend *fe,
				      struct analog_parameters *params)
{
	struct tda18271_priv *priv = fe->tuner_priv;
1004
	struct tda18271_std_map *std_map = &priv->std;
1005
	struct tda18271_std_map_item *map;
1006
	char *mode;
1007
	int ret;
1008 1009
	u32 freq = params->frequency * 125 *
		((params->mode == V4L2_TUNER_RADIO) ? 1 : 1000) / 2;
1010 1011 1012

	priv->mode = TDA18271_ANALOG;

1013
	if (params->mode == V4L2_TUNER_RADIO) {
1014
		map = &std_map->fm_radio;
1015 1016
		mode = "fm";
	} else if (params->std & V4L2_STD_MN) {
1017
		map = &std_map->atv_mn;
1018 1019
		mode = "MN";
	} else if (params->std & V4L2_STD_B) {
1020
		map = &std_map->atv_b;
1021 1022
		mode = "B";
	} else if (params->std & V4L2_STD_GH) {
1023
		map = &std_map->atv_gh;
1024 1025
		mode = "GH";
	} else if (params->std & V4L2_STD_PAL_I) {
1026
		map = &std_map->atv_i;
1027 1028
		mode = "I";
	} else if (params->std & V4L2_STD_DK) {
1029
		map = &std_map->atv_dk;
1030 1031
		mode = "DK";
	} else if (params->std & V4L2_STD_SECAM_L) {
1032
		map = &std_map->atv_l;
1033 1034
		mode = "L";
	} else if (params->std & V4L2_STD_SECAM_LC) {
1035
		map = &std_map->atv_lc;
1036
		mode = "L'";
1037
	} else {
1038
		map = &std_map->atv_i;
1039 1040 1041
		mode = "xx";
	}

1042
	tda_dbg("setting tda18271 to system %s\n", mode);
1043

1044
	ret = tda18271_tune(fe, map, freq, 0);
1045

1046
	if (tda_fail(ret))
1047 1048 1049 1050 1051 1052
		goto fail;

	priv->frequency = freq;
	priv->bandwidth = 0;
fail:
	return ret;
1053 1054 1055 1056
}

static int tda18271_release(struct dvb_frontend *fe)
{
1057 1058 1059 1060
	struct tda18271_priv *priv = fe->tuner_priv;

	mutex_lock(&tda18271_list_mutex);

1061 1062
	if (priv)
		hybrid_tuner_release_state(priv);
1063 1064 1065

	mutex_unlock(&tda18271_list_mutex);

1066
	fe->tuner_priv = NULL;
1067

1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084
	return 0;
}

static int tda18271_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	*frequency = priv->frequency;
	return 0;
}

static int tda18271_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	*bandwidth = priv->bandwidth;
	return 0;
}

1085 1086 1087
/* ------------------------------------------------------------------ */

#define tda18271_update_std(std_cfg, name) do {				\
1088
	if (map->std_cfg.if_freq +					\
1089 1090
		map->std_cfg.agc_mode + map->std_cfg.std +		\
		map->std_cfg.if_lvl + map->std_cfg.rfagc_top > 0) {	\
1091 1092 1093 1094 1095 1096
		tda_dbg("Using custom std config for %s\n", name);	\
		memcpy(&std->std_cfg, &map->std_cfg,			\
			sizeof(struct tda18271_std_map_item));		\
	} } while (0)

#define tda18271_dump_std_item(std_cfg, name) do {			\
1097 1098
	tda_dbg("(%s) if_freq = %d, agc_mode = %d, std = %d, "		\
		"if_lvl = %d, rfagc_top = 0x%02x\n",			\
1099
		name, std->std_cfg.if_freq,				\
1100 1101
		std->std_cfg.agc_mode, std->std_cfg.std,		\
		std->std_cfg.if_lvl, std->std_cfg.rfagc_top);		\
1102 1103 1104 1105 1106 1107 1108 1109
	} while (0)

static int tda18271_dump_std_map(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	struct tda18271_std_map *std = &priv->std;

	tda_dbg("========== STANDARD MAP SETTINGS ==========\n");
1110 1111 1112 1113 1114 1115 1116
	tda18271_dump_std_item(fm_radio, "  fm  ");
	tda18271_dump_std_item(atv_b,  "atv b ");
	tda18271_dump_std_item(atv_dk, "atv dk");
	tda18271_dump_std_item(atv_gh, "atv gh");
	tda18271_dump_std_item(atv_i,  "atv i ");
	tda18271_dump_std_item(atv_l,  "atv l ");
	tda18271_dump_std_item(atv_lc, "atv l'");
1117 1118 1119 1120 1121
	tda18271_dump_std_item(atv_mn, "atv mn");
	tda18271_dump_std_item(atsc_6, "atsc 6");
	tda18271_dump_std_item(dvbt_6, "dvbt 6");
	tda18271_dump_std_item(dvbt_7, "dvbt 7");
	tda18271_dump_std_item(dvbt_8, "dvbt 8");
1122 1123
	tda18271_dump_std_item(qam_6,  "qam 6 ");
	tda18271_dump_std_item(qam_8,  "qam 8 ");
1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136

	return 0;
}

static int tda18271_update_std_map(struct dvb_frontend *fe,
				   struct tda18271_std_map *map)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	struct tda18271_std_map *std = &priv->std;

	if (!map)
		return -EINVAL;

1137
	tda18271_update_std(fm_radio, "fm");
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154
	tda18271_update_std(atv_b,  "atv b");
	tda18271_update_std(atv_dk, "atv dk");
	tda18271_update_std(atv_gh, "atv gh");
	tda18271_update_std(atv_i,  "atv i");
	tda18271_update_std(atv_l,  "atv l");
	tda18271_update_std(atv_lc, "atv l'");
	tda18271_update_std(atv_mn, "atv mn");
	tda18271_update_std(atsc_6, "atsc 6");
	tda18271_update_std(dvbt_6, "dvbt 6");
	tda18271_update_std(dvbt_7, "dvbt 7");
	tda18271_update_std(dvbt_8, "dvbt 8");
	tda18271_update_std(qam_6,  "qam 6");
	tda18271_update_std(qam_8,  "qam 8");

	return 0;
}

1155 1156 1157 1158 1159 1160
static int tda18271_get_id(struct dvb_frontend *fe)
{
	struct tda18271_priv *priv = fe->tuner_priv;
	unsigned char *regs = priv->tda18271_regs;
	char *name;

1161
	mutex_lock(&priv->lock);
1162
	tda18271_read_regs(fe);
1163
	mutex_unlock(&priv->lock);
1164 1165 1166 1167

	switch (regs[R_ID] & 0x7f) {
	case 3:
		name = "TDA18271HD/C1";
1168
		priv->id = TDA18271HDC1;
1169 1170 1171
		break;
	case 4:
		name = "TDA18271HD/C2";
1172
		priv->id = TDA18271HDC2;
1173 1174
		break;
	default:
1175 1176 1177 1178
		tda_info("Unknown device (%i) detected @ %d-%04x, device not supported.\n",
			 regs[R_ID], i2c_adapter_id(priv->i2c_props.adap),
			 priv->i2c_props.addr);
		return -EINVAL;
1179 1180
	}

1181 1182
	tda_info("%s detected @ %d-%04x\n", name,
		 i2c_adapter_id(priv->i2c_props.adap), priv->i2c_props.addr);
1183

1184
	return 0;
1185 1186
}

1187 1188
static int tda18271_setup_configuration(struct dvb_frontend *fe,
					struct tda18271_config *cfg)
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202
{
	struct tda18271_priv *priv = fe->tuner_priv;

	priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO;
	priv->role = (cfg) ? cfg->role : TDA18271_MASTER;
	priv->config = (cfg) ? cfg->config : 0;
	priv->small_i2c = (cfg) ?
		cfg->small_i2c : TDA18271_39_BYTE_CHUNK_INIT;
	priv->output_opt = (cfg) ?
		cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON;

	return 0;
}

1203 1204 1205 1206 1207 1208 1209 1210 1211 1212
static inline int tda18271_need_cal_on_startup(struct tda18271_config *cfg)
{
	/* tda18271_cal_on_startup == -1 when cal module option is unset */
	return ((tda18271_cal_on_startup == -1) ?
		/* honor configuration setting */
		((cfg) && (cfg->rf_cal_on_startup)) :
		/* module option overrides configuration setting */
		(tda18271_cal_on_startup)) ? 1 : 0;
}

1213 1214 1215 1216 1217 1218
static int tda18271_set_config(struct dvb_frontend *fe, void *priv_cfg)
{
	struct tda18271_config *cfg = (struct tda18271_config *) priv_cfg;

	tda18271_setup_configuration(fe, cfg);

1219
	if (tda18271_need_cal_on_startup(cfg))
1220 1221
		tda18271_init(fe);

1222 1223 1224 1225
	/* override default std map with values in config struct */
	if ((cfg) && (cfg->std_map))
		tda18271_update_std_map(fe, cfg->std_map);

1226 1227 1228
	return 0;
}

1229 1230 1231 1232 1233 1234 1235
static struct dvb_tuner_ops tda18271_tuner_ops = {
	.info = {
		.name = "NXP TDA18271HD",
		.frequency_min  =  45000000,
		.frequency_max  = 864000000,
		.frequency_step =     62500
	},
1236
	.init              = tda18271_init,
1237
	.sleep             = tda18271_sleep,
1238 1239 1240
	.set_params        = tda18271_set_params,
	.set_analog_params = tda18271_set_analog_params,
	.release           = tda18271_release,
1241
	.set_config        = tda18271_set_config,
1242 1243 1244 1245 1246
	.get_frequency     = tda18271_get_frequency,
	.get_bandwidth     = tda18271_get_bandwidth,
};

struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1247
				     struct i2c_adapter *i2c,
1248
				     struct tda18271_config *cfg)
1249 1250
{
	struct tda18271_priv *priv = NULL;
1251
	int instance, ret;
1252 1253 1254

	mutex_lock(&tda18271_list_mutex);

1255 1256 1257 1258 1259 1260 1261 1262
	instance = hybrid_tuner_request_state(struct tda18271_priv, priv,
					      hybrid_tuner_instance_list,
					      i2c, addr, "tda18271");
	switch (instance) {
	case 0:
		goto fail;
	case 1:
		/* new tuner instance */
1263 1264
		fe->tuner_priv = priv;

1265
		tda18271_setup_configuration(fe, cfg);
1266

1267 1268
		priv->cal_initialized = false;
		mutex_init(&priv->lock);
1269

1270 1271
		ret = tda18271_get_id(fe);
		if (tda_fail(ret))
1272
			goto fail;
1273

1274 1275
		ret = tda18271_assign_map_layout(fe);
		if (tda_fail(ret))
1276
			goto fail;
1277

1278 1279
		mutex_lock(&priv->lock);
		tda18271_init_regs(fe);
1280

1281 1282
		if ((tda18271_need_cal_on_startup(cfg)) &&
		    (priv->id == TDA18271HDC2))
1283
			tda18271c2_rf_cal_init(fe);
1284

1285
		mutex_unlock(&priv->lock);
1286 1287 1288 1289 1290
		break;
	default:
		/* existing tuner instance */
		fe->tuner_priv = priv;

1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302
		/* allow dvb driver to override configuration settings */
		if (cfg) {
			if (cfg->gate != TDA18271_GATE_ANALOG)
				priv->gate = cfg->gate;
			if (cfg->role)
				priv->role = cfg->role;
			if (cfg->config)
				priv->config = cfg->config;
			if (cfg->small_i2c)
				priv->small_i2c = cfg->small_i2c;
			if (cfg->output_opt)
				priv->output_opt = cfg->output_opt;
1303 1304
			if (cfg->std_map)
				tda18271_update_std_map(fe, cfg->std_map);
1305
		}
1306
		if (tda18271_need_cal_on_startup(cfg))
1307
			tda18271_init(fe);
1308
		break;
1309
	}
1310

1311 1312 1313 1314
	/* override default std map with values in config struct */
	if ((cfg) && (cfg->std_map))
		tda18271_update_std_map(fe, cfg->std_map);

1315
	mutex_unlock(&tda18271_list_mutex);
1316

1317 1318
	memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops,
	       sizeof(struct dvb_tuner_ops));
1319

1320
	if (tda18271_debug & (DBG_MAP | DBG_ADV))
1321
		tda18271_dump_std_map(fe);
1322

1323
	return fe;
1324
fail:
1325 1326
	mutex_unlock(&tda18271_list_mutex);

1327 1328
	tda18271_release(fe);
	return NULL;
1329 1330 1331 1332 1333
}
EXPORT_SYMBOL_GPL(tda18271_attach);
MODULE_DESCRIPTION("NXP TDA18271HD analog / digital tuner driver");
MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
MODULE_LICENSE("GPL");
1334
MODULE_VERSION("0.4");
1335 1336 1337 1338 1339 1340 1341 1342

/*
 * Overrides for Emacs so that we follow Linus's tabbing style.
 * ---------------------------------------------------------------------------
 * Local variables:
 * c-basic-offset: 8
 * End:
 */