aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/dvb-core/dvb_ca_en50221.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2018-03-26 02:32:06 +0000
committerAlex Shi <alex.shi@linaro.org>2018-03-26 02:32:06 +0000
commit95263782222ba14acb4f45ce40343286653a212d (patch)
treeb1b91815dc7ecc03361e3e3ce192f7d64b71fe2e /drivers/media/dvb-core/dvb_ca_en50221.c
parent9c032b533b870102c1929870059ec2c089a31f2b (diff)
parentc5833b96030f9e06cf7c19dd4f99d3b55985eb8c (diff)
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-androidlsk-v4.4-18.03-android
Diffstat (limited to 'drivers/media/dvb-core/dvb_ca_en50221.c')
-rw-r--r--drivers/media/dvb-core/dvb_ca_en50221.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
index fb66184dc9b6..77cf211e842e 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -750,6 +750,29 @@ static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot, u8 * b
goto exit;
}
+ /*
+ * It may need some time for the CAM to settle down, or there might
+ * be a race condition between the CAM, writing HC and our last
+ * check for DA. This happens, if the CAM asserts DA, just after
+ * checking DA before we are setting HC. In this case it might be
+ * a bug in the CAM to keep the FR bit, the lower layer/HW
+ * communication requires a longer timeout or the CAM needs more
+ * time internally. But this happens in reality!
+ * We need to read the status from the HW again and do the same
+ * we did for the previous check for DA
+ */
+ status = ca->pub->read_cam_control(ca->pub, slot, CTRLIF_STATUS);
+ if (status < 0)
+ goto exit;
+
+ if (status & (STATUSREG_DA | STATUSREG_RE)) {
+ if (status & STATUSREG_DA)
+ dvb_ca_en50221_thread_wakeup(ca);
+
+ status = -EAGAIN;
+ goto exit;
+ }
+
/* send the amount of data */
if ((status = ca->pub->write_cam_control(ca->pub, slot, CTRLIF_SIZE_HIGH, bytes_write >> 8)) != 0)
goto exit;