1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
3  */
4 
5 #ifndef __DPU_CORE_IRQ_H__
6 #define __DPU_CORE_IRQ_H__
7 
8 #include "dpu_kms.h"
9 #include "dpu_hw_interrupts.h"
10 
11 /**
12  * dpu_core_irq_preinstall - perform pre-installation of core IRQ handler
13  * @kms:		MSM KMS handle
14  * @return:		none
15  */
16 void dpu_core_irq_preinstall(struct msm_kms *kms);
17 
18 /**
19  * dpu_core_irq_uninstall - uninstall core IRQ handler
20  * @kms:		MSM KMS handle
21  * @return:		none
22  */
23 void dpu_core_irq_uninstall(struct msm_kms *kms);
24 
25 /**
26  * dpu_core_irq - core IRQ handler
27  * @kms:		MSM KMS handle
28  * @return:		interrupt handling status
29  */
30 irqreturn_t dpu_core_irq(struct msm_kms *kms);
31 
32 /**
33  * dpu_core_irq_read - IRQ helper function for reading IRQ status
34  * @dpu_kms:		DPU handle
35  * @irq_idx:		irq index
36  * @return:		non-zero if irq detected; otherwise no irq detected
37  */
38 u32 dpu_core_irq_read(
39 		struct dpu_kms *dpu_kms,
40 		int irq_idx);
41 
42 /**
43  * dpu_core_irq_register_callback - For registering callback function on IRQ
44  *                             interrupt
45  * @dpu_kms:		DPU handle
46  * @irq_idx:		irq index
47  * @irq_cb:		IRQ callback funcion.
48  * @irq_arg:		IRQ callback argument.
49  * @return:		0 for success registering callback, otherwise failure
50  *
51  * This function supports registration of multiple callbacks for each interrupt.
52  */
53 int dpu_core_irq_register_callback(
54 		struct dpu_kms *dpu_kms,
55 		int irq_idx,
56 		void (*irq_cb)(void *arg, int irq_idx),
57 		void *irq_arg);
58 
59 /**
60  * dpu_core_irq_unregister_callback - For unregistering callback function on IRQ
61  *                             interrupt
62  * @dpu_kms:		DPU handle
63  * @irq_idx:		irq index
64  * @return:		0 for success registering callback, otherwise failure
65  *
66  * This function supports registration of multiple callbacks for each interrupt.
67  */
68 int dpu_core_irq_unregister_callback(
69 		struct dpu_kms *dpu_kms,
70 		int irq_idx);
71 
72 /**
73  * dpu_debugfs_core_irq_init - register core irq debugfs
74  * @dpu_kms: pointer to kms
75  * @parent: debugfs directory root
76  */
77 void dpu_debugfs_core_irq_init(struct dpu_kms *dpu_kms,
78 		struct dentry *parent);
79 
80 #endif /* __DPU_CORE_IRQ_H__ */
81