Skip to contentSkip to conversation

Zolid Hybrid PCI card add AGC control

PATCH In review [email protected] 2 participants 5 messages Sep 22, 2009 – Oct 2, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 Zolid Hybrid PCI card add AGC control

Switches IF AGC control via GPIO 21 of the saa7134. Improves DTV reception and FM radio reception.

Signed-off-by [email protected]
linux/drivers/media/video/saa7134/saa7134-cards.c +24 -1
diff -r 29e4ba1a09bc linux/drivers/media/video/saa7134/saa7134-cards.c
@@ -6651,6 +6651,22 @@
 	return 0;
 }
 
+static inline int saa7134_tda18271_zolid_toggle_agc(struct saa7134_dev *dev,
+						      enum tda18271_mode mode)
+{
+	switch (mode) {
+	case TDA18271_ANALOG:
+		saa7134_set_gpio(dev, 21, 0);
+		break;
+	case TDA18271_DIGITAL:
+		saa7134_set_gpio(dev, 21, 1);
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static int saa7134_tda8290_18271_callback(struct saa7134_dev *dev,
 					  int command, int arg)
 {
@@ -6663,7 +6679,8 @@
 		case SAA7134_BOARD_HAUPPAUGE_HVR1120:
 			ret = saa7134_tda18271_hvr11x0_toggle_agc(dev, arg);
 			break;
-		default:
+		case SAA7134_BOARD_ZOLID_HYBRID_PCI:
+			ret = saa7134_tda18271_zolid_toggle_agc(dev, arg);
 			break;
 		}
 		break;
@@ -6682,6 +6699,7 @@
 	switch (dev->board) {
 	case SAA7134_BOARD_HAUPPAUGE_HVR1150:
 	case SAA7134_BOARD_HAUPPAUGE_HVR1120:
+	case SAA7134_BOARD_ZOLID_HYBRID_PCI:
 		/* tda8290 + tda18271 */
 		ret = saa7134_tda8290_18271_callback(dev, command, arg);
 		break;
@@ -6985,6 +7003,11 @@
 		saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x00008000, 0x00008000);
 		saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00008000);
 		break;
+	case SAA7134_BOARD_ZOLID_HYBRID_PCI:
+		saa7134_set_gpio(dev, 21, 0);	/* s0 HC4052 */
+		saa7134_set_gpio(dev, 22, 0);	/* vsync tda18271 - TODO implement saa713x driven sync in analog TV modes */
+		saa7134_set_gpio(dev, 23, 0);	/* s1 HC4052 */
+		break;
 	}
 	return 0;
 }
linux/drivers/media/video/saa7134/saa7134-dvb.c +9 -0
diff -r 29e4ba1a09bc linux/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1026,8 +1026,17 @@
 	.disable_gate_access = 1,
 };
 
+static struct tda18271_std_map zolid_tda18271_std_map = {
+	/* FM reception via RF_IN */
+	.fm_radio = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 3, .std = 0,
+		      .if_lvl = 0, .rfagc_top = 0x2c, },
+};
+
 static struct tda18271_config zolid_tda18271_config = {
+	.std_map = &zolid_tda18271_std_map,
 	.gate    = TDA18271_GATE_ANALOG,
+	.config  = 3,
+	.output_opt = TDA18271_OUTPUT_LT_OFF,
 };
 
 /* ==================================================================
Reviewed-by on v1 4/4
#1 lore raw
Quoted 5 lines · On Tue, Sep 22, 2009 at 5:09 PM, <[email protected]> wrote:

Switches IF AGC control via GPIO 21 of the saa7134. Improves DTV reception and FM radio reception.

Signed-off-by [email protected]

Henk,

This is *very* interesting... Have you taken a scope to the board to
measure AGC interference? This seems to be *very* similar to
Hauppauge's design for the HVR1120 and HVR1150 boards, which are actually *not* based on any reference design.

I have no problems with this patch, but I would be interested to hear that you can prove it is actually needed by using a scope. If you don't have a scope, I understand.... but this certainly peaks my interest.

Do you have schematics of that board?

Regards,

Mike Krufky

Quoted 83 lines

diff -r 29e4ba1a09bc linux/drivers/media/video/saa7134/saa7134-cards.c

linux/drivers/media/video/saa7134/saa7134-cards.c Tue Sep 22 22:06:31 2009 +0200 renamed from linux/drivers/media/video/saa7134/saa7134-cards.c Sat Sep 19 09:45:22 2009 -0300 +16 -0
@@ -6651,6 +6651,22 @@
        return 0;
  }
 
+static inline int saa7134_tda18271_zolid_toggle_agc(struct saa7134_dev *dev,
+                                                     enum tda18271_mode mode)
+{
+       switch (mode) {
+       case TDA18271_ANALOG:
+               saa7134_set_gpio(dev, 21, 0);
+               break;
+       case TDA18271_DIGITAL:
+               saa7134_set_gpio(dev, 21, 1);
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
  static int saa7134_tda8290_18271_callback(struct saa7134_dev *dev,
                                          int command, int arg)
  {
@@ -6663,7 +6679,8 @@

               case SAA7134_BOARD_HAUPPAUGE_HVR1120:
                       ret = saa7134_tda18271_hvr11x0_toggle_agc(dev, arg); break;
-               default:
+               case SAA7134_BOARD_ZOLID_HYBRID_PCI:
+                       ret = saa7134_tda18271_zolid_toggle_agc(dev, arg); break;
               }
               break;

linux/drivers/media/video/saa7134/saa7134-cards.c Tue Sep 22 22:06:31 2009 +0200 renamed from linux/drivers/media/video/saa7134/saa7134-cards.c Sat Sep 19 09:45:22 2009 -0300 +0 -0
@@ -6682,6 +6699,7 @@
        switch (dev->board) {

       case SAA7134_BOARD_HAUPPAUGE_HVR1150:
       case SAA7134_BOARD_HAUPPAUGE_HVR1120:
+       case SAA7134_BOARD_ZOLID_HYBRID_PCI:
               /* tda8290 + tda18271 */
               ret = saa7134_tda8290_18271_callback(dev, command, arg); break;

linux/drivers/media/video/saa7134/saa7134-cards.c Tue Sep 22 22:06:31 2009 +0200 renamed from linux/drivers/media/video/saa7134/saa7134-cards.c Sat Sep 19 09:45:22 2009 -0300 +5 -0
@@ -6985,6 +7003,11 @@
                saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x00008000, 0x00008000);
                saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00008000, 0x00008000);
                break;
+       case SAA7134_BOARD_ZOLID_HYBRID_PCI:
+               saa7134_set_gpio(dev, 21, 0);   /* s0 HC4052 */
+               saa7134_set_gpio(dev, 22, 0);   /* vsync tda18271 - TODO implement saa713x driven sync in analog TV modes */
+               saa7134_set_gpio(dev, 23, 0);   /* s1 HC4052 */
+               break;
        }
        return 0;
  }

diff -r 29e4ba1a09bc linux/drivers/media/video/saa7134/saa7134-dvb.c

linux/drivers/media/video/saa7134/saa7134-dvb.c   Tue Sep 22 22:06:31 2009 +0200 renamed from linux/drivers/media/video/saa7134/saa7134-dvb.c   Sat Sep 19 09:45:22 2009 -0300 +9 -1
@@ -1026,8 +1026,17 @@
        .disable_gate_access = 1,
  };
 
+static struct tda18271_std_map zolid_tda18271_std_map = {
+       /* FM reception via RF_IN */
+       .fm_radio = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 3, .std = 0,
+                     .if_lvl = 0, .rfagc_top = 0x2c, },
+};
+
  static struct tda18271_config zolid_tda18271_config = {
+       .std_map = &zolid_tda18271_std_map,
        .gate    = TDA18271_GATE_ANALOG,
+       .config  = 3,
+       .output_opt = TDA18271_OUTPUT_LT_OFF,
  };
 
  /* ==================================================================
--

To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 7 lines · Michael Krufky

Henk,

This is *very* interesting... Have you taken a scope to the board to
measure AGC interference? This seems to be *very* similar to
Hauppauge's design for the HVR1120 and HVR1150 boards, which are actually *not* based on any reference design.

Yes a scope would be nice!

No I traced some pins with a ohm meter. After some gpio togling and measuring the voltage on the hc4052 I found out the s0 and s1 pins.

For the dvb reception I looked at the BER (bit-error-rate) using tzap it seemed to drop from 8000 or so to 4000 when using gpio21 = 1. Analog reception is a no-go in this mode it only works when gpio21 = 0.

FM radio seemed a (little) bit better when using fm_rfn = 0 and the 1.5Mhz antialiasing filter enabled. But its all somewhat subjective I must admit.

Quoted 7 lines

I have no problems with this patch, but I would be interested to hear that you can prove it is actually needed by using a scope. If you don't have a scope, I understand.... but this certainly peaks my interest.

Do you have schematics of that board?

Nope, I will update the wiki with a few drawings that I have been able to figure out.

Thanks for the support!

regards,
henk

BTW Currently the card is for sale in the Aldi for 28.99 euros if someone is interested and in the proximity of Holland ;).

Quoted 1 line
#3 lore raw
In reply to Michael Krufky
Quoted 21 lines · Michael Krufky
Quoted 5 lines · On Tue, Sep 22, 2009 at 5:09 PM, <[email protected]> wrote:

Switches IF AGC control via GPIO 21 of the saa7134. Improves DTV reception and FM radio reception.

Signed-off-by [email protected]

Henk,

This is *very* interesting... Have you taken a scope to the board to
measure AGC interference? This seems to be *very* similar to
Hauppauge's design for the HVR1120 and HVR1150 boards, which are actually *not* based on any reference design.

I have no problems with this patch, but I would be interested to hear that you can prove it is actually needed by using a scope. If you don't have a scope, I understand.... but this certainly peaks my interest.

Quoted 6 lines

Do you have schematics of that board?

Regards,

Mike Krufky

One note: I have tested the tda18271 signedness fixes in the debug repository. This is a big improvement in reception.

Based on the latest testing with all the fixes I would say that switching the AGC line via gpio is not needed and leaving it at 0 gives the best results.
(This is purely based on SNR and BER readings from tzap)

So I would recomend: leaving config at zero.

static struct tda18271_config zolid_tda18271_config = {
.std_map = &zolid_tda18271_std_map,
.gate = TDA18271_GATE_ANALOG,
- .config = 3,
+// .config = 3,

	.output_opt = TDA18271_OUTPUT_LT_OFF,

};

Regards,
Henk

#4 lore raw
Quoted 39 lines · On Fri, Oct 2, 2009 at 5:12 AM, <[email protected]> wrote:
Quoted 21 lines · Michael Krufky
Quoted 5 lines · On Tue, Sep 22, 2009 at 5:09 PM,  <[email protected]> wrote:

Switches IF AGC control via GPIO 21 of the saa7134. Improves DTV reception and FM radio reception.

Signed-off-by [email protected]

Henk,

This is *very* interesting...  Have you taken a scope to the board to measure AGC interference?   This seems to be *very* similar to Hauppauge's design for the HVR1120 and HVR1150 boards, which are actually *not* based on any reference design.

I have no problems with this patch, but I would be interested to hear that you can prove it is actually needed by using a scope.  If you don't have a scope, I understand....  but this certainly peaks my interest.

Quoted 6 lines

Do you have schematics of that board?

Regards,

Mike Krufky

One note: I have tested the tda18271 signedness fixes in the debug repository. This is a big improvement in reception.

Based on the latest testing with all the fixes I would say that switching the AGC line via gpio is not needed and leaving it at 0 gives the best results.
(This is purely based on SNR and BER readings from tzap)

So I would recomend: leaving config at zero.

Quoted 8 lines

 static struct tda18271_config zolid_tda18271_config = { .std_map = &zolid_tda18271_std_map, .gate    = TDA18271_GATE_ANALOG,
-       .config  = 3,
+//     .config  = 3,
       .output_opt = TDA18271_OUTPUT_LT_OFF,
 };

I removed the patch from my tree awaiting merge, "saa7134: add AGC control for Zolid Hybrid PCI card".

It wasn't as simple as changing the 3 to a 0, since the function, "saa7134_tda18271_zolid_toggle_agc" becomes a no-op.

Also, you've been sending the sign-off's in the wrong format in your previous submissions.

Please send in the "FM reception via RF_IN" as a separate patch, and include your sign-off using the actual format:

Regards,

Mike