diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-11-14 17:30:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:02:10 -0500 |
commit | 43efe70253dd13b2d22ee51bb474ece25b3b41b1 (patch) | |
tree | faf71cef76f85467345df2ec530c64398d40c6d3 /drivers/media/video/tuner-xc2028.c | |
parent | ddef2dcc4ead7a9412533202a42c40648e620f43 (diff) |
V4L/DVB (6592): Add the capability to work with more complete firmwares
Firmware version 2.7 has other firmware types. This patch adds the capability
for the driver to work with those newer types.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-xc2028.c')
-rw-r--r-- | drivers/media/video/tuner-xc2028.c | 82 |
1 files changed, 77 insertions, 5 deletions
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c index ecfc39036f90..ac0c9c3cde98 100644 --- a/drivers/media/video/tuner-xc2028.c +++ b/drivers/media/video/tuner-xc2028.c | |||
@@ -112,6 +112,68 @@ static unsigned int xc2028_get_reg(struct xc2028_data *priv, u16 reg) | |||
112 | return (buf[1]) | (buf[0] << 8); | 112 | return (buf[1]) | (buf[0] << 8); |
113 | } | 113 | } |
114 | 114 | ||
115 | void dump_firm_type(unsigned int type) | ||
116 | { | ||
117 | if (type & BASE) | ||
118 | printk("BASE "); | ||
119 | if (type & F8MHZ) | ||
120 | printk("F8MHZ "); | ||
121 | if (type & MTS) | ||
122 | printk("MTS "); | ||
123 | if (type & D2620) | ||
124 | printk("D2620 "); | ||
125 | if (type & D2633) | ||
126 | printk("D2633 "); | ||
127 | if (type & DTV6) | ||
128 | printk("DTV6 "); | ||
129 | if (type & QAM) | ||
130 | printk("QAM "); | ||
131 | if (type & DTV7) | ||
132 | printk("DTV7 "); | ||
133 | if (type & DTV78) | ||
134 | printk("DTV78 "); | ||
135 | if (type & DTV8) | ||
136 | printk("DTV8 "); | ||
137 | if (type & FM) | ||
138 | printk("FM "); | ||
139 | if (type & INPUT1) | ||
140 | printk("INPUT1 "); | ||
141 | if (type & LCD) | ||
142 | printk("LCD "); | ||
143 | if (type & NOGD) | ||
144 | printk("NOGD "); | ||
145 | if (type & MONO) | ||
146 | printk("MONO "); | ||
147 | if (type & ATSC) | ||
148 | printk("ATSC "); | ||
149 | if (type & IF) | ||
150 | printk("IF "); | ||
151 | if (type & LG60) | ||
152 | printk("LG60 "); | ||
153 | if (type & ATI638) | ||
154 | printk("ATI638 "); | ||
155 | if (type & OREN538) | ||
156 | printk("OREN538 "); | ||
157 | if (type & OREN36) | ||
158 | printk("OREN36 "); | ||
159 | if (type & TOYOTA388) | ||
160 | printk("TOYOTA388 "); | ||
161 | if (type & TOYOTA794) | ||
162 | printk("TOYOTA794 "); | ||
163 | if (type & DIBCOM52) | ||
164 | printk("DIBCOM52 "); | ||
165 | if (type & ZARLINK456) | ||
166 | printk("ZARLINK456 "); | ||
167 | if (type & CHINA) | ||
168 | printk("CHINA "); | ||
169 | if (type & F6MHZ) | ||
170 | printk("F6MHZ "); | ||
171 | if (type & INPUT2) | ||
172 | printk("INPUT2 "); | ||
173 | if (type & SCODE) | ||
174 | printk("SCODE "); | ||
175 | } | ||
176 | |||
115 | static void free_firmware(struct xc2028_data *priv) | 177 | static void free_firmware(struct xc2028_data *priv) |
116 | { | 178 | { |
117 | int i; | 179 | int i; |
@@ -214,8 +276,10 @@ static int load_all_firmwares(struct dvb_frontend *fe) | |||
214 | p += sizeof(size); | 276 | p += sizeof(size); |
215 | 277 | ||
216 | if ((!size) || (size + p > endp)) { | 278 | if ((!size) || (size + p > endp)) { |
217 | tuner_info("Firmware type %x, id %lx corrupt\n", | 279 | tuner_info("Firmware type "); |
218 | type, (unsigned long)id); | 280 | dump_firm_type(type); |
281 | printk("(%x), id %lx corrupt (size=%ld, expected %d)\n", | ||
282 | type, (unsigned long)id, endp - p, size); | ||
219 | goto corrupt; | 283 | goto corrupt; |
220 | } | 284 | } |
221 | 285 | ||
@@ -225,7 +289,9 @@ static int load_all_firmwares(struct dvb_frontend *fe) | |||
225 | rc = -ENOMEM; | 289 | rc = -ENOMEM; |
226 | goto err; | 290 | goto err; |
227 | } | 291 | } |
228 | tuner_info("Loading firmware type %x, id %lx, size=%d.\n", | 292 | tuner_info("Loading firmware type "); |
293 | dump_firm_type(type); | ||
294 | printk("(%x), id %lx, size=%d.\n", | ||
229 | type, (unsigned long)id, size); | 295 | type, (unsigned long)id, size); |
230 | 296 | ||
231 | memcpy(priv->firm[n].ptr, p, size); | 297 | memcpy(priv->firm[n].ptr, p, size); |
@@ -366,7 +432,7 @@ found: | |||
366 | size -= len; | 432 | size -= len; |
367 | } | 433 | } |
368 | } | 434 | } |
369 | return -EINVAL; | 435 | return 0; |
370 | } | 436 | } |
371 | 437 | ||
372 | static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, | 438 | static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, |
@@ -451,7 +517,7 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, | |||
451 | break; | 517 | break; |
452 | case BANDWIDTH_6_MHZ: | 518 | case BANDWIDTH_6_MHZ: |
453 | /* FIXME: Should allow select also ATSC */ | 519 | /* FIXME: Should allow select also ATSC */ |
454 | type |= DTV6_QAM; | 520 | type |= DTV6 | QAM; |
455 | break; | 521 | break; |
456 | 522 | ||
457 | default: | 523 | default: |
@@ -485,6 +551,12 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, | |||
485 | if (rc < 0) | 551 | if (rc < 0) |
486 | return rc; | 552 | return rc; |
487 | 553 | ||
554 | /* Load SCODE firmware, if needed */ | ||
555 | tuner_info("Trying to load scode firmware\n"); | ||
556 | type0 = SCODE | priv->ctrl.type; | ||
557 | if (priv->ctrl.type == XC2028_FIRM_MTS) | ||
558 | type0 |= MTS; | ||
559 | |||
488 | version = xc2028_get_reg(priv, 0x0004); | 560 | version = xc2028_get_reg(priv, 0x0004); |
489 | hwmodel = xc2028_get_reg(priv, 0x0008); | 561 | hwmodel = xc2028_get_reg(priv, 0x0008); |
490 | 562 | ||