From: Thierry Reding Date: Mon, 8 Dec 2014 14:05:48 +0000 (+0100) Subject: drm/panel: sharp: lq101r1sx01: Add delay after display on X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4569619d0f3a38c41a4556c79ef63cabd4282558;p=linux-beck.git drm/panel: sharp: lq101r1sx01: Add delay after display on After switching the display on (using the DCS display_on command), wait for 6 frames (100ms at 60 Hz) to give the display more time to prepare. Failing to do this results in the panel not initializing properly in a large number of cases. Signed-off-by: Thierry Reding --- diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c index 9d81759d82fc..8a11e83ab582 100644 --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c @@ -41,6 +41,16 @@ static inline struct sharp_panel *to_sharp_panel(struct drm_panel *panel) return container_of(panel, struct sharp_panel, base); } +static void sharp_wait_frames(struct sharp_panel *sharp, unsigned int frames) +{ + unsigned int refresh = drm_mode_vrefresh(sharp->mode); + + if (WARN_ON(frames > refresh)) + return; + + msleep(1000 / (refresh / frames)); +} + static int sharp_panel_write(struct sharp_panel *sharp, u16 offset, u8 value) { u8 payload[3] = { offset >> 8, offset & 0xff, value }; @@ -238,6 +248,9 @@ static int sharp_panel_prepare(struct drm_panel *panel) sharp->prepared = true; + /* wait for 6 frames before continuing */ + sharp_wait_frames(sharp, 6); + return 0; poweroff: