hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/gpu/drm/omapdrm/omap_irq.c
....@@ -1,19 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
34 * Author: Rob Clark <rob.clark@linaro.org>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published by
7
- * the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program. If not, see <http://www.gnu.org/licenses/>.
165 */
6
+
7
+#include <drm/drm_vblank.h>
178
189 #include "omap_drv.h"
1910
....@@ -83,6 +74,28 @@
8374 kfree(wait);
8475
8576 return ret == 0 ? -1 : 0;
77
+}
78
+
79
+int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
80
+{
81
+ struct drm_device *dev = crtc->dev;
82
+ struct omap_drm_private *priv = dev->dev_private;
83
+ unsigned long flags;
84
+ enum omap_channel channel = omap_crtc_channel(crtc);
85
+ int framedone_irq =
86
+ priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel);
87
+
88
+ DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
89
+
90
+ spin_lock_irqsave(&priv->wait_lock, flags);
91
+ if (enable)
92
+ priv->irq_mask |= framedone_irq;
93
+ else
94
+ priv->irq_mask &= ~framedone_irq;
95
+ omap_irq_update(dev);
96
+ spin_unlock_irqrestore(&priv->wait_lock, flags);
97
+
98
+ return 0;
8699 }
87100
88101 /**
....@@ -206,8 +219,8 @@
206219
207220 VERB("irqs: %08x", irqstatus);
208221
209
- for (id = 0; id < priv->num_crtcs; id++) {
210
- struct drm_crtc *crtc = priv->crtcs[id];
222
+ for (id = 0; id < priv->num_pipes; id++) {
223
+ struct drm_crtc *crtc = priv->pipes[id].crtc;
211224 enum omap_channel channel = omap_crtc_channel(crtc);
212225
213226 if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) {
....@@ -217,6 +230,9 @@
217230
218231 if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel))
219232 omap_crtc_error_irq(crtc, irqstatus);
233
+
234
+ if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel))
235
+ omap_crtc_framedone_irq(crtc, irqstatus);
220236 }
221237
222238 omap_irq_ocp_error_handler(dev, irqstatus);