Commit 25a42e4d authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

V4L/DVB (12207): cx18: Add an EEPROM dump routine for the Yuan MPC718 and future cards

Add a routine for dumping the EEPROM of the MPC718.  It is generic enough
to use for other cards in the future that may have an EEPROM.
Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 76e9741d
...@@ -204,7 +204,7 @@ static const struct cx18_card cx18_card_mpc718 = { ...@@ -204,7 +204,7 @@ static const struct cx18_card cx18_card_mpc718 = {
.v4l2_capabilities = CX18_CAP_ENCODER, .v4l2_capabilities = CX18_CAP_ENCODER,
.hw_audio_ctrl = CX18_HW_418_AV, .hw_audio_ctrl = CX18_HW_418_AV,
.hw_muxer = CX18_HW_GPIO_MUX, .hw_muxer = CX18_HW_GPIO_MUX,
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL, CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
.video_inputs = { .video_inputs = {
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
......
...@@ -268,6 +268,20 @@ static void cx18_iounmap(struct cx18 *cx) ...@@ -268,6 +268,20 @@ static void cx18_iounmap(struct cx18 *cx)
} }
} }
static void cx18_eeprom_dump(struct cx18 *cx, unsigned char *eedata, int len)
{
int i;
CX18_INFO("eeprom dump:\n");
for (i = 0; i < len; i++) {
if (0 == (i % 16))
CX18_INFO("eeprom %02x:", i);
printk(KERN_CONT " %02x", eedata[i]);
if (15 == (i % 16))
printk(KERN_CONT "\n");
}
}
/* Hauppauge card? get values from tveeprom */ /* Hauppauge card? get values from tveeprom */
void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
{ {
...@@ -279,8 +293,26 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) ...@@ -279,8 +293,26 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
c.adapter = &cx->i2c_adap[0]; c.adapter = &cx->i2c_adap[0];
c.addr = 0xA0 >> 1; c.addr = 0xA0 >> 1;
tveeprom_read(&c, eedata, sizeof(eedata)); memset(tv, 0, sizeof(*tv));
if (tveeprom_read(&c, eedata, sizeof(eedata)))
return;
switch (cx->card->type) {
case CX18_CARD_HVR_1600_ESMT:
case CX18_CARD_HVR_1600_SAMSUNG:
tveeprom_hauppauge_analog(&c, tv, eedata); tveeprom_hauppauge_analog(&c, tv, eedata);
break;
case CX18_CARD_YUAN_MPC718:
tv->model = 0x718;
cx18_eeprom_dump(cx, eedata, sizeof(eedata));
CX18_INFO("eeprom PCI ID: %02x%02x:%02x%02x\n",
eedata[2], eedata[1], eedata[4], eedata[3]);
break;
default:
tv->model = 0xffffffff;
cx18_eeprom_dump(cx, eedata, sizeof(eedata));
break;
}
} }
static void cx18_process_eeprom(struct cx18 *cx) static void cx18_process_eeprom(struct cx18 *cx)
...@@ -298,6 +330,11 @@ static void cx18_process_eeprom(struct cx18 *cx) ...@@ -298,6 +330,11 @@ static void cx18_process_eeprom(struct cx18 *cx)
case 74000 ... 74999: case 74000 ... 74999:
cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
break; break;
case 0x718:
return;
case 0xffffffff:
CX18_INFO("Unknown EEPROM encoding\n");
return;
case 0: case 0:
CX18_ERR("Invalid EEPROM\n"); CX18_ERR("Invalid EEPROM\n");
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment