Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 1 | /* |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 2 | * sec-irq.c |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 3 | * |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 4 | * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 5 | * http://www.samsung.com |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the |
| 9 | * Free Software Foundation; either version 2 of the License, or (at your |
| 10 | * option) any later version. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include <linux/device.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/irq.h> |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 17 | #include <linux/regmap.h> |
| 18 | |
Sangbeom Kim | 54227bc | 2012-07-11 21:07:16 +0900 | [diff] [blame] | 19 | #include <linux/mfd/samsung/core.h> |
| 20 | #include <linux/mfd/samsung/irq.h> |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 21 | #include <linux/mfd/samsung/s2mps11.h> |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 22 | #include <linux/mfd/samsung/s2mps14.h> |
Sangbeom Kim | 54227bc | 2012-07-11 21:07:16 +0900 | [diff] [blame] | 23 | #include <linux/mfd/samsung/s5m8763.h> |
| 24 | #include <linux/mfd/samsung/s5m8767.h> |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 25 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 26 | static const struct regmap_irq s2mps11_irqs[] = { |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 27 | [S2MPS11_IRQ_PWRONF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 28 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 29 | .mask = S2MPS11_IRQ_PWRONF_MASK, |
| 30 | }, |
| 31 | [S2MPS11_IRQ_PWRONR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 32 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 33 | .mask = S2MPS11_IRQ_PWRONR_MASK, |
| 34 | }, |
| 35 | [S2MPS11_IRQ_JIGONBF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 36 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 37 | .mask = S2MPS11_IRQ_JIGONBF_MASK, |
| 38 | }, |
| 39 | [S2MPS11_IRQ_JIGONBR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 40 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 41 | .mask = S2MPS11_IRQ_JIGONBR_MASK, |
| 42 | }, |
| 43 | [S2MPS11_IRQ_ACOKBF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 44 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 45 | .mask = S2MPS11_IRQ_ACOKBF_MASK, |
| 46 | }, |
| 47 | [S2MPS11_IRQ_ACOKBR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 48 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 49 | .mask = S2MPS11_IRQ_ACOKBR_MASK, |
| 50 | }, |
| 51 | [S2MPS11_IRQ_PWRON1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 52 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 53 | .mask = S2MPS11_IRQ_PWRON1S_MASK, |
| 54 | }, |
| 55 | [S2MPS11_IRQ_MRB] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 56 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 57 | .mask = S2MPS11_IRQ_MRB_MASK, |
| 58 | }, |
| 59 | [S2MPS11_IRQ_RTC60S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 60 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 61 | .mask = S2MPS11_IRQ_RTC60S_MASK, |
| 62 | }, |
Krzysztof Kozlowski | 6776209 | 2014-02-28 11:41:43 +0100 | [diff] [blame] | 63 | [S2MPS11_IRQ_RTCA0] = { |
| 64 | .reg_offset = 1, |
| 65 | .mask = S2MPS11_IRQ_RTCA0_MASK, |
| 66 | }, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 67 | [S2MPS11_IRQ_RTCA1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 68 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 69 | .mask = S2MPS11_IRQ_RTCA1_MASK, |
| 70 | }, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 71 | [S2MPS11_IRQ_SMPL] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 72 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 73 | .mask = S2MPS11_IRQ_SMPL_MASK, |
| 74 | }, |
| 75 | [S2MPS11_IRQ_RTC1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 76 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 77 | .mask = S2MPS11_IRQ_RTC1S_MASK, |
| 78 | }, |
| 79 | [S2MPS11_IRQ_WTSR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 80 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 81 | .mask = S2MPS11_IRQ_WTSR_MASK, |
| 82 | }, |
| 83 | [S2MPS11_IRQ_INT120C] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 84 | .reg_offset = 2, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 85 | .mask = S2MPS11_IRQ_INT120C_MASK, |
| 86 | }, |
| 87 | [S2MPS11_IRQ_INT140C] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 88 | .reg_offset = 2, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 89 | .mask = S2MPS11_IRQ_INT140C_MASK, |
| 90 | }, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 91 | }; |
| 92 | |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 93 | static const struct regmap_irq s2mps14_irqs[] = { |
| 94 | [S2MPS14_IRQ_PWRONF] = { |
| 95 | .reg_offset = 0, |
| 96 | .mask = S2MPS11_IRQ_PWRONF_MASK, |
| 97 | }, |
| 98 | [S2MPS14_IRQ_PWRONR] = { |
| 99 | .reg_offset = 0, |
| 100 | .mask = S2MPS11_IRQ_PWRONR_MASK, |
| 101 | }, |
| 102 | [S2MPS14_IRQ_JIGONBF] = { |
| 103 | .reg_offset = 0, |
| 104 | .mask = S2MPS11_IRQ_JIGONBF_MASK, |
| 105 | }, |
| 106 | [S2MPS14_IRQ_JIGONBR] = { |
| 107 | .reg_offset = 0, |
| 108 | .mask = S2MPS11_IRQ_JIGONBR_MASK, |
| 109 | }, |
| 110 | [S2MPS14_IRQ_ACOKBF] = { |
| 111 | .reg_offset = 0, |
| 112 | .mask = S2MPS11_IRQ_ACOKBF_MASK, |
| 113 | }, |
| 114 | [S2MPS14_IRQ_ACOKBR] = { |
| 115 | .reg_offset = 0, |
| 116 | .mask = S2MPS11_IRQ_ACOKBR_MASK, |
| 117 | }, |
| 118 | [S2MPS14_IRQ_PWRON1S] = { |
| 119 | .reg_offset = 0, |
| 120 | .mask = S2MPS11_IRQ_PWRON1S_MASK, |
| 121 | }, |
| 122 | [S2MPS14_IRQ_MRB] = { |
| 123 | .reg_offset = 0, |
| 124 | .mask = S2MPS11_IRQ_MRB_MASK, |
| 125 | }, |
| 126 | [S2MPS14_IRQ_RTC60S] = { |
| 127 | .reg_offset = 1, |
| 128 | .mask = S2MPS11_IRQ_RTC60S_MASK, |
| 129 | }, |
| 130 | [S2MPS14_IRQ_RTCA1] = { |
| 131 | .reg_offset = 1, |
| 132 | .mask = S2MPS11_IRQ_RTCA1_MASK, |
| 133 | }, |
| 134 | [S2MPS14_IRQ_RTCA0] = { |
| 135 | .reg_offset = 1, |
| 136 | .mask = S2MPS11_IRQ_RTCA0_MASK, |
| 137 | }, |
| 138 | [S2MPS14_IRQ_SMPL] = { |
| 139 | .reg_offset = 1, |
| 140 | .mask = S2MPS11_IRQ_SMPL_MASK, |
| 141 | }, |
| 142 | [S2MPS14_IRQ_RTC1S] = { |
| 143 | .reg_offset = 1, |
| 144 | .mask = S2MPS11_IRQ_RTC1S_MASK, |
| 145 | }, |
| 146 | [S2MPS14_IRQ_WTSR] = { |
| 147 | .reg_offset = 1, |
| 148 | .mask = S2MPS11_IRQ_WTSR_MASK, |
| 149 | }, |
| 150 | [S2MPS14_IRQ_INT120C] = { |
| 151 | .reg_offset = 2, |
| 152 | .mask = S2MPS11_IRQ_INT120C_MASK, |
| 153 | }, |
| 154 | [S2MPS14_IRQ_INT140C] = { |
| 155 | .reg_offset = 2, |
| 156 | .mask = S2MPS11_IRQ_INT140C_MASK, |
| 157 | }, |
| 158 | [S2MPS14_IRQ_TSD] = { |
| 159 | .reg_offset = 2, |
| 160 | .mask = S2MPS14_IRQ_TSD_MASK, |
| 161 | }, |
| 162 | }; |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 163 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 164 | static const struct regmap_irq s5m8767_irqs[] = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 165 | [S5M8767_IRQ_PWRR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 166 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 167 | .mask = S5M8767_IRQ_PWRR_MASK, |
| 168 | }, |
| 169 | [S5M8767_IRQ_PWRF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 170 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 171 | .mask = S5M8767_IRQ_PWRF_MASK, |
| 172 | }, |
| 173 | [S5M8767_IRQ_PWR1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 174 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 175 | .mask = S5M8767_IRQ_PWR1S_MASK, |
| 176 | }, |
| 177 | [S5M8767_IRQ_JIGR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 178 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 179 | .mask = S5M8767_IRQ_JIGR_MASK, |
| 180 | }, |
| 181 | [S5M8767_IRQ_JIGF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 182 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 183 | .mask = S5M8767_IRQ_JIGF_MASK, |
| 184 | }, |
| 185 | [S5M8767_IRQ_LOWBAT2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 186 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 187 | .mask = S5M8767_IRQ_LOWBAT2_MASK, |
| 188 | }, |
| 189 | [S5M8767_IRQ_LOWBAT1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 190 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 191 | .mask = S5M8767_IRQ_LOWBAT1_MASK, |
| 192 | }, |
| 193 | [S5M8767_IRQ_MRB] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 194 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 195 | .mask = S5M8767_IRQ_MRB_MASK, |
| 196 | }, |
| 197 | [S5M8767_IRQ_DVSOK2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 198 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 199 | .mask = S5M8767_IRQ_DVSOK2_MASK, |
| 200 | }, |
| 201 | [S5M8767_IRQ_DVSOK3] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 202 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 203 | .mask = S5M8767_IRQ_DVSOK3_MASK, |
| 204 | }, |
| 205 | [S5M8767_IRQ_DVSOK4] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 206 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 207 | .mask = S5M8767_IRQ_DVSOK4_MASK, |
| 208 | }, |
| 209 | [S5M8767_IRQ_RTC60S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 210 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 211 | .mask = S5M8767_IRQ_RTC60S_MASK, |
| 212 | }, |
| 213 | [S5M8767_IRQ_RTCA1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 214 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 215 | .mask = S5M8767_IRQ_RTCA1_MASK, |
| 216 | }, |
| 217 | [S5M8767_IRQ_RTCA2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 218 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 219 | .mask = S5M8767_IRQ_RTCA2_MASK, |
| 220 | }, |
| 221 | [S5M8767_IRQ_SMPL] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 222 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 223 | .mask = S5M8767_IRQ_SMPL_MASK, |
| 224 | }, |
| 225 | [S5M8767_IRQ_RTC1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 226 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 227 | .mask = S5M8767_IRQ_RTC1S_MASK, |
| 228 | }, |
| 229 | [S5M8767_IRQ_WTSR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 230 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 231 | .mask = S5M8767_IRQ_WTSR_MASK, |
| 232 | }, |
| 233 | }; |
| 234 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 235 | static const struct regmap_irq s5m8763_irqs[] = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 236 | [S5M8763_IRQ_DCINF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 237 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 238 | .mask = S5M8763_IRQ_DCINF_MASK, |
| 239 | }, |
| 240 | [S5M8763_IRQ_DCINR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 241 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 242 | .mask = S5M8763_IRQ_DCINR_MASK, |
| 243 | }, |
| 244 | [S5M8763_IRQ_JIGF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 245 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 246 | .mask = S5M8763_IRQ_JIGF_MASK, |
| 247 | }, |
| 248 | [S5M8763_IRQ_JIGR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 249 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 250 | .mask = S5M8763_IRQ_JIGR_MASK, |
| 251 | }, |
| 252 | [S5M8763_IRQ_PWRONF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 253 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 254 | .mask = S5M8763_IRQ_PWRONF_MASK, |
| 255 | }, |
| 256 | [S5M8763_IRQ_PWRONR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 257 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 258 | .mask = S5M8763_IRQ_PWRONR_MASK, |
| 259 | }, |
| 260 | [S5M8763_IRQ_WTSREVNT] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 261 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 262 | .mask = S5M8763_IRQ_WTSREVNT_MASK, |
| 263 | }, |
| 264 | [S5M8763_IRQ_SMPLEVNT] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 265 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 266 | .mask = S5M8763_IRQ_SMPLEVNT_MASK, |
| 267 | }, |
| 268 | [S5M8763_IRQ_ALARM1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 269 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 270 | .mask = S5M8763_IRQ_ALARM1_MASK, |
| 271 | }, |
| 272 | [S5M8763_IRQ_ALARM0] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 273 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 274 | .mask = S5M8763_IRQ_ALARM0_MASK, |
| 275 | }, |
| 276 | [S5M8763_IRQ_ONKEY1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 277 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 278 | .mask = S5M8763_IRQ_ONKEY1S_MASK, |
| 279 | }, |
| 280 | [S5M8763_IRQ_TOPOFFR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 281 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 282 | .mask = S5M8763_IRQ_TOPOFFR_MASK, |
| 283 | }, |
| 284 | [S5M8763_IRQ_DCINOVPR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 285 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 286 | .mask = S5M8763_IRQ_DCINOVPR_MASK, |
| 287 | }, |
| 288 | [S5M8763_IRQ_CHGRSTF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 289 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 290 | .mask = S5M8763_IRQ_CHGRSTF_MASK, |
| 291 | }, |
| 292 | [S5M8763_IRQ_DONER] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 293 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 294 | .mask = S5M8763_IRQ_DONER_MASK, |
| 295 | }, |
| 296 | [S5M8763_IRQ_CHGFAULT] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 297 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 298 | .mask = S5M8763_IRQ_CHGFAULT_MASK, |
| 299 | }, |
| 300 | [S5M8763_IRQ_LOBAT1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 301 | .reg_offset = 3, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 302 | .mask = S5M8763_IRQ_LOBAT1_MASK, |
| 303 | }, |
| 304 | [S5M8763_IRQ_LOBAT2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 305 | .reg_offset = 3, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 306 | .mask = S5M8763_IRQ_LOBAT2_MASK, |
| 307 | }, |
| 308 | }; |
| 309 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 310 | static const struct regmap_irq_chip s2mps11_irq_chip = { |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 311 | .name = "s2mps11", |
| 312 | .irqs = s2mps11_irqs, |
| 313 | .num_irqs = ARRAY_SIZE(s2mps11_irqs), |
| 314 | .num_regs = 3, |
| 315 | .status_base = S2MPS11_REG_INT1, |
| 316 | .mask_base = S2MPS11_REG_INT1M, |
| 317 | .ack_base = S2MPS11_REG_INT1, |
| 318 | }; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 319 | |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 320 | static const struct regmap_irq_chip s2mps14_irq_chip = { |
| 321 | .name = "s2mps14", |
| 322 | .irqs = s2mps14_irqs, |
| 323 | .num_irqs = ARRAY_SIZE(s2mps14_irqs), |
| 324 | .num_regs = 3, |
| 325 | .status_base = S2MPS14_REG_INT1, |
| 326 | .mask_base = S2MPS14_REG_INT1M, |
| 327 | .ack_base = S2MPS14_REG_INT1, |
| 328 | }; |
| 329 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 330 | static const struct regmap_irq_chip s5m8767_irq_chip = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 331 | .name = "s5m8767", |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 332 | .irqs = s5m8767_irqs, |
| 333 | .num_irqs = ARRAY_SIZE(s5m8767_irqs), |
| 334 | .num_regs = 3, |
| 335 | .status_base = S5M8767_REG_INT1, |
| 336 | .mask_base = S5M8767_REG_INT1M, |
| 337 | .ack_base = S5M8767_REG_INT1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 338 | }; |
| 339 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 340 | static const struct regmap_irq_chip s5m8763_irq_chip = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 341 | .name = "s5m8763", |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 342 | .irqs = s5m8763_irqs, |
| 343 | .num_irqs = ARRAY_SIZE(s5m8763_irqs), |
| 344 | .num_regs = 4, |
| 345 | .status_base = S5M8763_REG_IRQ1, |
| 346 | .mask_base = S5M8763_REG_IRQM1, |
| 347 | .ack_base = S5M8763_REG_IRQ1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 348 | }; |
| 349 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 350 | int sec_irq_init(struct sec_pmic_dev *sec_pmic) |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 351 | { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 352 | int ret = 0; |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 353 | int type = sec_pmic->device_type; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 354 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 355 | if (!sec_pmic->irq) { |
| 356 | dev_warn(sec_pmic->dev, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 357 | "No interrupt specified, no interrupts\n"); |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 358 | sec_pmic->irq_base = 0; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 359 | return 0; |
| 360 | } |
| 361 | |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 362 | switch (type) { |
| 363 | case S5M8763X: |
Krzysztof Kozlowski | 3e1e4a5 | 2013-12-12 17:12:31 -0800 | [diff] [blame] | 364 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 365 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 366 | sec_pmic->irq_base, &s5m8763_irq_chip, |
| 367 | &sec_pmic->irq_data); |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 368 | break; |
| 369 | case S5M8767X: |
Krzysztof Kozlowski | 3e1e4a5 | 2013-12-12 17:12:31 -0800 | [diff] [blame] | 370 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 371 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 372 | sec_pmic->irq_base, &s5m8767_irq_chip, |
| 373 | &sec_pmic->irq_data); |
| 374 | break; |
| 375 | case S2MPS11X: |
Krzysztof Kozlowski | 3e1e4a5 | 2013-12-12 17:12:31 -0800 | [diff] [blame] | 376 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 377 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 378 | sec_pmic->irq_base, &s2mps11_irq_chip, |
| 379 | &sec_pmic->irq_data); |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 380 | break; |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 381 | case S2MPS14X: |
| 382 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
| 383 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 384 | sec_pmic->irq_base, &s2mps14_irq_chip, |
| 385 | &sec_pmic->irq_data); |
| 386 | break; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 387 | default: |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 388 | dev_err(sec_pmic->dev, "Unknown device type %d\n", |
| 389 | sec_pmic->device_type); |
Jonghwan Choi | c7a1fcf | 2012-02-20 16:22:56 +0100 | [diff] [blame] | 390 | return -EINVAL; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 391 | } |
| 392 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 393 | if (ret != 0) { |
| 394 | dev_err(sec_pmic->dev, "Failed to register IRQ chip: %d\n", ret); |
Jonghwan Choi | c7a1fcf | 2012-02-20 16:22:56 +0100 | [diff] [blame] | 395 | return ret; |
| 396 | } |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 397 | |
| 398 | return 0; |
| 399 | } |
| 400 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 401 | void sec_irq_exit(struct sec_pmic_dev *sec_pmic) |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 402 | { |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 403 | regmap_del_irq_chip(sec_pmic->irq, sec_pmic->irq_data); |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 404 | } |