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 | * |
| 4 | * Copyright (c) 2011 Samsung Electronics Co., Ltd |
| 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> |
Sangbeom Kim | 54227bc | 2012-07-11 21:07:16 +0900 | [diff] [blame] | 22 | #include <linux/mfd/samsung/s5m8763.h> |
| 23 | #include <linux/mfd/samsung/s5m8767.h> |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 24 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 25 | static struct regmap_irq s2mps11_irqs[] = { |
| 26 | [S2MPS11_IRQ_PWRONF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 27 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 28 | .mask = S2MPS11_IRQ_PWRONF_MASK, |
| 29 | }, |
| 30 | [S2MPS11_IRQ_PWRONR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 31 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 32 | .mask = S2MPS11_IRQ_PWRONR_MASK, |
| 33 | }, |
| 34 | [S2MPS11_IRQ_JIGONBF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 35 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 36 | .mask = S2MPS11_IRQ_JIGONBF_MASK, |
| 37 | }, |
| 38 | [S2MPS11_IRQ_JIGONBR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 39 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 40 | .mask = S2MPS11_IRQ_JIGONBR_MASK, |
| 41 | }, |
| 42 | [S2MPS11_IRQ_ACOKBF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 43 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 44 | .mask = S2MPS11_IRQ_ACOKBF_MASK, |
| 45 | }, |
| 46 | [S2MPS11_IRQ_ACOKBR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 47 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 48 | .mask = S2MPS11_IRQ_ACOKBR_MASK, |
| 49 | }, |
| 50 | [S2MPS11_IRQ_PWRON1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 51 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 52 | .mask = S2MPS11_IRQ_PWRON1S_MASK, |
| 53 | }, |
| 54 | [S2MPS11_IRQ_MRB] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 55 | .reg_offset = 0, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 56 | .mask = S2MPS11_IRQ_MRB_MASK, |
| 57 | }, |
| 58 | [S2MPS11_IRQ_RTC60S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 59 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 60 | .mask = S2MPS11_IRQ_RTC60S_MASK, |
| 61 | }, |
| 62 | [S2MPS11_IRQ_RTCA1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 63 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 64 | .mask = S2MPS11_IRQ_RTCA1_MASK, |
| 65 | }, |
| 66 | [S2MPS11_IRQ_RTCA2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 67 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 68 | .mask = S2MPS11_IRQ_RTCA2_MASK, |
| 69 | }, |
| 70 | [S2MPS11_IRQ_SMPL] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 71 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 72 | .mask = S2MPS11_IRQ_SMPL_MASK, |
| 73 | }, |
| 74 | [S2MPS11_IRQ_RTC1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 75 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 76 | .mask = S2MPS11_IRQ_RTC1S_MASK, |
| 77 | }, |
| 78 | [S2MPS11_IRQ_WTSR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 79 | .reg_offset = 1, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 80 | .mask = S2MPS11_IRQ_WTSR_MASK, |
| 81 | }, |
| 82 | [S2MPS11_IRQ_INT120C] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 83 | .reg_offset = 2, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 84 | .mask = S2MPS11_IRQ_INT120C_MASK, |
| 85 | }, |
| 86 | [S2MPS11_IRQ_INT140C] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 87 | .reg_offset = 2, |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 88 | .mask = S2MPS11_IRQ_INT140C_MASK, |
| 89 | }, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 90 | }; |
| 91 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 92 | |
| 93 | static struct regmap_irq s5m8767_irqs[] = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 94 | [S5M8767_IRQ_PWRR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 95 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 96 | .mask = S5M8767_IRQ_PWRR_MASK, |
| 97 | }, |
| 98 | [S5M8767_IRQ_PWRF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 99 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 100 | .mask = S5M8767_IRQ_PWRF_MASK, |
| 101 | }, |
| 102 | [S5M8767_IRQ_PWR1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 103 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 104 | .mask = S5M8767_IRQ_PWR1S_MASK, |
| 105 | }, |
| 106 | [S5M8767_IRQ_JIGR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 107 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 108 | .mask = S5M8767_IRQ_JIGR_MASK, |
| 109 | }, |
| 110 | [S5M8767_IRQ_JIGF] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 111 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 112 | .mask = S5M8767_IRQ_JIGF_MASK, |
| 113 | }, |
| 114 | [S5M8767_IRQ_LOWBAT2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 115 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 116 | .mask = S5M8767_IRQ_LOWBAT2_MASK, |
| 117 | }, |
| 118 | [S5M8767_IRQ_LOWBAT1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 119 | .reg_offset = 0, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 120 | .mask = S5M8767_IRQ_LOWBAT1_MASK, |
| 121 | }, |
| 122 | [S5M8767_IRQ_MRB] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 123 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 124 | .mask = S5M8767_IRQ_MRB_MASK, |
| 125 | }, |
| 126 | [S5M8767_IRQ_DVSOK2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 127 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 128 | .mask = S5M8767_IRQ_DVSOK2_MASK, |
| 129 | }, |
| 130 | [S5M8767_IRQ_DVSOK3] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 131 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 132 | .mask = S5M8767_IRQ_DVSOK3_MASK, |
| 133 | }, |
| 134 | [S5M8767_IRQ_DVSOK4] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 135 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 136 | .mask = S5M8767_IRQ_DVSOK4_MASK, |
| 137 | }, |
| 138 | [S5M8767_IRQ_RTC60S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 139 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 140 | .mask = S5M8767_IRQ_RTC60S_MASK, |
| 141 | }, |
| 142 | [S5M8767_IRQ_RTCA1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 143 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 144 | .mask = S5M8767_IRQ_RTCA1_MASK, |
| 145 | }, |
| 146 | [S5M8767_IRQ_RTCA2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 147 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 148 | .mask = S5M8767_IRQ_RTCA2_MASK, |
| 149 | }, |
| 150 | [S5M8767_IRQ_SMPL] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 151 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 152 | .mask = S5M8767_IRQ_SMPL_MASK, |
| 153 | }, |
| 154 | [S5M8767_IRQ_RTC1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 155 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 156 | .mask = S5M8767_IRQ_RTC1S_MASK, |
| 157 | }, |
| 158 | [S5M8767_IRQ_WTSR] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 159 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 160 | .mask = S5M8767_IRQ_WTSR_MASK, |
| 161 | }, |
| 162 | }; |
| 163 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 164 | static struct regmap_irq s5m8763_irqs[] = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 165 | [S5M8763_IRQ_DCINF] = { |
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 = S5M8763_IRQ_DCINF_MASK, |
| 168 | }, |
| 169 | [S5M8763_IRQ_DCINR] = { |
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 = S5M8763_IRQ_DCINR_MASK, |
| 172 | }, |
| 173 | [S5M8763_IRQ_JIGF] = { |
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 = S5M8763_IRQ_JIGF_MASK, |
| 176 | }, |
| 177 | [S5M8763_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 = S5M8763_IRQ_JIGR_MASK, |
| 180 | }, |
| 181 | [S5M8763_IRQ_PWRONF] = { |
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 = S5M8763_IRQ_PWRONF_MASK, |
| 184 | }, |
| 185 | [S5M8763_IRQ_PWRONR] = { |
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 = S5M8763_IRQ_PWRONR_MASK, |
| 188 | }, |
| 189 | [S5M8763_IRQ_WTSREVNT] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 190 | .reg_offset = 1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 191 | .mask = S5M8763_IRQ_WTSREVNT_MASK, |
| 192 | }, |
| 193 | [S5M8763_IRQ_SMPLEVNT] = { |
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 = S5M8763_IRQ_SMPLEVNT_MASK, |
| 196 | }, |
| 197 | [S5M8763_IRQ_ALARM1] = { |
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 = S5M8763_IRQ_ALARM1_MASK, |
| 200 | }, |
| 201 | [S5M8763_IRQ_ALARM0] = { |
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 = S5M8763_IRQ_ALARM0_MASK, |
| 204 | }, |
| 205 | [S5M8763_IRQ_ONKEY1S] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 206 | .reg_offset = 2, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 207 | .mask = S5M8763_IRQ_ONKEY1S_MASK, |
| 208 | }, |
| 209 | [S5M8763_IRQ_TOPOFFR] = { |
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 = S5M8763_IRQ_TOPOFFR_MASK, |
| 212 | }, |
| 213 | [S5M8763_IRQ_DCINOVPR] = { |
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 = S5M8763_IRQ_DCINOVPR_MASK, |
| 216 | }, |
| 217 | [S5M8763_IRQ_CHGRSTF] = { |
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 = S5M8763_IRQ_CHGRSTF_MASK, |
| 220 | }, |
| 221 | [S5M8763_IRQ_DONER] = { |
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 = S5M8763_IRQ_DONER_MASK, |
| 224 | }, |
| 225 | [S5M8763_IRQ_CHGFAULT] = { |
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 = S5M8763_IRQ_CHGFAULT_MASK, |
| 228 | }, |
| 229 | [S5M8763_IRQ_LOBAT1] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 230 | .reg_offset = 3, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 231 | .mask = S5M8763_IRQ_LOBAT1_MASK, |
| 232 | }, |
| 233 | [S5M8763_IRQ_LOBAT2] = { |
Inderpal Singh | 5e393a2 | 2012-10-17 11:48:55 +0530 | [diff] [blame] | 234 | .reg_offset = 3, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 235 | .mask = S5M8763_IRQ_LOBAT2_MASK, |
| 236 | }, |
| 237 | }; |
| 238 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 239 | static struct regmap_irq_chip s2mps11_irq_chip = { |
| 240 | .name = "s2mps11", |
| 241 | .irqs = s2mps11_irqs, |
| 242 | .num_irqs = ARRAY_SIZE(s2mps11_irqs), |
| 243 | .num_regs = 3, |
| 244 | .status_base = S2MPS11_REG_INT1, |
| 245 | .mask_base = S2MPS11_REG_INT1M, |
| 246 | .ack_base = S2MPS11_REG_INT1, |
| 247 | }; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 248 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 249 | static struct regmap_irq_chip s5m8767_irq_chip = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 250 | .name = "s5m8767", |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 251 | .irqs = s5m8767_irqs, |
| 252 | .num_irqs = ARRAY_SIZE(s5m8767_irqs), |
| 253 | .num_regs = 3, |
| 254 | .status_base = S5M8767_REG_INT1, |
| 255 | .mask_base = S5M8767_REG_INT1M, |
| 256 | .ack_base = S5M8767_REG_INT1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 257 | }; |
| 258 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 259 | static struct regmap_irq_chip s5m8763_irq_chip = { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 260 | .name = "s5m8763", |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 261 | .irqs = s5m8763_irqs, |
| 262 | .num_irqs = ARRAY_SIZE(s5m8763_irqs), |
| 263 | .num_regs = 4, |
| 264 | .status_base = S5M8763_REG_IRQ1, |
| 265 | .mask_base = S5M8763_REG_IRQM1, |
| 266 | .ack_base = S5M8763_REG_IRQ1, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 267 | }; |
| 268 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 269 | int sec_irq_init(struct sec_pmic_dev *sec_pmic) |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 270 | { |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 271 | int ret = 0; |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 272 | int type = sec_pmic->device_type; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 273 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 274 | if (!sec_pmic->irq) { |
| 275 | dev_warn(sec_pmic->dev, |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 276 | "No interrupt specified, no interrupts\n"); |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 277 | sec_pmic->irq_base = 0; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 278 | return 0; |
| 279 | } |
| 280 | |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 281 | switch (type) { |
| 282 | case S5M8763X: |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 283 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, |
| 284 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 285 | sec_pmic->irq_base, &s5m8763_irq_chip, |
| 286 | &sec_pmic->irq_data); |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 287 | break; |
| 288 | case S5M8767X: |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 289 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, |
| 290 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 291 | sec_pmic->irq_base, &s5m8767_irq_chip, |
| 292 | &sec_pmic->irq_data); |
| 293 | break; |
| 294 | case S2MPS11X: |
| 295 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, |
| 296 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 297 | sec_pmic->irq_base, &s2mps11_irq_chip, |
| 298 | &sec_pmic->irq_data); |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 299 | break; |
| 300 | default: |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 301 | dev_err(sec_pmic->dev, "Unknown device type %d\n", |
| 302 | sec_pmic->device_type); |
Jonghwan Choi | c7a1fcf | 2012-02-20 16:22:56 +0100 | [diff] [blame] | 303 | return -EINVAL; |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 304 | } |
| 305 | |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 306 | if (ret != 0) { |
| 307 | 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] | 308 | return ret; |
| 309 | } |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 310 | |
| 311 | return 0; |
| 312 | } |
| 313 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 314 | void sec_irq_exit(struct sec_pmic_dev *sec_pmic) |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 315 | { |
Sangbeom Kim | 6445b84 | 2012-07-11 21:08:11 +0900 | [diff] [blame] | 316 | regmap_del_irq_chip(sec_pmic->irq, sec_pmic->irq_data); |
Sangbeom Kim | 5ac2ffa7 | 2011-12-23 17:28:09 +0900 | [diff] [blame] | 317 | } |