blob: eeb7a0002eab6cd14449b5b6dab49125172eb7e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only 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.
*/
#define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__
#include <linux/irqdomain.h>
#include <linux/irq.h>
#include <linux/kthread.h>
#include "sde_irq.h"
#include "sde_core_irq.h"
irqreturn_t sde_irq(struct msm_kms *kms)
{
struct sde_kms *sde_kms = to_sde_kms(kms);
u32 interrupts;
sde_kms->hw_intr->ops.get_interrupt_sources(sde_kms->hw_intr,
&interrupts);
/*
* Taking care of MDP interrupt
*/
if (interrupts & IRQ_SOURCE_MDP) {
interrupts &= ~IRQ_SOURCE_MDP;
sde_core_irq(sde_kms);
}
/*
* Routing all other interrupts to external drivers
*/
while (interrupts) {
irq_hw_number_t hwirq = fls(interrupts) - 1;
generic_handle_irq(irq_find_mapping(
sde_kms->irq_controller.domain, hwirq));
interrupts &= ~(1 << hwirq);
}
return IRQ_HANDLED;
}
void sde_irq_preinstall(struct msm_kms *kms)
{
struct sde_kms *sde_kms = to_sde_kms(kms);
if (!sde_kms->dev || !sde_kms->dev->dev) {
pr_err("invalid device handles\n");
return;
}
sde_core_irq_preinstall(sde_kms);
}
int sde_irq_postinstall(struct msm_kms *kms)
{
struct sde_kms *sde_kms = to_sde_kms(kms);
int rc;
if (!kms) {
SDE_ERROR("invalid parameters\n");
return -EINVAL;
}
rc = sde_core_irq_postinstall(sde_kms);
return rc;
}
void sde_irq_uninstall(struct msm_kms *kms)
{
struct sde_kms *sde_kms = to_sde_kms(kms);
if (!kms) {
SDE_ERROR("invalid parameters\n");
return;
}
sde_core_irq_uninstall(sde_kms);
sde_core_irq_domain_fini(sde_kms);
}
|