[media] m88ds3103: calculate DiSEqC message sending time
authorAntti Palosaari <crope@iki.fi>
Wed, 29 Jun 2016 23:39:45 +0000 (20:39 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 8 Jul 2016 19:56:18 +0000 (16:56 -0300)
DiSEqC message sending takes 13.5 ms per byte, which is 54 ms total
when typical 4 byte message is sent. Don't hard-code time limit to
54 ms, but calculate it. Time limit is only used to determine when to
start poll "DiSEqC Tx ready" status from the chip.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/dvb-frontends/m88ds3103.c

index 7c19601a24832e19bc257df6593ad588d8f2a04b..6f03ca8b25da058451558b943ee10199c8382b3f 100644 (file)
@@ -1116,8 +1116,9 @@ static int m88ds3103_diseqc_send_master_cmd(struct dvb_frontend *fe,
        #define SEND_MASTER_CMD_TIMEOUT 120
        timeout = jiffies + msecs_to_jiffies(SEND_MASTER_CMD_TIMEOUT);
 
-       /* DiSEqC message typical period is 54 ms */
-       usleep_range(50000, 54000);
+       /* DiSEqC message period is 13.5 ms per byte */
+       utmp = diseqc_cmd->msg_len * 13500;
+       usleep_range(utmp - 4000, utmp);
 
        for (utmp = 1; !time_after(jiffies, timeout) && utmp;) {
                ret = regmap_read(dev->regmap, 0xa1, &utmp);
This page took 0.024857 seconds and 5 git commands to generate.