summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier.martinez@collabora.co.uk>2014-07-04 16:24:04 -0400
committerLee Jones <lee.jones@linaro.org>2014-07-21 11:54:26 -0400
commit6f1c1e71d933f58a6248f1681aededdd407f32a8 (patch)
tree8625163e93481f9b28eb838883b37ebb1f29f85e /drivers/mfd
parent4eb9560b8ffa854caa7c625a955762d4b43b4841 (diff)
mfd: max77686: Convert to use regmap_irq
By using the generic IRQ support in the Register map API, it is possible to get rid max77686-irq.c and simplify the code. Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/Kconfig1
-rw-r--r--drivers/mfd/Makefile2
-rw-r--r--drivers/mfd/max77686-irq.c319
-rw-r--r--drivers/mfd/max77686.c97
4 files changed, 93 insertions, 326 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b8d9ca0b68e2..30102042dcaf 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -384,6 +384,7 @@ config MFD_MAX77686
384 depends on I2C=y 384 depends on I2C=y
385 select MFD_CORE 385 select MFD_CORE
386 select REGMAP_I2C 386 select REGMAP_I2C
387 select REGMAP_IRQ
387 select IRQ_DOMAIN 388 select IRQ_DOMAIN
388 help 389 help
389 Say yes here to add support for Maxim Semiconductor MAX77686. 390 Say yes here to add support for Maxim Semiconductor MAX77686.
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 4e2bc255b8b0..f00148782d9b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -115,7 +115,7 @@ da9063-objs := da9063-core.o da9063-irq.o da9063-i2c.o
115obj-$(CONFIG_MFD_DA9063) += da9063.o 115obj-$(CONFIG_MFD_DA9063) += da9063.o
116 116
117obj-$(CONFIG_MFD_MAX14577) += max14577.o 117obj-$(CONFIG_MFD_MAX14577) += max14577.o
118obj-$(CONFIG_MFD_MAX77686) += max77686.o max77686-irq.o 118obj-$(CONFIG_MFD_MAX77686) += max77686.o
119obj-$(CONFIG_MFD_MAX77693) += max77693.o 119obj-$(CONFIG_MFD_MAX77693) += max77693.o
120obj-$(CONFIG_MFD_MAX8907) += max8907.o 120obj-$(CONFIG_MFD_MAX8907) += max8907.o
121max8925-objs := max8925-core.o max8925-i2c.o 121max8925-objs := max8925-core.o max8925-i2c.o
diff --git a/drivers/mfd/max77686-irq.c b/drivers/mfd/max77686-irq.c
deleted file mode 100644
index cdc3280e2ec7..000000000000
--- a/drivers/mfd/max77686-irq.c
+++ /dev/null
@@ -1,319 +0,0 @@
1/*
2 * max77686-irq.c - Interrupt controller support for MAX77686
3 *
4 * Copyright (C) 2012 Samsung Electronics Co.Ltd
5 * Chiwoong Byun <woong.byun@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * This driver is based on max8997-irq.c
22 */
23
24#include <linux/err.h>
25#include <linux/irq.h>
26#include <linux/interrupt.h>
27#include <linux/gpio.h>
28#include <linux/mfd/max77686.h>
29#include <linux/mfd/max77686-private.h>
30#include <linux/irqdomain.h>
31#include <linux/regmap.h>
32
33enum {
34 MAX77686_DEBUG_IRQ_INFO = 1 << 0,
35 MAX77686_DEBUG_IRQ_MASK = 1 << 1,
36 MAX77686_DEBUG_IRQ_INT = 1 << 2,
37};
38
39static int debug_mask = 0;
40module_param(debug_mask, int, 0);
41MODULE_PARM_DESC(debug_mask, "Set debug_mask : 0x0=off 0x1=IRQ_INFO 0x2=IRQ_MASK 0x4=IRQ_INI)");
42
43static const u8 max77686_mask_reg[] = {
44 [PMIC_INT1] = MAX77686_REG_INT1MSK,
45 [PMIC_INT2] = MAX77686_REG_INT2MSK,
46 [RTC_INT] = MAX77686_RTC_INTM,
47};
48
49static struct regmap *max77686_get_regmap(struct max77686_dev *max77686,
50 enum max77686_irq_source src)
51{
52 switch (src) {
53 case PMIC_INT1 ... PMIC_INT2:
54 return max77686->regmap;
55 case RTC_INT:
56 return max77686->rtc_regmap;
57 default:
58 return ERR_PTR(-EINVAL);
59 }
60}
61
62struct max77686_irq_data {
63 int mask;
64 enum max77686_irq_source group;
65};
66
67#define DECLARE_IRQ(idx, _group, _mask) \
68 [(idx)] = { .group = (_group), .mask = (_mask) }
69static const struct max77686_irq_data max77686_irqs[] = {
70 DECLARE_IRQ(MAX77686_PMICIRQ_PWRONF, PMIC_INT1, 1 << 0),
71 DECLARE_IRQ(MAX77686_PMICIRQ_PWRONR, PMIC_INT1, 1 << 1),
72 DECLARE_IRQ(MAX77686_PMICIRQ_JIGONBF, PMIC_INT1, 1 << 2),
73 DECLARE_IRQ(MAX77686_PMICIRQ_JIGONBR, PMIC_INT1, 1 << 3),
74 DECLARE_IRQ(MAX77686_PMICIRQ_ACOKBF, PMIC_INT1, 1 << 4),
75 DECLARE_IRQ(MAX77686_PMICIRQ_ACOKBR, PMIC_INT1, 1 << 5),
76 DECLARE_IRQ(MAX77686_PMICIRQ_ONKEY1S, PMIC_INT1, 1 << 6),
77 DECLARE_IRQ(MAX77686_PMICIRQ_MRSTB, PMIC_INT1, 1 << 7),
78 DECLARE_IRQ(MAX77686_PMICIRQ_140C, PMIC_INT2, 1 << 0),
79 DECLARE_IRQ(MAX77686_PMICIRQ_120C, PMIC_INT2, 1 << 1),
80 DECLARE_IRQ(MAX77686_RTCIRQ_RTC60S, RTC_INT, 1 << 0),
81 DECLARE_IRQ(MAX77686_RTCIRQ_RTCA1, RTC_INT, 1 << 1),
82 DECLARE_IRQ(MAX77686_RTCIRQ_RTCA2, RTC_INT, 1 << 2),
83 DECLARE_IRQ(MAX77686_RTCIRQ_SMPL, RTC_INT, 1 << 3),
84 DECLARE_IRQ(MAX77686_RTCIRQ_RTC1S, RTC_INT, 1 << 4),
85 DECLARE_IRQ(MAX77686_RTCIRQ_WTSR, RTC_INT, 1 << 5),
86};
87
88static void max77686_irq_lock(struct irq_data *data)
89{
90 struct max77686_dev *max77686 = irq_get_chip_data(data->irq);
91
92 if (debug_mask & MAX77686_DEBUG_IRQ_MASK)
93 pr_info("%s\n", __func__);
94
95 mutex_lock(&max77686->irqlock);
96}
97
98static void max77686_irq_sync_unlock(struct irq_data *data)
99{
100 struct max77686_dev *max77686 = irq_get_chip_data(data->irq);
101 int i;
102
103 for (i = 0; i < MAX77686_IRQ_GROUP_NR; i++) {
104 u8 mask_reg = max77686_mask_reg[i];
105 struct regmap *map = max77686_get_regmap(max77686, i);
106
107 if (debug_mask & MAX77686_DEBUG_IRQ_MASK)
108 pr_debug("%s: mask_reg[%d]=0x%x, cur=0x%x\n",
109 __func__, i, mask_reg, max77686->irq_masks_cur[i]);
110
111 if (mask_reg == MAX77686_REG_INVALID ||
112 IS_ERR_OR_NULL(map))
113 continue;
114
115 max77686->irq_masks_cache[i] = max77686->irq_masks_cur[i];
116
117 regmap_write(map, max77686_mask_reg[i],
118 max77686->irq_masks_cur[i]);
119 }
120
121 mutex_unlock(&max77686->irqlock);
122}
123
124static const inline struct max77686_irq_data *to_max77686_irq(int irq)
125{
126 struct irq_data *data = irq_get_irq_data(irq);
127 return &max77686_irqs[data->hwirq];
128}
129
130static void max77686_irq_mask(struct irq_data *data)
131{
132 struct max77686_dev *max77686 = irq_get_chip_data(data->irq);
133 const struct max77686_irq_data *irq_data = to_max77686_irq(data->irq);
134
135 max77686->irq_masks_cur[irq_data->group] |= irq_data->mask;
136
137 if (debug_mask & MAX77686_DEBUG_IRQ_MASK)
138 pr_info("%s: group=%d, cur=0x%x\n",
139 __func__, irq_data->group,
140 max77686->irq_masks_cur[irq_data->group]);
141}
142
143static void max77686_irq_unmask(struct irq_data *data)
144{
145 struct max77686_dev *max77686 = irq_get_chip_data(data->irq);
146 const struct max77686_irq_data *irq_data = to_max77686_irq(data->irq);
147
148 max77686->irq_masks_cur[irq_data->group] &= ~irq_data->mask;
149
150 if (debug_mask & MAX77686_DEBUG_IRQ_MASK)
151 pr_info("%s: group=%d, cur=0x%x\n",
152 __func__, irq_data->group,
153 max77686->irq_masks_cur[irq_data->group]);
154}
155
156static struct irq_chip max77686_irq_chip = {
157 .name = "max77686",
158 .irq_bus_lock = max77686_irq_lock,
159 .irq_bus_sync_unlock = max77686_irq_sync_unlock,
160 .irq_mask = max77686_irq_mask,
161 .irq_unmask = max77686_irq_unmask,
162};
163
164static irqreturn_t max77686_irq_thread(int irq, void *data)
165{
166 struct max77686_dev *max77686 = data;
167 unsigned int irq_reg[MAX77686_IRQ_GROUP_NR] = {};
168 unsigned int irq_src;
169 int ret;
170 int i, cur_irq;
171
172 ret = regmap_read(max77686->regmap, MAX77686_REG_INTSRC, &irq_src);
173 if (ret < 0) {
174 dev_err(max77686->dev, "Failed to read interrupt source: %d\n",
175 ret);
176 return IRQ_NONE;
177 }
178
179 if (debug_mask & MAX77686_DEBUG_IRQ_INT)
180 pr_info("%s: irq_src=0x%x\n", __func__, irq_src);
181
182 if (irq_src == MAX77686_IRQSRC_PMIC) {
183 ret = regmap_bulk_read(max77686->regmap,
184 MAX77686_REG_INT1, irq_reg, 2);
185 if (ret < 0) {
186 dev_err(max77686->dev, "Failed to read interrupt source: %d\n",
187 ret);
188 return IRQ_NONE;
189 }
190
191 if (debug_mask & MAX77686_DEBUG_IRQ_INT)
192 pr_info("%s: int1=0x%x, int2=0x%x\n", __func__,
193 irq_reg[PMIC_INT1], irq_reg[PMIC_INT2]);
194 }
195
196 if (irq_src & MAX77686_IRQSRC_RTC) {
197 ret = regmap_read(max77686->rtc_regmap,
198 MAX77686_RTC_INT, &irq_reg[RTC_INT]);
199 if (ret < 0) {
200 dev_err(max77686->dev, "Failed to read interrupt source: %d\n",
201 ret);
202 return IRQ_NONE;
203 }
204
205 if (debug_mask & MAX77686_DEBUG_IRQ_INT)
206 pr_info("%s: rtc int=0x%x\n", __func__,
207 irq_reg[RTC_INT]);
208
209 }
210
211 for (i = 0; i < MAX77686_IRQ_GROUP_NR; i++)
212 irq_reg[i] &= ~max77686->irq_masks_cur[i];
213
214 for (i = 0; i < MAX77686_IRQ_NR; i++) {
215 if (irq_reg[max77686_irqs[i].group] & max77686_irqs[i].mask) {
216 cur_irq = irq_find_mapping(max77686->irq_domain, i);
217 if (cur_irq)
218 handle_nested_irq(cur_irq);
219 }
220 }
221
222 return IRQ_HANDLED;
223}
224
225static int max77686_irq_domain_map(struct irq_domain *d, unsigned int irq,
226 irq_hw_number_t hw)
227{
228 struct max77686_dev *max77686 = d->host_data;
229
230 irq_set_chip_data(irq, max77686);
231 irq_set_chip_and_handler(irq, &max77686_irq_chip, handle_edge_irq);
232 irq_set_nested_thread(irq, 1);
233#ifdef CONFIG_ARM
234 set_irq_flags(irq, IRQF_VALID);
235#else
236 irq_set_noprobe(irq);
237#endif
238 return 0;
239}
240
241static struct irq_domain_ops max77686_irq_domain_ops = {
242 .map = max77686_irq_domain_map,
243};
244
245int max77686_irq_init(struct max77686_dev *max77686)
246{
247 struct irq_domain *domain;
248 int i;
249 int ret;
250 int val;
251 struct regmap *map;
252
253 mutex_init(&max77686->irqlock);
254
255 if (max77686->irq_gpio && !max77686->irq) {
256 max77686->irq = gpio_to_irq(max77686->irq_gpio);
257
258 if (debug_mask & MAX77686_DEBUG_IRQ_INT) {
259 ret = gpio_request(max77686->irq_gpio, "pmic_irq");
260 if (ret < 0) {
261 dev_err(max77686->dev,
262 "Failed to request gpio %d with ret:"
263 "%d\n", max77686->irq_gpio, ret);
264 return IRQ_NONE;
265 }
266
267 gpio_direction_input(max77686->irq_gpio);
268 val = gpio_get_value(max77686->irq_gpio);
269 gpio_free(max77686->irq_gpio);
270 pr_info("%s: gpio_irq=%x\n", __func__, val);
271 }
272 }
273
274 if (!max77686->irq) {
275 dev_err(max77686->dev, "irq is not specified\n");
276 return -ENODEV;
277 }
278
279 /* Mask individual interrupt sources */
280 for (i = 0; i < MAX77686_IRQ_GROUP_NR; i++) {
281 max77686->irq_masks_cur[i] = 0xff;
282 max77686->irq_masks_cache[i] = 0xff;
283 map = max77686_get_regmap(max77686, i);
284
285 if (IS_ERR_OR_NULL(map))
286 continue;
287 if (max77686_mask_reg[i] == MAX77686_REG_INVALID)
288 continue;
289
290 regmap_write(map, max77686_mask_reg[i], 0xff);
291 }
292 domain = irq_domain_add_linear(NULL, MAX77686_IRQ_NR,
293 &max77686_irq_domain_ops, max77686);
294 if (!domain) {
295 dev_err(max77686->dev, "could not create irq domain\n");
296 return -ENODEV;
297 }
298 max77686->irq_domain = domain;
299
300 ret = request_threaded_irq(max77686->irq, NULL, max77686_irq_thread,
301 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
302 "max77686-irq", max77686);
303
304 if (ret)
305 dev_err(max77686->dev, "Failed to request IRQ %d: %d\n",
306 max77686->irq, ret);
307
308
309 if (debug_mask & MAX77686_DEBUG_IRQ_INFO)
310 pr_info("%s-\n", __func__);
311
312 return 0;
313}
314
315void max77686_irq_exit(struct max77686_dev *max77686)
316{
317 if (max77686->irq)
318 free_irq(max77686->irq, max77686);
319}
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index ce869acf27ae..3cb41d02cd3d 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -25,6 +25,8 @@
25#include <linux/export.h> 25#include <linux/export.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/irq.h>
29#include <linux/interrupt.h>
28#include <linux/pm_runtime.h> 30#include <linux/pm_runtime.h>
29#include <linux/module.h> 31#include <linux/module.h>
30#include <linux/mfd/core.h> 32#include <linux/mfd/core.h>
@@ -46,6 +48,54 @@ static struct regmap_config max77686_regmap_config = {
46 .val_bits = 8, 48 .val_bits = 8,
47}; 49};
48 50
51static struct regmap_config max77686_rtc_regmap_config = {
52 .reg_bits = 8,
53 .val_bits = 8,
54};
55
56static const struct regmap_irq max77686_irqs[] = {
57 /* INT1 interrupts */
58 { .reg_offset = 0, .mask = MAX77686_INT1_PWRONF_MSK, },
59 { .reg_offset = 0, .mask = MAX77686_INT1_PWRONR_MSK, },
60 { .reg_offset = 0, .mask = MAX77686_INT1_JIGONBF_MSK, },
61 { .reg_offset = 0, .mask = MAX77686_INT1_JIGONBR_MSK, },
62 { .reg_offset = 0, .mask = MAX77686_INT1_ACOKBF_MSK, },
63 { .reg_offset = 0, .mask = MAX77686_INT1_ACOKBR_MSK, },
64 { .reg_offset = 0, .mask = MAX77686_INT1_ONKEY1S_MSK, },
65 { .reg_offset = 0, .mask = MAX77686_INT1_MRSTB_MSK, },
66 /* INT2 interrupts */
67 { .reg_offset = 1, .mask = MAX77686_INT2_140C_MSK, },
68 { .reg_offset = 1, .mask = MAX77686_INT2_120C_MSK, },
69};
70
71static const struct regmap_irq_chip max77686_irq_chip = {
72 .name = "max77686-pmic",
73 .status_base = MAX77686_REG_INT1,
74 .mask_base = MAX77686_REG_INT1MSK,
75 .num_regs = 2,
76 .irqs = max77686_irqs,
77 .num_irqs = ARRAY_SIZE(max77686_irqs),
78};
79
80static const struct regmap_irq max77686_rtc_irqs[] = {
81 /* RTC interrupts */
82 { .reg_offset = 0, .mask = MAX77686_RTCINT_RTC60S_MSK, },
83 { .reg_offset = 0, .mask = MAX77686_RTCINT_RTCA1_MSK, },
84 { .reg_offset = 0, .mask = MAX77686_RTCINT_RTCA2_MSK, },
85 { .reg_offset = 0, .mask = MAX77686_RTCINT_SMPL_MSK, },
86 { .reg_offset = 0, .mask = MAX77686_RTCINT_RTC1S_MSK, },
87 { .reg_offset = 0, .mask = MAX77686_RTCINT_WTSR_MSK, },
88};
89
90static const struct regmap_irq_chip max77686_rtc_irq_chip = {
91 .name = "max77686-rtc",
92 .status_base = MAX77686_RTC_INT,
93 .mask_base = MAX77686_RTC_INTM,
94 .num_regs = 1,
95 .irqs = max77686_rtc_irqs,
96 .num_irqs = ARRAY_SIZE(max77686_rtc_irqs),
97};
98
49#ifdef CONFIG_OF 99#ifdef CONFIG_OF
50static const struct of_device_id max77686_pmic_dt_match[] = { 100static const struct of_device_id max77686_pmic_dt_match[] = {
51 {.compatible = "maxim,max77686", .data = NULL}, 101 {.compatible = "maxim,max77686", .data = NULL},
@@ -101,7 +151,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
101 max77686->type = id->driver_data; 151 max77686->type = id->driver_data;
102 152
103 max77686->wakeup = pdata->wakeup; 153 max77686->wakeup = pdata->wakeup;
104 max77686->irq_gpio = pdata->irq_gpio;
105 max77686->irq = i2c->irq; 154 max77686->irq = i2c->irq;
106 155
107 max77686->regmap = devm_regmap_init_i2c(i2c, &max77686_regmap_config); 156 max77686->regmap = devm_regmap_init_i2c(i2c, &max77686_regmap_config);
@@ -117,8 +166,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
117 dev_err(max77686->dev, 166 dev_err(max77686->dev,
118 "device not found on this channel (this is not an error)\n"); 167 "device not found on this channel (this is not an error)\n");
119 return -ENODEV; 168 return -ENODEV;
120 } else 169 }
121 dev_info(max77686->dev, "device found\n");
122 170
123 max77686->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC); 171 max77686->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC);
124 if (!max77686->rtc) { 172 if (!max77686->rtc) {
@@ -127,15 +175,48 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
127 } 175 }
128 i2c_set_clientdata(max77686->rtc, max77686); 176 i2c_set_clientdata(max77686->rtc, max77686);
129 177
130 max77686_irq_init(max77686); 178 max77686->rtc_regmap = devm_regmap_init_i2c(max77686->rtc,
179 &max77686_rtc_regmap_config);
180 if (IS_ERR(max77686->rtc_regmap)) {
181 ret = PTR_ERR(max77686->rtc_regmap);
182 dev_err(max77686->dev, "failed to allocate RTC regmap: %d\n",
183 ret);
184 goto err_unregister_i2c;
185 }
186
187 ret = regmap_add_irq_chip(max77686->regmap, max77686->irq,
188 IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
189 IRQF_SHARED, 0, &max77686_irq_chip,
190 &max77686->irq_data);
191 if (ret != 0) {
192 dev_err(&i2c->dev, "failed to add PMIC irq chip: %d\n", ret);
193 goto err_unregister_i2c;
194 }
195 ret = regmap_add_irq_chip(max77686->rtc_regmap, max77686->irq,
196 IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
197 IRQF_SHARED, 0, &max77686_rtc_irq_chip,
198 &max77686->rtc_irq_data);
199 if (ret != 0) {
200 dev_err(&i2c->dev, "failed to add RTC irq chip: %d\n", ret);
201 goto err_del_irqc;
202 }
131 203
132 ret = mfd_add_devices(max77686->dev, -1, max77686_devs, 204 ret = mfd_add_devices(max77686->dev, -1, max77686_devs,
133 ARRAY_SIZE(max77686_devs), NULL, 0, NULL); 205 ARRAY_SIZE(max77686_devs), NULL, 0, NULL);
134 if (ret < 0) { 206 if (ret < 0) {
135 mfd_remove_devices(max77686->dev); 207 dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
136 i2c_unregister_device(max77686->rtc); 208 goto err_del_rtc_irqc;
137 } 209 }
138 210
211 return 0;
212
213err_del_rtc_irqc:
214 regmap_del_irq_chip(max77686->irq, max77686->rtc_irq_data);
215err_del_irqc:
216 regmap_del_irq_chip(max77686->irq, max77686->irq_data);
217err_unregister_i2c:
218 i2c_unregister_device(max77686->rtc);
219
139 return ret; 220 return ret;
140} 221}
141 222
@@ -144,6 +225,10 @@ static int max77686_i2c_remove(struct i2c_client *i2c)
144 struct max77686_dev *max77686 = i2c_get_clientdata(i2c); 225 struct max77686_dev *max77686 = i2c_get_clientdata(i2c);
145 226
146 mfd_remove_devices(max77686->dev); 227 mfd_remove_devices(max77686->dev);
228
229 regmap_del_irq_chip(max77686->irq, max77686->rtc_irq_data);
230 regmap_del_irq_chip(max77686->irq, max77686->irq_data);
231
147 i2c_unregister_device(max77686->rtc); 232 i2c_unregister_device(max77686->rtc);
148 233
149 return 0; 234 return 0;