@@ -39,31 +39,6 @@
#include "dpu_core_perf.h"
#include "dpu_trace.h"
-struct dpu_crtc_irq_info {
- struct dpu_irq_callback irq;
- u32 event;
- int (*func)(struct drm_crtc *crtc, bool en,
- struct dpu_irq_callback *irq);
- struct list_head list;
-};
-
-struct dpu_crtc_custom_events {
- u32 event;
- int (*func)(struct drm_crtc *crtc, bool en,
- struct dpu_irq_callback *irq);
-};
-
-static int dpu_crtc_power_interrupt_handler(struct drm_crtc *crtc_drm,
- bool en, struct dpu_irq_callback *ad_irq);
-static int dpu_crtc_idle_interrupt_handler(struct drm_crtc *crtc_drm,
- bool en, struct dpu_irq_callback *idle_irq);
-
-static struct dpu_crtc_custom_events custom_events[] = {
- {DRM_EVENT_AD_BACKLIGHT, dpu_cp_ad_interrupt},
- {DRM_EVENT_CRTC_POWER, dpu_crtc_power_interrupt_handler},
- {DRM_EVENT_IDLE_NOTIFY, dpu_crtc_idle_interrupt_handler}
-};
-
/* layer mixer index on dpu_crtc */
#define LEFT_MIXER 0
#define RIGHT_MIXER 1
@@ -2455,9 +2430,6 @@ static void dpu_crtc_handle_power_event(u32 event_type, void *arg)
struct drm_encoder *encoder;
struct dpu_crtc_mixer *m;
u32 i, misr_status;
- unsigned long flags;
- struct dpu_crtc_irq_info *node = NULL;
- int ret = 0;
if (!crtc) {
DPU_ERROR("invalid crtc\n");
@@ -2479,17 +2451,6 @@ static void dpu_crtc_handle_power_event(u32 event_type, void *arg)
dpu_encoder_virt_restore(encoder);
}
- spin_lock_irqsave(&dpu_crtc->spin_lock, flags);
- list_for_each_entry(node, &dpu_crtc->user_event_list, list) {
- ret = 0;
- if (node->func)
- ret = node->func(crtc, true, &node->irq);
- if (ret)
- DPU_ERROR("%s failed to enable event %x\n",
- dpu_crtc->name, node->event);
- }
- spin_unlock_irqrestore(&dpu_crtc->spin_lock, flags);
-
dpu_cp_crtc_post_ipc(crtc);
for (i = 0; i < dpu_crtc->num_mixers; ++i) {
@@ -2514,18 +2475,6 @@ static void dpu_crtc_handle_power_event(u32 event_type, void *arg)
dpu_crtc->misr_data[i];
}
- spin_lock_irqsave(&dpu_crtc->spin_lock, flags);
- node = NULL;
- list_for_each_entry(node, &dpu_crtc->user_event_list, list) {
- ret = 0;
- if (node->func)
- ret = node->func(crtc, false, &node->irq);
- if (ret)
- DPU_ERROR("%s failed to disable event %x\n",
- dpu_crtc->name, node->event);
- }
- spin_unlock_irqrestore(&dpu_crtc->spin_lock, flags);
-
dpu_cp_crtc_pre_ipc(crtc);
break;
case DPU_POWER_EVENT_POST_DISABLE:
@@ -2553,8 +2502,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
struct drm_display_mode *mode;
struct drm_encoder *encoder;
struct msm_drm_private *priv;
- unsigned long flags;
- struct dpu_crtc_irq_info *node = NULL;
struct drm_event event;
u32 power_on;
int ret;
@@ -2614,17 +2561,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
atomic_set(&dpu_crtc->frame_pending, 0);
}
- spin_lock_irqsave(&dpu_crtc->spin_lock, flags);
- list_for_each_entry(node, &dpu_crtc->user_event_list, list) {
- ret = 0;
- if (node->func)
- ret = node->func(crtc, false, &node->irq);
- if (ret)
- DPU_ERROR("%s failed to disable event %x\n",
- dpu_crtc->name, node->event);
- }
- spin_unlock_irqrestore(&dpu_crtc->spin_lock, flags);
-
dpu_core_perf_crtc_update(crtc, 0, true);
drm_for_each_encoder(encoder, crtc->dev) {
@@ -2656,8 +2592,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
struct dpu_crtc *dpu_crtc;
struct drm_encoder *encoder;
struct msm_drm_private *priv;
- unsigned long flags;
- struct dpu_crtc_irq_info *node = NULL;
struct drm_event event;
u32 power_on;
int ret;
@@ -2709,17 +2643,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
mutex_unlock(&dpu_crtc->crtc_lock);
- spin_lock_irqsave(&dpu_crtc->spin_lock, flags);
- list_for_each_entry(node, &dpu_crtc->user_event_list, list) {
- ret = 0;
- if (node->func)
- ret = node->func(crtc, true, &node->irq);
- if (ret)
- DPU_ERROR("%s failed to enable event %x\n",
- dpu_crtc->name, node->event);
- }
- spin_unlock_irqrestore(&dpu_crtc->spin_lock, flags);
-
dpu_crtc->power_event = dpu_power_handle_register_event(
&priv->phandle,
DPU_POWER_EVENT_POST_ENABLE | DPU_POWER_EVENT_POST_DISABLE |
@@ -3995,7 +3918,7 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane)
init_completion(&dpu_crtc->frame_done_comp);
INIT_LIST_HEAD(&dpu_crtc->frame_event_list);
- INIT_LIST_HEAD(&dpu_crtc->user_event_list);
+
for (i = 0; i < ARRAY_SIZE(dpu_crtc->frame_events); i++) {
INIT_LIST_HEAD(&dpu_crtc->frame_events[i].list);
list_add(&dpu_crtc->frame_events[i].list,
@@ -4039,142 +3962,3 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane)
DPU_DEBUG("%s: successfully initialized crtc\n", dpu_crtc->name);
return crtc;
}
-
-static int _dpu_crtc_event_enable(struct dpu_kms *kms,
- struct drm_crtc *crtc_drm, u32 event)
-{
- struct dpu_crtc *crtc = NULL;
- struct dpu_crtc_irq_info *node;
- struct msm_drm_private *priv;
- unsigned long flags;
- bool found = false;
- int ret, i = 0;
-
- crtc = to_dpu_crtc(crtc_drm);
- spin_lock_irqsave(&crtc->spin_lock, flags);
- list_for_each_entry(node, &crtc->user_event_list, list) {
- if (node->event == event) {
- found = true;
- break;
- }
- }
- spin_unlock_irqrestore(&crtc->spin_lock, flags);
-
- /* event already enabled */
- if (found)
- return 0;
-
- node = NULL;
- for (i = 0; i < ARRAY_SIZE(custom_events); i++) {
- if (custom_events[i].event == event &&
- custom_events[i].func) {
- node = kzalloc(sizeof(*node), GFP_KERNEL);
- if (!node)
- return -ENOMEM;
- node->event = event;
- INIT_LIST_HEAD(&node->list);
- node->func = custom_events[i].func;
- node->event = event;
- break;
- }
- }
-
- if (!node) {
- DPU_ERROR("unsupported event %x\n", event);
- return -EINVAL;
- }
-
- priv = kms->dev->dev_private;
- ret = 0;
- if (crtc_drm->enabled) {
- dpu_power_resource_enable(&priv->phandle, kms->core_client,
- true);
- INIT_LIST_HEAD(&node->irq.list);
- ret = node->func(crtc_drm, true, &node->irq);
- dpu_power_resource_enable(&priv->phandle, kms->core_client,
- false);
- }
-
- if (!ret) {
- spin_lock_irqsave(&crtc->spin_lock, flags);
- list_add_tail(&node->list, &crtc->user_event_list);
- spin_unlock_irqrestore(&crtc->spin_lock, flags);
- } else {
- kfree(node);
- }
-
- return ret;
-}
-
-static int _dpu_crtc_event_disable(struct dpu_kms *kms,
- struct drm_crtc *crtc_drm, u32 event)
-{
- struct dpu_crtc *crtc = NULL;
- struct dpu_crtc_irq_info *node = NULL;
- struct msm_drm_private *priv;
- unsigned long flags;
- bool found = false;
- int ret;
-
- crtc = to_dpu_crtc(crtc_drm);
- spin_lock_irqsave(&crtc->spin_lock, flags);
- list_for_each_entry(node, &crtc->user_event_list, list) {
- if (node->event == event) {
- list_del(&node->list);
- found = true;
- break;
- }
- }
- spin_unlock_irqrestore(&crtc->spin_lock, flags);
-
- /* event already disabled */
- if (!found)
- return 0;
-
- /**
- * crtc is disabled interrupts are cleared remove from the list,
- * no need to disable/de-register.
- */
- if (!crtc_drm->enabled) {
- kfree(node);
- return 0;
- }
- priv = kms->dev->dev_private;
- dpu_power_resource_enable(&priv->phandle, kms->core_client, true);
- ret = node->func(crtc_drm, false, &node->irq);
- dpu_power_resource_enable(&priv->phandle, kms->core_client, false);
- return ret;
-}
-
-int dpu_crtc_register_custom_event(struct dpu_kms *kms,
- struct drm_crtc *crtc_drm, u32 event, bool en)
-{
- struct dpu_crtc *crtc = NULL;
- int ret;
-
- crtc = to_dpu_crtc(crtc_drm);
- if (!crtc || !kms || !kms->dev) {
- DRM_ERROR("invalid dpu_crtc %pK kms %pK dev %pK\n", crtc,
- kms, ((kms) ? (kms->dev) : NULL));
- return -EINVAL;
- }
-
- if (en)
- ret = _dpu_crtc_event_enable(kms, crtc_drm, event);
- else
- ret = _dpu_crtc_event_disable(kms, crtc_drm, event);
-
- return ret;
-}
-
-static int dpu_crtc_power_interrupt_handler(struct drm_crtc *crtc_drm,
- bool en, struct dpu_irq_callback *irq)
-{
- return 0;
-}
-
-static int dpu_crtc_idle_interrupt_handler(struct drm_crtc *crtc_drm,
- bool en, struct dpu_irq_callback *irq)
-{
- return 0;
-}
@@ -223,7 +223,6 @@ struct dpu_crtc {
struct list_head dirty_list;
struct list_head ad_dirty;
struct list_head ad_active;
- struct list_head user_event_list;
struct mutex crtc_lock;
@@ -90,8 +90,6 @@
static int dpu_kms_hw_init(struct msm_kms *kms);
static int _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms);
-static int _dpu_kms_register_events(struct msm_kms *kms,
- struct drm_mode_object *obj, u32 event, bool en);
bool dpu_is_custom_client(void)
{
return dpucustom;
@@ -1745,7 +1743,6 @@ static int dpu_kms_pm_resume(struct device *dev)
.pm_suspend = dpu_kms_pm_suspend,
.pm_resume = dpu_kms_pm_resume,
.destroy = dpu_kms_destroy,
- .register_events = _dpu_kms_register_events,
.get_address_space = _dpu_kms_get_address_space,
.postopen = _dpu_kms_post_open,
};
@@ -2162,31 +2159,3 @@ struct msm_kms *dpu_kms_init(struct drm_device *dev)
return &dpu_kms->base;
}
-static int _dpu_kms_register_events(struct msm_kms *kms,
- struct drm_mode_object *obj, u32 event, bool en)
-{
- int ret = 0;
- struct drm_crtc *crtc = NULL;
- struct drm_connector *conn = NULL;
- struct dpu_kms *dpu_kms = NULL;
-
- if (!kms || !obj) {
- DPU_ERROR("invalid argument kms %pK obj %pK\n", kms, obj);
- return -EINVAL;
- }
-
- dpu_kms = to_dpu_kms(kms);
- switch (obj->type) {
- case DRM_MODE_OBJECT_CRTC:
- crtc = obj_to_crtc(obj);
- ret = dpu_crtc_register_custom_event(dpu_kms, crtc, event, en);
- break;
- case DRM_MODE_OBJECT_CONNECTOR:
- conn = obj_to_connector(obj);
- ret = dpu_connector_register_custom_event(dpu_kms, conn, event,
- en);
- break;
- }
-
- return ret;
-}
@@ -1226,180 +1226,6 @@ static int msm_ioctl_submitqueue_close(struct drm_device *dev, void *data,
return msm_submitqueue_remove(file->driver_priv, id);
}
-static int msm_drm_object_supports_event(struct drm_device *dev,
- struct drm_msm_event_req *req, struct drm_file *file)
-{
- int ret = -EINVAL;
- struct drm_mode_object *arg_obj;
-
- arg_obj = drm_mode_object_find(dev, file, req->object_id, req->object_type);
- if (!arg_obj)
- return -ENOENT;
-
- switch (arg_obj->type) {
- case DRM_MODE_OBJECT_CRTC:
- case DRM_MODE_OBJECT_CONNECTOR:
- ret = 0;
- break;
- default:
- ret = -EOPNOTSUPP;
- break;
- }
-
- return ret;
-}
-
-static int msm_register_event(struct drm_device *dev,
- struct drm_msm_event_req *req, struct drm_file *file, bool en)
-{
- int ret = -EINVAL;
- struct msm_drm_private *priv = dev->dev_private;
- struct msm_kms *kms = priv->kms;
- struct drm_mode_object *arg_obj;
-
- arg_obj = drm_mode_object_find(dev, file, req->object_id, req->object_type);
- if (!arg_obj)
- return -ENOENT;
-
- ret = kms->funcs->register_events(kms, arg_obj, req->event, en);
- return ret;
-}
-
-static int msm_event_client_count(struct drm_device *dev,
- struct drm_msm_event_req *req_event, bool locked)
-{
- struct msm_drm_private *priv = dev->dev_private;
- unsigned long flag = 0;
- struct msm_drm_event *node;
- int count = 0;
-
- if (!locked)
- spin_lock_irqsave(&dev->event_lock, flag);
- list_for_each_entry(node, &priv->client_event_list, base.link) {
- if (node->event.type == req_event->event &&
- node->info.object_id == req_event->object_id)
- count++;
- }
- if (!locked)
- spin_unlock_irqrestore(&dev->event_lock, flag);
-
- return count;
-}
-
-static int msm_ioctl_register_event(struct drm_device *dev, void *data,
- struct drm_file *file)
-{
- struct msm_drm_private *priv = dev->dev_private;
- struct drm_msm_event_req *req_event = data;
- struct msm_drm_event *client, *node;
- unsigned long flag = 0;
- bool dup_request = false;
- int ret = 0, count = 0;
-
- ret = msm_drm_object_supports_event(dev, req_event, file);
- if (ret) {
- DRM_ERROR("unsupported event %x object %x object id %d\n",
- req_event->event, req_event->object_type,
- req_event->object_id);
- return ret;
- }
-
- spin_lock_irqsave(&dev->event_lock, flag);
- list_for_each_entry(node, &priv->client_event_list, base.link) {
- if (node->base.file_priv != file)
- continue;
- if (node->event.type == req_event->event &&
- node->info.object_id == req_event->object_id) {
- DRM_DEBUG("duplicate request for event %x obj id %d\n",
- node->event.type, node->info.object_id);
- dup_request = true;
- break;
- }
- }
- spin_unlock_irqrestore(&dev->event_lock, flag);
-
- if (dup_request)
- return -EALREADY;
-
- client = kzalloc(sizeof(*client), GFP_KERNEL);
- if (!client)
- return -ENOMEM;
-
- client->base.file_priv = file;
- client->base.event = &client->event;
- client->event.type = req_event->event;
- memcpy(&client->info, req_event, sizeof(client->info));
-
- /* Get the count of clients that have registered for event.
- * Event should be enabled for first client, for subsequent enable
- * calls add to client list and return.
- */
- count = msm_event_client_count(dev, req_event, false);
- /* Add current client to list */
- spin_lock_irqsave(&dev->event_lock, flag);
- list_add_tail(&client->base.link, &priv->client_event_list);
- spin_unlock_irqrestore(&dev->event_lock, flag);
-
- if (count)
- return 0;
-
- ret = msm_register_event(dev, req_event, file, true);
- if (ret) {
- DRM_ERROR("failed to enable event %x object %x object id %d\n",
- req_event->event, req_event->object_type,
- req_event->object_id);
- spin_lock_irqsave(&dev->event_lock, flag);
- list_del(&client->base.link);
- spin_unlock_irqrestore(&dev->event_lock, flag);
- kfree(client);
- }
- return ret;
-}
-
-static int msm_ioctl_deregister_event(struct drm_device *dev, void *data,
- struct drm_file *file)
-{
- struct msm_drm_private *priv = dev->dev_private;
- struct drm_msm_event_req *req_event = data;
- struct msm_drm_event *client = NULL, *node, *temp;
- unsigned long flag = 0;
- int count = 0;
- bool found = false;
- int ret = 0;
-
- ret = msm_drm_object_supports_event(dev, req_event, file);
- if (ret) {
- DRM_ERROR("unsupported event %x object %x object id %d\n",
- req_event->event, req_event->object_type,
- req_event->object_id);
- return ret;
- }
-
- spin_lock_irqsave(&dev->event_lock, flag);
- list_for_each_entry_safe(node, temp, &priv->client_event_list,
- base.link) {
- if (node->event.type == req_event->event &&
- node->info.object_id == req_event->object_id &&
- node->base.file_priv == file) {
- client = node;
- list_del(&client->base.link);
- found = true;
- kfree(client);
- break;
- }
- }
- spin_unlock_irqrestore(&dev->event_lock, flag);
-
- if (!found)
- return -ENOENT;
-
- count = msm_event_client_count(dev, req_event, false);
- if (!count)
- ret = msm_register_event(dev, req_event, file, false);
-
- return ret;
-}
-
void msm_mode_object_event_notify(struct drm_mode_object *obj,
struct drm_device *dev, struct drm_event *event, u8 *payload)
{
@@ -1452,29 +1278,6 @@ void msm_mode_object_event_notify(struct drm_mode_object *obj,
static int msm_release(struct inode *inode, struct file *filp)
{
- struct drm_file *file_priv = filp->private_data;
- struct drm_minor *minor = file_priv->minor;
- struct drm_device *dev = minor->dev;
- struct msm_drm_private *priv = dev->dev_private;
- struct msm_drm_event *node, *temp;
- u32 count;
- unsigned long flags;
-
- spin_lock_irqsave(&dev->event_lock, flags);
- list_for_each_entry_safe(node, temp, &priv->client_event_list,
- base.link) {
- if (node->base.file_priv != file_priv)
- continue;
- list_del(&node->base.link);
- spin_unlock_irqrestore(&dev->event_lock, flags);
- count = msm_event_client_count(dev, &node->info, true);
- if (!count)
- msm_register_event(dev, &node->info, file_priv, false);
- kfree(node);
- spin_lock_irqsave(&dev->event_lock, flags);
- }
- spin_unlock_irqrestore(&dev->event_lock, flags);
-
return drm_release(inode, filp);
}
@@ -1595,10 +1398,6 @@ int msm_ioctl_rmfb2(struct drm_device *dev, void *data,
#ifdef CONFIG_DRM_MSM_WRITEBACK
DRM_IOCTL_DEF_DRV(DPU_WB_CONFIG, dpu_wb_config, DRM_UNLOCKED|DRM_AUTH),
#endif
- DRM_IOCTL_DEF_DRV(MSM_REGISTER_EVENT, msm_ioctl_register_event,
- DRM_UNLOCKED|DRM_CONTROL_ALLOW),
- DRM_IOCTL_DEF_DRV(MSM_DEREGISTER_EVENT, msm_ioctl_deregister_event,
- DRM_UNLOCKED|DRM_CONTROL_ALLOW),
DRM_IOCTL_DEF_DRV(MSM_RMFB2, msm_ioctl_rmfb2,
DRM_CONTROL_ALLOW|DRM_UNLOCKED),
};
@@ -94,8 +94,6 @@ struct msm_kms_funcs {
void (*preclose)(struct msm_kms *kms, struct drm_file *file);
void (*postclose)(struct msm_kms *kms, struct drm_file *file);
void (*lastclose)(struct msm_kms *kms);
- int (*register_events)(struct msm_kms *kms,
- struct drm_mode_object *obj, u32 event, bool en);
void (*set_encoder_mode)(struct msm_kms *kms,
struct drm_encoder *encoder,
bool cmd_mode);