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 * @dpu_kms: DPU handle 14 * @return: none 15 */ 16 void dpu_core_irq_preinstall(struct dpu_kms *dpu_kms); 17 18 /** 19 * dpu_core_irq_uninstall - uninstall core IRQ handler 20 * @dpu_kms: DPU handle 21 * @return: none 22 */ 23 void dpu_core_irq_uninstall(struct dpu_kms *dpu_kms); 24 25 /** 26 * dpu_core_irq - core IRQ handler 27 * @dpu_kms: DPU handle 28 * @return: interrupt handling status 29 */ 30 irqreturn_t dpu_core_irq(struct dpu_kms *dpu_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 * @clear: True to clear the irq after read 37 * @return: non-zero if irq detected; otherwise no irq detected 38 */ 39 u32 dpu_core_irq_read( 40 struct dpu_kms *dpu_kms, 41 int irq_idx, 42 bool clear); 43 44 /** 45 * dpu_core_irq_register_callback - For registering callback function on IRQ 46 * interrupt 47 * @dpu_kms: DPU handle 48 * @irq_idx: irq index 49 * @irq_cb: IRQ callback structure, containing callback function 50 * and argument. Passing NULL for irq_cb will unregister 51 * the callback for the given irq_idx 52 * This must exist until un-registration. 53 * @return: 0 for success registering callback, otherwise failure 54 * 55 * This function supports registration of multiple callbacks for each interrupt. 56 */ 57 int dpu_core_irq_register_callback( 58 struct dpu_kms *dpu_kms, 59 int irq_idx, 60 struct dpu_irq_callback *irq_cb); 61 62 /** 63 * dpu_core_irq_unregister_callback - For unregistering callback function on IRQ 64 * interrupt 65 * @dpu_kms: DPU handle 66 * @irq_idx: irq index 67 * @irq_cb: IRQ callback structure, containing callback function 68 * and argument. Passing NULL for irq_cb will unregister 69 * the callback for the given irq_idx 70 * This must match with registration. 71 * @return: 0 for success registering callback, otherwise failure 72 * 73 * This function supports registration of multiple callbacks for each interrupt. 74 */ 75 int dpu_core_irq_unregister_callback( 76 struct dpu_kms *dpu_kms, 77 int irq_idx, 78 struct dpu_irq_callback *irq_cb); 79 80 /** 81 * dpu_debugfs_core_irq_init - register core irq debugfs 82 * @dpu_kms: pointer to kms 83 * @parent: debugfs directory root 84 */ 85 void dpu_debugfs_core_irq_init(struct dpu_kms *dpu_kms, 86 struct dentry *parent); 87 88 #endif /* __DPU_CORE_IRQ_H__ */ 89