aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/xc4000.c
diff options
context:
space:
mode:
authoristvan_v@mailbox.hu <istvan_v@mailbox.hu>2011-06-06 12:00:17 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:52:40 -0400
commit09f4634293f2d48a9619f51b104bef8e6cc6d559 (patch)
tree22185c6fff9502b82aee5a48f277444b7ceccd66 /drivers/media/common/tuners/xc4000.c
parent7c8ec47a92107281cd00d5d4c2b7ccfb53143e28 (diff)
[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: Istvan Varga <istvan_v@mailbox.hu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners/xc4000.c')
-rw-r--r--drivers/media/common/tuners/xc4000.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c
index ebc84269b5e6..a053dece60ce 100644
--- a/drivers/media/common/tuners/xc4000.c
+++ b/drivers/media/common/tuners/xc4000.c
@@ -919,7 +919,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
919 struct xc4000_priv *priv = fe->tuner_priv; 919 struct xc4000_priv *priv = fe->tuner_priv;
920 struct firmware_properties new_fw; 920 struct firmware_properties new_fw;
921 int rc = 0, is_retry = 0; 921 int rc = 0, is_retry = 0;
922 u16 version = 0, hwmodel; 922 u16 hwmodel;
923 v4l2_std_id std0; 923 v4l2_std_id std0;
924 u8 hw_major, hw_minor, fw_major, fw_minor; 924 u8 hw_major, hw_minor, fw_major, fw_minor;
925 925
@@ -1032,23 +1032,23 @@ check_device:
1032 hwmodel, hw_major, hw_minor, fw_major, fw_minor); 1032 hwmodel, hw_major, hw_minor, fw_major, fw_minor);
1033 1033
1034 /* Check firmware version against what we downloaded. */ 1034 /* Check firmware version against what we downloaded. */
1035#ifdef DJH_DEBUG 1035 if (priv->firm_version != ((fw_major << 8) | fw_minor)) {
1036 if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { 1036 printk(KERN_WARNING
1037 printk("Incorrect readback of firmware version %x.\n", 1037 "Incorrect readback of firmware version %d.%d.\n",
1038 (version & 0xff)); 1038 fw_major, fw_minor);
1039 goto fail; 1039 goto fail;
1040 } 1040 }
1041#endif
1042 1041
1043 /* Check that the tuner hardware model remains consistent over time. */ 1042 /* Check that the tuner hardware model remains consistent over time. */
1044 if (priv->hwmodel == 0 && 1043 if (priv->hwmodel == 0 &&
1045 (hwmodel == XC_PRODUCT_ID_XC4000 || 1044 (hwmodel == XC_PRODUCT_ID_XC4000 ||
1046 hwmodel == XC_PRODUCT_ID_XC4100)) { 1045 hwmodel == XC_PRODUCT_ID_XC4100)) {
1047 priv->hwmodel = hwmodel; 1046 priv->hwmodel = hwmodel;
1048 priv->hwvers = version & 0xff00; 1047 priv->hwvers = (hw_major << 8) | hw_minor;
1049 } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel || 1048 } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel ||
1050 priv->hwvers != (version & 0xff00)) { 1049 priv->hwvers != ((hw_major << 8) | hw_minor)) {
1051 printk("Read invalid device hardware information - tuner " 1050 printk(KERN_WARNING
1051 "Read invalid device hardware information - tuner "
1052 "hung?\n"); 1052 "hung?\n");
1053 goto fail; 1053 goto fail;
1054 } 1054 }