diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-04 13:15:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-07 08:58:55 -0400 |
commit | 0de04ca1dc0bd38fd7b88871ab9a17e2d8dbd0db (patch) | |
tree | f3a412b8483c66264e46edd77f993f9b70d8475c | |
parent | 4607bb7a472482ed985bf0a8d5a288ecd3a04ec8 (diff) |
[media] dib0090: Fix the sleep time at the state machine
msleep() is not too precise: its precision depends on the
HZ config. As the driver selects precise timings for the
state machine, change it to usleep_range().
Acked-By: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/dvb-frontends/dib0090.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/dvb-frontends/dib0090.c b/drivers/media/dvb-frontends/dib0090.c index 3ee22ff76315..68e2af2650d3 100644 --- a/drivers/media/dvb-frontends/dib0090.c +++ b/drivers/media/dvb-frontends/dib0090.c | |||
@@ -2557,10 +2557,19 @@ static int dib0090_set_params(struct dvb_frontend *fe) | |||
2557 | 2557 | ||
2558 | do { | 2558 | do { |
2559 | ret = dib0090_tune(fe); | 2559 | ret = dib0090_tune(fe); |
2560 | if (ret != FE_CALLBACK_TIME_NEVER) | 2560 | if (ret == FE_CALLBACK_TIME_NEVER) |
2561 | msleep(ret / 10); | ||
2562 | else | ||
2563 | break; | 2561 | break; |
2562 | |||
2563 | /* | ||
2564 | * Despite dib0090_tune returns time at a 0.1 ms range, | ||
2565 | * the actual sleep time depends on CONFIG_HZ. The worse case | ||
2566 | * is when CONFIG_HZ=100. In such case, the minimum granularity | ||
2567 | * is 10ms. On some real field tests, the tuner sometimes don't | ||
2568 | * lock when this timer is lower than 10ms. So, enforce a 10ms | ||
2569 | * granularity and use usleep_range() instead of msleep(). | ||
2570 | */ | ||
2571 | ret = 10 * (ret + 99)/100; | ||
2572 | usleep_range(ret * 1000, (ret + 1) * 1000); | ||
2564 | } while (state->tune_state != CT_TUNER_STOP); | 2573 | } while (state->tune_state != CT_TUNER_STOP); |
2565 | 2574 | ||
2566 | return 0; | 2575 | return 0; |