提交 43efe702 编写于 作者: M Mauro Carvalho Chehab

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: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 ddef2dcc
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
DTV6 - 6MHz - ATSC/DVB-C/DVB-T/ISDB-T/DOCSIS DTV6 - 6MHz - ATSC/DVB-C/DVB-T/ISDB-T/DOCSIS
DTV8 - 8MHz - DVB-C/DVB-T DTV8 - 8MHz - DVB-C/DVB-T
*/ */
#define DTV6_ATSC (1<<5) #define DTV6 (1 << 5)
#define DTV6_QAM (1<<6) #define QAM (1 << 6)
#define DTV7 (1<<7) #define DTV7 (1<<7)
#define DTV78 (1<<8) #define DTV78 (1<<8)
#define DTV8 (1<<9) #define DTV8 (1<<9)
...@@ -60,9 +60,25 @@ ...@@ -60,9 +60,25 @@
/* Old firmwares were broken into init0 and init1 */ /* Old firmwares were broken into init0 and init1 */
#define INIT1 (1<<14) #define INIT1 (1<<14)
#define MONO (1 << 15)
#define ATSC (1 << 16)
#define IF (1 << 17)
#define LG60 (1 << 18)
#define ATI638 (1 << 19)
#define OREN538 (1 << 20)
#define OREN36 (1 << 21)
#define TOYOTA388 (1 << 22)
#define TOYOTA794 (1 << 23)
#define DIBCOM52 (1 << 24)
#define ZARLINK456 (1 << 25)
#define CHINA (1 << 26)
#define F6MHZ (1 << 27)
#define INPUT2 (1 << 28)
#define SCODE (1 << 29)
/* Newer types to be moved to videodev2.h */ /* Newer types to be moved to videodev2.h */
#define V4L2_STD_SECAM_K3 (0x02000000) #define V4L2_STD_SECAM_K3 (0x04000000)
/* Audio types */ /* Audio types */
......
...@@ -112,6 +112,68 @@ static unsigned int xc2028_get_reg(struct xc2028_data *priv, u16 reg) ...@@ -112,6 +112,68 @@ static unsigned int xc2028_get_reg(struct xc2028_data *priv, u16 reg)
return (buf[1]) | (buf[0] << 8); return (buf[1]) | (buf[0] << 8);
} }
void dump_firm_type(unsigned int type)
{
if (type & BASE)
printk("BASE ");
if (type & F8MHZ)
printk("F8MHZ ");
if (type & MTS)
printk("MTS ");
if (type & D2620)
printk("D2620 ");
if (type & D2633)
printk("D2633 ");
if (type & DTV6)
printk("DTV6 ");
if (type & QAM)
printk("QAM ");
if (type & DTV7)
printk("DTV7 ");
if (type & DTV78)
printk("DTV78 ");
if (type & DTV8)
printk("DTV8 ");
if (type & FM)
printk("FM ");
if (type & INPUT1)
printk("INPUT1 ");
if (type & LCD)
printk("LCD ");
if (type & NOGD)
printk("NOGD ");
if (type & MONO)
printk("MONO ");
if (type & ATSC)
printk("ATSC ");
if (type & IF)
printk("IF ");
if (type & LG60)
printk("LG60 ");
if (type & ATI638)
printk("ATI638 ");
if (type & OREN538)
printk("OREN538 ");
if (type & OREN36)
printk("OREN36 ");
if (type & TOYOTA388)
printk("TOYOTA388 ");
if (type & TOYOTA794)
printk("TOYOTA794 ");
if (type & DIBCOM52)
printk("DIBCOM52 ");
if (type & ZARLINK456)
printk("ZARLINK456 ");
if (type & CHINA)
printk("CHINA ");
if (type & F6MHZ)
printk("F6MHZ ");
if (type & INPUT2)
printk("INPUT2 ");
if (type & SCODE)
printk("SCODE ");
}
static void free_firmware(struct xc2028_data *priv) static void free_firmware(struct xc2028_data *priv)
{ {
int i; int i;
...@@ -214,8 +276,10 @@ static int load_all_firmwares(struct dvb_frontend *fe) ...@@ -214,8 +276,10 @@ static int load_all_firmwares(struct dvb_frontend *fe)
p += sizeof(size); p += sizeof(size);
if ((!size) || (size + p > endp)) { if ((!size) || (size + p > endp)) {
tuner_info("Firmware type %x, id %lx corrupt\n", tuner_info("Firmware type ");
type, (unsigned long)id); dump_firm_type(type);
printk("(%x), id %lx corrupt (size=%ld, expected %d)\n",
type, (unsigned long)id, endp - p, size);
goto corrupt; goto corrupt;
} }
...@@ -225,7 +289,9 @@ static int load_all_firmwares(struct dvb_frontend *fe) ...@@ -225,7 +289,9 @@ static int load_all_firmwares(struct dvb_frontend *fe)
rc = -ENOMEM; rc = -ENOMEM;
goto err; goto err;
} }
tuner_info("Loading firmware type %x, id %lx, size=%d.\n", tuner_info("Loading firmware type ");
dump_firm_type(type);
printk("(%x), id %lx, size=%d.\n",
type, (unsigned long)id, size); type, (unsigned long)id, size);
memcpy(priv->firm[n].ptr, p, size); memcpy(priv->firm[n].ptr, p, size);
...@@ -366,7 +432,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, ...@@ -366,7 +432,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,
size -= len; size -= len;
} }
} }
return -EINVAL; return 0;
} }
static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, 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,7 +517,7 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
break; break;
case BANDWIDTH_6_MHZ: case BANDWIDTH_6_MHZ:
/* FIXME: Should allow select also ATSC */ /* FIXME: Should allow select also ATSC */
type |= DTV6_QAM; type |= DTV6 | QAM;
break; break;
default: default:
...@@ -485,6 +551,12 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode, ...@@ -485,6 +551,12 @@ static int check_firmware(struct dvb_frontend *fe, enum tuner_mode new_mode,
if (rc < 0) if (rc < 0)
return rc; return rc;
/* Load SCODE firmware, if needed */
tuner_info("Trying to load scode firmware\n");
type0 = SCODE | priv->ctrl.type;
if (priv->ctrl.type == XC2028_FIRM_MTS)
type0 |= MTS;
version = xc2028_get_reg(priv, 0x0004); version = xc2028_get_reg(priv, 0x0004);
hwmodel = xc2028_get_reg(priv, 0x0008); hwmodel = xc2028_get_reg(priv, 0x0008);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册