disp: msm: add runtime_pm ops support in drm driver
Add runtime_pm ops support in drm driver instead of direct sde_power_resource_enable/disable call. It allows drm driver to use runtime pm refcount logic to track the resources instead of custom implementation. The change also removes the NRT_CLIENT support from sde_power_handle code to simplify it further. Change-Id: Ib14692dca5876703d0a230da2512d731b69b8ebb Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
这个提交包含在:
@@ -120,35 +120,6 @@ static inline struct drm_encoder *_sde_crtc_get_encoder(struct drm_crtc *crtc)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int _sde_crtc_power_enable(struct sde_crtc *sde_crtc, bool enable)
|
||||
{
|
||||
struct drm_crtc *crtc;
|
||||
struct msm_drm_private *priv;
|
||||
struct sde_kms *sde_kms;
|
||||
|
||||
if (!sde_crtc) {
|
||||
SDE_ERROR("invalid sde crtc\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
crtc = &sde_crtc->base;
|
||||
if (!crtc->dev || !crtc->dev->dev_private) {
|
||||
SDE_ERROR("invalid drm device\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
priv = crtc->dev->dev_private;
|
||||
if (!priv->kms) {
|
||||
SDE_ERROR("invalid kms\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
sde_kms = to_sde_kms(priv->kms);
|
||||
|
||||
return sde_power_resource_enable(&priv->phandle, sde_kms->core_client,
|
||||
enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* sde_crtc_calc_fps() - Calculates fps value.
|
||||
* @sde_crtc : CRTC structure
|
||||
@@ -3666,9 +3637,9 @@ static int _sde_crtc_vblank_enable_no_lock(
|
||||
|
||||
/* drop lock since power crtc cb may try to re-acquire lock */
|
||||
mutex_unlock(&sde_crtc->crtc_lock);
|
||||
ret = _sde_crtc_power_enable(sde_crtc, true);
|
||||
ret = pm_runtime_get_sync(crtc->dev->dev);
|
||||
mutex_lock(&sde_crtc->crtc_lock);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
list_for_each_entry(enc, &dev->mode_config.encoder_list, head) {
|
||||
@@ -3698,7 +3669,7 @@ static int _sde_crtc_vblank_enable_no_lock(
|
||||
|
||||
/* drop lock since power crtc cb may try to re-acquire lock */
|
||||
mutex_unlock(&sde_crtc->crtc_lock);
|
||||
_sde_crtc_power_enable(sde_crtc, false);
|
||||
pm_runtime_put_sync(crtc->dev->dev);
|
||||
mutex_lock(&sde_crtc->crtc_lock);
|
||||
}
|
||||
|
||||
@@ -5539,13 +5510,13 @@ static ssize_t _sde_crtc_misr_setup(struct file *file,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = _sde_crtc_power_enable(sde_crtc, true);
|
||||
if (rc)
|
||||
rc = pm_runtime_get_sync(crtc->dev->dev);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
sde_crtc->misr_enable_debugfs = enable;
|
||||
sde_crtc_misr_setup(crtc, enable, frame_count);
|
||||
_sde_crtc_power_enable(sde_crtc, false);
|
||||
pm_runtime_put_sync(crtc->dev->dev);
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -5573,8 +5544,8 @@ static ssize_t _sde_crtc_misr_read(struct file *file,
|
||||
if (!sde_kms)
|
||||
return -EINVAL;
|
||||
|
||||
rc = _sde_crtc_power_enable(sde_crtc, true);
|
||||
if (rc)
|
||||
rc = pm_runtime_get_sync(crtc->dev->dev);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (sde_kms_is_secure_session_inprogress(sde_kms)) {
|
||||
@@ -5628,7 +5599,7 @@ buff_check:
|
||||
*ppos += len; /* increase offset */
|
||||
|
||||
end:
|
||||
_sde_crtc_power_enable(sde_crtc, false);
|
||||
pm_runtime_put_sync(crtc->dev->dev);
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -6110,7 +6081,6 @@ static int _sde_crtc_event_enable(struct sde_kms *kms,
|
||||
{
|
||||
struct sde_crtc *crtc = NULL;
|
||||
struct sde_crtc_irq_info *node;
|
||||
struct msm_drm_private *priv;
|
||||
unsigned long flags;
|
||||
bool found = false;
|
||||
int ret, i = 0;
|
||||
@@ -6151,13 +6121,10 @@ static int _sde_crtc_event_enable(struct sde_kms *kms,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
priv = kms->dev->dev_private;
|
||||
ret = 0;
|
||||
if (crtc_drm->enabled) {
|
||||
ret = sde_power_resource_enable(&priv->phandle,
|
||||
kms->core_client, true);
|
||||
if (ret) {
|
||||
SDE_ERROR("failed to enable power resource %d\n", ret);
|
||||
ret = pm_runtime_get_sync(crtc_drm->dev->dev);
|
||||
if (ret < 0) {
|
||||
SDE_EVT32(ret, SDE_EVTLOG_ERROR);
|
||||
kfree(node);
|
||||
return ret;
|
||||
@@ -6175,8 +6142,7 @@ static int _sde_crtc_event_enable(struct sde_kms *kms,
|
||||
}
|
||||
mutex_unlock(&crtc->crtc_lock);
|
||||
|
||||
sde_power_resource_enable(&priv->phandle, kms->core_client,
|
||||
false);
|
||||
pm_runtime_put_sync(crtc_drm->dev->dev);
|
||||
}
|
||||
|
||||
if (add_event)
|
||||
@@ -6198,7 +6164,6 @@ static int _sde_crtc_event_disable(struct sde_kms *kms,
|
||||
{
|
||||
struct sde_crtc *crtc = NULL;
|
||||
struct sde_crtc_irq_info *node = NULL;
|
||||
struct msm_drm_private *priv;
|
||||
unsigned long flags;
|
||||
bool found = false;
|
||||
int ret;
|
||||
@@ -6226,9 +6191,8 @@ static int _sde_crtc_event_disable(struct sde_kms *kms,
|
||||
kfree(node);
|
||||
return 0;
|
||||
}
|
||||
priv = kms->dev->dev_private;
|
||||
ret = sde_power_resource_enable(&priv->phandle, kms->core_client, true);
|
||||
if (ret) {
|
||||
ret = pm_runtime_get_sync(crtc_drm->dev->dev);
|
||||
if (ret < 0) {
|
||||
SDE_ERROR("failed to enable power resource %d\n", ret);
|
||||
SDE_EVT32(ret, SDE_EVTLOG_ERROR);
|
||||
kfree(node);
|
||||
@@ -6237,7 +6201,7 @@ static int _sde_crtc_event_disable(struct sde_kms *kms,
|
||||
|
||||
ret = node->func(crtc_drm, false, &node->irq);
|
||||
kfree(node);
|
||||
sde_power_resource_enable(&priv->phandle, kms->core_client, false);
|
||||
pm_runtime_put_sync(crtc_drm->dev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
在新工单中引用
屏蔽一个用户