summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/rtl2832_sdr.c
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2014-08-25 06:44:13 +0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-21 23:42:37 +0400
commitb538a8e85b2b2fbb954da2b9189eaf18cf9098bf (patch)
tree67d0611c92abe3cccd855fb0c708d54ebd8f0d54 /drivers/media/dvb-frontends/rtl2832_sdr.c
parentabfc8d66d72ba183eb3b5d344fd1ec17233db8bb (diff)
downloadlinux-b538a8e85b2b2fbb954da2b9189eaf18cf9098bf.tar.xz
[media] rtl2832_sdr: enhance sample rate debug calculation precision
Sample rate calculation gives a little bit too large results because in real life there was around one milliseconds (~one usb packet) too much data for given time. Calculate time more accurate in order to provide better results. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/rtl2832_sdr.c')
-rw-r--r--drivers/media/dvb-frontends/rtl2832_sdr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c
index 029189d8be88..9211ddeff227 100644
--- a/drivers/media/dvb-frontends/rtl2832_sdr.c
+++ b/drivers/media/dvb-frontends/rtl2832_sdr.c
@@ -365,17 +365,19 @@ static unsigned int rtl2832_sdr_convert_stream(struct rtl2832_sdr_state *s,
dst_len = 0;
}
- /* calculate samping rate and output it in 10 seconds intervals */
+ /* calculate sample rate and output it in 10 seconds intervals */
if (unlikely(time_is_before_jiffies(s->jiffies_next))) {
-#define MSECS 10000UL
+ #define MSECS 10000UL
+ unsigned int msecs = jiffies_to_msecs(jiffies -
+ s->jiffies_next + msecs_to_jiffies(MSECS));
unsigned int samples = s->sample - s->sample_measured;
s->jiffies_next = jiffies + msecs_to_jiffies(MSECS);
s->sample_measured = s->sample;
dev_dbg(&s->udev->dev,
- "slen=%d samples=%u msecs=%lu sampling rate=%lu\n",
- src_len, samples, MSECS,
- samples * 1000UL / MSECS);
+ "slen=%u samples=%u msecs=%u sample rate=%lu\n",
+ src_len, samples, msecs,
+ samples * 1000UL / msecs);
}
/* total number of I+Q pairs */