blob: be06d0abbf19f8b171c7554a5474afa861fb889e [file] [log] [blame]
Sangbeom Kim0f5f7072011-12-23 17:28:08 +09001/*
Sangbeom Kim63063bf2012-07-11 21:06:55 +09002 * sec-core.c
Sangbeom Kim0f5f7072011-12-23 17:28:08 +09003 *
Sangbeom Kim63063bf2012-07-11 21:06:55 +09004 * Copyright (c) 2012 Samsung Electronics Co., Ltd
Sangbeom Kim0f5f7072011-12-23 17:28:08 +09005 * 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/module.h>
15#include <linux/moduleparam.h>
16#include <linux/init.h>
17#include <linux/err.h>
18#include <linux/slab.h>
19#include <linux/i2c.h>
Sachin Kamat1c5a0992013-10-16 14:26:52 +053020#include <linux/of.h>
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -080021#include <linux/of_irq.h>
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090022#include <linux/interrupt.h>
23#include <linux/pm_runtime.h>
24#include <linux/mutex.h>
25#include <linux/mfd/core.h>
Sangbeom Kim54227bc2012-07-11 21:07:16 +090026#include <linux/mfd/samsung/core.h>
27#include <linux/mfd/samsung/irq.h>
Sachin Kamatce249912014-03-14 17:21:57 +053028#include <linux/mfd/samsung/s2mpa01.h>
Mark Brown25f311f2013-07-01 23:02:19 +010029#include <linux/mfd/samsung/s2mps11.h>
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +010030#include <linux/mfd/samsung/s2mps14.h>
Mark Brown25f311f2013-07-01 23:02:19 +010031#include <linux/mfd/samsung/s5m8763.h>
32#include <linux/mfd/samsung/s5m8767.h>
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090033#include <linux/regmap.h>
34
Geert Uytterhoeven5ac98552013-11-18 14:33:06 +010035static const struct mfd_cell s5m8751_devs[] = {
Sangbeom Kim88a1cfd2012-01-20 16:09:12 +090036 {
37 .name = "s5m8751-pmic",
38 }, {
39 .name = "s5m-charger",
40 }, {
41 .name = "s5m8751-codec",
42 },
43};
44
Geert Uytterhoeven5ac98552013-11-18 14:33:06 +010045static const struct mfd_cell s5m8763_devs[] = {
Sangbeom Kim88a1cfd2012-01-20 16:09:12 +090046 {
47 .name = "s5m8763-pmic",
48 }, {
49 .name = "s5m-rtc",
50 }, {
51 .name = "s5m-charger",
52 },
53};
54
Geert Uytterhoeven5ac98552013-11-18 14:33:06 +010055static const struct mfd_cell s5m8767_devs[] = {
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090056 {
57 .name = "s5m8767-pmic",
58 }, {
59 .name = "s5m-rtc",
Tushar Behera39fed002013-12-26 15:49:00 +053060 }, {
61 .name = "s5m8767-clk",
Krzysztof Kozlowski53c31b32014-03-17 10:19:17 +010062 .of_compatible = "samsung,s5m8767-clk",
Tushar Behera39fed002013-12-26 15:49:00 +053063 }
Sangbeom Kim0f5f7072011-12-23 17:28:08 +090064};
65
Geert Uytterhoeven5ac98552013-11-18 14:33:06 +010066static const struct mfd_cell s2mps11_devs[] = {
Sangbeom Kim9b6d1342012-07-11 21:07:55 +090067 {
68 .name = "s2mps11-pmic",
Yadwinder Singh Brar3134bca2013-07-07 17:14:21 +053069 }, {
70 .name = "s2mps11-clk",
Krzysztof Kozlowski53c31b32014-03-17 10:19:17 +010071 .of_compatible = "samsung,s2mps11-clk",
Yadwinder Singh Brar3134bca2013-07-07 17:14:21 +053072 }
Sangbeom Kim9b6d1342012-07-11 21:07:55 +090073};
74
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +010075static const struct mfd_cell s2mps14_devs[] = {
76 {
77 .name = "s2mps14-pmic",
78 }, {
79 .name = "s2mps14-rtc",
80 }, {
81 .name = "s2mps14-clk",
Krzysztof Kozlowski53c31b32014-03-17 10:19:17 +010082 .of_compatible = "samsung,s2mps14-clk",
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +010083 }
84};
85
Sachin Kamatce249912014-03-14 17:21:57 +053086static const struct mfd_cell s2mpa01_devs[] = {
87 {
88 .name = "s2mpa01-pmic",
89 },
90};
91
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -080092#ifdef CONFIG_OF
Krzysztof Kozlowskidf20b7c2014-05-13 12:58:46 +020093static const struct of_device_id sec_dt_match[] = {
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -080094 { .compatible = "samsung,s5m8767-pmic",
95 .data = (void *)S5M8767X,
Sachin Kamatce249912014-03-14 17:21:57 +053096 }, {
97 .compatible = "samsung,s2mps11-pmic",
Yadwinder Singh Braraa32aca2013-06-29 18:21:20 +053098 .data = (void *)S2MPS11X,
Sachin Kamatce249912014-03-14 17:21:57 +053099 }, {
100 .compatible = "samsung,s2mps14-pmic",
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +0100101 .data = (void *)S2MPS14X,
Sachin Kamatce249912014-03-14 17:21:57 +0530102 }, {
103 .compatible = "samsung,s2mpa01-pmic",
104 .data = (void *)S2MPA01,
105 }, {
106 /* Sentinel */
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +0100107 },
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800108};
109#endif
110
Sachin Kamatce249912014-03-14 17:21:57 +0530111static bool s2mpa01_volatile(struct device *dev, unsigned int reg)
112{
113 switch (reg) {
114 case S2MPA01_REG_INT1M:
115 case S2MPA01_REG_INT2M:
116 case S2MPA01_REG_INT3M:
117 return false;
118 default:
119 return true;
120 }
121}
122
Mark Brown6b845ba2013-07-02 18:51:16 +0100123static bool s2mps11_volatile(struct device *dev, unsigned int reg)
124{
125 switch (reg) {
126 case S2MPS11_REG_INT1M:
127 case S2MPS11_REG_INT2M:
128 case S2MPS11_REG_INT3M:
129 return false;
130 default:
131 return true;
132 }
133}
134
135static bool s5m8763_volatile(struct device *dev, unsigned int reg)
136{
137 switch (reg) {
138 case S5M8763_REG_IRQM1:
139 case S5M8763_REG_IRQM2:
140 case S5M8763_REG_IRQM3:
141 case S5M8763_REG_IRQM4:
142 return false;
143 default:
144 return true;
145 }
146}
147
Krzysztof Kozlowskia30fffb2013-11-28 09:09:43 +0100148static const struct regmap_config sec_regmap_config = {
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900149 .reg_bits = 8,
150 .val_bits = 8,
151};
152
Sachin Kamatce249912014-03-14 17:21:57 +0530153static const struct regmap_config s2mpa01_regmap_config = {
154 .reg_bits = 8,
155 .val_bits = 8,
156
157 .max_register = S2MPA01_REG_LDO_OVCB4,
158 .volatile_reg = s2mpa01_volatile,
159 .cache_type = REGCACHE_FLAT,
160};
161
Krzysztof Kozlowskia30fffb2013-11-28 09:09:43 +0100162static const struct regmap_config s2mps11_regmap_config = {
Mark Brown25f311f2013-07-01 23:02:19 +0100163 .reg_bits = 8,
164 .val_bits = 8,
165
166 .max_register = S2MPS11_REG_L38CTRL,
Mark Brown6b845ba2013-07-02 18:51:16 +0100167 .volatile_reg = s2mps11_volatile,
168 .cache_type = REGCACHE_FLAT,
Mark Brown25f311f2013-07-01 23:02:19 +0100169};
170
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +0100171static const struct regmap_config s2mps14_regmap_config = {
172 .reg_bits = 8,
173 .val_bits = 8,
174
175 .max_register = S2MPS14_REG_LDODSCH3,
176 .volatile_reg = s2mps11_volatile,
177 .cache_type = REGCACHE_FLAT,
178};
179
Krzysztof Kozlowskia30fffb2013-11-28 09:09:43 +0100180static const struct regmap_config s5m8763_regmap_config = {
Mark Brown25f311f2013-07-01 23:02:19 +0100181 .reg_bits = 8,
182 .val_bits = 8,
183
184 .max_register = S5M8763_REG_LBCNFG2,
Mark Brown6b845ba2013-07-02 18:51:16 +0100185 .volatile_reg = s5m8763_volatile,
186 .cache_type = REGCACHE_FLAT,
Mark Brown25f311f2013-07-01 23:02:19 +0100187};
188
Krzysztof Kozlowskia30fffb2013-11-28 09:09:43 +0100189static const struct regmap_config s5m8767_regmap_config = {
Mark Brown25f311f2013-07-01 23:02:19 +0100190 .reg_bits = 8,
191 .val_bits = 8,
192
193 .max_register = S5M8767_REG_LDO28CTRL,
Mark Brown6b845ba2013-07-02 18:51:16 +0100194 .volatile_reg = s2mps11_volatile,
195 .cache_type = REGCACHE_FLAT,
Mark Brown25f311f2013-07-01 23:02:19 +0100196};
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800197
198#ifdef CONFIG_OF
199/*
200 * Only the common platform data elements for s5m8767 are parsed here from the
201 * device tree. Other sub-modules of s5m8767 such as pmic, rtc , charger and
202 * others have to parse their own platform data elements from device tree.
203 *
204 * The s5m8767 platform data structure is instantiated here and the drivers for
205 * the sub-modules need not instantiate another instance while parsing their
206 * platform data.
207 */
208static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(
209 struct device *dev)
210{
211 struct sec_platform_data *pd;
212
213 pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
214 if (!pd) {
215 dev_err(dev, "could not allocate memory for pdata\n");
216 return ERR_PTR(-ENOMEM);
217 }
218
219 /*
220 * ToDo: the 'wakeup' member in the platform data is more of a linux
221 * specfic information. Hence, there is no binding for that yet and
222 * not parsed here.
223 */
224
225 return pd;
226}
227#else
Mark Brown197bf852013-02-04 18:31:25 +0000228static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800229 struct device *dev)
230{
Wei Yongjun005718c2013-12-07 14:02:15 +0800231 return NULL;
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800232}
233#endif
234
Pankaj Dubey8f695de2014-03-13 11:14:07 +0900235static inline unsigned long sec_i2c_get_driver_data(struct i2c_client *i2c,
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800236 const struct i2c_device_id *id)
237{
238#ifdef CONFIG_OF
239 if (i2c->dev.of_node) {
240 const struct of_device_id *match;
241 match = of_match_node(sec_dt_match, i2c->dev.of_node);
Pankaj Dubey8f695de2014-03-13 11:14:07 +0900242 return (unsigned long)match->data;
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800243 }
244#endif
Pankaj Dubey8f695de2014-03-13 11:14:07 +0900245 return id->driver_data;
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800246}
247
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900248static int sec_pmic_probe(struct i2c_client *i2c,
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900249 const struct i2c_device_id *id)
250{
Jingoo Han334a41c2013-07-30 17:10:05 +0900251 struct sec_platform_data *pdata = dev_get_platdata(&i2c->dev);
Krzysztof Kozlowskie349c912014-04-14 09:40:45 +0200252 const struct regmap_config *regmap;
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900253 struct sec_pmic_dev *sec_pmic;
Krzysztof Kozlowski9549b5f2014-04-23 16:13:05 +0200254 unsigned long device_type;
Axel Lin61a2af32012-02-28 14:23:55 +0800255 int ret;
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900256
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900257 sec_pmic = devm_kzalloc(&i2c->dev, sizeof(struct sec_pmic_dev),
Sangbeom Kim621210e2012-01-20 16:09:11 +0900258 GFP_KERNEL);
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900259 if (sec_pmic == NULL)
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900260 return -ENOMEM;
261
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900262 i2c_set_clientdata(i2c, sec_pmic);
263 sec_pmic->dev = &i2c->dev;
264 sec_pmic->i2c = i2c;
265 sec_pmic->irq = i2c->irq;
Krzysztof Kozlowski9549b5f2014-04-23 16:13:05 +0200266 device_type = sec_i2c_get_driver_data(i2c, id);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900267
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800268 if (sec_pmic->dev->of_node) {
269 pdata = sec_pmic_i2c_parse_dt_pdata(sec_pmic->dev);
270 if (IS_ERR(pdata)) {
271 ret = PTR_ERR(pdata);
272 return ret;
273 }
Krzysztof Kozlowski9549b5f2014-04-23 16:13:05 +0200274 pdata->device_type = device_type;
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800275 }
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900276 if (pdata) {
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900277 sec_pmic->device_type = pdata->device_type;
278 sec_pmic->ono = pdata->ono;
279 sec_pmic->irq_base = pdata->irq_base;
280 sec_pmic->wakeup = pdata->wakeup;
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800281 sec_pmic->pdata = pdata;
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900282 }
283
Mark Brown25f311f2013-07-01 23:02:19 +0100284 switch (sec_pmic->device_type) {
Sachin Kamatce249912014-03-14 17:21:57 +0530285 case S2MPA01:
286 regmap = &s2mpa01_regmap_config;
287 break;
Mark Brown25f311f2013-07-01 23:02:19 +0100288 case S2MPS11X:
289 regmap = &s2mps11_regmap_config;
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +0100290 break;
291 case S2MPS14X:
292 regmap = &s2mps14_regmap_config;
Mark Brown25f311f2013-07-01 23:02:19 +0100293 break;
294 case S5M8763X:
295 regmap = &s5m8763_regmap_config;
296 break;
297 case S5M8767X:
298 regmap = &s5m8767_regmap_config;
299 break;
300 default:
301 regmap = &sec_regmap_config;
302 break;
303 }
304
Krzysztof Kozlowski3e1e4a52013-12-12 17:12:31 -0800305 sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap);
306 if (IS_ERR(sec_pmic->regmap_pmic)) {
307 ret = PTR_ERR(sec_pmic->regmap_pmic);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900308 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
Axel Lin61a2af32012-02-28 14:23:55 +0800309 ret);
Axel Lin1092e1c2012-04-25 10:03:44 +0800310 return ret;
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900311 }
312
Jonghwan Choic3ebb302012-01-16 09:08:42 +0900313 if (pdata && pdata->cfg_pmic_irq)
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900314 pdata->cfg_pmic_irq();
315
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900316 sec_irq_init(sec_pmic);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900317
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900318 pm_runtime_set_active(sec_pmic->dev);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900319
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900320 switch (sec_pmic->device_type) {
Sangbeom Kim88a1cfd2012-01-20 16:09:12 +0900321 case S5M8751X:
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900322 ret = mfd_add_devices(sec_pmic->dev, -1, s5m8751_devs,
Mark Brown0848c942012-09-11 15:16:36 +0800323 ARRAY_SIZE(s5m8751_devs), NULL, 0, NULL);
Sangbeom Kim88a1cfd2012-01-20 16:09:12 +0900324 break;
325 case S5M8763X:
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900326 ret = mfd_add_devices(sec_pmic->dev, -1, s5m8763_devs,
Mark Brown0848c942012-09-11 15:16:36 +0800327 ARRAY_SIZE(s5m8763_devs), NULL, 0, NULL);
Sangbeom Kim88a1cfd2012-01-20 16:09:12 +0900328 break;
329 case S5M8767X:
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900330 ret = mfd_add_devices(sec_pmic->dev, -1, s5m8767_devs,
Mark Brown0848c942012-09-11 15:16:36 +0800331 ARRAY_SIZE(s5m8767_devs), NULL, 0, NULL);
Sangbeom Kim88a1cfd2012-01-20 16:09:12 +0900332 break;
Sachin Kamatce249912014-03-14 17:21:57 +0530333 case S2MPA01:
334 ret = mfd_add_devices(sec_pmic->dev, -1, s2mpa01_devs,
335 ARRAY_SIZE(s2mpa01_devs), NULL, 0, NULL);
336 break;
Sangbeom Kim9b6d1342012-07-11 21:07:55 +0900337 case S2MPS11X:
338 ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs,
Mark Brown0848c942012-09-11 15:16:36 +0800339 ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL);
Sangbeom Kim9b6d1342012-07-11 21:07:55 +0900340 break;
Krzysztof Kozlowskidc691962014-02-28 11:41:44 +0100341 case S2MPS14X:
342 ret = mfd_add_devices(sec_pmic->dev, -1, s2mps14_devs,
343 ARRAY_SIZE(s2mps14_devs), NULL, 0, NULL);
344 break;
Sangbeom Kim88a1cfd2012-01-20 16:09:12 +0900345 default:
346 /* If this happens the probe function is problem */
347 BUG();
348 }
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900349
Leon Romanovsky15447a462013-05-15 18:00:48 +0300350 if (ret)
Krzysztof Kozlowski8c66eec2014-03-18 13:57:50 +0100351 goto err_mfd;
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900352
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100353 device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup);
354
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900355 return ret;
356
Krzysztof Kozlowski8c66eec2014-03-18 13:57:50 +0100357err_mfd:
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900358 sec_irq_exit(sec_pmic);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900359 return ret;
360}
361
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900362static int sec_pmic_remove(struct i2c_client *i2c)
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900363{
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900364 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900365
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900366 mfd_remove_devices(sec_pmic->dev);
367 sec_irq_exit(sec_pmic);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900368 return 0;
369}
370
Geert Uytterhoeven8321bbf2014-01-26 11:38:43 +0100371#ifdef CONFIG_PM_SLEEP
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100372static int sec_pmic_suspend(struct device *dev)
373{
374 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
375 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
376
Krzysztof Kozlowski360d15d2014-04-22 16:00:25 +0200377 if (device_may_wakeup(dev))
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100378 enable_irq_wake(sec_pmic->irq);
Krzysztof Kozlowski360d15d2014-04-22 16:00:25 +0200379 /*
380 * PMIC IRQ must be disabled during suspend for RTC alarm
381 * to work properly.
382 * When device is woken up from suspend, an
383 * interrupt occurs before resuming I2C bus controller.
384 * The interrupt is handled by regmap_irq_thread which tries
385 * to read RTC registers. This read fails (I2C is still
386 * suspended) and RTC Alarm interrupt is disabled.
387 */
388 disable_irq(sec_pmic->irq);
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100389
390 return 0;
391}
392
393static int sec_pmic_resume(struct device *dev)
394{
395 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
396 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
397
Krzysztof Kozlowski360d15d2014-04-22 16:00:25 +0200398 if (device_may_wakeup(dev))
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100399 disable_irq_wake(sec_pmic->irq);
Krzysztof Kozlowski360d15d2014-04-22 16:00:25 +0200400 enable_irq(sec_pmic->irq);
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100401
402 return 0;
403}
Geert Uytterhoeven8321bbf2014-01-26 11:38:43 +0100404#endif /* CONFIG_PM_SLEEP */
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100405
406static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume);
407
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900408static const struct i2c_device_id sec_pmic_id[] = {
409 { "sec_pmic", 0 },
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900410 { }
411};
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900412MODULE_DEVICE_TABLE(i2c, sec_pmic_id);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900413
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900414static struct i2c_driver sec_pmic_driver = {
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900415 .driver = {
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900416 .name = "sec_pmic",
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900417 .owner = THIS_MODULE,
Krzysztof Kozlowskif6d6daa2013-11-26 14:50:27 +0100418 .pm = &sec_pmic_pm_ops,
Amit Daniel Kachhap26aec0092013-02-03 15:49:47 -0800419 .of_match_table = of_match_ptr(sec_dt_match),
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900420 },
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900421 .probe = sec_pmic_probe,
422 .remove = sec_pmic_remove,
423 .id_table = sec_pmic_id,
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900424};
425
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900426static int __init sec_pmic_init(void)
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900427{
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900428 return i2c_add_driver(&sec_pmic_driver);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900429}
430
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900431subsys_initcall(sec_pmic_init);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900432
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900433static void __exit sec_pmic_exit(void)
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900434{
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900435 i2c_del_driver(&sec_pmic_driver);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900436}
Sangbeom Kim63063bf2012-07-11 21:06:55 +0900437module_exit(sec_pmic_exit);
Sangbeom Kim0f5f7072011-12-23 17:28:08 +0900438
439MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
440MODULE_DESCRIPTION("Core support for the S5M MFD");
441MODULE_LICENSE("GPL");