All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: linux-media@vger.kernel.org
Cc: Antti Palosaari <crope@iki.fi>
Subject: [PATCH 2/5] m88ds3103: calculate DiSEqC message sending time
Date: Thu, 30 Jun 2016 02:39:45 +0300	[thread overview]
Message-ID: <1467243588-26204-2-git-send-email-crope@iki.fi> (raw)
In-Reply-To: <1467243588-26204-1-git-send-email-crope@iki.fi>

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>
---
 drivers/media/dvb-frontends/m88ds3103.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
index 7c19601..6f03ca8 100644
--- a/drivers/media/dvb-frontends/m88ds3103.c
+++ b/drivers/media/dvb-frontends/m88ds3103.c
@@ -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);
-- 
http://palosaari.fi/


  reply	other threads:[~2016-06-29 23:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 23:39 [PATCH 1/5] m88ds3103: remove useless most significant bit clear Antti Palosaari
2016-06-29 23:39 ` Antti Palosaari [this message]
2016-06-29 23:39 ` [PATCH 3/5] m88ds3103: improve ts clock setting Antti Palosaari
2016-06-29 23:39 ` [PATCH 4/5] m88ds3103: use Hz instead of kHz on calculations Antti Palosaari
2016-06-29 23:39 ` [PATCH 5/5] m88ds3103: refactor firmware download Antti Palosaari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467243588-26204-2-git-send-email-crope@iki.fi \
    --to=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.