[PATCH 042/141] V4L/DVB (3268): Move video std detection to top ofset_tv_freq function

From: mchehab
Date: Mon Mar 20 2006 - 10:22:58 EST


From: Michael Krufky <mkrufky@xxxxxxxxxxx>
Date: 1139300733 -0200

- move video std detection to top of set_tv_freq function
- we must detect video std first, so that we can choose the correct
tuner_params

Signed-off-by: Michael Krufky <mkrufky@xxxxxxxxxxx>
Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxx>
---

diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index 6f0d376..907ea8c 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -142,6 +142,29 @@ static void default_set_tv_freq(struct i
tun = &tuners[t->type];
j = TUNER_PARAM_ANALOG;

+ /* IFPCoff = Video Intermediate Frequency - Vif:
+ 940 =16*58.75 NTSC/J (Japan)
+ 732 =16*45.75 M/N STD
+ 704 =16*44 ATSC (at DVB code)
+ 632 =16*39.50 I U.K.
+ 622.4=16*38.90 B/G D/K I, L STD
+ 592 =16*37.00 D China
+ 590 =16.36.875 B Australia
+ 543.2=16*33.95 L' STD
+ 171.2=16*10.70 FM Radio (at set_radio_freq)
+ */
+
+ if (t->std == V4L2_STD_NTSC_M_JP) {
+ IFPCoff = 940;
+ } else if ((t->std & V4L2_STD_MN) &&
+ !(t->std & ~V4L2_STD_MN)) {
+ IFPCoff = 732;
+ } else if (t->std == V4L2_STD_SECAM_LC) {
+ IFPCoff = 543;
+ } else {
+ IFPCoff = 623;
+ }
+
for (i = 0; i < tun->params[j].count; i++) {
if (freq > tun->params[j].ranges[i].limit)
continue;
@@ -154,11 +177,19 @@ static void default_set_tv_freq(struct i
}
config = tun->params[j].ranges[i].config;
cb = tun->params[j].ranges[i].cb;
- /* i == 0 -> VHF_LO */
- /* i == 1 -> VHF_HI */
- /* i == 2 -> UHF */
+ /* i == 0 -> VHF_LO
+ * i == 1 -> VHF_HI
+ * i == 2 -> UHF */
tuner_dbg("tv: range %d\n",i);

+ div=freq + IFPCoff + offset;
+
+ tuner_dbg("Freq= %d.%02d MHz, V_IF=%d.%02d MHz, Offset=%d.%02d MHz, div=%0d\n",
+ freq / 16, freq % 16 * 100 / 16,
+ IFPCoff / 16, IFPCoff % 16 * 100 / 16,
+ offset / 16, offset % 16 * 100 / 16,
+ div);
+
/* tv norm specific stuff for multi-norm tuners */
switch (t->type) {
case TUNER_PHILIPS_SECAM: // FI1216MF
@@ -245,37 +276,6 @@ static void default_set_tv_freq(struct i
break;
}

- /* IFPCoff = Video Intermediate Frequency - Vif:
- 940 =16*58.75 NTSC/J (Japan)
- 732 =16*45.75 M/N STD
- 704 =16*44 ATSC (at DVB code)
- 632 =16*39.50 I U.K.
- 622.4=16*38.90 B/G D/K I, L STD
- 592 =16*37.00 D China
- 590 =16.36.875 B Australia
- 543.2=16*33.95 L' STD
- 171.2=16*10.70 FM Radio (at set_radio_freq)
- */
-
- if (t->std == V4L2_STD_NTSC_M_JP) {
- IFPCoff = 940;
- } else if ((t->std & V4L2_STD_MN) &&
- !(t->std & ~V4L2_STD_MN)) {
- IFPCoff = 732;
- } else if (t->std == V4L2_STD_SECAM_LC) {
- IFPCoff = 543;
- } else {
- IFPCoff = 623;
- }
-
- div=freq + IFPCoff + offset;
-
- tuner_dbg("Freq= %d.%02d MHz, V_IF=%d.%02d MHz, Offset=%d.%02d MHz, div=%0d\n",
- freq / 16, freq % 16 * 100 / 16,
- IFPCoff / 16, IFPCoff % 16 * 100 / 16,
- offset / 16, offset % 16 * 100 / 16,
- div);
-
if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) {
buffer[0] = config;
buffer[1] = cb;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/