Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 1 | /* |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 2 | * sec-core.c |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 3 | * |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +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/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 Kamat | 1c5a099 | 2013-10-16 14:26:52 +0530 | [diff] [blame] | 20 | #include <linux/of.h> |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 21 | #include <linux/of_irq.h> |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 22 | #include <linux/interrupt.h> |
| 23 | #include <linux/pm_runtime.h> |
| 24 | #include <linux/mutex.h> |
| 25 | #include <linux/mfd/core.h> |
Sangbeom Kim | 54227bc | 2012-07-11 21:07:16 +0900 | [diff] [blame] | 26 | #include <linux/mfd/samsung/core.h> |
| 27 | #include <linux/mfd/samsung/irq.h> |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 28 | #include <linux/mfd/samsung/s2mpa01.h> |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 29 | #include <linux/mfd/samsung/s2mps11.h> |
Chanwoo Choi | 76b9840 | 2014-11-18 17:59:40 +0900 | [diff] [blame] | 30 | #include <linux/mfd/samsung/s2mps13.h> |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 31 | #include <linux/mfd/samsung/s2mps14.h> |
Thomas Abraham | 9e4808d | 2015-11-20 16:07:51 +0530 | [diff] [blame] | 32 | #include <linux/mfd/samsung/s2mps15.h> |
Chanwoo Choi | 00e2573 | 2014-06-25 16:14:45 +0900 | [diff] [blame] | 33 | #include <linux/mfd/samsung/s2mpu02.h> |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 34 | #include <linux/mfd/samsung/s5m8763.h> |
| 35 | #include <linux/mfd/samsung/s5m8767.h> |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 36 | #include <linux/regmap.h> |
| 37 | |
Geert Uytterhoeven | 5ac9855 | 2013-11-18 14:33:06 +0100 | [diff] [blame] | 38 | static const struct mfd_cell s5m8751_devs[] = { |
Sangbeom Kim | 88a1cfd | 2012-01-20 16:09:12 +0900 | [diff] [blame] | 39 | { |
| 40 | .name = "s5m8751-pmic", |
| 41 | }, { |
| 42 | .name = "s5m-charger", |
| 43 | }, { |
| 44 | .name = "s5m8751-codec", |
| 45 | }, |
| 46 | }; |
| 47 | |
Geert Uytterhoeven | 5ac9855 | 2013-11-18 14:33:06 +0100 | [diff] [blame] | 48 | static const struct mfd_cell s5m8763_devs[] = { |
Sangbeom Kim | 88a1cfd | 2012-01-20 16:09:12 +0900 | [diff] [blame] | 49 | { |
| 50 | .name = "s5m8763-pmic", |
| 51 | }, { |
| 52 | .name = "s5m-rtc", |
| 53 | }, { |
| 54 | .name = "s5m-charger", |
| 55 | }, |
| 56 | }; |
| 57 | |
Geert Uytterhoeven | 5ac9855 | 2013-11-18 14:33:06 +0100 | [diff] [blame] | 58 | static const struct mfd_cell s5m8767_devs[] = { |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 59 | { |
| 60 | .name = "s5m8767-pmic", |
| 61 | }, { |
| 62 | .name = "s5m-rtc", |
Tushar Behera | 39fed00 | 2013-12-26 15:49:00 +0530 | [diff] [blame] | 63 | }, { |
| 64 | .name = "s5m8767-clk", |
Krzysztof Kozlowski | 53c31b3 | 2014-03-17 10:19:17 +0100 | [diff] [blame] | 65 | .of_compatible = "samsung,s5m8767-clk", |
Tushar Behera | 39fed00 | 2013-12-26 15:49:00 +0530 | [diff] [blame] | 66 | } |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 67 | }; |
| 68 | |
Geert Uytterhoeven | 5ac9855 | 2013-11-18 14:33:06 +0100 | [diff] [blame] | 69 | static const struct mfd_cell s2mps11_devs[] = { |
Sangbeom Kim | 9b6d134 | 2012-07-11 21:07:55 +0900 | [diff] [blame] | 70 | { |
Alim Akhtar | 2fadbbf | 2015-11-20 16:18:26 +0530 | [diff] [blame] | 71 | .name = "s2mps11-regulator", |
Yadwinder Singh Brar | 3134bca | 2013-07-07 17:14:21 +0530 | [diff] [blame] | 72 | }, { |
Krzysztof Kozlowski | eea2e59 | 2015-03-17 13:36:17 +0100 | [diff] [blame] | 73 | .name = "s2mps14-rtc", |
| 74 | }, { |
Yadwinder Singh Brar | 3134bca | 2013-07-07 17:14:21 +0530 | [diff] [blame] | 75 | .name = "s2mps11-clk", |
Krzysztof Kozlowski | 53c31b3 | 2014-03-17 10:19:17 +0100 | [diff] [blame] | 76 | .of_compatible = "samsung,s2mps11-clk", |
Yadwinder Singh Brar | 3134bca | 2013-07-07 17:14:21 +0530 | [diff] [blame] | 77 | } |
Sangbeom Kim | 9b6d134 | 2012-07-11 21:07:55 +0900 | [diff] [blame] | 78 | }; |
| 79 | |
Chanwoo Choi | 3bc2ee9 | 2014-11-18 17:59:39 +0900 | [diff] [blame] | 80 | static const struct mfd_cell s2mps13_devs[] = { |
Alim Akhtar | 2fadbbf | 2015-11-20 16:18:26 +0530 | [diff] [blame] | 81 | { .name = "s2mps13-regulator", }, |
Chanwoo Choi | 3bc2ee9 | 2014-11-18 17:59:39 +0900 | [diff] [blame] | 82 | { .name = "s2mps13-rtc", }, |
| 83 | { |
| 84 | .name = "s2mps13-clk", |
| 85 | .of_compatible = "samsung,s2mps13-clk", |
| 86 | }, |
| 87 | }; |
| 88 | |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 89 | static const struct mfd_cell s2mps14_devs[] = { |
| 90 | { |
Alim Akhtar | 2fadbbf | 2015-11-20 16:18:26 +0530 | [diff] [blame] | 91 | .name = "s2mps14-regulator", |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 92 | }, { |
| 93 | .name = "s2mps14-rtc", |
| 94 | }, { |
| 95 | .name = "s2mps14-clk", |
Krzysztof Kozlowski | 53c31b3 | 2014-03-17 10:19:17 +0100 | [diff] [blame] | 96 | .of_compatible = "samsung,s2mps14-clk", |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 97 | } |
| 98 | }; |
| 99 | |
Thomas Abraham | 9e4808d | 2015-11-20 16:07:51 +0530 | [diff] [blame] | 100 | static const struct mfd_cell s2mps15_devs[] = { |
| 101 | { |
| 102 | .name = "s2mps15-regulator", |
| 103 | }, { |
| 104 | .name = "s2mps15-rtc", |
| 105 | }, { |
| 106 | .name = "s2mps13-clk", |
| 107 | .of_compatible = "samsung,s2mps13-clk", |
| 108 | }, |
| 109 | }; |
| 110 | |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 111 | static const struct mfd_cell s2mpa01_devs[] = { |
| 112 | { |
| 113 | .name = "s2mpa01-pmic", |
| 114 | }, |
| 115 | }; |
| 116 | |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 117 | static const struct mfd_cell s2mpu02_devs[] = { |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 118 | { |
Alim Akhtar | 2fadbbf | 2015-11-20 16:18:26 +0530 | [diff] [blame] | 119 | .name = "s2mpu02-regulator", |
Krzysztof Kozlowski | 644a374 | 2015-10-30 16:51:21 +0900 | [diff] [blame] | 120 | }, |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 121 | }; |
| 122 | |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 123 | #ifdef CONFIG_OF |
Krzysztof Kozlowski | df20b7c | 2014-05-13 12:58:46 +0200 | [diff] [blame] | 124 | static const struct of_device_id sec_dt_match[] = { |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 125 | { .compatible = "samsung,s5m8767-pmic", |
| 126 | .data = (void *)S5M8767X, |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 127 | }, { |
| 128 | .compatible = "samsung,s2mps11-pmic", |
Yadwinder Singh Brar | aa32aca | 2013-06-29 18:21:20 +0530 | [diff] [blame] | 129 | .data = (void *)S2MPS11X, |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 130 | }, { |
Chanwoo Choi | 3bc2ee9 | 2014-11-18 17:59:39 +0900 | [diff] [blame] | 131 | .compatible = "samsung,s2mps13-pmic", |
| 132 | .data = (void *)S2MPS13X, |
| 133 | }, { |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 134 | .compatible = "samsung,s2mps14-pmic", |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 135 | .data = (void *)S2MPS14X, |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 136 | }, { |
Thomas Abraham | 9e4808d | 2015-11-20 16:07:51 +0530 | [diff] [blame] | 137 | .compatible = "samsung,s2mps15-pmic", |
| 138 | .data = (void *)S2MPS15X, |
| 139 | }, { |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 140 | .compatible = "samsung,s2mpa01-pmic", |
| 141 | .data = (void *)S2MPA01, |
| 142 | }, { |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 143 | .compatible = "samsung,s2mpu02-pmic", |
| 144 | .data = (void *)S2MPU02, |
| 145 | }, { |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 146 | /* Sentinel */ |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 147 | }, |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 148 | }; |
| 149 | #endif |
| 150 | |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 151 | static bool s2mpa01_volatile(struct device *dev, unsigned int reg) |
| 152 | { |
| 153 | switch (reg) { |
| 154 | case S2MPA01_REG_INT1M: |
| 155 | case S2MPA01_REG_INT2M: |
| 156 | case S2MPA01_REG_INT3M: |
| 157 | return false; |
| 158 | default: |
| 159 | return true; |
| 160 | } |
| 161 | } |
| 162 | |
Mark Brown | 6b845ba | 2013-07-02 18:51:16 +0100 | [diff] [blame] | 163 | static bool s2mps11_volatile(struct device *dev, unsigned int reg) |
| 164 | { |
| 165 | switch (reg) { |
| 166 | case S2MPS11_REG_INT1M: |
| 167 | case S2MPS11_REG_INT2M: |
| 168 | case S2MPS11_REG_INT3M: |
| 169 | return false; |
| 170 | default: |
| 171 | return true; |
| 172 | } |
| 173 | } |
| 174 | |
Chanwoo Choi | 00e2573 | 2014-06-25 16:14:45 +0900 | [diff] [blame] | 175 | static bool s2mpu02_volatile(struct device *dev, unsigned int reg) |
| 176 | { |
| 177 | switch (reg) { |
| 178 | case S2MPU02_REG_INT1M: |
| 179 | case S2MPU02_REG_INT2M: |
| 180 | case S2MPU02_REG_INT3M: |
| 181 | return false; |
| 182 | default: |
| 183 | return true; |
| 184 | } |
| 185 | } |
| 186 | |
Mark Brown | 6b845ba | 2013-07-02 18:51:16 +0100 | [diff] [blame] | 187 | static bool s5m8763_volatile(struct device *dev, unsigned int reg) |
| 188 | { |
| 189 | switch (reg) { |
| 190 | case S5M8763_REG_IRQM1: |
| 191 | case S5M8763_REG_IRQM2: |
| 192 | case S5M8763_REG_IRQM3: |
| 193 | case S5M8763_REG_IRQM4: |
| 194 | return false; |
| 195 | default: |
| 196 | return true; |
| 197 | } |
| 198 | } |
| 199 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 200 | static const struct regmap_config sec_regmap_config = { |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 201 | .reg_bits = 8, |
| 202 | .val_bits = 8, |
| 203 | }; |
| 204 | |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 205 | static const struct regmap_config s2mpa01_regmap_config = { |
| 206 | .reg_bits = 8, |
| 207 | .val_bits = 8, |
| 208 | |
| 209 | .max_register = S2MPA01_REG_LDO_OVCB4, |
| 210 | .volatile_reg = s2mpa01_volatile, |
| 211 | .cache_type = REGCACHE_FLAT, |
| 212 | }; |
| 213 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 214 | static const struct regmap_config s2mps11_regmap_config = { |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 215 | .reg_bits = 8, |
| 216 | .val_bits = 8, |
| 217 | |
| 218 | .max_register = S2MPS11_REG_L38CTRL, |
Mark Brown | 6b845ba | 2013-07-02 18:51:16 +0100 | [diff] [blame] | 219 | .volatile_reg = s2mps11_volatile, |
| 220 | .cache_type = REGCACHE_FLAT, |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 221 | }; |
| 222 | |
Chanwoo Choi | 76b9840 | 2014-11-18 17:59:40 +0900 | [diff] [blame] | 223 | static const struct regmap_config s2mps13_regmap_config = { |
| 224 | .reg_bits = 8, |
| 225 | .val_bits = 8, |
| 226 | |
| 227 | .max_register = S2MPS13_REG_LDODSCH5, |
| 228 | .volatile_reg = s2mps11_volatile, |
| 229 | .cache_type = REGCACHE_FLAT, |
| 230 | }; |
| 231 | |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 232 | static const struct regmap_config s2mps14_regmap_config = { |
| 233 | .reg_bits = 8, |
| 234 | .val_bits = 8, |
| 235 | |
| 236 | .max_register = S2MPS14_REG_LDODSCH3, |
| 237 | .volatile_reg = s2mps11_volatile, |
| 238 | .cache_type = REGCACHE_FLAT, |
| 239 | }; |
| 240 | |
Thomas Abraham | 9e4808d | 2015-11-20 16:07:51 +0530 | [diff] [blame] | 241 | static const struct regmap_config s2mps15_regmap_config = { |
| 242 | .reg_bits = 8, |
| 243 | .val_bits = 8, |
| 244 | |
| 245 | .max_register = S2MPS15_REG_LDODSCH4, |
| 246 | .volatile_reg = s2mps11_volatile, |
| 247 | .cache_type = REGCACHE_FLAT, |
| 248 | }; |
| 249 | |
Chanwoo Choi | 00e2573 | 2014-06-25 16:14:45 +0900 | [diff] [blame] | 250 | static const struct regmap_config s2mpu02_regmap_config = { |
| 251 | .reg_bits = 8, |
| 252 | .val_bits = 8, |
| 253 | |
| 254 | .max_register = S2MPU02_REG_DVSDATA, |
| 255 | .volatile_reg = s2mpu02_volatile, |
| 256 | .cache_type = REGCACHE_FLAT, |
| 257 | }; |
| 258 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 259 | static const struct regmap_config s5m8763_regmap_config = { |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 260 | .reg_bits = 8, |
| 261 | .val_bits = 8, |
| 262 | |
| 263 | .max_register = S5M8763_REG_LBCNFG2, |
Mark Brown | 6b845ba | 2013-07-02 18:51:16 +0100 | [diff] [blame] | 264 | .volatile_reg = s5m8763_volatile, |
| 265 | .cache_type = REGCACHE_FLAT, |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 266 | }; |
| 267 | |
Krzysztof Kozlowski | a30fffb | 2013-11-28 09:09:43 +0100 | [diff] [blame] | 268 | static const struct regmap_config s5m8767_regmap_config = { |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 269 | .reg_bits = 8, |
| 270 | .val_bits = 8, |
| 271 | |
| 272 | .max_register = S5M8767_REG_LDO28CTRL, |
Mark Brown | 6b845ba | 2013-07-02 18:51:16 +0100 | [diff] [blame] | 273 | .volatile_reg = s2mps11_volatile, |
| 274 | .cache_type = REGCACHE_FLAT, |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 275 | }; |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 276 | |
Krzysztof Kozlowski | c2c9f1f | 2015-10-07 09:44:39 +0900 | [diff] [blame] | 277 | static void sec_pmic_dump_rev(struct sec_pmic_dev *sec_pmic) |
| 278 | { |
| 279 | unsigned int val; |
| 280 | |
| 281 | /* For each device type, the REG_ID is always the first register */ |
| 282 | if (!regmap_read(sec_pmic->regmap_pmic, S2MPS11_REG_ID, &val)) |
| 283 | dev_dbg(sec_pmic->dev, "Revision: 0x%x\n", val); |
| 284 | } |
| 285 | |
Krzysztof Kozlowski | 8a97d42 | 2015-10-07 09:44:41 +0900 | [diff] [blame] | 286 | static void sec_pmic_configure(struct sec_pmic_dev *sec_pmic) |
| 287 | { |
| 288 | int err; |
| 289 | |
| 290 | if (sec_pmic->device_type != S2MPS13X) |
| 291 | return; |
| 292 | |
| 293 | if (sec_pmic->pdata->disable_wrstbi) { |
| 294 | /* |
| 295 | * If WRSTBI pin is pulled down this feature must be disabled |
| 296 | * because each Suspend to RAM will trigger buck voltage reset |
| 297 | * to default values. |
| 298 | */ |
| 299 | err = regmap_update_bits(sec_pmic->regmap_pmic, |
| 300 | S2MPS13_REG_WRSTBI, |
| 301 | S2MPS13_REG_WRSTBI_MASK, 0x0); |
| 302 | if (err) |
| 303 | dev_warn(sec_pmic->dev, |
| 304 | "Cannot initialize WRSTBI config: %d\n", |
| 305 | err); |
| 306 | } |
| 307 | } |
| 308 | |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 309 | #ifdef CONFIG_OF |
| 310 | /* |
| 311 | * Only the common platform data elements for s5m8767 are parsed here from the |
| 312 | * device tree. Other sub-modules of s5m8767 such as pmic, rtc , charger and |
| 313 | * others have to parse their own platform data elements from device tree. |
| 314 | * |
| 315 | * The s5m8767 platform data structure is instantiated here and the drivers for |
| 316 | * the sub-modules need not instantiate another instance while parsing their |
| 317 | * platform data. |
| 318 | */ |
| 319 | static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata( |
| 320 | struct device *dev) |
| 321 | { |
| 322 | struct sec_platform_data *pd; |
| 323 | |
| 324 | pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); |
Krzysztof Kozlowski | 82a00c4 | 2015-02-26 10:13:51 +0100 | [diff] [blame] | 325 | if (!pd) |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 326 | return ERR_PTR(-ENOMEM); |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 327 | |
| 328 | /* |
| 329 | * ToDo: the 'wakeup' member in the platform data is more of a linux |
| 330 | * specfic information. Hence, there is no binding for that yet and |
| 331 | * not parsed here. |
| 332 | */ |
| 333 | |
Krzysztof Kozlowski | d785334 | 2015-09-14 21:12:45 +0900 | [diff] [blame] | 334 | pd->manual_poweroff = of_property_read_bool(dev->of_node, |
| 335 | "samsung,s2mps11-acokb-ground"); |
Krzysztof Kozlowski | 8a97d42 | 2015-10-07 09:44:41 +0900 | [diff] [blame] | 336 | pd->disable_wrstbi = of_property_read_bool(dev->of_node, |
| 337 | "samsung,s2mps11-wrstbi-ground"); |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 338 | return pd; |
| 339 | } |
| 340 | #else |
Mark Brown | 197bf85 | 2013-02-04 18:31:25 +0000 | [diff] [blame] | 341 | static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata( |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 342 | struct device *dev) |
| 343 | { |
Wei Yongjun | 005718c | 2013-12-07 14:02:15 +0800 | [diff] [blame] | 344 | return NULL; |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 345 | } |
| 346 | #endif |
| 347 | |
Pankaj Dubey | 8f695de | 2014-03-13 11:14:07 +0900 | [diff] [blame] | 348 | static inline unsigned long sec_i2c_get_driver_data(struct i2c_client *i2c, |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 349 | const struct i2c_device_id *id) |
| 350 | { |
| 351 | #ifdef CONFIG_OF |
| 352 | if (i2c->dev.of_node) { |
| 353 | const struct of_device_id *match; |
Lee Jones | b6c1cb4 | 2014-07-21 13:09:25 +0100 | [diff] [blame] | 354 | |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 355 | match = of_match_node(sec_dt_match, i2c->dev.of_node); |
Pankaj Dubey | 8f695de | 2014-03-13 11:14:07 +0900 | [diff] [blame] | 356 | return (unsigned long)match->data; |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 357 | } |
| 358 | #endif |
Pankaj Dubey | 8f695de | 2014-03-13 11:14:07 +0900 | [diff] [blame] | 359 | return id->driver_data; |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 360 | } |
| 361 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 362 | static int sec_pmic_probe(struct i2c_client *i2c, |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 363 | const struct i2c_device_id *id) |
| 364 | { |
Jingoo Han | 334a41c | 2013-07-30 17:10:05 +0900 | [diff] [blame] | 365 | struct sec_platform_data *pdata = dev_get_platdata(&i2c->dev); |
Krzysztof Kozlowski | e349c91 | 2014-04-14 09:40:45 +0200 | [diff] [blame] | 366 | const struct regmap_config *regmap; |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 367 | const struct mfd_cell *sec_devs; |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 368 | struct sec_pmic_dev *sec_pmic; |
Krzysztof Kozlowski | 9549b5f | 2014-04-23 16:13:05 +0200 | [diff] [blame] | 369 | unsigned long device_type; |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 370 | int ret, num_sec_devs; |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 371 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 372 | sec_pmic = devm_kzalloc(&i2c->dev, sizeof(struct sec_pmic_dev), |
Sangbeom Kim | 621210e | 2012-01-20 16:09:11 +0900 | [diff] [blame] | 373 | GFP_KERNEL); |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 374 | if (sec_pmic == NULL) |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 375 | return -ENOMEM; |
| 376 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 377 | i2c_set_clientdata(i2c, sec_pmic); |
| 378 | sec_pmic->dev = &i2c->dev; |
| 379 | sec_pmic->i2c = i2c; |
| 380 | sec_pmic->irq = i2c->irq; |
Krzysztof Kozlowski | 9549b5f | 2014-04-23 16:13:05 +0200 | [diff] [blame] | 381 | device_type = sec_i2c_get_driver_data(i2c, id); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 382 | |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 383 | if (sec_pmic->dev->of_node) { |
| 384 | pdata = sec_pmic_i2c_parse_dt_pdata(sec_pmic->dev); |
| 385 | if (IS_ERR(pdata)) { |
| 386 | ret = PTR_ERR(pdata); |
| 387 | return ret; |
| 388 | } |
Krzysztof Kozlowski | 9549b5f | 2014-04-23 16:13:05 +0200 | [diff] [blame] | 389 | pdata->device_type = device_type; |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 390 | } |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 391 | if (pdata) { |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 392 | sec_pmic->device_type = pdata->device_type; |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 393 | sec_pmic->irq_base = pdata->irq_base; |
| 394 | sec_pmic->wakeup = pdata->wakeup; |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 395 | sec_pmic->pdata = pdata; |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 396 | } |
| 397 | |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 398 | switch (sec_pmic->device_type) { |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 399 | case S2MPA01: |
| 400 | regmap = &s2mpa01_regmap_config; |
| 401 | break; |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 402 | case S2MPS11X: |
| 403 | regmap = &s2mps11_regmap_config; |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 404 | break; |
Chanwoo Choi | 76b9840 | 2014-11-18 17:59:40 +0900 | [diff] [blame] | 405 | case S2MPS13X: |
| 406 | regmap = &s2mps13_regmap_config; |
| 407 | break; |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 408 | case S2MPS14X: |
| 409 | regmap = &s2mps14_regmap_config; |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 410 | break; |
Thomas Abraham | 9e4808d | 2015-11-20 16:07:51 +0530 | [diff] [blame] | 411 | case S2MPS15X: |
| 412 | regmap = &s2mps15_regmap_config; |
| 413 | break; |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 414 | case S5M8763X: |
| 415 | regmap = &s5m8763_regmap_config; |
| 416 | break; |
| 417 | case S5M8767X: |
| 418 | regmap = &s5m8767_regmap_config; |
| 419 | break; |
Chanwoo Choi | 00e2573 | 2014-06-25 16:14:45 +0900 | [diff] [blame] | 420 | case S2MPU02: |
| 421 | regmap = &s2mpu02_regmap_config; |
| 422 | break; |
Mark Brown | 25f311f | 2013-07-01 23:02:19 +0100 | [diff] [blame] | 423 | default: |
| 424 | regmap = &sec_regmap_config; |
| 425 | break; |
| 426 | } |
| 427 | |
Krzysztof Kozlowski | 3e1e4a5 | 2013-12-12 17:12:31 -0800 | [diff] [blame] | 428 | sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap); |
| 429 | if (IS_ERR(sec_pmic->regmap_pmic)) { |
| 430 | ret = PTR_ERR(sec_pmic->regmap_pmic); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 431 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
Axel Lin | 61a2af3 | 2012-02-28 14:23:55 +0800 | [diff] [blame] | 432 | ret); |
Axel Lin | 1092e1c | 2012-04-25 10:03:44 +0800 | [diff] [blame] | 433 | return ret; |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 434 | } |
| 435 | |
Jonghwan Choi | c3ebb30 | 2012-01-16 09:08:42 +0900 | [diff] [blame] | 436 | if (pdata && pdata->cfg_pmic_irq) |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 437 | pdata->cfg_pmic_irq(); |
| 438 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 439 | sec_irq_init(sec_pmic); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 440 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 441 | pm_runtime_set_active(sec_pmic->dev); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 442 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 443 | switch (sec_pmic->device_type) { |
Sangbeom Kim | 88a1cfd | 2012-01-20 16:09:12 +0900 | [diff] [blame] | 444 | case S5M8751X: |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 445 | sec_devs = s5m8751_devs; |
| 446 | num_sec_devs = ARRAY_SIZE(s5m8751_devs); |
Sangbeom Kim | 88a1cfd | 2012-01-20 16:09:12 +0900 | [diff] [blame] | 447 | break; |
| 448 | case S5M8763X: |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 449 | sec_devs = s5m8763_devs; |
| 450 | num_sec_devs = ARRAY_SIZE(s5m8763_devs); |
Sangbeom Kim | 88a1cfd | 2012-01-20 16:09:12 +0900 | [diff] [blame] | 451 | break; |
| 452 | case S5M8767X: |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 453 | sec_devs = s5m8767_devs; |
| 454 | num_sec_devs = ARRAY_SIZE(s5m8767_devs); |
Sangbeom Kim | 88a1cfd | 2012-01-20 16:09:12 +0900 | [diff] [blame] | 455 | break; |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 456 | case S2MPA01: |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 457 | sec_devs = s2mpa01_devs; |
| 458 | num_sec_devs = ARRAY_SIZE(s2mpa01_devs); |
Sachin Kamat | ce24991 | 2014-03-14 17:21:57 +0530 | [diff] [blame] | 459 | break; |
Sangbeom Kim | 9b6d134 | 2012-07-11 21:07:55 +0900 | [diff] [blame] | 460 | case S2MPS11X: |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 461 | sec_devs = s2mps11_devs; |
| 462 | num_sec_devs = ARRAY_SIZE(s2mps11_devs); |
Sangbeom Kim | 9b6d134 | 2012-07-11 21:07:55 +0900 | [diff] [blame] | 463 | break; |
Chanwoo Choi | 3bc2ee9 | 2014-11-18 17:59:39 +0900 | [diff] [blame] | 464 | case S2MPS13X: |
| 465 | sec_devs = s2mps13_devs; |
| 466 | num_sec_devs = ARRAY_SIZE(s2mps13_devs); |
| 467 | break; |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 468 | case S2MPS14X: |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 469 | sec_devs = s2mps14_devs; |
| 470 | num_sec_devs = ARRAY_SIZE(s2mps14_devs); |
| 471 | break; |
Thomas Abraham | 9e4808d | 2015-11-20 16:07:51 +0530 | [diff] [blame] | 472 | case S2MPS15X: |
| 473 | sec_devs = s2mps15_devs; |
| 474 | num_sec_devs = ARRAY_SIZE(s2mps15_devs); |
| 475 | break; |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 476 | case S2MPU02: |
| 477 | sec_devs = s2mpu02_devs; |
| 478 | num_sec_devs = ARRAY_SIZE(s2mpu02_devs); |
Krzysztof Kozlowski | dc69196 | 2014-02-28 11:41:44 +0100 | [diff] [blame] | 479 | break; |
Sangbeom Kim | 88a1cfd | 2012-01-20 16:09:12 +0900 | [diff] [blame] | 480 | default: |
| 481 | /* If this happens the probe function is problem */ |
| 482 | BUG(); |
| 483 | } |
Chanwoo Choi | 54e8827 | 2014-06-25 16:14:44 +0900 | [diff] [blame] | 484 | ret = mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs, NULL, |
| 485 | 0, NULL); |
Leon Romanovsky | 15447a46 | 2013-05-15 18:00:48 +0300 | [diff] [blame] | 486 | if (ret) |
Krzysztof Kozlowski | 8c66eec | 2014-03-18 13:57:50 +0100 | [diff] [blame] | 487 | goto err_mfd; |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 488 | |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 489 | device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); |
Krzysztof Kozlowski | 8a97d42 | 2015-10-07 09:44:41 +0900 | [diff] [blame] | 490 | sec_pmic_configure(sec_pmic); |
Krzysztof Kozlowski | c2c9f1f | 2015-10-07 09:44:39 +0900 | [diff] [blame] | 491 | sec_pmic_dump_rev(sec_pmic); |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 492 | |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 493 | return ret; |
| 494 | |
Krzysztof Kozlowski | 8c66eec | 2014-03-18 13:57:50 +0100 | [diff] [blame] | 495 | err_mfd: |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 496 | sec_irq_exit(sec_pmic); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 497 | return ret; |
| 498 | } |
| 499 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 500 | static int sec_pmic_remove(struct i2c_client *i2c) |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 501 | { |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 502 | struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 503 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 504 | mfd_remove_devices(sec_pmic->dev); |
| 505 | sec_irq_exit(sec_pmic); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 506 | return 0; |
| 507 | } |
| 508 | |
Krzysztof Kozlowski | d785334 | 2015-09-14 21:12:45 +0900 | [diff] [blame] | 509 | static void sec_pmic_shutdown(struct i2c_client *i2c) |
| 510 | { |
| 511 | struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); |
| 512 | unsigned int reg, mask; |
| 513 | |
| 514 | if (!sec_pmic->pdata->manual_poweroff) |
| 515 | return; |
| 516 | |
| 517 | switch (sec_pmic->device_type) { |
| 518 | case S2MPS11X: |
| 519 | reg = S2MPS11_REG_CTRL1; |
| 520 | mask = S2MPS11_CTRL1_PWRHOLD_MASK; |
| 521 | break; |
| 522 | default: |
| 523 | /* |
| 524 | * Currently only one board with S2MPS11 needs this, so just |
| 525 | * ignore the rest. |
| 526 | */ |
| 527 | dev_warn(sec_pmic->dev, |
| 528 | "Unsupported device %lu for manual power off\n", |
| 529 | sec_pmic->device_type); |
| 530 | return; |
| 531 | } |
| 532 | |
| 533 | regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0); |
| 534 | } |
| 535 | |
Geert Uytterhoeven | 8321bbf | 2014-01-26 11:38:43 +0100 | [diff] [blame] | 536 | #ifdef CONFIG_PM_SLEEP |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 537 | static int sec_pmic_suspend(struct device *dev) |
| 538 | { |
Geliang Tang | 1b5420e | 2015-12-28 23:00:14 +0800 | [diff] [blame] | 539 | struct i2c_client *i2c = to_i2c_client(dev); |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 540 | struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); |
| 541 | |
Krzysztof Kozlowski | 360d15d | 2014-04-22 16:00:25 +0200 | [diff] [blame] | 542 | if (device_may_wakeup(dev)) |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 543 | enable_irq_wake(sec_pmic->irq); |
Krzysztof Kozlowski | 360d15d | 2014-04-22 16:00:25 +0200 | [diff] [blame] | 544 | /* |
| 545 | * PMIC IRQ must be disabled during suspend for RTC alarm |
| 546 | * to work properly. |
| 547 | * When device is woken up from suspend, an |
| 548 | * interrupt occurs before resuming I2C bus controller. |
| 549 | * The interrupt is handled by regmap_irq_thread which tries |
| 550 | * to read RTC registers. This read fails (I2C is still |
| 551 | * suspended) and RTC Alarm interrupt is disabled. |
| 552 | */ |
| 553 | disable_irq(sec_pmic->irq); |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 554 | |
| 555 | return 0; |
| 556 | } |
| 557 | |
| 558 | static int sec_pmic_resume(struct device *dev) |
| 559 | { |
Geliang Tang | 1b5420e | 2015-12-28 23:00:14 +0800 | [diff] [blame] | 560 | struct i2c_client *i2c = to_i2c_client(dev); |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 561 | struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); |
| 562 | |
Krzysztof Kozlowski | 360d15d | 2014-04-22 16:00:25 +0200 | [diff] [blame] | 563 | if (device_may_wakeup(dev)) |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 564 | disable_irq_wake(sec_pmic->irq); |
Krzysztof Kozlowski | 360d15d | 2014-04-22 16:00:25 +0200 | [diff] [blame] | 565 | enable_irq(sec_pmic->irq); |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 566 | |
| 567 | return 0; |
| 568 | } |
Geert Uytterhoeven | 8321bbf | 2014-01-26 11:38:43 +0100 | [diff] [blame] | 569 | #endif /* CONFIG_PM_SLEEP */ |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 570 | |
| 571 | static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume); |
| 572 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 573 | static const struct i2c_device_id sec_pmic_id[] = { |
| 574 | { "sec_pmic", 0 }, |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 575 | { } |
| 576 | }; |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 577 | MODULE_DEVICE_TABLE(i2c, sec_pmic_id); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 578 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 579 | static struct i2c_driver sec_pmic_driver = { |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 580 | .driver = { |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 581 | .name = "sec_pmic", |
Krzysztof Kozlowski | f6d6daa | 2013-11-26 14:50:27 +0100 | [diff] [blame] | 582 | .pm = &sec_pmic_pm_ops, |
Amit Daniel Kachhap | 26aec009 | 2013-02-03 15:49:47 -0800 | [diff] [blame] | 583 | .of_match_table = of_match_ptr(sec_dt_match), |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 584 | }, |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 585 | .probe = sec_pmic_probe, |
| 586 | .remove = sec_pmic_remove, |
Krzysztof Kozlowski | d785334 | 2015-09-14 21:12:45 +0900 | [diff] [blame] | 587 | .shutdown = sec_pmic_shutdown, |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 588 | .id_table = sec_pmic_id, |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 589 | }; |
| 590 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 591 | static int __init sec_pmic_init(void) |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 592 | { |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 593 | return i2c_add_driver(&sec_pmic_driver); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 594 | } |
| 595 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 596 | subsys_initcall(sec_pmic_init); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 597 | |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 598 | static void __exit sec_pmic_exit(void) |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 599 | { |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 600 | i2c_del_driver(&sec_pmic_driver); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 601 | } |
Sangbeom Kim | 63063bf | 2012-07-11 21:06:55 +0900 | [diff] [blame] | 602 | module_exit(sec_pmic_exit); |
Sangbeom Kim | 0f5f707 | 2011-12-23 17:28:08 +0900 | [diff] [blame] | 603 | |
| 604 | MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>"); |
| 605 | MODULE_DESCRIPTION("Core support for the S5M MFD"); |
| 606 | MODULE_LICENSE("GPL"); |