summaryrefslogtreecommitdiff
path: root/drivers/media/usb/airspy
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2014-08-24 20:11:27 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-21 16:42:33 -0300
commitb8843c7979fc8ea54efeaef8e9d524c33c42f099 (patch)
tree7feec03a9df82458297b8463442113bc4b6ac14b /drivers/media/usb/airspy
parent8880f2cbdb0a981ea8e6a5ce2915abac26120523 (diff)
[media] airspy: 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/usb/airspy')
-rw-r--r--drivers/media/usb/airspy/airspy.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
index 994c9914ab9b..4069234abed5 100644
--- a/drivers/media/usb/airspy/airspy.c
+++ b/drivers/media/usb/airspy/airspy.c
@@ -250,16 +250,18 @@ static unsigned int airspy_convert_stream(struct airspy *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
+ 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->dev, "slen=%d samples=%u msecs=%lu sample rate=%lu\n",
- src_len, samples, MSECS,
- samples * 1000UL / MSECS);
+ dev_dbg(s->dev, "slen=%u samples=%u msecs=%u sample rate=%lu\n",
+ src_len, samples, msecs,
+ samples * 1000UL / msecs);
}
/* total number of samples */