[media] m88ds3103: calculate DiSEqC message sending time
[deliverable/linux.git] / drivers / media / dvb-frontends / m88ds3103.c
index 5557ef8fc7049f2e0339fa6974e1a3991a225f94..6f03ca8b25da058451558b943ee10199c8382b3f 100644 (file)
@@ -605,9 +605,6 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
 
        s32tmp = 0x10000 * (tuner_frequency - c->frequency);
        s32tmp = DIV_ROUND_CLOSEST(s32tmp, dev->mclk_khz);
-       if (s32tmp < 0)
-               s32tmp += 0x10000;
-
        buf[0] = (s32tmp >> 0) & 0xff;
        buf[1] = (s32tmp >> 8) & 0xff;
        ret = regmap_bulk_write(dev->regmap, 0x5e, buf, 2);
@@ -1119,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.02598 seconds and 5 git commands to generate.