Commit 09f46342 authored by istvan_v@mailbox.hu's avatar istvan_v@mailbox.hu Committed by Mauro Carvalho Chehab

[media] xc4000: check firmware version

Enabled code to check if the version of the firmware reported by the hardware
is correct after uploading it.
Signed-off-by: default avatarIstvan Varga <istvan_v@mailbox.hu>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7c8ec47a
...@@ -919,7 +919,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, ...@@ -919,7 +919,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
struct xc4000_priv *priv = fe->tuner_priv; struct xc4000_priv *priv = fe->tuner_priv;
struct firmware_properties new_fw; struct firmware_properties new_fw;
int rc = 0, is_retry = 0; int rc = 0, is_retry = 0;
u16 version = 0, hwmodel; u16 hwmodel;
v4l2_std_id std0; v4l2_std_id std0;
u8 hw_major, hw_minor, fw_major, fw_minor; u8 hw_major, hw_minor, fw_major, fw_minor;
...@@ -1032,23 +1032,23 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, ...@@ -1032,23 +1032,23 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
hwmodel, hw_major, hw_minor, fw_major, fw_minor); hwmodel, hw_major, hw_minor, fw_major, fw_minor);
/* Check firmware version against what we downloaded. */ /* Check firmware version against what we downloaded. */
#ifdef DJH_DEBUG if (priv->firm_version != ((fw_major << 8) | fw_minor)) {
if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { printk(KERN_WARNING
printk("Incorrect readback of firmware version %x.\n", "Incorrect readback of firmware version %d.%d.\n",
(version & 0xff)); fw_major, fw_minor);
goto fail; goto fail;
} }
#endif
/* Check that the tuner hardware model remains consistent over time. */ /* Check that the tuner hardware model remains consistent over time. */
if (priv->hwmodel == 0 && if (priv->hwmodel == 0 &&
(hwmodel == XC_PRODUCT_ID_XC4000 || (hwmodel == XC_PRODUCT_ID_XC4000 ||
hwmodel == XC_PRODUCT_ID_XC4100)) { hwmodel == XC_PRODUCT_ID_XC4100)) {
priv->hwmodel = hwmodel; priv->hwmodel = hwmodel;
priv->hwvers = version & 0xff00; priv->hwvers = (hw_major << 8) | hw_minor;
} else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel || } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel ||
priv->hwvers != (version & 0xff00)) { priv->hwvers != ((hw_major << 8) | hw_minor)) {
printk("Read invalid device hardware information - tuner " printk(KERN_WARNING
"Read invalid device hardware information - tuner "
"hung?\n"); "hung?\n");
goto fail; goto fail;
} }
......
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