aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-09-28 01:24:44 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:37:09 -0400
commit0975fc68719c75cbe14132c6f0dead57cd4d5210 (patch)
tree7dedb552fb9e2e8d874ca2b66cefe39406fd7737
parent767f3b3bf23244d52be0492df20b0eaf14f501c5 (diff)
V4L/DVB (9055): tuner-xc2028: Do a better job selecting firmware type
Firmware selection is very tricky on this device. This patch do a better selection of the proper firmware type, by using a code to hint if the firmware to be loaded should be D2620 or D2633. It also allows overriding the hint at the control structure. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.c33
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.h8
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c3
3 files changed, 33 insertions, 11 deletions
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index fc82d154c8c2..b65e6803e6c6 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -1013,11 +1013,6 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1013 1013
1014 tuner_dbg("%s called\n", __func__); 1014 tuner_dbg("%s called\n", __func__);
1015 1015
1016 if (priv->ctrl.d2633)
1017 type |= D2633;
1018 else
1019 type |= D2620;
1020
1021 switch(fe->ops.info.type) { 1016 switch(fe->ops.info.type) {
1022 case FE_OFDM: 1017 case FE_OFDM:
1023 bw = p->u.ofdm.bandwidth; 1018 bw = p->u.ofdm.bandwidth;
@@ -1032,10 +1027,8 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1032 break; 1027 break;
1033 case FE_ATSC: 1028 case FE_ATSC:
1034 bw = BANDWIDTH_6_MHZ; 1029 bw = BANDWIDTH_6_MHZ;
1035 /* The only ATSC firmware (at least on v2.7) is D2633, 1030 /* The only ATSC firmware (at least on v2.7) is D2633 */
1036 so overrides ctrl->d2633 */ 1031 type |= ATSC | D2633;
1037 type |= ATSC| D2633;
1038 type &= ~D2620;
1039 break; 1032 break;
1040 /* DVB-S is not supported */ 1033 /* DVB-S is not supported */
1041 default: 1034 default:
@@ -1068,6 +1061,28 @@ static int xc2028_set_params(struct dvb_frontend *fe,
1068 tuner_err("error: bandwidth not supported.\n"); 1061 tuner_err("error: bandwidth not supported.\n");
1069 }; 1062 };
1070 1063
1064 /*
1065 Selects between D2633 or D2620 firmware.
1066 It doesn't make sense for ATSC, since it should be D2633 on all cases
1067 */
1068 if (fe->ops.info.type != FE_ATSC) {
1069 switch (priv->ctrl.type) {
1070 case XC2028_D2633:
1071 type |= D2633;
1072 break;
1073 case XC2028_D2620:
1074 type |= D2620;
1075 break;
1076 case XC2028_AUTO:
1077 default:
1078 /* Zarlink seems to need D2633 */
1079 if (priv->ctrl.demod == XC3028_FE_ZARLINK456)
1080 type |= D2633;
1081 else
1082 type |= D2620;
1083 }
1084 }
1085
1071 /* All S-code tables need a 200kHz shift */ 1086 /* All S-code tables need a 200kHz shift */
1072 if (priv->ctrl.demod) 1087 if (priv->ctrl.demod)
1073 demod = priv->ctrl.demod + 200; 1088 demod = priv->ctrl.demod + 200;
diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h
index 1af69f49f8e1..19de7928a74e 100644
--- a/drivers/media/common/tuners/tuner-xc2028.h
+++ b/drivers/media/common/tuners/tuner-xc2028.h
@@ -24,16 +24,22 @@
24#define XC3028_FE_ZARLINK456 4560 24#define XC3028_FE_ZARLINK456 4560
25#define XC3028_FE_CHINA 5200 25#define XC3028_FE_CHINA 5200
26 26
27enum firmware_type {
28 XC2028_AUTO = 0, /* By default, auto-detects */
29 XC2028_D2633,
30 XC2028_D2620,
31};
32
27struct xc2028_ctrl { 33struct xc2028_ctrl {
28 char *fname; 34 char *fname;
29 int max_len; 35 int max_len;
30 unsigned int scode_table; 36 unsigned int scode_table;
31 unsigned int mts :1; 37 unsigned int mts :1;
32 unsigned int d2633 :1;
33 unsigned int input1:1; 38 unsigned int input1:1;
34 unsigned int vhfbw7:1; 39 unsigned int vhfbw7:1;
35 unsigned int uhfbw8:1; 40 unsigned int uhfbw8:1;
36 unsigned int demod; 41 unsigned int demod;
42 enum firmware_type type:2;
37}; 43};
38 44
39struct xc2028_config { 45struct xc2028_config {
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 6c5475d7d321..24bd18327aa0 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -444,7 +444,8 @@ static int dvb_register(struct cx23885_tsport *port)
444 .fname = XC3028L_DEFAULT_FIRMWARE, 444 .fname = XC3028L_DEFAULT_FIRMWARE,
445 .max_len = 64, 445 .max_len = 64,
446 .demod = 5000, 446 .demod = 5000,
447 .d2633 = 1 447 /* This is true for all demods with v36 firmware? */
448 .type = XC2028_D2633,
448 }; 449 };
449 450
450 fe = dvb_attach(xc2028_attach, 451 fe = dvb_attach(xc2028_attach,