disp: msm: add support to request mdp core clk through mmrm
For Waipio onwards, mdp core clock rate needs to be requested through the mmrm driver, which will make sure the requested rate can be sustained by the its power rail, which is shared by multiple clients. Current change adds the support to request the mdp core clk rate through mmrm driver as well as returns the corresponding failures to user space during when a rate cannot be supported by the system. Change-Id: Icc0e8ab5b71e8c99baf7913bdbd96d9504cc11ae Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
This commit is contained in:
@@ -62,6 +62,8 @@ static int sde_crtc_power_interrupt_handler(struct drm_crtc *crtc_drm,
|
||||
bool en, struct sde_irq_callback *ad_irq);
|
||||
static int sde_crtc_idle_interrupt_handler(struct drm_crtc *crtc_drm,
|
||||
bool en, struct sde_irq_callback *idle_irq);
|
||||
static int sde_crtc_mmrm_interrupt_handler(struct drm_crtc *crtc_drm,
|
||||
bool en, struct sde_irq_callback *idle_irq);
|
||||
static int sde_crtc_pm_event_handler(struct drm_crtc *crtc, bool en,
|
||||
struct sde_irq_callback *noirq);
|
||||
|
||||
@@ -74,6 +76,7 @@ static struct sde_crtc_custom_events custom_events[] = {
|
||||
{DRM_EVENT_LTM_HIST, sde_cp_ltm_hist_interrupt},
|
||||
{DRM_EVENT_LTM_WB_PB, sde_cp_ltm_wb_pb_interrupt},
|
||||
{DRM_EVENT_LTM_OFF, sde_cp_ltm_off_event_handler},
|
||||
{DRM_EVENT_MMRM_CB, sde_crtc_mmrm_interrupt_handler},
|
||||
};
|
||||
|
||||
/* default input fence timeout, in ms */
|
||||
@@ -4087,6 +4090,38 @@ static void sde_crtc_post_ipc(struct drm_crtc *crtc)
|
||||
sde_cp_crtc_post_ipc(crtc);
|
||||
}
|
||||
|
||||
static void sde_crtc_mmrm_cb_notification(struct drm_crtc *crtc)
|
||||
{
|
||||
struct msm_drm_private *priv;
|
||||
unsigned long requested_clk;
|
||||
struct sde_kms *kms = NULL;
|
||||
struct drm_event event;
|
||||
|
||||
if (!crtc->dev->dev_private) {
|
||||
pr_err("invalid crtc priv\n");
|
||||
return;
|
||||
}
|
||||
priv = crtc->dev->dev_private;
|
||||
kms = to_sde_kms(priv->kms);
|
||||
if (!kms) {
|
||||
SDE_ERROR("invalid parameters\n");
|
||||
return;
|
||||
}
|
||||
|
||||
requested_clk = sde_power_mmrm_get_requested_clk(&priv->phandle,
|
||||
kms->perf.clk_name);
|
||||
|
||||
/* notify user space the reduced clk rate */
|
||||
event.type = DRM_EVENT_MMRM_CB;
|
||||
event.length = sizeof(unsigned long);
|
||||
msm_mode_object_event_notify(&crtc->base, crtc->dev,
|
||||
&event, (u8 *)&requested_clk);
|
||||
|
||||
SDE_EVT32(DRMID(crtc), requested_clk);
|
||||
SDE_DEBUG("crtc[%d]: MMRM cb notified clk:%d\n",
|
||||
crtc->base.id, requested_clk);
|
||||
}
|
||||
|
||||
static void sde_crtc_handle_power_event(u32 event_type, void *arg)
|
||||
{
|
||||
struct drm_crtc *crtc = arg;
|
||||
@@ -4161,6 +4196,10 @@ static void sde_crtc_handle_power_event(u32 event_type, void *arg)
|
||||
msm_mode_object_event_notify(&crtc->base, crtc->dev, &event,
|
||||
(u8 *)&power_on);
|
||||
break;
|
||||
case SDE_POWER_EVENT_MMRM_CALLBACK:
|
||||
sde_crtc_mmrm_cb_notification(crtc);
|
||||
|
||||
break;
|
||||
default:
|
||||
SDE_DEBUG("event:%d not handled\n", event_type);
|
||||
break;
|
||||
@@ -4427,7 +4466,7 @@ static void sde_crtc_enable(struct drm_crtc *crtc,
|
||||
sde_crtc->power_event = sde_power_handle_register_event(
|
||||
&priv->phandle,
|
||||
SDE_POWER_EVENT_POST_ENABLE | SDE_POWER_EVENT_POST_DISABLE |
|
||||
SDE_POWER_EVENT_PRE_DISABLE,
|
||||
SDE_POWER_EVENT_PRE_DISABLE | SDE_POWER_EVENT_MMRM_CALLBACK,
|
||||
sde_crtc_handle_power_event, crtc, sde_crtc->name);
|
||||
|
||||
/* Enable ESD thread */
|
||||
@@ -7038,6 +7077,12 @@ static int sde_crtc_idle_interrupt_handler(struct drm_crtc *crtc_drm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sde_crtc_mmrm_interrupt_handler(struct drm_crtc *crtc_drm,
|
||||
bool en, struct sde_irq_callback *irq)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* sde_crtc_update_cont_splash_settings - update mixer settings
|
||||
* and initial clk during device bootup for cont_splash use case
|
||||
|
Reference in New Issue
Block a user