1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Interrupt support for Cirrus Logic Madera codecs 4 * 5 * Copyright (C) 2016-2018 Cirrus Logic, Inc. and 6 * Cirrus Logic International Semiconductor Ltd. 7 */ 8 9 #ifndef IRQCHIP_MADERA_H 10 #define IRQCHIP_MADERA_H 11 12 #include <linux/interrupt.h> 13 #include <linux/mfd/madera/core.h> 14 15 #define MADERA_IRQ_FLL1_LOCK 0 16 #define MADERA_IRQ_FLL2_LOCK 1 17 #define MADERA_IRQ_FLL3_LOCK 2 18 #define MADERA_IRQ_FLLAO_LOCK 3 19 #define MADERA_IRQ_CLK_SYS_ERR 4 20 #define MADERA_IRQ_CLK_ASYNC_ERR 5 21 #define MADERA_IRQ_CLK_DSP_ERR 6 22 #define MADERA_IRQ_HPDET 7 23 #define MADERA_IRQ_MICDET1 8 24 #define MADERA_IRQ_MICDET2 9 25 #define MADERA_IRQ_JD1_RISE 10 26 #define MADERA_IRQ_JD1_FALL 11 27 #define MADERA_IRQ_JD2_RISE 12 28 #define MADERA_IRQ_JD2_FALL 13 29 #define MADERA_IRQ_MICD_CLAMP_RISE 14 30 #define MADERA_IRQ_MICD_CLAMP_FALL 15 31 #define MADERA_IRQ_DRC2_SIG_DET 16 32 #define MADERA_IRQ_DRC1_SIG_DET 17 33 #define MADERA_IRQ_ASRC1_IN1_LOCK 18 34 #define MADERA_IRQ_ASRC1_IN2_LOCK 19 35 #define MADERA_IRQ_ASRC2_IN1_LOCK 20 36 #define MADERA_IRQ_ASRC2_IN2_LOCK 21 37 #define MADERA_IRQ_DSP_IRQ1 22 38 #define MADERA_IRQ_DSP_IRQ2 23 39 #define MADERA_IRQ_DSP_IRQ3 24 40 #define MADERA_IRQ_DSP_IRQ4 25 41 #define MADERA_IRQ_DSP_IRQ5 26 42 #define MADERA_IRQ_DSP_IRQ6 27 43 #define MADERA_IRQ_DSP_IRQ7 28 44 #define MADERA_IRQ_DSP_IRQ8 29 45 #define MADERA_IRQ_DSP_IRQ9 30 46 #define MADERA_IRQ_DSP_IRQ10 31 47 #define MADERA_IRQ_DSP_IRQ11 32 48 #define MADERA_IRQ_DSP_IRQ12 33 49 #define MADERA_IRQ_DSP_IRQ13 34 50 #define MADERA_IRQ_DSP_IRQ14 35 51 #define MADERA_IRQ_DSP_IRQ15 36 52 #define MADERA_IRQ_DSP_IRQ16 37 53 #define MADERA_IRQ_HP1L_SC 38 54 #define MADERA_IRQ_HP1R_SC 39 55 #define MADERA_IRQ_HP2L_SC 40 56 #define MADERA_IRQ_HP2R_SC 41 57 #define MADERA_IRQ_HP3L_SC 42 58 #define MADERA_IRQ_HP3R_SC 43 59 #define MADERA_IRQ_SPKOUTL_SC 44 60 #define MADERA_IRQ_SPKOUTR_SC 45 61 #define MADERA_IRQ_HP1L_ENABLE_DONE 46 62 #define MADERA_IRQ_HP1R_ENABLE_DONE 47 63 #define MADERA_IRQ_HP2L_ENABLE_DONE 48 64 #define MADERA_IRQ_HP2R_ENABLE_DONE 49 65 #define MADERA_IRQ_HP3L_ENABLE_DONE 50 66 #define MADERA_IRQ_HP3R_ENABLE_DONE 51 67 #define MADERA_IRQ_SPKOUTL_ENABLE_DONE 52 68 #define MADERA_IRQ_SPKOUTR_ENABLE_DONE 53 69 #define MADERA_IRQ_SPK_SHUTDOWN 54 70 #define MADERA_IRQ_SPK_OVERHEAT 55 71 #define MADERA_IRQ_SPK_OVERHEAT_WARN 56 72 #define MADERA_IRQ_GPIO1 57 73 #define MADERA_IRQ_GPIO2 58 74 #define MADERA_IRQ_GPIO3 59 75 #define MADERA_IRQ_GPIO4 60 76 #define MADERA_IRQ_GPIO5 61 77 #define MADERA_IRQ_GPIO6 62 78 #define MADERA_IRQ_GPIO7 63 79 #define MADERA_IRQ_GPIO8 64 80 #define MADERA_IRQ_DSP1_BUS_ERR 65 81 #define MADERA_IRQ_DSP2_BUS_ERR 66 82 #define MADERA_IRQ_DSP3_BUS_ERR 67 83 #define MADERA_IRQ_DSP4_BUS_ERR 68 84 #define MADERA_IRQ_DSP5_BUS_ERR 69 85 #define MADERA_IRQ_DSP6_BUS_ERR 70 86 #define MADERA_IRQ_DSP7_BUS_ERR 71 87 88 #define MADERA_NUM_IRQ 72 89 90 /* 91 * These wrapper functions are for use by other child drivers of the 92 * same parent MFD. 93 */ 94 static inline int madera_get_irq_mapping(struct madera *madera, int irq) 95 { 96 if (!madera->irq_dev) 97 return -ENODEV; 98 99 return regmap_irq_get_virq(madera->irq_data, irq); 100 } 101 102 static inline int madera_request_irq(struct madera *madera, int irq, 103 const char *name, 104 irq_handler_t handler, void *data) 105 { 106 irq = madera_get_irq_mapping(madera, irq); 107 if (irq < 0) 108 return irq; 109 110 return request_threaded_irq(irq, NULL, handler, IRQF_ONESHOT, name, 111 data); 112 } 113 114 static inline void madera_free_irq(struct madera *madera, int irq, void *data) 115 { 116 irq = madera_get_irq_mapping(madera, irq); 117 if (irq < 0) 118 return; 119 120 free_irq(irq, data); 121 } 122 123 static inline int madera_set_irq_wake(struct madera *madera, int irq, int on) 124 { 125 irq = madera_get_irq_mapping(madera, irq); 126 if (irq < 0) 127 return irq; 128 129 return irq_set_irq_wake(irq, on); 130 } 131 132 #endif 133
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.