disp: msm: sde: trigger panel event notifications

Trigger various panel event notifications when
operational fps and power mode changes.

Change-Id: I8c5e066c8f20de4c31bb21a6fd6226dd93678fb6
Signed-off-by: Shashank Babu Chinta Venkata <sbchin@codeaurora.org>
Цей коміт міститься в:
Shashank Babu Chinta Venkata
2021-03-15 18:48:37 -07:00
зафіксовано Gerrit - the friendly Code Review server
джерело df2282649d
коміт 036bba0053
2 змінених файлів з 31 додано та 29 видалено

Переглянути файл

@@ -26,6 +26,7 @@
#include <linux/of_irq.h>
#include <linux/dma-buf.h>
#include <linux/memblock.h>
#include <linux/soc/qcom/panel_event_notifier.h>
#include <drm/drm_atomic_uapi.h>
#include <drm/drm_probe_helper.h>
@@ -926,15 +927,15 @@ static int _sde_kms_get_blank(struct drm_crtc_state *crtc_state,
switch (lp_mode) {
case SDE_MODE_DPMS_ON:
blank = DRM_PANEL_BLANK_UNBLANK;
blank = DRM_PANEL_EVENT_UNBLANK;
break;
case SDE_MODE_DPMS_LP1:
case SDE_MODE_DPMS_LP2:
blank = DRM_PANEL_BLANK_LP;
blank = DRM_PANEL_EVENT_BLANK_LP;
break;
case SDE_MODE_DPMS_OFF:
default:
blank = DRM_PANEL_BLANK_POWERDOWN;
blank = DRM_PANEL_EVENT_BLANK;
break;
}
@@ -942,14 +943,16 @@ static int _sde_kms_get_blank(struct drm_crtc_state *crtc_state,
}
static void _sde_kms_drm_check_dpms(struct drm_atomic_state *old_state,
unsigned long event)
bool is_pre_commit)
{
struct panel_event_notification notification;
struct drm_connector *connector;
struct drm_connector_state *old_conn_state;
struct drm_crtc_state *old_crtc_state;
struct drm_crtc *crtc;
struct sde_connector *c_conn;
int i, old_mode, new_mode, old_fps, new_fps;
enum panel_event_notifier_tag panel_type;
for_each_old_connector_in_state(old_state, connector,
old_conn_state, i) {
@@ -960,6 +963,7 @@ static void _sde_kms_drm_check_dpms(struct drm_atomic_state *old_state,
new_fps = drm_mode_vrefresh(&crtc->state->mode);
new_mode = _sde_kms_get_blank(crtc->state, connector->state);
if (old_conn_state->crtc) {
old_crtc_state = drm_atomic_get_existing_crtc_state(
old_state, old_conn_state->crtc);
@@ -969,16 +973,16 @@ static void _sde_kms_drm_check_dpms(struct drm_atomic_state *old_state,
old_conn_state);
} else {
old_fps = 0;
old_mode = DRM_PANEL_BLANK_POWERDOWN;
old_mode = DRM_PANEL_EVENT_BLANK;
}
if ((old_mode != new_mode) || (old_fps != new_fps)) {
c_conn = to_sde_connector(connector);
SDE_EVT32(old_mode, new_mode, old_fps, new_fps,
c_conn->panel, crtc->state->active,
old_conn_state->crtc, event);
pr_debug("change detected (power mode %d->%d, fps %d->%d)\n",
old_mode, new_mode, old_fps, new_fps);
old_conn_state->crtc);
pr_debug("change detected for connector:%s (power mode %d->%d, fps %d->%d)\n",
c_conn->name, old_mode, new_mode, old_fps, new_fps);
/* If suspend resume and fps change are happening
* at the same time, give preference to power mode
@@ -986,7 +990,23 @@ static void _sde_kms_drm_check_dpms(struct drm_atomic_state *old_state,
*/
if ((old_mode == new_mode) && (old_fps != new_fps))
new_mode = DRM_PANEL_BLANK_FPS_CHANGE;
new_mode = DRM_PANEL_EVENT_FPS_CHANGE;
if (!c_conn->panel)
continue;
panel_type = sde_encoder_is_primary_display(
connector->encoder) ?
PANEL_EVENT_NOTIFICATION_PRIMARY :
PANEL_EVENT_NOTIFICATION_SECONDARY;
notification.notif_type = new_mode;
notification.panel = c_conn->panel;
notification.notif_data.old_fps = old_fps;
notification.notif_data.new_fps = new_fps;
notification.notif_data.early_trigger = is_pre_commit;
panel_event_notification_trigger(panel_type,
&notification);
}
}
@@ -1178,7 +1198,7 @@ static void sde_kms_prepare_commit(struct msm_kms *kms,
vm_ops->vm_prepare_commit(sde_kms, state);
end_vm:
_sde_kms_drm_check_dpms(state, DRM_PANEL_EARLY_EVENT_BLANK);
_sde_kms_drm_check_dpms(state, true);
end:
SDE_ATRACE_END("prepare_commit");
}
@@ -1500,7 +1520,7 @@ static void sde_kms_complete_commit(struct msm_kms *kms,
SDE_ERROR("vm post commit failed, rc = %d\n",
rc);
}
_sde_kms_drm_check_dpms(old_state, DRM_PANEL_EVENT_BLANK);
_sde_kms_drm_check_dpms(old_state, false);
pm_runtime_put_sync(sde_kms->dev->dev);

Переглянути файл

@@ -128,11 +128,6 @@
/* ESD status check interval in miliseconds */
#define STATUS_CHECK_INTERVAL_MS 5000
/* A hardware display blank change occurred */
#define DRM_PANEL_EVENT_BLANK 0x01
/* A hardware display blank early change occurred */
#define DRM_PANEL_EARLY_EVENT_BLANK 0x02
/**
* enum sde_kms_smmu_state: smmu state
* @ATTACHED: all the context banks are attached.
@@ -191,19 +186,6 @@ enum frame_trigger_mode_type {
FRAME_DONE_WAIT_POSTED_START,
};
/*
* @DRM_PANEL_BLANK_UNBLANK: power on
* @DRM_PANEL_BLANK_POWERDOWN: power off
* @DRM_PANEL_BLANK_LP: low power mode
* @DRM_PANEL_BLANK_FPS_CHANGE: fps change
*/
enum {
DRM_PANEL_BLANK_UNBLANK,
DRM_PANEL_BLANK_POWERDOWN,
DRM_PANEL_BLANK_LP,
DRM_PANEL_BLANK_FPS_CHANGE,
};
/**
* struct sde_kms_smmu_state_data: stores the smmu state and transition type
* @state: current state of smmu context banks