diff options
-rw-r--r-- | drivers/media/dvb/frontends/tda18271-fe.c | 82 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271-priv.h | 23 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271-tables.c | 18 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271.h | 30 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-dvb.c | 12 | ||||
-rw-r--r-- | drivers/media/video/tda8290.c | 6 |
6 files changed, 131 insertions, 40 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c index 537d520de22f..b17ab4ace08c 100644 --- a/drivers/media/dvb/frontends/tda18271-fe.c +++ b/drivers/media/dvb/frontends/tda18271-fe.c | |||
@@ -768,12 +768,12 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
768 | struct dvb_frontend_parameters *params) | 768 | struct dvb_frontend_parameters *params) |
769 | { | 769 | { |
770 | struct tda18271_priv *priv = fe->tuner_priv; | 770 | struct tda18271_priv *priv = fe->tuner_priv; |
771 | struct tda18271_std_map *std_map = priv->std; | 771 | struct tda18271_std_map *std_map = &priv->std; |
772 | u8 std; | 772 | u8 std; |
773 | u32 bw, sgIF = 0; | 773 | u32 bw, sgIF = 0; |
774 | u32 freq = params->frequency; | 774 | u32 freq = params->frequency; |
775 | 775 | ||
776 | BUG_ON(!priv->tune || !priv->std); | 776 | BUG_ON(!priv->tune); |
777 | 777 | ||
778 | priv->mode = TDA18271_DIGITAL; | 778 | priv->mode = TDA18271_DIGITAL; |
779 | 779 | ||
@@ -832,12 +832,12 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe, | |||
832 | struct analog_parameters *params) | 832 | struct analog_parameters *params) |
833 | { | 833 | { |
834 | struct tda18271_priv *priv = fe->tuner_priv; | 834 | struct tda18271_priv *priv = fe->tuner_priv; |
835 | struct tda18271_std_map *std_map = priv->std; | 835 | struct tda18271_std_map *std_map = &priv->std; |
836 | char *mode; | 836 | char *mode; |
837 | u8 std; | 837 | u8 std; |
838 | u32 sgIF, freq = params->frequency * 62500; | 838 | u32 sgIF, freq = params->frequency * 62500; |
839 | 839 | ||
840 | BUG_ON(!priv->tune || !priv->std); | 840 | BUG_ON(!priv->tune); |
841 | 841 | ||
842 | priv->mode = TDA18271_ANALOG; | 842 | priv->mode = TDA18271_ANALOG; |
843 | 843 | ||
@@ -901,6 +901,69 @@ static int tda18271_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth) | |||
901 | return 0; | 901 | return 0; |
902 | } | 902 | } |
903 | 903 | ||
904 | /* ------------------------------------------------------------------ */ | ||
905 | |||
906 | #define tda18271_update_std(std_cfg, name) do { \ | ||
907 | if (map->std_cfg.if_freq + map->std_cfg.std_bits > 0) { \ | ||
908 | tda_dbg("Using custom std config for %s\n", name); \ | ||
909 | memcpy(&std->std_cfg, &map->std_cfg, \ | ||
910 | sizeof(struct tda18271_std_map_item)); \ | ||
911 | } } while (0) | ||
912 | |||
913 | #define tda18271_dump_std_item(std_cfg, name) do { \ | ||
914 | tda_dbg("(%s) if freq = %d, std bits = 0x%02x\n", \ | ||
915 | name, std->std_cfg.if_freq, std->std_cfg.std_bits); \ | ||
916 | } while (0) | ||
917 | |||
918 | static int tda18271_dump_std_map(struct dvb_frontend *fe) | ||
919 | { | ||
920 | struct tda18271_priv *priv = fe->tuner_priv; | ||
921 | struct tda18271_std_map *std = &priv->std; | ||
922 | |||
923 | tda_dbg("========== STANDARD MAP SETTINGS ==========\n"); | ||
924 | tda18271_dump_std_item(atv_b, "pal b"); | ||
925 | tda18271_dump_std_item(atv_dk, "pal dk"); | ||
926 | tda18271_dump_std_item(atv_gh, "pal gh"); | ||
927 | tda18271_dump_std_item(atv_i, "pal i"); | ||
928 | tda18271_dump_std_item(atv_l, "pal l"); | ||
929 | tda18271_dump_std_item(atv_lc, "pal l'"); | ||
930 | tda18271_dump_std_item(atv_mn, "atv mn"); | ||
931 | tda18271_dump_std_item(atsc_6, "atsc 6"); | ||
932 | tda18271_dump_std_item(dvbt_6, "dvbt 6"); | ||
933 | tda18271_dump_std_item(dvbt_7, "dvbt 7"); | ||
934 | tda18271_dump_std_item(dvbt_8, "dvbt 8"); | ||
935 | tda18271_dump_std_item(qam_6, "qam 6"); | ||
936 | tda18271_dump_std_item(qam_8, "qam 8"); | ||
937 | |||
938 | return 0; | ||
939 | } | ||
940 | |||
941 | static int tda18271_update_std_map(struct dvb_frontend *fe, | ||
942 | struct tda18271_std_map *map) | ||
943 | { | ||
944 | struct tda18271_priv *priv = fe->tuner_priv; | ||
945 | struct tda18271_std_map *std = &priv->std; | ||
946 | |||
947 | if (!map) | ||
948 | return -EINVAL; | ||
949 | |||
950 | tda18271_update_std(atv_b, "atv b"); | ||
951 | tda18271_update_std(atv_dk, "atv dk"); | ||
952 | tda18271_update_std(atv_gh, "atv gh"); | ||
953 | tda18271_update_std(atv_i, "atv i"); | ||
954 | tda18271_update_std(atv_l, "atv l"); | ||
955 | tda18271_update_std(atv_lc, "atv l'"); | ||
956 | tda18271_update_std(atv_mn, "atv mn"); | ||
957 | tda18271_update_std(atsc_6, "atsc 6"); | ||
958 | tda18271_update_std(dvbt_6, "dvbt 6"); | ||
959 | tda18271_update_std(dvbt_7, "dvbt 7"); | ||
960 | tda18271_update_std(dvbt_8, "dvbt 8"); | ||
961 | tda18271_update_std(qam_6, "qam 6"); | ||
962 | tda18271_update_std(qam_8, "qam 8"); | ||
963 | |||
964 | return 0; | ||
965 | } | ||
966 | |||
904 | static int tda18271_get_id(struct dvb_frontend *fe) | 967 | static int tda18271_get_id(struct dvb_frontend *fe) |
905 | { | 968 | { |
906 | struct tda18271_priv *priv = fe->tuner_priv; | 969 | struct tda18271_priv *priv = fe->tuner_priv; |
@@ -951,7 +1014,7 @@ static struct dvb_tuner_ops tda18271_tuner_ops = { | |||
951 | 1014 | ||
952 | struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | 1015 | struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, |
953 | struct i2c_adapter *i2c, | 1016 | struct i2c_adapter *i2c, |
954 | enum tda18271_i2c_gate gate) | 1017 | struct tda18271_config *cfg) |
955 | { | 1018 | { |
956 | struct tda18271_priv *priv = NULL; | 1019 | struct tda18271_priv *priv = NULL; |
957 | 1020 | ||
@@ -961,7 +1024,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
961 | 1024 | ||
962 | priv->i2c_addr = addr; | 1025 | priv->i2c_addr = addr; |
963 | priv->i2c_adap = i2c; | 1026 | priv->i2c_adap = i2c; |
964 | priv->gate = gate; | 1027 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; |
965 | priv->cal_initialized = false; | 1028 | priv->cal_initialized = false; |
966 | 1029 | ||
967 | fe->tuner_priv = priv; | 1030 | fe->tuner_priv = priv; |
@@ -975,6 +1038,13 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
975 | memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops, | 1038 | memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops, |
976 | sizeof(struct dvb_tuner_ops)); | 1039 | sizeof(struct dvb_tuner_ops)); |
977 | 1040 | ||
1041 | /* override default std map with values in config struct */ | ||
1042 | if ((cfg) && (cfg->std_map)) | ||
1043 | tda18271_update_std_map(fe, cfg->std_map); | ||
1044 | |||
1045 | if (tda18271_debug & DBG_MAP) | ||
1046 | tda18271_dump_std_map(fe); | ||
1047 | |||
978 | tda18271_init_regs(fe); | 1048 | tda18271_init_regs(fe); |
979 | 1049 | ||
980 | return fe; | 1050 | return fe; |
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h index deb375ea253e..6e04258ca6f9 100644 --- a/drivers/media/dvb/frontends/tda18271-priv.h +++ b/drivers/media/dvb/frontends/tda18271-priv.h | |||
@@ -84,27 +84,6 @@ struct tda18271_rf_tracking_filter_cal { | |||
84 | int rf_b2; | 84 | int rf_b2; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | struct tda18271_std_map_item { | ||
88 | u32 if_freq; | ||
89 | u8 std_bits; | ||
90 | }; | ||
91 | |||
92 | struct tda18271_std_map { | ||
93 | struct tda18271_std_map_item atv_b; | ||
94 | struct tda18271_std_map_item atv_dk; | ||
95 | struct tda18271_std_map_item atv_gh; | ||
96 | struct tda18271_std_map_item atv_i; | ||
97 | struct tda18271_std_map_item atv_l; | ||
98 | struct tda18271_std_map_item atv_lc; | ||
99 | struct tda18271_std_map_item atv_mn; | ||
100 | struct tda18271_std_map_item atsc_6; | ||
101 | struct tda18271_std_map_item dvbt_6; | ||
102 | struct tda18271_std_map_item dvbt_7; | ||
103 | struct tda18271_std_map_item dvbt_8; | ||
104 | struct tda18271_std_map_item qam_6; | ||
105 | struct tda18271_std_map_item qam_8; | ||
106 | }; | ||
107 | |||
108 | enum tda18271_mode { | 87 | enum tda18271_mode { |
109 | TDA18271_ANALOG, | 88 | TDA18271_ANALOG, |
110 | TDA18271_DIGITAL, | 89 | TDA18271_DIGITAL, |
@@ -128,8 +107,8 @@ struct tda18271_priv { | |||
128 | 107 | ||
129 | unsigned int cal_initialized:1; | 108 | unsigned int cal_initialized:1; |
130 | 109 | ||
131 | struct tda18271_std_map *std; | ||
132 | struct tda18271_map_layout *maps; | 110 | struct tda18271_map_layout *maps; |
111 | struct tda18271_std_map std; | ||
133 | struct tda18271_rf_tracking_filter_cal rf_cal_state[8]; | 112 | struct tda18271_rf_tracking_filter_cal rf_cal_state[8]; |
134 | 113 | ||
135 | int (*tune) (struct dvb_frontend *fe, | 114 | int (*tune) (struct dvb_frontend *fe, |
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c index 46f1d4ddda34..2f8ea72bcabb 100644 --- a/drivers/media/dvb/frontends/tda18271-tables.c +++ b/drivers/media/dvb/frontends/tda18271-tables.c | |||
@@ -1194,11 +1194,11 @@ static struct tda18271_std_map tda18271c1_std_map = { | |||
1194 | .atv_l = { .if_freq = 7750000, .std_bits = 0x0f }, | 1194 | .atv_l = { .if_freq = 7750000, .std_bits = 0x0f }, |
1195 | .atv_lc = { .if_freq = 1250000, .std_bits = 0x0f }, | 1195 | .atv_lc = { .if_freq = 1250000, .std_bits = 0x0f }, |
1196 | .atv_mn = { .if_freq = 5750000, .std_bits = 0x0d }, | 1196 | .atv_mn = { .if_freq = 5750000, .std_bits = 0x0d }, |
1197 | .atsc_6 = { .if_freq = 5380000, .std_bits = 0x1b }, | 1197 | .atsc_6 = { .if_freq = 3250000, .std_bits = 0x1c }, |
1198 | .dvbt_6 = { .if_freq = 3300000, .std_bits = 0x1b }, | 1198 | .dvbt_6 = { .if_freq = 3300000, .std_bits = 0x1c }, |
1199 | .dvbt_7 = { .if_freq = 3800000, .std_bits = 0x19 }, | 1199 | .dvbt_7 = { .if_freq = 3800000, .std_bits = 0x1d }, |
1200 | .dvbt_8 = { .if_freq = 4300000, .std_bits = 0x1a }, | 1200 | .dvbt_8 = { .if_freq = 4300000, .std_bits = 0x1e }, |
1201 | .qam_6 = { .if_freq = 4000000, .std_bits = 0x18 }, | 1201 | .qam_6 = { .if_freq = 4000000, .std_bits = 0x1d }, |
1202 | .qam_8 = { .if_freq = 5000000, .std_bits = 0x1f }, | 1202 | .qam_8 = { .if_freq = 5000000, .std_bits = 0x1f }, |
1203 | }; | 1203 | }; |
1204 | 1204 | ||
@@ -1210,7 +1210,7 @@ static struct tda18271_std_map tda18271c2_std_map = { | |||
1210 | .atv_l = { .if_freq = 6900000, .std_bits = 0x0e }, | 1210 | .atv_l = { .if_freq = 6900000, .std_bits = 0x0e }, |
1211 | .atv_lc = { .if_freq = 1250000, .std_bits = 0x0e }, | 1211 | .atv_lc = { .if_freq = 1250000, .std_bits = 0x0e }, |
1212 | .atv_mn = { .if_freq = 5400000, .std_bits = 0x0c }, | 1212 | .atv_mn = { .if_freq = 5400000, .std_bits = 0x0c }, |
1213 | .atsc_6 = { .if_freq = 5380000, .std_bits = 0x1b }, | 1213 | .atsc_6 = { .if_freq = 3250000, .std_bits = 0x1c }, |
1214 | .dvbt_6 = { .if_freq = 3300000, .std_bits = 0x1c }, | 1214 | .dvbt_6 = { .if_freq = 3300000, .std_bits = 0x1c }, |
1215 | .dvbt_7 = { .if_freq = 3500000, .std_bits = 0x1c }, | 1215 | .dvbt_7 = { .if_freq = 3500000, .std_bits = 0x1c }, |
1216 | .dvbt_8 = { .if_freq = 4000000, .std_bits = 0x1d }, | 1216 | .dvbt_8 = { .if_freq = 4000000, .std_bits = 0x1d }, |
@@ -1256,11 +1256,13 @@ int tda18271_assign_map_layout(struct dvb_frontend *fe) | |||
1256 | switch (priv->id) { | 1256 | switch (priv->id) { |
1257 | case TDA18271HDC1: | 1257 | case TDA18271HDC1: |
1258 | priv->maps = &tda18271c1_map_layout; | 1258 | priv->maps = &tda18271c1_map_layout; |
1259 | priv->std = &tda18271c1_std_map; | 1259 | memcpy(&priv->std, &tda18271c1_std_map, |
1260 | sizeof(struct tda18271_std_map)); | ||
1260 | break; | 1261 | break; |
1261 | case TDA18271HDC2: | 1262 | case TDA18271HDC2: |
1262 | priv->maps = &tda18271c2_map_layout; | 1263 | priv->maps = &tda18271c2_map_layout; |
1263 | priv->std = &tda18271c2_std_map; | 1264 | memcpy(&priv->std, &tda18271c2_std_map, |
1265 | sizeof(struct tda18271_std_map)); | ||
1264 | break; | 1266 | break; |
1265 | default: | 1267 | default: |
1266 | ret = -EINVAL; | 1268 | ret = -EINVAL; |
diff --git a/drivers/media/dvb/frontends/tda18271.h b/drivers/media/dvb/frontends/tda18271.h index f53568103311..36a3a548a6f5 100644 --- a/drivers/media/dvb/frontends/tda18271.h +++ b/drivers/media/dvb/frontends/tda18271.h | |||
@@ -24,21 +24,47 @@ | |||
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include "dvb_frontend.h" | 25 | #include "dvb_frontend.h" |
26 | 26 | ||
27 | struct tda18271_std_map_item { | ||
28 | u32 if_freq; | ||
29 | u8 std_bits; | ||
30 | }; | ||
31 | |||
32 | struct tda18271_std_map { | ||
33 | struct tda18271_std_map_item atv_b; | ||
34 | struct tda18271_std_map_item atv_dk; | ||
35 | struct tda18271_std_map_item atv_gh; | ||
36 | struct tda18271_std_map_item atv_i; | ||
37 | struct tda18271_std_map_item atv_l; | ||
38 | struct tda18271_std_map_item atv_lc; | ||
39 | struct tda18271_std_map_item atv_mn; | ||
40 | struct tda18271_std_map_item atsc_6; | ||
41 | struct tda18271_std_map_item dvbt_6; | ||
42 | struct tda18271_std_map_item dvbt_7; | ||
43 | struct tda18271_std_map_item dvbt_8; | ||
44 | struct tda18271_std_map_item qam_6; | ||
45 | struct tda18271_std_map_item qam_8; | ||
46 | }; | ||
47 | |||
27 | enum tda18271_i2c_gate { | 48 | enum tda18271_i2c_gate { |
28 | TDA18271_GATE_AUTO = 0, | 49 | TDA18271_GATE_AUTO = 0, |
29 | TDA18271_GATE_ANALOG, | 50 | TDA18271_GATE_ANALOG, |
30 | TDA18271_GATE_DIGITAL, | 51 | TDA18271_GATE_DIGITAL, |
31 | }; | 52 | }; |
32 | 53 | ||
54 | struct tda18271_config { | ||
55 | struct tda18271_std_map *std_map; | ||
56 | enum tda18271_i2c_gate gate; | ||
57 | }; | ||
58 | |||
33 | #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE)) | 59 | #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE)) |
34 | extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | 60 | extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, |
35 | struct i2c_adapter *i2c, | 61 | struct i2c_adapter *i2c, |
36 | enum tda18271_i2c_gate gate); | 62 | struct tda18271_config *cfg); |
37 | #else | 63 | #else |
38 | static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, | 64 | static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, |
39 | u8 addr, | 65 | u8 addr, |
40 | struct i2c_adapter *i2c, | 66 | struct i2c_adapter *i2c, |
41 | enum tda18271_i2c_gate gate) | 67 | struct tda18271_config *cfg) |
42 | { | 68 | { |
43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 69 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); |
44 | return NULL; | 70 | return NULL; |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 81dd47f6f654..948a7fb7ed06 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -183,6 +183,16 @@ static struct tda829x_config tda829x_no_probe = { | |||
183 | .probe_tuner = TDA829X_DONT_PROBE, | 183 | .probe_tuner = TDA829X_DONT_PROBE, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | static struct tda18271_std_map hauppauge_tda18271_std_map = { | ||
187 | .atsc_6 = { .if_freq = 5380000, .std_bits = 0x1b }, | ||
188 | .qam_6 = { .if_freq = 4000000, .std_bits = 0x18 }, | ||
189 | }; | ||
190 | |||
191 | static struct tda18271_config hauppauge_tda18271_config = { | ||
192 | .std_map = &hauppauge_tda18271_std_map, | ||
193 | .gate = TDA18271_GATE_ANALOG, | ||
194 | }; | ||
195 | |||
186 | static int cx23885_hvr1500_xc3028_callback(void *ptr, int command, int arg) | 196 | static int cx23885_hvr1500_xc3028_callback(void *ptr, int command, int arg) |
187 | { | 197 | { |
188 | struct cx23885_tsport *port = ptr; | 198 | struct cx23885_tsport *port = ptr; |
@@ -248,7 +258,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
248 | &tda829x_no_probe); | 258 | &tda829x_no_probe); |
249 | dvb_attach(tda18271_attach, port->dvb.frontend, | 259 | dvb_attach(tda18271_attach, port->dvb.frontend, |
250 | 0x60, &dev->i2c_bus[1].i2c_adap, | 260 | 0x60, &dev->i2c_bus[1].i2c_adap, |
251 | TDA18271_GATE_ANALOG); | 261 | &hauppauge_tda18271_config); |
252 | } | 262 | } |
253 | break; | 263 | break; |
254 | case 0: | 264 | case 0: |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 54d261a2f25a..eab530708a49 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -509,6 +509,10 @@ static void tda829x_release(struct dvb_frontend *fe) | |||
509 | fe->analog_demod_priv = NULL; | 509 | fe->analog_demod_priv = NULL; |
510 | } | 510 | } |
511 | 511 | ||
512 | static struct tda18271_config tda829x_tda18271_config = { | ||
513 | .gate = TDA18271_GATE_ANALOG, | ||
514 | }; | ||
515 | |||
512 | static int tda829x_find_tuner(struct dvb_frontend *fe) | 516 | static int tda829x_find_tuner(struct dvb_frontend *fe) |
513 | { | 517 | { |
514 | struct tda8290_priv *priv = fe->analog_demod_priv; | 518 | struct tda8290_priv *priv = fe->analog_demod_priv; |
@@ -574,7 +578,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) | |||
574 | priv->ver |= TDA18271; | 578 | priv->ver |= TDA18271; |
575 | tda18271_attach(fe, priv->tda827x_addr, | 579 | tda18271_attach(fe, priv->tda827x_addr, |
576 | priv->i2c_props.adap, | 580 | priv->i2c_props.adap, |
577 | TDA18271_GATE_ANALOG); | 581 | &tda829x_tda18271_config); |
578 | } else { | 582 | } else { |
579 | if ((data & 0x3c) == 0) | 583 | if ((data & 0x3c) == 0) |
580 | priv->ver |= TDA8275; | 584 | priv->ver |= TDA8275; |