techpack/display: msm: Set idle state correctly
Set the idle state based on sde encoder's rc state. Test: watch -n 0.1 cat /sys/class/drm/card0/device/idle_state - shows "active" when display is being updated - "idle" otherwise Change-Id: I3b7b8f9e8ab2b7dc008060493d7fb1d7323afd4c Signed-off-by: Karan Parashar <karan@pixelos.net>
This commit is contained in:
parent
74a2c92068
commit
29df08815f
@ -51,6 +51,7 @@
|
||||
#include "msm_mmu.h"
|
||||
#include "sde_wb.h"
|
||||
#include "sde_dbg.h"
|
||||
#include "sde/sde_encoder.h"
|
||||
|
||||
/*
|
||||
* MSM driver version:
|
||||
@ -70,7 +71,7 @@
|
||||
#define LASTCLOSE_TIMEOUT_MS 500
|
||||
|
||||
#define IDLE_ENCODER_MASK_DEFAULT 2
|
||||
#define IDLE_TIMEOUT_MS_DEFAULT 100
|
||||
#define IDLE_TIMEOUT_MS_DEFAULT 100 - IDLE_POWERCOLLAPSE_DURATION
|
||||
|
||||
#define msm_wait_event_timeout(waitq, cond, timeout_ms, ret) \
|
||||
do { \
|
||||
|
@ -1646,6 +1646,29 @@ void sde_encoder_control_idle_pc(struct drm_encoder *drm_enc, bool enable)
|
||||
SDE_EVT32(sde_enc->idle_pc_enabled);
|
||||
}
|
||||
|
||||
static void _sde_encoder_set_rc_state(struct sde_encoder_virt *sde_enc,
|
||||
enum sde_enc_rc_states rc_state)
|
||||
{
|
||||
struct drm_encoder *drm_enc = &sde_enc->base;
|
||||
|
||||
if (sde_enc->rc_state == rc_state)
|
||||
return;
|
||||
|
||||
sde_enc->rc_state = rc_state;
|
||||
|
||||
switch (rc_state) {
|
||||
case SDE_ENC_RC_STATE_OFF:
|
||||
case SDE_ENC_RC_STATE_IDLE:
|
||||
msm_idle_set_state(drm_enc, false);
|
||||
break;
|
||||
case SDE_ENC_RC_STATE_ON:
|
||||
msm_idle_set_state(drm_enc, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _sde_encoder_rc_restart_delayed(struct sde_encoder_virt *sde_enc,
|
||||
u32 sw_event)
|
||||
{
|
||||
@ -1750,15 +1773,13 @@ static int _sde_encoder_rc_kickoff(struct drm_encoder *drm_enc,
|
||||
}
|
||||
SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state,
|
||||
SDE_ENC_RC_STATE_ON, SDE_EVTLOG_FUNC_CASE1);
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_ON;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_ON);
|
||||
|
||||
end:
|
||||
/* avoid delayed off work if called from esd thread */
|
||||
if (!sde_enc->delay_kickoff)
|
||||
_sde_encoder_rc_kickoff_delayed(sde_enc, sw_event);
|
||||
|
||||
msm_idle_set_state(drm_enc, false);
|
||||
|
||||
mutex_unlock(&sde_enc->rc_lock);
|
||||
return ret;
|
||||
}
|
||||
@ -1769,8 +1790,6 @@ static int _sde_encoder_rc_pre_stop(struct drm_encoder *drm_enc,
|
||||
/* cancel delayed off work, if any */
|
||||
_sde_encoder_rc_cancel_delayed(sde_enc, sw_event);
|
||||
|
||||
msm_idle_set_state(drm_enc, true);
|
||||
|
||||
mutex_lock(&sde_enc->rc_lock);
|
||||
|
||||
if (is_vid_mode &&
|
||||
@ -1797,7 +1816,7 @@ static int _sde_encoder_rc_pre_stop(struct drm_encoder *drm_enc,
|
||||
SDE_ENC_RC_STATE_PRE_OFF,
|
||||
SDE_EVTLOG_FUNC_CASE3);
|
||||
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_PRE_OFF;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_PRE_OFF);
|
||||
|
||||
end:
|
||||
mutex_unlock(&sde_enc->rc_lock);
|
||||
@ -1837,7 +1856,7 @@ static int _sde_encoder_rc_stop(struct drm_encoder *drm_enc,
|
||||
SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state,
|
||||
SDE_ENC_RC_STATE_OFF, SDE_EVTLOG_FUNC_CASE4);
|
||||
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_OFF;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_OFF);
|
||||
|
||||
end:
|
||||
mutex_unlock(&sde_enc->rc_lock);
|
||||
@ -1875,7 +1894,7 @@ static int _sde_encoder_rc_pre_modeset(struct drm_encoder *drm_enc,
|
||||
|
||||
SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state,
|
||||
SDE_ENC_RC_STATE_ON, SDE_EVTLOG_FUNC_CASE5);
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_ON;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_ON);
|
||||
}
|
||||
|
||||
if (sde_encoder_has_dsc_hw_rev_2(sde_enc))
|
||||
@ -1893,7 +1912,7 @@ skip_wait:
|
||||
SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state,
|
||||
SDE_ENC_RC_STATE_MODESET, SDE_EVTLOG_FUNC_CASE5);
|
||||
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_MODESET;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_MODESET);
|
||||
_sde_encoder_pm_qos_remove_request(drm_enc);
|
||||
|
||||
end:
|
||||
@ -1929,7 +1948,7 @@ static int _sde_encoder_rc_post_modeset(struct drm_encoder *drm_enc,
|
||||
SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state,
|
||||
SDE_ENC_RC_STATE_ON, SDE_EVTLOG_FUNC_CASE6);
|
||||
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_ON;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_ON);
|
||||
_sde_encoder_pm_qos_add_request(drm_enc);
|
||||
|
||||
end:
|
||||
@ -1982,7 +2001,7 @@ static int _sde_encoder_rc_idle(struct drm_encoder *drm_enc,
|
||||
|
||||
SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state,
|
||||
SDE_ENC_RC_STATE_IDLE, SDE_EVTLOG_FUNC_CASE7);
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_IDLE;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_IDLE);
|
||||
|
||||
end:
|
||||
mutex_unlock(&sde_enc->rc_lock);
|
||||
@ -2056,7 +2075,7 @@ static int _sde_encoder_rc_early_wakeup(struct drm_encoder *drm_enc,
|
||||
msecs_to_jiffies(
|
||||
IDLE_POWERCOLLAPSE_IN_EARLY_WAKEUP));
|
||||
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_ON;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_ON);
|
||||
}
|
||||
|
||||
SDE_EVT32(DRMID(drm_enc), sw_event, sde_enc->rc_state,
|
||||
@ -3848,7 +3867,7 @@ void sde_encoder_trigger_rsc_state_change(struct drm_encoder *drm_enc)
|
||||
_sde_encoder_update_rsc_client(drm_enc, true);
|
||||
|
||||
SDE_EVT32(DRMID(drm_enc), sde_enc->rc_state, SDE_ENC_RC_STATE_ON);
|
||||
sde_enc->rc_state = SDE_ENC_RC_STATE_ON;
|
||||
_sde_encoder_set_rc_state(sde_enc, SDE_ENC_RC_STATE_ON);
|
||||
|
||||
end:
|
||||
mutex_unlock(&sde_enc->rc_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user