>From c74f3603e3f0b03d3f41567fea3aa5a756e933ef Mon Sep 17 00:00:00 2001
From: Alexander Kurpiers <[email protected]>
Date: Thu, 9 Jan 2014 20:35:03 +0100
Subject: [PATCH 5/7] E4000 data sheet gain values are a bit off

LNA gain of 30dB seems to be 25dB instead (error in data sheet)?
Low mixer gain is more 5dB than 4dB.

Correct small error for -25dB in "linearity" mode.
---
 src/tuner_e4k.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/tuner_e4k.c b/src/tuner_e4k.c
index 27b44ad..4302fa8 100644
--- a/src/tuner_e4k.c
+++ b/src/tuner_e4k.c
@@ -687,10 +687,12 @@ static const struct gain_table_mode_struct {
 	int32_t LNA_gain;
 	int32_t mixer_gain;
 	int32_t IF_gain[6];
+	/* data sheet seems wrong, LNA gain "30dB" is 25dB and mixer gain
+	   4dB is more 5dB */
 } gain_table_mode_linearity[] = {         /* LNA Mixer IF  Total */
-	-250, -5,  4, { -3, 0, 0, 0, 9, 6},   /* -5    4  12      9  */
-	-200, -5,  4, { -3, 0, 0, 1, 12, 9},  /* -5    4  19     18  */
-	-150, -5,  4, { -3, 6, 0, 0, 12, 9},  /* -5    4  24     23  */
+	-250, -5,  4, { -3, 0, 0, 2, 9, 6},   /* -5    5  12     14  */
+	-200, -5,  4, { -3, 0, 0, 1, 12, 9},  /* -5    5  19     19  */
+	-150, -5,  4, { -3, 6, 0, 0, 12, 9},  /* -5    5  24     24  */
 	-100, -5, 12, { -3, 3, 0, 1, 12, 9},  /* -5   12  22     29  */
 	 -50, -5, 12, { -3, 6, 0, 0, 12, 12}, /* -5   12  27     34  */
 	   0,  0, 12, { -3, 6, 0, 0, 12, 12}, /*  0   12  27     39  */
@@ -698,20 +700,20 @@ static const struct gain_table_mode_struct {
 	 100, 10, 12, { -3, 6, 0, 0, 12, 12}, /* 10   12  27     49  */
 	 150, 15, 12, { -3, 6, 0, 0, 12, 12}, /* 15   12  27     54  */
 	 200, 20, 12, { -3, 6, 0, 0, 12, 12}, /* 20   12  27     59  */
-	 250, 30, 12, { -3, 6, 0, 0, 12, 12}, /* 30   12  27     69  */
+	 250, 30, 12, { -3, 6, 0, 0, 12, 12}, /* 25   12  27     64  */
 },
 gain_table_mode_sensitivity[] = {         /* LNA Mixer IF  Total */
-	-250,  5,  4, { -3, 0, 0, 1, 6, 3},   /*  5    4   7     16  */
-	-200, 10,  4, { -3, 0, 0, 1, 6, 3},   /* 10    4   7     21  */
-	-150, 15,  4, { -3, 0, 0, 1, 6, 3},   /* 15    4   7     26  */
-	-100, 20,  4, { -3, 0, 0, 1, 6, 3},   /* 20    4   7     31  */
-	 -50, 30,  4, { -3, 0, 0, 1, 6, 3},   /* 30    4   7     41  */
-	   0, 30, 12, { -3, 0, 0, 2, 3, 3},   /* 30   12   5     47  */
-	  50, 30, 12, { -3, 3, 0, 1, 6, 3},   /* 30   12  10     52  */
-	 100, 30, 12, {  6, 0, 0, 0, 6, 3},   /* 30   12  15     57  */
-	 150, 30, 12, {  6, 0, 0, 2, 9, 3},   /* 30   12  20     62  */
-	 200, 30, 12, {  6, 3, 0, 1, 9, 6},   /* 30   12  25     67  */
-	 250, 30, 12, {  6, 6, 0, 0, 9, 9},   /* 30   12  30     72  */
+	-250,  5,  4, { -3, 0, 0, 1, 6, 3},   /*  5    5   7     17  */
+	-200, 10,  4, { -3, 0, 0, 1, 6, 3},   /* 10    5   7     22  */
+	-150, 15,  4, { -3, 0, 0, 1, 6, 3},   /* 15    5   7     27  */
+	-100, 20,  4, { -3, 0, 0, 1, 6, 3},   /* 20    5   7     32  */
+	 -50, 30,  4, { -3, 0, 0, 1, 6, 3},   /* 25    5   7     37  */
+	   0, 30, 12, { -3, 0, 0, 2, 3, 3},   /* 25   12   5     42  */
+	  50, 30, 12, { -3, 3, 0, 1, 6, 3},   /* 25   12  10     47  */
+	 100, 30, 12, {  6, 0, 0, 0, 6, 3},   /* 25   12  15     52  */
+	 150, 30, 12, {  6, 0, 0, 2, 9, 3},   /* 25   12  20     57  */
+	 200, 30, 12, {  6, 3, 0, 1, 9, 6},   /* 25   12  25     62  */
+	 250, 30, 12, {  6, 6, 0, 0, 9, 9},   /* 25   12  30     67  */
 };
 
 int e4k_set_lna_mixer_if_gain(struct e4k_state *e4k, int32_t gain)
-- 
1.7.9.5

Reply via email to