2012-12-05 02:59:12 +07:00
|
|
|
/*
|
2017-12-06 03:29:31 +07:00
|
|
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
2012-12-05 02:59:12 +07:00
|
|
|
* Author: Rob Clark <rob.clark@linaro.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
|
|
* the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "omap_drv.h"
|
|
|
|
|
2016-04-19 06:47:02 +07:00
|
|
|
struct omap_irq_wait {
|
|
|
|
struct list_head node;
|
2016-04-19 07:07:59 +07:00
|
|
|
wait_queue_head_t wq;
|
2018-02-11 20:07:33 +07:00
|
|
|
u32 irqmask;
|
2016-04-19 06:47:02 +07:00
|
|
|
int count;
|
|
|
|
};
|
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
/* call with wait_lock and dispc runtime held */
|
2012-12-05 02:59:12 +07:00
|
|
|
static void omap_irq_update(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
2016-04-19 06:47:02 +07:00
|
|
|
struct omap_irq_wait *wait;
|
2018-02-11 20:07:33 +07:00
|
|
|
u32 irqmask = priv->irq_mask;
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
assert_spin_locked(&priv->wait_lock);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2016-04-19 06:47:02 +07:00
|
|
|
list_for_each_entry(wait, &priv->wait_list, node)
|
|
|
|
irqmask |= wait->irqmask;
|
2012-12-05 02:59:12 +07:00
|
|
|
|
|
|
|
DBG("irqmask=%08x", irqmask);
|
|
|
|
|
2018-02-13 19:00:42 +07:00
|
|
|
priv->dispc_ops->write_irqenable(priv->dispc, irqmask);
|
2012-12-05 02:59:12 +07:00
|
|
|
}
|
|
|
|
|
2016-04-19 06:47:02 +07:00
|
|
|
static void omap_irq_wait_handler(struct omap_irq_wait *wait)
|
2012-12-05 02:59:12 +07:00
|
|
|
{
|
|
|
|
wait->count--;
|
2016-04-19 07:07:59 +07:00
|
|
|
wake_up(&wait->wq);
|
2012-12-05 02:59:12 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev,
|
2018-02-11 20:07:33 +07:00
|
|
|
u32 irqmask, int count)
|
2012-12-05 02:59:12 +07:00
|
|
|
{
|
2016-04-19 06:47:02 +07:00
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
2012-12-05 02:59:12 +07:00
|
|
|
struct omap_irq_wait *wait = kzalloc(sizeof(*wait), GFP_KERNEL);
|
2016-04-19 06:47:02 +07:00
|
|
|
unsigned long flags;
|
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
init_waitqueue_head(&wait->wq);
|
2016-04-19 06:47:02 +07:00
|
|
|
wait->irqmask = irqmask;
|
2012-12-05 02:59:12 +07:00
|
|
|
wait->count = count;
|
2016-04-19 06:47:02 +07:00
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_lock_irqsave(&priv->wait_lock, flags);
|
2016-04-19 06:47:02 +07:00
|
|
|
list_add(&wait->node, &priv->wait_list);
|
|
|
|
omap_irq_update(dev);
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_unlock_irqrestore(&priv->wait_lock, flags);
|
2016-04-19 06:47:02 +07:00
|
|
|
|
2012-12-05 02:59:12 +07:00
|
|
|
return wait;
|
|
|
|
}
|
|
|
|
|
|
|
|
int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
|
|
|
|
unsigned long timeout)
|
|
|
|
{
|
2016-04-19 07:07:59 +07:00
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
2016-04-19 06:47:02 +07:00
|
|
|
unsigned long flags;
|
2016-04-19 07:07:59 +07:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = wait_event_timeout(wait->wq, (wait->count <= 0), timeout);
|
2016-04-19 06:47:02 +07:00
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_lock_irqsave(&priv->wait_lock, flags);
|
2016-04-19 06:47:02 +07:00
|
|
|
list_del(&wait->node);
|
|
|
|
omap_irq_update(dev);
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_unlock_irqrestore(&priv->wait_lock, flags);
|
2016-04-19 06:47:02 +07:00
|
|
|
|
2012-12-05 02:59:12 +07:00
|
|
|
kfree(wait);
|
2016-04-19 06:47:02 +07:00
|
|
|
|
|
|
|
return ret == 0 ? -1 : 0;
|
2012-12-05 02:59:12 +07:00
|
|
|
}
|
|
|
|
|
2019-05-24 03:07:55 +07:00
|
|
|
int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = crtc->dev;
|
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
|
|
|
unsigned long flags;
|
|
|
|
enum omap_channel channel = omap_crtc_channel(crtc);
|
|
|
|
int framedone_irq =
|
|
|
|
priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel);
|
|
|
|
|
|
|
|
DBG("dev=%p, crtc=%u, enable=%d", dev, channel, enable);
|
|
|
|
|
|
|
|
spin_lock_irqsave(&priv->wait_lock, flags);
|
|
|
|
if (enable)
|
|
|
|
priv->irq_mask |= framedone_irq;
|
|
|
|
else
|
|
|
|
priv->irq_mask &= ~framedone_irq;
|
|
|
|
omap_irq_update(dev);
|
|
|
|
spin_unlock_irqrestore(&priv->wait_lock, flags);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-05 02:59:12 +07:00
|
|
|
/**
|
|
|
|
* enable_vblank - enable vblank interrupt events
|
|
|
|
* @dev: DRM device
|
2015-09-24 23:35:31 +07:00
|
|
|
* @pipe: which irq to enable
|
2012-12-05 02:59:12 +07:00
|
|
|
*
|
|
|
|
* Enable vblank interrupts for @crtc. If the device doesn't have
|
|
|
|
* a hardware vblank counter, this routine should be a no-op, since
|
|
|
|
* interrupts will have to stay on to keep the count accurate.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Zero on success, appropriate errno if the given @crtc's vblank
|
|
|
|
* interrupt cannot be enabled.
|
|
|
|
*/
|
2017-02-08 18:26:00 +07:00
|
|
|
int omap_irq_enable_vblank(struct drm_crtc *crtc)
|
2012-12-05 02:59:12 +07:00
|
|
|
{
|
2017-02-08 18:26:00 +07:00
|
|
|
struct drm_device *dev = crtc->dev;
|
2012-12-05 02:59:12 +07:00
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
|
|
|
unsigned long flags;
|
2017-02-08 18:26:00 +07:00
|
|
|
enum omap_channel channel = omap_crtc_channel(crtc);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2017-02-08 18:26:00 +07:00
|
|
|
DBG("dev=%p, crtc=%u", dev, channel);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_lock_irqsave(&priv->wait_lock, flags);
|
2018-02-13 19:00:42 +07:00
|
|
|
priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
|
|
|
|
channel);
|
2012-12-05 02:59:12 +07:00
|
|
|
omap_irq_update(dev);
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_unlock_irqrestore(&priv->wait_lock, flags);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* disable_vblank - disable vblank interrupt events
|
|
|
|
* @dev: DRM device
|
2015-09-24 23:35:31 +07:00
|
|
|
* @pipe: which irq to enable
|
2012-12-05 02:59:12 +07:00
|
|
|
*
|
|
|
|
* Disable vblank interrupts for @crtc. If the device doesn't have
|
|
|
|
* a hardware vblank counter, this routine should be a no-op, since
|
|
|
|
* interrupts will have to stay on to keep the count accurate.
|
|
|
|
*/
|
2017-02-08 18:26:00 +07:00
|
|
|
void omap_irq_disable_vblank(struct drm_crtc *crtc)
|
2012-12-05 02:59:12 +07:00
|
|
|
{
|
2017-02-08 18:26:00 +07:00
|
|
|
struct drm_device *dev = crtc->dev;
|
2012-12-05 02:59:12 +07:00
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
|
|
|
unsigned long flags;
|
2017-02-08 18:26:00 +07:00
|
|
|
enum omap_channel channel = omap_crtc_channel(crtc);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2017-02-08 18:26:00 +07:00
|
|
|
DBG("dev=%p, crtc=%u", dev, channel);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_lock_irqsave(&priv->wait_lock, flags);
|
2018-02-13 19:00:42 +07:00
|
|
|
priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(priv->dispc,
|
|
|
|
channel);
|
2012-12-05 02:59:12 +07:00
|
|
|
omap_irq_update(dev);
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_unlock_irqrestore(&priv->wait_lock, flags);
|
2012-12-05 02:59:12 +07:00
|
|
|
}
|
|
|
|
|
2015-05-28 04:21:29 +07:00
|
|
|
static void omap_irq_fifo_underflow(struct omap_drm_private *priv,
|
|
|
|
u32 irqstatus)
|
|
|
|
{
|
|
|
|
static DEFINE_RATELIMIT_STATE(_rs, DEFAULT_RATELIMIT_INTERVAL,
|
|
|
|
DEFAULT_RATELIMIT_BURST);
|
|
|
|
static const struct {
|
|
|
|
const char *name;
|
|
|
|
u32 mask;
|
|
|
|
} sources[] = {
|
|
|
|
{ "gfx", DISPC_IRQ_GFX_FIFO_UNDERFLOW },
|
|
|
|
{ "vid1", DISPC_IRQ_VID1_FIFO_UNDERFLOW },
|
|
|
|
{ "vid2", DISPC_IRQ_VID2_FIFO_UNDERFLOW },
|
|
|
|
{ "vid3", DISPC_IRQ_VID3_FIFO_UNDERFLOW },
|
|
|
|
};
|
|
|
|
|
|
|
|
const u32 mask = DISPC_IRQ_GFX_FIFO_UNDERFLOW
|
|
|
|
| DISPC_IRQ_VID1_FIFO_UNDERFLOW
|
|
|
|
| DISPC_IRQ_VID2_FIFO_UNDERFLOW
|
|
|
|
| DISPC_IRQ_VID3_FIFO_UNDERFLOW;
|
|
|
|
unsigned int i;
|
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_lock(&priv->wait_lock);
|
2015-05-28 04:21:29 +07:00
|
|
|
irqstatus &= priv->irq_mask & mask;
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_unlock(&priv->wait_lock);
|
2015-05-28 04:21:29 +07:00
|
|
|
|
|
|
|
if (!irqstatus)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!__ratelimit(&_rs))
|
|
|
|
return;
|
|
|
|
|
|
|
|
DRM_ERROR("FIFO underflow on ");
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(sources); ++i) {
|
|
|
|
if (sources[i].mask & irqstatus)
|
|
|
|
pr_cont("%s ", sources[i].name);
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_cont("(0x%08x)\n", irqstatus);
|
|
|
|
}
|
|
|
|
|
2017-03-03 17:15:39 +07:00
|
|
|
static void omap_irq_ocp_error_handler(struct drm_device *dev,
|
|
|
|
u32 irqstatus)
|
2015-05-28 05:05:20 +07:00
|
|
|
{
|
|
|
|
if (!(irqstatus & DISPC_IRQ_OCP_ERR))
|
|
|
|
return;
|
|
|
|
|
2017-03-03 17:15:39 +07:00
|
|
|
dev_err_ratelimited(dev->dev, "OCP error\n");
|
2015-05-28 05:05:20 +07:00
|
|
|
}
|
|
|
|
|
2015-01-26 03:06:45 +07:00
|
|
|
static irqreturn_t omap_irq_handler(int irq, void *arg)
|
2012-12-05 02:59:12 +07:00
|
|
|
{
|
|
|
|
struct drm_device *dev = (struct drm_device *) arg;
|
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
2016-04-19 06:47:02 +07:00
|
|
|
struct omap_irq_wait *wait, *n;
|
2012-12-05 02:59:12 +07:00
|
|
|
unsigned long flags;
|
|
|
|
unsigned int id;
|
|
|
|
u32 irqstatus;
|
|
|
|
|
2018-02-13 19:00:42 +07:00
|
|
|
irqstatus = priv->dispc_ops->read_irqstatus(priv->dispc);
|
|
|
|
priv->dispc_ops->clear_irqstatus(priv->dispc, irqstatus);
|
|
|
|
priv->dispc_ops->read_irqstatus(priv->dispc); /* flush posted write */
|
2012-12-05 02:59:12 +07:00
|
|
|
|
|
|
|
VERB("irqs: %08x", irqstatus);
|
|
|
|
|
2018-03-05 20:02:22 +07:00
|
|
|
for (id = 0; id < priv->num_pipes; id++) {
|
|
|
|
struct drm_crtc *crtc = priv->pipes[id].crtc;
|
2015-05-28 04:21:29 +07:00
|
|
|
enum omap_channel channel = omap_crtc_channel(crtc);
|
drm/omap: Fix and improve crtc and overlay manager correlation
The omapdrm driver currently takes a config/module arg to figure out the number
of crtcs it needs to create. We could create as many crtcs as there are overlay
managers in the DSS hardware, but we don't do that because each crtc eats up
one DSS overlay, and that reduces the number of planes we can attach to a single
crtc.
Since the number of crtcs may be lesser than the number of hardware overlay
managers, we need to figure out which overlay managers to use for our crtcs. The
current approach is to use pipe2chan(), which returns a higher numbered manager
for the crtc.
The problem with this approach is that it assumes that the overlay managers we
choose will connect to the encoders the platform's panels are going to use,
this isn't true, an overlay manager connects only to a few outputs/encoders, and
choosing any overlay manager for our crtc might lead to a situation where the
encoder cannot connect to any of the crtcs we have chosen. For example, an
omap5-panda board has just one hdmi output. If num_crtc is set to 1, with the
current approach, pipe2chan will pick up the LCD2 overlay manager, which cannot
connect to the hdmi encoder at all. The only manager that could have connected
to hdmi was the TV overlay manager.
Therefore, there is a need to choose our overlay managers keeping in mind the
panels we have on that platform. The new approach iterates through all the
available panels, creates encoders and connectors for them, and then tries to
get a suitable overlay manager to create a crtc which can connect to the
encoders.
We use the dispc_channel field in omap_dss_output to retrieve the desired
overlay manager's channel number, we then check whether the manager had already
been assigned to a crtc or not. If it was already assigned to a crtc, we assume
that out of all the encoders which intend use this crtc, only one will run at a
time. If the overlay manager wan't assigned to a crtc till then, we create a
new crtc and link it with the overlay manager.
This approach just looks for the best dispc_channel for each encoder. On DSS HW,
some encoders can connect to multiple overlay managers. Since we don't try
looking for alternate overlay managers, there is a greater possibility that 2
or more encoders end up asking for the same crtc, causing only one encoder to
run at a time.
Also, this approach isn't the most optimal one, it can do either good or bad
depending on the sequence in which the panels/outputs are parsed. The optimal
way would be some sort of back tracking approach, where we improve the set of
managers we use as we iterate through the list of panels/encoders. That's
something left for later.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-03-26 20:45:19 +07:00
|
|
|
|
2018-02-13 19:00:42 +07:00
|
|
|
if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) {
|
2012-12-05 02:59:12 +07:00
|
|
|
drm_handle_vblank(dev, id);
|
2016-04-19 05:43:03 +07:00
|
|
|
omap_crtc_vblank_irq(crtc);
|
|
|
|
}
|
2015-05-28 04:21:29 +07:00
|
|
|
|
2018-02-13 19:00:42 +07:00
|
|
|
if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel))
|
2015-05-28 04:21:29 +07:00
|
|
|
omap_crtc_error_irq(crtc, irqstatus);
|
2019-05-24 03:07:55 +07:00
|
|
|
|
|
|
|
if (irqstatus & priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, channel))
|
|
|
|
omap_crtc_framedone_irq(crtc, irqstatus);
|
drm/omap: Fix and improve crtc and overlay manager correlation
The omapdrm driver currently takes a config/module arg to figure out the number
of crtcs it needs to create. We could create as many crtcs as there are overlay
managers in the DSS hardware, but we don't do that because each crtc eats up
one DSS overlay, and that reduces the number of planes we can attach to a single
crtc.
Since the number of crtcs may be lesser than the number of hardware overlay
managers, we need to figure out which overlay managers to use for our crtcs. The
current approach is to use pipe2chan(), which returns a higher numbered manager
for the crtc.
The problem with this approach is that it assumes that the overlay managers we
choose will connect to the encoders the platform's panels are going to use,
this isn't true, an overlay manager connects only to a few outputs/encoders, and
choosing any overlay manager for our crtc might lead to a situation where the
encoder cannot connect to any of the crtcs we have chosen. For example, an
omap5-panda board has just one hdmi output. If num_crtc is set to 1, with the
current approach, pipe2chan will pick up the LCD2 overlay manager, which cannot
connect to the hdmi encoder at all. The only manager that could have connected
to hdmi was the TV overlay manager.
Therefore, there is a need to choose our overlay managers keeping in mind the
panels we have on that platform. The new approach iterates through all the
available panels, creates encoders and connectors for them, and then tries to
get a suitable overlay manager to create a crtc which can connect to the
encoders.
We use the dispc_channel field in omap_dss_output to retrieve the desired
overlay manager's channel number, we then check whether the manager had already
been assigned to a crtc or not. If it was already assigned to a crtc, we assume
that out of all the encoders which intend use this crtc, only one will run at a
time. If the overlay manager wan't assigned to a crtc till then, we create a
new crtc and link it with the overlay manager.
This approach just looks for the best dispc_channel for each encoder. On DSS HW,
some encoders can connect to multiple overlay managers. Since we don't try
looking for alternate overlay managers, there is a greater possibility that 2
or more encoders end up asking for the same crtc, causing only one encoder to
run at a time.
Also, this approach isn't the most optimal one, it can do either good or bad
depending on the sequence in which the panels/outputs are parsed. The optimal
way would be some sort of back tracking approach, where we improve the set of
managers we use as we iterate through the list of panels/encoders. That's
something left for later.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2013-03-26 20:45:19 +07:00
|
|
|
}
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2017-03-03 17:15:39 +07:00
|
|
|
omap_irq_ocp_error_handler(dev, irqstatus);
|
2015-05-28 04:21:29 +07:00
|
|
|
omap_irq_fifo_underflow(priv, irqstatus);
|
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_lock_irqsave(&priv->wait_lock, flags);
|
2016-04-19 06:47:02 +07:00
|
|
|
list_for_each_entry_safe(wait, n, &priv->wait_list, node) {
|
|
|
|
if (wait->irqmask & irqstatus)
|
|
|
|
omap_irq_wait_handler(wait);
|
2012-12-05 02:59:12 +07:00
|
|
|
}
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_unlock_irqrestore(&priv->wait_lock, flags);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2015-05-28 04:21:29 +07:00
|
|
|
static const u32 omap_underflow_irqs[] = {
|
|
|
|
[OMAP_DSS_GFX] = DISPC_IRQ_GFX_FIFO_UNDERFLOW,
|
|
|
|
[OMAP_DSS_VIDEO1] = DISPC_IRQ_VID1_FIFO_UNDERFLOW,
|
|
|
|
[OMAP_DSS_VIDEO2] = DISPC_IRQ_VID2_FIFO_UNDERFLOW,
|
|
|
|
[OMAP_DSS_VIDEO3] = DISPC_IRQ_VID3_FIFO_UNDERFLOW,
|
|
|
|
};
|
|
|
|
|
2015-01-26 03:06:45 +07:00
|
|
|
/*
|
|
|
|
* We need a special version, instead of just using drm_irq_install(),
|
|
|
|
* because we need to register the irq via omapdss. Once omapdss and
|
|
|
|
* omapdrm are merged together we can assign the dispc hwmod data to
|
|
|
|
* ourselves and drop these and just use drm_irq_{install,uninstall}()
|
|
|
|
*/
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2015-01-26 03:06:45 +07:00
|
|
|
int omap_drm_irq_install(struct drm_device *dev)
|
2012-12-05 02:59:12 +07:00
|
|
|
{
|
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
2018-02-13 19:00:42 +07:00
|
|
|
unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
|
2015-05-28 04:21:29 +07:00
|
|
|
unsigned int max_planes;
|
|
|
|
unsigned int i;
|
2015-01-26 03:06:45 +07:00
|
|
|
int ret;
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2016-04-19 07:07:59 +07:00
|
|
|
spin_lock_init(&priv->wait_lock);
|
2016-04-19 06:47:02 +07:00
|
|
|
INIT_LIST_HEAD(&priv->wait_list);
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2015-05-28 05:05:20 +07:00
|
|
|
priv->irq_mask = DISPC_IRQ_OCP_ERR;
|
2015-05-28 04:21:29 +07:00
|
|
|
|
|
|
|
max_planes = min(ARRAY_SIZE(priv->planes),
|
|
|
|
ARRAY_SIZE(omap_underflow_irqs));
|
|
|
|
for (i = 0; i < max_planes; ++i) {
|
|
|
|
if (priv->planes[i])
|
|
|
|
priv->irq_mask |= omap_underflow_irqs[i];
|
|
|
|
}
|
|
|
|
|
2015-05-28 04:21:29 +07:00
|
|
|
for (i = 0; i < num_mgrs; ++i)
|
2018-02-13 19:00:42 +07:00
|
|
|
priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, i);
|
2015-05-28 04:21:29 +07:00
|
|
|
|
2018-02-13 19:00:42 +07:00
|
|
|
priv->dispc_ops->runtime_get(priv->dispc);
|
|
|
|
priv->dispc_ops->clear_irqstatus(priv->dispc, 0xffffffff);
|
|
|
|
priv->dispc_ops->runtime_put(priv->dispc);
|
2015-01-26 03:06:45 +07:00
|
|
|
|
2018-02-13 19:00:42 +07:00
|
|
|
ret = priv->dispc_ops->request_irq(priv->dispc, omap_irq_handler, dev);
|
2015-01-26 03:06:45 +07:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2013-10-04 18:53:37 +07:00
|
|
|
dev->irq_enabled = true;
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2015-01-26 03:06:45 +07:00
|
|
|
return 0;
|
2012-12-05 02:59:12 +07:00
|
|
|
}
|
|
|
|
|
2015-01-26 03:06:45 +07:00
|
|
|
void omap_drm_irq_uninstall(struct drm_device *dev)
|
2012-12-05 02:59:12 +07:00
|
|
|
{
|
2015-11-05 23:39:52 +07:00
|
|
|
struct omap_drm_private *priv = dev->dev_private;
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2015-01-26 03:06:45 +07:00
|
|
|
if (!dev->irq_enabled)
|
|
|
|
return;
|
|
|
|
|
2013-10-04 18:53:37 +07:00
|
|
|
dev->irq_enabled = false;
|
2012-12-05 02:59:12 +07:00
|
|
|
|
2018-02-13 19:00:42 +07:00
|
|
|
priv->dispc_ops->free_irq(priv->dispc, dev);
|
2012-12-05 02:59:12 +07:00
|
|
|
}
|