aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/tuner-xc2028.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/tuners/tuner-xc2028.c')
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index 96d61707f501..b6ce528e1889 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -100,6 +100,8 @@ struct xc2028_data {
100 if (size != _rc) \ 100 if (size != _rc) \
101 tuner_info("i2c output error: rc = %d (should be %d)\n",\ 101 tuner_info("i2c output error: rc = %d (should be %d)\n",\
102 _rc, (int)size); \ 102 _rc, (int)size); \
103 if (priv->ctrl.msleep) \
104 msleep(priv->ctrl.msleep); \
103 _rc; \ 105 _rc; \
104}) 106})
105 107
@@ -119,6 +121,8 @@ struct xc2028_data {
119 if (isize != _rc) \ 121 if (isize != _rc) \
120 tuner_err("i2c input error: rc = %d (should be %d)\n", \ 122 tuner_err("i2c input error: rc = %d (should be %d)\n", \
121 _rc, (int)isize); \ 123 _rc, (int)isize); \
124 if (priv->ctrl.msleep) \
125 msleep(priv->ctrl.msleep); \
122 _rc; \ 126 _rc; \
123}) 127})
124 128
@@ -129,8 +133,8 @@ struct xc2028_data {
129 (_rc = tuner_i2c_xfer_send(&priv->i2c_props, \ 133 (_rc = tuner_i2c_xfer_send(&priv->i2c_props, \
130 _val, sizeof(_val)))) { \ 134 _val, sizeof(_val)))) { \
131 tuner_err("Error on line %d: %d\n", __LINE__, _rc); \ 135 tuner_err("Error on line %d: %d\n", __LINE__, _rc); \
132 } else \ 136 } else if (priv->ctrl.msleep) \
133 msleep(10); \ 137 msleep(priv->ctrl.msleep); \
134 _rc; \ 138 _rc; \
135}) 139})
136 140
@@ -809,10 +813,20 @@ check_device:
809 hwmodel, (version & 0xf000) >> 12, (version & 0xf00) >> 8, 813 hwmodel, (version & 0xf000) >> 12, (version & 0xf00) >> 8,
810 (version & 0xf0) >> 4, version & 0xf); 814 (version & 0xf0) >> 4, version & 0xf);
811 815
816
817 if (priv->ctrl.read_not_reliable)
818 goto read_not_reliable;
819
812 /* Check firmware version against what we downloaded. */ 820 /* Check firmware version against what we downloaded. */
813 if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { 821 if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) {
814 tuner_err("Incorrect readback of firmware version.\n"); 822 if (!priv->ctrl.read_not_reliable) {
815 goto fail; 823 tuner_err("Incorrect readback of firmware version.\n");
824 goto fail;
825 } else {
826 tuner_err("Returned an incorrect version. However, "
827 "read is not reliable enough. Ignoring it.\n");
828 hwmodel = 3028;
829 }
816 } 830 }
817 831
818 /* Check that the tuner hardware model remains consistent over time. */ 832 /* Check that the tuner hardware model remains consistent over time. */
@@ -826,6 +840,7 @@ check_device:
826 goto fail; 840 goto fail;
827 } 841 }
828 842
843read_not_reliable:
829 memcpy(&priv->cur_fw, &new_fw, sizeof(priv->cur_fw)); 844 memcpy(&priv->cur_fw, &new_fw, sizeof(priv->cur_fw));
830 845
831 /* 846 /*
@@ -996,6 +1011,8 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
996 The reset CLK is needed only with tm6000. 1011 The reset CLK is needed only with tm6000.
997 Driver should work fine even if this fails. 1012 Driver should work fine even if this fails.
998 */ 1013 */
1014 if (priv->ctrl.msleep)
1015 msleep(priv->ctrl.msleep);
999 do_tuner_callback(fe, XC2028_RESET_CLK, 1); 1016 do_tuner_callback(fe, XC2028_RESET_CLK, 1);
1000 1017
1001 msleep(10); 1018 msleep(10);