Commit fa8e91b1 authored by Drew Davenport's avatar Drew Davenport Committed by Douglas Anderson

drm/panel-edp: Use ktime_get_boottime for delays

ktime_get is based on CLOCK_MONOTONIC which stops on suspend. On
suspend, the time that the panel was powerd off is recorded with
ktime_get, and on resume this time is compared to the current ktime_get
time to determine if the driver should wait for the panel to power down
completely before re-enabling it.

Because we're using ktime_get, this delay doesn't account for the time
that the device is suspended, during which the power down delay may have
already elapsed.

Change to use ktime_get_boottime throughout, which uses CLOCK_BOOTTIME
which does not stop when suspended. This ensures that the resume path
will not be delayed if the power off delay has already been met while
the device is suspended.
Signed-off-by: default avatarDrew Davenport <ddavenport@chromium.org>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20221117133655.1.I51639dc112bbbe27259df6bdad56dbabd655d91a@changeid
parent de86815b
...@@ -351,7 +351,7 @@ static void panel_edp_wait(ktime_t start_ktime, unsigned int min_ms) ...@@ -351,7 +351,7 @@ static void panel_edp_wait(ktime_t start_ktime, unsigned int min_ms)
return; return;
min_ktime = ktime_add(start_ktime, ms_to_ktime(min_ms)); min_ktime = ktime_add(start_ktime, ms_to_ktime(min_ms));
now_ktime = ktime_get(); now_ktime = ktime_get_boottime();
if (ktime_before(now_ktime, min_ktime)) if (ktime_before(now_ktime, min_ktime))
msleep(ktime_to_ms(ktime_sub(min_ktime, now_ktime)) + 1); msleep(ktime_to_ms(ktime_sub(min_ktime, now_ktime)) + 1);
...@@ -378,7 +378,7 @@ static int panel_edp_suspend(struct device *dev) ...@@ -378,7 +378,7 @@ static int panel_edp_suspend(struct device *dev)
gpiod_set_value_cansleep(p->enable_gpio, 0); gpiod_set_value_cansleep(p->enable_gpio, 0);
regulator_disable(p->supply); regulator_disable(p->supply);
p->unprepared_time = ktime_get(); p->unprepared_time = ktime_get_boottime();
return 0; return 0;
} }
...@@ -464,14 +464,14 @@ static int panel_edp_prepare_once(struct panel_edp *p) ...@@ -464,14 +464,14 @@ static int panel_edp_prepare_once(struct panel_edp *p)
} }
} }
p->prepared_time = ktime_get(); p->prepared_time = ktime_get_boottime();
return 0; return 0;
error: error:
gpiod_set_value_cansleep(p->enable_gpio, 0); gpiod_set_value_cansleep(p->enable_gpio, 0);
regulator_disable(p->supply); regulator_disable(p->supply);
p->unprepared_time = ktime_get(); p->unprepared_time = ktime_get_boottime();
return err; return err;
} }
......
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