diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-04 14:15:35 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-07 09:58:42 -0300 |
commit | 4607bb7a472482ed985bf0a8d5a288ecd3a04ec8 (patch) | |
tree | d1f211cc5deafcee07325c866d7b5452da8ec7e4 /drivers/media/dvb-frontends/dib8000.c | |
parent | 40d1a7c3ded03347336fbd33234af89aaf5ffdca (diff) |
[media] dib8000: 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>
Diffstat (limited to 'drivers/media/dvb-frontends/dib8000.c')
-rw-r--r-- | drivers/media/dvb-frontends/dib8000.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c index 5d1e141d3109..91bdecc751d6 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c @@ -3606,10 +3606,19 @@ static int dib8000_set_frontend(struct dvb_frontend *fe) else if ((time_slave != FE_CALLBACK_TIME_NEVER) && (time_slave > time)) time = time_slave; } - if (time != FE_CALLBACK_TIME_NEVER) - msleep(time / 10); - else + if (time == FE_CALLBACK_TIME_NEVER) break; + + /* + * Despite dib8000_agc_startup 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. + */ + time = 10 * (time + 99)/100; + usleep_range(time * 1000, (time + 1) * 1000); exit_condition = 1; for (index_frontend = 0; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { if (dib8000_get_tune_state(state->fe[index_frontend]) != CT_AGC_STOP) { |