Skip to content

Commit

Permalink
drm/msm/sde: Trigger panel reset after first kickoff on non-60 Hz
Browse files Browse the repository at this point in the history
If we're using a refresh rate different from what the bootloader
initializes the display with, a panel reset is necessary for our custom
refresh rate to take effect.

After the first kickoff, request a panel reset from userspace using the
existing ESD recovery mechanism to update the refresh rate. Note that
this is only done if the target refresh rate is *not* 60 Hz because this
is redundant if we don't need a refresh rate update.

Signed-off-by: Danny Lin <[email protected]>
  • Loading branch information
kdrag0n authored and SiddharthBharadwaj committed Feb 19, 2020
1 parent 99e1087 commit 0557323
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions drivers/gpu/drm/msm/sde/sde_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ void sde_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc)

void sde_encoder_kickoff(struct drm_encoder *drm_enc)
{
static bool first_run = true;
struct sde_encoder_virt *sde_enc;
struct sde_encoder_phys *phys;
unsigned int i;
Expand Down Expand Up @@ -1027,6 +1028,33 @@ void sde_encoder_kickoff(struct drm_encoder *drm_enc)
if (phys && phys->ops.handle_post_kickoff)
phys->ops.handle_post_kickoff(phys);
}

if (sde_enc->disp_info.intf_type == DRM_MODE_CONNECTOR_DSI &&
!_sde_encoder_wakeup_time(drm_enc, &wakeup_time)) {
SDE_EVT32_VERBOSE(ktime_to_ms(wakeup_time));
mod_timer(&sde_enc->vsync_event_timer,
nsecs_to_jiffies(ktime_to_ns(wakeup_time)));
}

/*
* Trigger a panel reset if this is the first kickoff and the refresh
* rate is not 60 Hz
*/
if (cmpxchg(&first_run, true, false) &&
sde_enc->crtc->mode.vrefresh != 60) {
struct sde_connector *conn = container_of(phys->connector, struct sde_connector, base);
struct drm_event event = {
.type = DRM_EVENT_PANEL_DEAD,
.length = sizeof(bool)
};

conn->panel_dead = true;
event.type = DRM_EVENT_PANEL_DEAD;
event.length = sizeof(bool);
msm_mode_object_event_notify(&conn->base.base,
conn->base.dev, &event, (u8 *) &conn->panel_dead);
}

SDE_ATRACE_END("encoder_kickoff");
}

Expand Down

0 comments on commit 0557323

Please sign in to comment.