aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-04-22 13:46:06 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:52 -0400
commit7f7203df3f7d056e5f3c4419c6ab3835f44b288c (patch)
tree56716e59f395057cdffb80769ff3f28f19a4a842
parentc293d0a72ecb9dd09037cdf4a9089e455404cf4a (diff)
V4L/DVB (7385): tda18271: store agc_mode configuration independently of std_bits
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c14
-rw-r--r--drivers/media/dvb/frontends/tda18271-tables.c84
-rw-r--r--drivers/media/dvb/frontends/tda18271.h7
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c4
4 files changed, 72 insertions, 37 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index fef225abee96..eb44ab71ff74 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -48,7 +48,7 @@ static int tda18271_channel_configuration(struct dvb_frontend *fe,
48 48
49 /* set standard */ 49 /* set standard */
50 regs[R_EP3] &= ~0x1f; /* clear std bits */ 50 regs[R_EP3] &= ~0x1f; /* clear std bits */
51 regs[R_EP3] |= map->std_bits; 51 regs[R_EP3] |= (map->agc_mode << 3) | map->std;
52 52
53 /* set cal mode to normal */ 53 /* set cal mode to normal */
54 regs[R_EP4] &= ~0x03; 54 regs[R_EP4] &= ~0x03;
@@ -731,8 +731,8 @@ static int tda18271_tune(struct dvb_frontend *fe,
731{ 731{
732 struct tda18271_priv *priv = fe->tuner_priv; 732 struct tda18271_priv *priv = fe->tuner_priv;
733 733
734 tda_dbg("freq = %d, ifc = %d, bw = %d, std = 0x%02x\n", 734 tda_dbg("freq = %d, ifc = %d, bw = %d, agc_mode = %d, std = %d\n",
735 freq, map->if_freq, bw, map->std_bits); 735 freq, map->if_freq, bw, map->agc_mode, map->std);
736 736
737 tda18271_init(fe); 737 tda18271_init(fe);
738 738
@@ -927,15 +927,17 @@ static int tda18271_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
927/* ------------------------------------------------------------------ */ 927/* ------------------------------------------------------------------ */
928 928
929#define tda18271_update_std(std_cfg, name) do { \ 929#define tda18271_update_std(std_cfg, name) do { \
930 if (map->std_cfg.if_freq + map->std_cfg.std_bits > 0) { \ 930 if (map->std_cfg.if_freq + \
931 map->std_cfg.agc_mode + map->std_cfg.std > 0) { \
931 tda_dbg("Using custom std config for %s\n", name); \ 932 tda_dbg("Using custom std config for %s\n", name); \
932 memcpy(&std->std_cfg, &map->std_cfg, \ 933 memcpy(&std->std_cfg, &map->std_cfg, \
933 sizeof(struct tda18271_std_map_item)); \ 934 sizeof(struct tda18271_std_map_item)); \
934 } } while (0) 935 } } while (0)
935 936
936#define tda18271_dump_std_item(std_cfg, name) do { \ 937#define tda18271_dump_std_item(std_cfg, name) do { \
937 tda_dbg("(%s) if freq = %d, std bits = 0x%02x\n", \ 938 tda_dbg("(%s) if freq = %d, agc_mode = %d, std = %d\n", \
938 name, std->std_cfg.if_freq, std->std_cfg.std_bits); \ 939 name, std->std_cfg.if_freq, \
940 std->std_cfg.agc_mode, std->std_cfg.std); \
939 } while (0) 941 } while (0)
940 942
941static int tda18271_dump_std_map(struct dvb_frontend *fe) 943static int tda18271_dump_std_map(struct dvb_frontend *fe)
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c
index 462f20b41728..b402abd15bb2 100644
--- a/drivers/media/dvb/frontends/tda18271-tables.c
+++ b/drivers/media/dvb/frontends/tda18271-tables.c
@@ -1187,37 +1187,65 @@ fail:
1187/*---------------------------------------------------------------------*/ 1187/*---------------------------------------------------------------------*/
1188 1188
1189static struct tda18271_std_map tda18271c1_std_map = { 1189static struct tda18271_std_map tda18271c1_std_map = {
1190 .fm_radio = { .if_freq = 1250, .std_bits = 0x18, .fm_rfn = 1 }, 1190 .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0 },
1191 .atv_b = { .if_freq = 6750, .std_bits = 0x0e, .fm_rfn = 0 }, 1191 /* EP3[4:0] 0x18 */
1192 .atv_dk = { .if_freq = 7750, .std_bits = 0x0f, .fm_rfn = 0 }, 1192 .atv_b = { .if_freq = 6750, .fm_rfn = 0, .agc_mode = 1, .std = 6 },
1193 .atv_gh = { .if_freq = 7750, .std_bits = 0x0f, .fm_rfn = 0 }, 1193 /* EP3[4:0] 0x0e */
1194 .atv_i = { .if_freq = 7750, .std_bits = 0x0f, .fm_rfn = 0 }, 1194 .atv_dk = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7 },
1195 .atv_l = { .if_freq = 7750, .std_bits = 0x0f, .fm_rfn = 0 }, 1195 /* EP3[4:0] 0x0f */
1196 .atv_lc = { .if_freq = 1250, .std_bits = 0x0f, .fm_rfn = 0 }, 1196 .atv_gh = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7 },
1197 .atv_mn = { .if_freq = 5750, .std_bits = 0x0d, .fm_rfn = 0 }, 1197 /* EP3[4:0] 0x0f */
1198 .atsc_6 = { .if_freq = 3250, .std_bits = 0x1c, .fm_rfn = 0 }, 1198 .atv_i = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7 },
1199 .dvbt_6 = { .if_freq = 3300, .std_bits = 0x1c, .fm_rfn = 0 }, 1199 /* EP3[4:0] 0x0f */
1200 .dvbt_7 = { .if_freq = 3800, .std_bits = 0x1d, .fm_rfn = 0 }, 1200 .atv_l = { .if_freq = 7750, .fm_rfn = 0, .agc_mode = 1, .std = 7 },
1201 .dvbt_8 = { .if_freq = 4300, .std_bits = 0x1e, .fm_rfn = 0 }, 1201 /* EP3[4:0] 0x0f */
1202 .qam_6 = { .if_freq = 4000, .std_bits = 0x1d, .fm_rfn = 0 }, 1202 .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 7 },
1203 .qam_8 = { .if_freq = 5000, .std_bits = 0x1f, .fm_rfn = 0 }, 1203 /* EP3[4:0] 0x0f */
1204 .atv_mn = { .if_freq = 5750, .fm_rfn = 0, .agc_mode = 1, .std = 5 },
1205 /* EP3[4:0] 0x0d */
1206 .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4 },
1207 /* EP3[4:0] 0x1c */
1208 .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4 },
1209 /* EP3[4:0] 0x1c */
1210 .dvbt_7 = { .if_freq = 3800, .fm_rfn = 0, .agc_mode = 3, .std = 5 },
1211 /* EP3[4:0] 0x1d */
1212 .dvbt_8 = { .if_freq = 4300, .fm_rfn = 0, .agc_mode = 3, .std = 6 },
1213 /* EP3[4:0] 0x1e */
1214 .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5 },
1215 /* EP3[4:0] 0x1d */
1216 .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7 },
1217 /* EP3[4:0] 0x1f */
1204}; 1218};
1205 1219
1206static struct tda18271_std_map tda18271c2_std_map = { 1220static struct tda18271_std_map tda18271c2_std_map = {
1207 .fm_radio = { .if_freq = 1250, .std_bits = 0x18, .fm_rfn = 1 }, 1221 .fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0 },
1208 .atv_b = { .if_freq = 6000, .std_bits = 0x0d, .fm_rfn = 0 }, 1222 /* EP3[4:0] 0x18 */
1209 .atv_dk = { .if_freq = 6900, .std_bits = 0x0e, .fm_rfn = 0 }, 1223 .atv_b = { .if_freq = 6000, .fm_rfn = 0, .agc_mode = 1, .std = 5 },
1210 .atv_gh = { .if_freq = 7100, .std_bits = 0x0e, .fm_rfn = 0 }, 1224 /* EP3[4:0] 0x0d */
1211 .atv_i = { .if_freq = 7250, .std_bits = 0x0e, .fm_rfn = 0 }, 1225 .atv_dk = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6 },
1212 .atv_l = { .if_freq = 6900, .std_bits = 0x0e, .fm_rfn = 0 }, 1226 /* EP3[4:0] 0x0e */
1213 .atv_lc = { .if_freq = 1250, .std_bits = 0x0e, .fm_rfn = 0 }, 1227 .atv_gh = { .if_freq = 7100, .fm_rfn = 0, .agc_mode = 1, .std = 6 },
1214 .atv_mn = { .if_freq = 5400, .std_bits = 0x0c, .fm_rfn = 0 }, 1228 /* EP3[4:0] 0x0e */
1215 .atsc_6 = { .if_freq = 3250, .std_bits = 0x1c, .fm_rfn = 0 }, 1229 .atv_i = { .if_freq = 7250, .fm_rfn = 0, .agc_mode = 1, .std = 6 },
1216 .dvbt_6 = { .if_freq = 3300, .std_bits = 0x1c, .fm_rfn = 0 }, 1230 /* EP3[4:0] 0x0e */
1217 .dvbt_7 = { .if_freq = 3500, .std_bits = 0x1c, .fm_rfn = 0 }, 1231 .atv_l = { .if_freq = 6900, .fm_rfn = 0, .agc_mode = 1, .std = 6 },
1218 .dvbt_8 = { .if_freq = 4000, .std_bits = 0x1d, .fm_rfn = 0 }, 1232 /* EP3[4:0] 0x0e */
1219 .qam_6 = { .if_freq = 4000, .std_bits = 0x1d, .fm_rfn = 0 }, 1233 .atv_lc = { .if_freq = 1250, .fm_rfn = 0, .agc_mode = 1, .std = 6 },
1220 .qam_8 = { .if_freq = 5000, .std_bits = 0x1f, .fm_rfn = 0 }, 1234 /* EP3[4:0] 0x0e */
1235 .atv_mn = { .if_freq = 5400, .fm_rfn = 0, .agc_mode = 1, .std = 4 },
1236 /* EP3[4:0] 0x0c */
1237 .atsc_6 = { .if_freq = 3250, .fm_rfn = 0, .agc_mode = 3, .std = 4 },
1238 /* EP3[4:0] 0x1c */
1239 .dvbt_6 = { .if_freq = 3300, .fm_rfn = 0, .agc_mode = 3, .std = 4 },
1240 /* EP3[4:0] 0x1c */
1241 .dvbt_7 = { .if_freq = 3500, .fm_rfn = 0, .agc_mode = 3, .std = 4 },
1242 /* EP3[4:0] 0x1c */
1243 .dvbt_8 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5 },
1244 /* EP3[4:0] 0x1d */
1245 .qam_6 = { .if_freq = 4000, .fm_rfn = 0, .agc_mode = 3, .std = 5 },
1246 /* EP3[4:0] 0x1d */
1247 .qam_8 = { .if_freq = 5000, .fm_rfn = 0, .agc_mode = 3, .std = 7 },
1248 /* EP3[4:0] 0x1f */
1221}; 1249};
1222 1250
1223/*---------------------------------------------------------------------*/ 1251/*---------------------------------------------------------------------*/
diff --git a/drivers/media/dvb/frontends/tda18271.h b/drivers/media/dvb/frontends/tda18271.h
index a33095757ea8..3a743b0f0e8b 100644
--- a/drivers/media/dvb/frontends/tda18271.h
+++ b/drivers/media/dvb/frontends/tda18271.h
@@ -26,7 +26,12 @@
26 26
27struct tda18271_std_map_item { 27struct tda18271_std_map_item {
28 u16 if_freq; 28 u16 if_freq;
29 u8 std_bits; 29
30 /* EP3[4:3] */
31 unsigned int agc_mode:2;
32 /* EP3[2:0] */
33 unsigned int std:3;
34 /* EP4[7] */
30 unsigned int fm_rfn:1; 35 unsigned int fm_rfn:1;
31}; 36};
32 37
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 6c21779852fb..22381de7359e 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -164,8 +164,8 @@ static struct tda829x_config tda829x_no_probe = {
164}; 164};
165 165
166static struct tda18271_std_map hauppauge_tda18271_std_map = { 166static struct tda18271_std_map hauppauge_tda18271_std_map = {
167 .atsc_6 = { .if_freq = 5380, .std_bits = 0x1b }, 167 .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3 },
168 .qam_6 = { .if_freq = 4000, .std_bits = 0x18 }, 168 .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 0 },
169}; 169};
170 170
171static struct tda18271_config hauppauge_tda18271_config = { 171static struct tda18271_config hauppauge_tda18271_config = {