Commit f0fa86a5 authored by Michael Krufky's avatar Michael Krufky Committed by Linus Torvalds
Browse files

[PATCH] dvb: determine tuner write method based on nxt chip



- Add support for AVerTVHD MCE a180.
- Instead of determining how to write to the tuner based on which NIM
  is being used, make this determination based on whether the chip is a
  NXT2002 or NXT2004.
- If NXT2004, write directly to tuner. If NXT2002, write through NXT chip.

Signed-off-by: default avatarMichael Krufky <mkrufky@m1k.net>
Cc: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6d35ae3d
Loading
Loading
Loading
Loading
+44 −38
Original line number Diff line number Diff line
@@ -342,8 +342,10 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)

	dprintk("Tuner Bytes: %02X %02X %02X %02X\n", data[0], data[1], data[2], data[3]);

	/* if pll is a Philips TUV1236D then write directly to tuner */
	if (strcmp(state->config->pll_desc->name, "Philips TUV1236D") == 0) {
	/* if NXT2004, write directly to tuner. if NXT2002, write through NXT chip.
	 * direct write is required for Philips TUV1236D and ALPS TDHU2 */
	switch (state->demod_chip) {
		case NXT2004:
			if (i2c_writebytes(state, state->config->pll_address, data, 4))
	        	        printk(KERN_WARNING "nxt200x: error writing to tuner\n");
			/* wait until we have a lock */
@@ -354,9 +356,9 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
				msleep(100);
				count++;
			}
		printk("nxt200x: timeout waiting for tuner lock\n");
		return 0;
	} else {
			printk("nxt2004: timeout waiting for tuner lock\n");
			break;
		case NXT2002:
			/* set the i2c transfer speed to the tuner */
			buf = 0x03;
			nxt200x_writebytes(state, 0x20, &buf, 1);
@@ -383,9 +385,13 @@ static int nxt200x_writetuner (struct nxt200x_state* state, u8* data)
				msleep(100);
				count++;
			}
		printk("nxt200x: timeout error writing tuner\n");
		return 0;
			printk("nxt2002: timeout error writing tuner\n");
			break;
		default:
			return -EINVAL;
			break;
	}
	return 0;
}

static void nxt200x_agc_reset(struct nxt200x_state* state)