diff options
author | Antti Palosaari <crope@iki.fi> | 2014-08-24 19:11:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-21 15:42:33 -0400 |
commit | b8843c7979fc8ea54efeaef8e9d524c33c42f099 (patch) | |
tree | 7feec03a9df82458297b8463442113bc4b6ac14b | |
parent | 8880f2cbdb0a981ea8e6a5ce2915abac26120523 (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>
-rw-r--r-- | drivers/media/usb/airspy/airspy.c | 10 |
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, | |||
250 | dst_len = 0; | 250 | dst_len = 0; |
251 | } | 251 | } |
252 | 252 | ||
253 | /* calculate samping rate and output it in 10 seconds intervals */ | 253 | /* calculate sample rate and output it in 10 seconds intervals */ |
254 | if (unlikely(time_is_before_jiffies(s->jiffies_next))) { | 254 | if (unlikely(time_is_before_jiffies(s->jiffies_next))) { |
255 | #define MSECS 10000UL | 255 | #define MSECS 10000UL |
256 | unsigned int msecs = jiffies_to_msecs(jiffies - | ||
257 | s->jiffies_next + msecs_to_jiffies(MSECS)); | ||
256 | unsigned int samples = s->sample - s->sample_measured; | 258 | unsigned int samples = s->sample - s->sample_measured; |
257 | 259 | ||
258 | s->jiffies_next = jiffies + msecs_to_jiffies(MSECS); | 260 | s->jiffies_next = jiffies + msecs_to_jiffies(MSECS); |
259 | s->sample_measured = s->sample; | 261 | s->sample_measured = s->sample; |
260 | dev_dbg(s->dev, "slen=%d samples=%u msecs=%lu sample rate=%lu\n", | 262 | dev_dbg(s->dev, "slen=%u samples=%u msecs=%u sample rate=%lu\n", |
261 | src_len, samples, MSECS, | 263 | src_len, samples, msecs, |
262 | samples * 1000UL / MSECS); | 264 | samples * 1000UL / msecs); |
263 | } | 265 | } |
264 | 266 | ||
265 | /* total number of samples */ | 267 | /* total number of samples */ |