瀏覽代碼

V4L/DVB (6654): mt352: support oversampled IF input

Rework the input frequency calculation so that it produces the right values
when the ADC oversamples the IF input.

This means MT352 devices can now process a near-zero IF (according to the,
specs 4.57MHz is supported with the default crystal).

Signed-off-by: Chris Pascoe <c.pascoe@itee.uq.edu.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Chris Pascoe 17 年之前
父節點
當前提交
c6e62a3a39
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      drivers/media/dvb/frontends/mt352.c

+ 7 - 1
drivers/media/dvb/frontends/mt352.c

@@ -152,7 +152,13 @@ static void mt352_calc_input_freq(struct mt352_state* state,
 	if (state->config.if2)
 	if (state->config.if2)
 		if2 = state->config.if2;
 		if2 = state->config.if2;
 
 
-	ife = (2*adc_clock - if2);
+	if (adc_clock >= if2 * 2)
+		ife = if2;
+	else {
+		ife = adc_clock - (if2 % adc_clock);
+		if (ife > adc_clock / 2)
+			ife = adc_clock - ife;
+	}
 	value = -16374 * ife / adc_clock;
 	value = -16374 * ife / adc_clock;
 	dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n",
 	dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n",
 		__FUNCTION__, if2, ife, adc_clock, value, value & 0x3fff);
 		__FUNCTION__, if2, ife, adc_clock, value, value & 0x3fff);