Commit 0de04ca1 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[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: default avatarPatrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 4607bb7a
...@@ -2557,10 +2557,19 @@ static int dib0090_set_params(struct dvb_frontend *fe) ...@@ -2557,10 +2557,19 @@ static int dib0090_set_params(struct dvb_frontend *fe)
do { do {
ret = dib0090_tune(fe); ret = dib0090_tune(fe);
if (ret != FE_CALLBACK_TIME_NEVER) if (ret == FE_CALLBACK_TIME_NEVER)
msleep(ret / 10);
else
break; break;
/*
* Despite dib0090_tune returns time at a 0.1 ms range,
* the actual sleep time depends on CONFIG_HZ. The worse case
* is when CONFIG_HZ=100. In such case, the minimum granularity
* is 10ms. On some real field tests, the tuner sometimes don't
* lock when this timer is lower than 10ms. So, enforce a 10ms
* granularity and use usleep_range() instead of msleep().
*/
ret = 10 * (ret + 99)/100;
usleep_range(ret * 1000, (ret + 1) * 1000);
} while (state->tune_state != CT_TUNER_STOP); } while (state->tune_state != CT_TUNER_STOP);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment