CHROMIUM: drm: exynos - use msleep, not mdelay when waiting
authorDaniel Kurtz <djkurtz@chromium.org>
Tue, 2 Oct 2012 13:47:51 +0000 (21:47 +0800)
committerGerrit <chrome-bot@google.com>
Wed, 3 Oct 2012 14:33:25 +0000 (07:33 -0700)
commitf97ae2f368770a236e3e935ed55e9824387d773e
treeaa74aaa4dbde8313c95c03a37b9e7947ab431d8d
parentd57951fa3453dfeae49ecaae41cf9b7f67793f90
CHROMIUM: drm: exynos - use msleep, not mdelay when waiting

mdelay() is a busy loop, which keeps the current thread active.
msleep() allows the scheduler to wake up other threads.

Using mdelay(100) to delay while waiting for the video stream to turn on
- in the hotplug work task - means that no other tasks can get scheduled
for a long time.  This can have lots of bad side-effects.
For example, the threaded interrupt handlers used reading data from
i2c-connected input devices do not get a chance to run, so many input
events can get lost or delayed.  In particular, if a key down event
indirectly causes a hotplug event (i.e., pressing brightness up key when
at minimum brightness setting), the corresponding "key up" event is
delayed for an entire second until the video is fully up.  During this
time, many key autorepeat events will get generated (either in the
kernel, or in X, or both).

Note: there are still other uses of udelay / mdelay in the exynos drm
driver.  They should all be scrubbed and converted to usleep_range(),
unless a blocking delay is absolutely required.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
BUG=chrome-os-partner:14746
TEST=Set brightness down to minimum (screen off).
     Click the brightness up button just one time.
     Screen should turn back on - but at the lowest visible brightness.

Change-Id: I94584d2d48a1215c39fe7397db17becfc53f6406
Reviewed-on: https://gerrit.chromium.org/gerrit/34418
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
drivers/gpu/drm/exynos/exynos_dp_core.c