GNU Linux-libre 4.19.264-gnu1
[releases.git] / drivers / gpu / drm / msm / disp / dpu1 / dpu_irq.c
1 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 #define pr_fmt(fmt)     "[drm:%s:%d] " fmt, __func__, __LINE__
14
15 #include <linux/irqdomain.h>
16 #include <linux/irq.h>
17 #include <linux/kthread.h>
18
19 #include "dpu_irq.h"
20 #include "dpu_core_irq.h"
21
22 irqreturn_t dpu_irq(struct msm_kms *kms)
23 {
24         struct dpu_kms *dpu_kms = to_dpu_kms(kms);
25
26         return dpu_core_irq(dpu_kms);
27 }
28
29 void dpu_irq_preinstall(struct msm_kms *kms)
30 {
31         struct dpu_kms *dpu_kms = to_dpu_kms(kms);
32
33         if (!dpu_kms->dev || !dpu_kms->dev->dev) {
34                 pr_err("invalid device handles\n");
35                 return;
36         }
37
38         dpu_core_irq_preinstall(dpu_kms);
39 }
40
41 int dpu_irq_postinstall(struct msm_kms *kms)
42 {
43         struct dpu_kms *dpu_kms = to_dpu_kms(kms);
44         int rc;
45
46         if (!kms) {
47                 DPU_ERROR("invalid parameters\n");
48                 return -EINVAL;
49         }
50
51         rc = dpu_core_irq_postinstall(dpu_kms);
52
53         return rc;
54 }
55
56 void dpu_irq_uninstall(struct msm_kms *kms)
57 {
58         struct dpu_kms *dpu_kms = to_dpu_kms(kms);
59
60         if (!kms) {
61                 DPU_ERROR("invalid parameters\n");
62                 return;
63         }
64
65         dpu_core_irq_uninstall(dpu_kms);
66 }