aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-11-14 17:30:28 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:02:10 -0500
commit43efe70253dd13b2d22ee51bb474ece25b3b41b1 (patch)
treefaf71cef76f85467345df2ec530c64398d40c6d3 /drivers/media/video
parentddef2dcc4ead7a9412533202a42c40648e620f43 (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')
-rw-r--r--drivers/media/video/tuner-xc2028-types.h22
-rw-r--r--drivers/media/video/tuner-xc2028.c82
2 files changed, 96 insertions, 8 deletions
diff --git a/drivers/media/video/tuner-xc2028-types.h b/drivers/media/video/tuner-xc2028-types.h
index 80b19eb1b083..f6695d413563 100644
--- a/drivers/media/video/tuner-xc2028-types.h
+++ b/drivers/media/video/tuner-xc2028-types.h
@@ -31,8 +31,8 @@
31 DTV6 - 6MHz - ATSC/DVB-C/DVB-T/ISDB-T/DOCSIS 31 DTV6 - 6MHz - ATSC/DVB-C/DVB-T/ISDB-T/DOCSIS
32 DTV8 - 8MHz - DVB-C/DVB-T 32 DTV8 - 8MHz - DVB-C/DVB-T
33 */ 33 */
34#define DTV6_ATSC (1<<5) 34#define DTV6 (1 << 5)
35#define DTV6_QAM (1<<6) 35#define QAM (1 << 6)
36#define DTV7 (1<<7) 36#define DTV7 (1<<7)
37#define DTV78 (1<<8) 37#define DTV78 (1<<8)
38#define DTV8 (1<<9) 38#define DTV8 (1<<9)
@@ -60,9 +60,25 @@
60/* Old firmwares were broken into init0 and init1 */ 60/* Old firmwares were broken into init0 and init1 */
61#define INIT1 (1<<14) 61#define INIT1 (1<<14)
62 62
63#define MONO (1 << 15)
64#define ATSC (1 << 16)
65#define IF (1 << 17)
66#define LG60 (1 << 18)
67#define ATI638 (1 << 19)
68#define OREN538 (1 << 20)
69#define OREN36 (1 << 21)
70#define TOYOTA388 (1 << 22)
71#define TOYOTA794 (1 << 23)
72#define DIBCOM52 (1 << 24)
73#define ZARLINK456 (1 << 25)
74#define CHINA (1 << 26)
75#define F6MHZ (1 << 27)
76#define INPUT2 (1 << 28)
77#define SCODE (1 << 29)
78
63/* Newer types to be moved to videodev2.h */ 79/* Newer types to be moved to videodev2.h */
64 80
65#define V4L2_STD_SECAM_K3 (0x02000000) 81#define V4L2_STD_SECAM_K3 (0x04000000)
66 82
67/* Audio types */ 83/* Audio types */
68 84
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
115void 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
115static void free_firmware(struct xc2028_data *priv) 177static 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
372static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, 438static 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