linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "nibble.max" <nibble.max@gmail.com>
To: "Antti Palosaari" <crope@iki.fi>
Cc: "linux-media" <linux-media@vger.kernel.org>,
	"olli.salonen" <olli.salonen@iki.fi>
Subject: [PATCH] m88ts2022: fix high symbol rate transponders missing on 32bit platform.
Date: Sat, 16 Aug 2014 14:26:35 +0800	[thread overview]
Message-ID: <201408161426307340191@gmail.com> (raw)

The current m88ts2022 driver will miss the following high symbol rate transponders on Telstar 18 138.0.
12385 H 43200, 
12690 H 43200,
12538 V 41250...
the code for f_3db_hz will overflow for the high symbol rate.
for example, symbol rate=41250 KS/s
symbol_rate * 135UL = 5568750000(1 4BEC 61B0), the value is larger than unsigned int on 32bit platform. 
that makes the wrong result.
Exchanging the div and mul position fixs it.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
---
 drivers/media/tuners/m88ts2022.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c
index 40c42de..65c8acc 100644
--- a/drivers/media/tuners/m88ts2022.c
+++ b/drivers/media/tuners/m88ts2022.c
@@ -314,7 +314,7 @@ static int m88ts2022_set_params(struct dvb_frontend *fe)
 	div_min = gdiv28 * 78 / 100;
 	div_max = clamp_val(div_max, 0U, 63U);
 
-	f_3db_hz = c->symbol_rate * 135UL / 200UL;
+	f_3db_hz = (c->symbol_rate / 200UL) * 135UL;
 	f_3db_hz +=  2000000U + (frequency_offset_khz * 1000U);
 	f_3db_hz = clamp(f_3db_hz, 7000000U, 40000000U);

-- 
1.9.1


             reply	other threads:[~2014-08-16  6:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-16  6:26 nibble.max [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-16  6:12 [PATCH] m88ts2022: fix high symbol rate transponders missing on 32bit platform nibble.max
2014-08-16 12:38 ` Mauro Carvalho Chehab
2014-08-16 12:53   ` Antti Palosaari
2014-08-16 19:26     ` Matthias Schwarzott

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=201408161426307340191@gmail.com \
    --to=nibble.max@gmail.com \
    --cc=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=olli.salonen@iki.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).