diff options
-rw-r--r-- | drivers/mfd/sec-core.c | 48 | ||||
-rw-r--r-- | drivers/mfd/sec-irq.c | 89 | ||||
-rw-r--r-- | include/linux/mfd/samsung/core.h | 1 | ||||
-rw-r--r-- | include/linux/mfd/samsung/irq.h | 27 | ||||
-rw-r--r-- | include/linux/mfd/samsung/rtc.h | 55 | ||||
-rw-r--r-- | include/linux/mfd/samsung/s2mps14.h | 152 |
6 files changed, 360 insertions, 12 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 9623899e6f7c..a4df76c160f8 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/mfd/samsung/irq.h> | 27 | #include <linux/mfd/samsung/irq.h> |
28 | #include <linux/mfd/samsung/rtc.h> | 28 | #include <linux/mfd/samsung/rtc.h> |
29 | #include <linux/mfd/samsung/s2mps11.h> | 29 | #include <linux/mfd/samsung/s2mps11.h> |
30 | #include <linux/mfd/samsung/s2mps14.h> | ||
30 | #include <linux/mfd/samsung/s5m8763.h> | 31 | #include <linux/mfd/samsung/s5m8763.h> |
31 | #include <linux/mfd/samsung/s5m8767.h> | 32 | #include <linux/mfd/samsung/s5m8767.h> |
32 | #include <linux/regmap.h> | 33 | #include <linux/regmap.h> |
@@ -69,6 +70,16 @@ static const struct mfd_cell s2mps11_devs[] = { | |||
69 | } | 70 | } |
70 | }; | 71 | }; |
71 | 72 | ||
73 | static const struct mfd_cell s2mps14_devs[] = { | ||
74 | { | ||
75 | .name = "s2mps14-pmic", | ||
76 | }, { | ||
77 | .name = "s2mps14-rtc", | ||
78 | }, { | ||
79 | .name = "s2mps14-clk", | ||
80 | } | ||
81 | }; | ||
82 | |||
72 | #ifdef CONFIG_OF | 83 | #ifdef CONFIG_OF |
73 | static struct of_device_id sec_dt_match[] = { | 84 | static struct of_device_id sec_dt_match[] = { |
74 | { .compatible = "samsung,s5m8767-pmic", | 85 | { .compatible = "samsung,s5m8767-pmic", |
@@ -77,6 +88,9 @@ static struct of_device_id sec_dt_match[] = { | |||
77 | { .compatible = "samsung,s2mps11-pmic", | 88 | { .compatible = "samsung,s2mps11-pmic", |
78 | .data = (void *)S2MPS11X, | 89 | .data = (void *)S2MPS11X, |
79 | }, | 90 | }, |
91 | { .compatible = "samsung,s2mps14-pmic", | ||
92 | .data = (void *)S2MPS14X, | ||
93 | }, | ||
80 | {}, | 94 | {}, |
81 | }; | 95 | }; |
82 | #endif | 96 | #endif |
@@ -120,6 +134,15 @@ static const struct regmap_config s2mps11_regmap_config = { | |||
120 | .cache_type = REGCACHE_FLAT, | 134 | .cache_type = REGCACHE_FLAT, |
121 | }; | 135 | }; |
122 | 136 | ||
137 | static const struct regmap_config s2mps14_regmap_config = { | ||
138 | .reg_bits = 8, | ||
139 | .val_bits = 8, | ||
140 | |||
141 | .max_register = S2MPS14_REG_LDODSCH3, | ||
142 | .volatile_reg = s2mps11_volatile, | ||
143 | .cache_type = REGCACHE_FLAT, | ||
144 | }; | ||
145 | |||
123 | static const struct regmap_config s5m8763_regmap_config = { | 146 | static const struct regmap_config s5m8763_regmap_config = { |
124 | .reg_bits = 8, | 147 | .reg_bits = 8, |
125 | .val_bits = 8, | 148 | .val_bits = 8, |
@@ -138,13 +161,20 @@ static const struct regmap_config s5m8767_regmap_config = { | |||
138 | .cache_type = REGCACHE_FLAT, | 161 | .cache_type = REGCACHE_FLAT, |
139 | }; | 162 | }; |
140 | 163 | ||
141 | static const struct regmap_config sec_rtc_regmap_config = { | 164 | static const struct regmap_config s5m_rtc_regmap_config = { |
142 | .reg_bits = 8, | 165 | .reg_bits = 8, |
143 | .val_bits = 8, | 166 | .val_bits = 8, |
144 | 167 | ||
145 | .max_register = SEC_RTC_REG_MAX, | 168 | .max_register = SEC_RTC_REG_MAX, |
146 | }; | 169 | }; |
147 | 170 | ||
171 | static const struct regmap_config s2mps14_rtc_regmap_config = { | ||
172 | .reg_bits = 8, | ||
173 | .val_bits = 8, | ||
174 | |||
175 | .max_register = S2MPS_RTC_REG_MAX, | ||
176 | }; | ||
177 | |||
148 | #ifdef CONFIG_OF | 178 | #ifdef CONFIG_OF |
149 | /* | 179 | /* |
150 | * Only the common platform data elements for s5m8767 are parsed here from the | 180 | * Only the common platform data elements for s5m8767 are parsed here from the |
@@ -239,19 +269,23 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
239 | * However we must pass something to devm_regmap_init_i2c() | 269 | * However we must pass something to devm_regmap_init_i2c() |
240 | * so use S5M-like regmap config even though it wouldn't work. | 270 | * so use S5M-like regmap config even though it wouldn't work. |
241 | */ | 271 | */ |
242 | regmap_rtc = &sec_rtc_regmap_config; | 272 | regmap_rtc = &s5m_rtc_regmap_config; |
273 | break; | ||
274 | case S2MPS14X: | ||
275 | regmap = &s2mps14_regmap_config; | ||
276 | regmap_rtc = &s2mps14_rtc_regmap_config; | ||
243 | break; | 277 | break; |
244 | case S5M8763X: | 278 | case S5M8763X: |
245 | regmap = &s5m8763_regmap_config; | 279 | regmap = &s5m8763_regmap_config; |
246 | regmap_rtc = &sec_rtc_regmap_config; | 280 | regmap_rtc = &s5m_rtc_regmap_config; |
247 | break; | 281 | break; |
248 | case S5M8767X: | 282 | case S5M8767X: |
249 | regmap = &s5m8767_regmap_config; | 283 | regmap = &s5m8767_regmap_config; |
250 | regmap_rtc = &sec_rtc_regmap_config; | 284 | regmap_rtc = &s5m_rtc_regmap_config; |
251 | break; | 285 | break; |
252 | default: | 286 | default: |
253 | regmap = &sec_regmap_config; | 287 | regmap = &sec_regmap_config; |
254 | regmap_rtc = &sec_rtc_regmap_config; | 288 | regmap_rtc = &s5m_rtc_regmap_config; |
255 | break; | 289 | break; |
256 | } | 290 | } |
257 | 291 | ||
@@ -298,6 +332,10 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
298 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, | 332 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, |
299 | ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL); | 333 | ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL); |
300 | break; | 334 | break; |
335 | case S2MPS14X: | ||
336 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mps14_devs, | ||
337 | ARRAY_SIZE(s2mps14_devs), NULL, 0, NULL); | ||
338 | break; | ||
301 | default: | 339 | default: |
302 | /* If this happens the probe function is problem */ | 340 | /* If this happens the probe function is problem */ |
303 | BUG(); | 341 | BUG(); |
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index e403c293b437..64e7913aadc6 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * sec-irq.c | 2 | * sec-irq.c |
3 | * | 3 | * |
4 | * Copyright (c) 2011 Samsung Electronics Co., Ltd | 4 | * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd |
5 | * http://www.samsung.com | 5 | * http://www.samsung.com |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/mfd/samsung/core.h> | 19 | #include <linux/mfd/samsung/core.h> |
20 | #include <linux/mfd/samsung/irq.h> | 20 | #include <linux/mfd/samsung/irq.h> |
21 | #include <linux/mfd/samsung/s2mps11.h> | 21 | #include <linux/mfd/samsung/s2mps11.h> |
22 | #include <linux/mfd/samsung/s2mps14.h> | ||
22 | #include <linux/mfd/samsung/s5m8763.h> | 23 | #include <linux/mfd/samsung/s5m8763.h> |
23 | #include <linux/mfd/samsung/s5m8767.h> | 24 | #include <linux/mfd/samsung/s5m8767.h> |
24 | 25 | ||
@@ -89,6 +90,76 @@ static const struct regmap_irq s2mps11_irqs[] = { | |||
89 | }, | 90 | }, |
90 | }; | 91 | }; |
91 | 92 | ||
93 | static const struct regmap_irq s2mps14_irqs[] = { | ||
94 | [S2MPS14_IRQ_PWRONF] = { | ||
95 | .reg_offset = 0, | ||
96 | .mask = S2MPS11_IRQ_PWRONF_MASK, | ||
97 | }, | ||
98 | [S2MPS14_IRQ_PWRONR] = { | ||
99 | .reg_offset = 0, | ||
100 | .mask = S2MPS11_IRQ_PWRONR_MASK, | ||
101 | }, | ||
102 | [S2MPS14_IRQ_JIGONBF] = { | ||
103 | .reg_offset = 0, | ||
104 | .mask = S2MPS11_IRQ_JIGONBF_MASK, | ||
105 | }, | ||
106 | [S2MPS14_IRQ_JIGONBR] = { | ||
107 | .reg_offset = 0, | ||
108 | .mask = S2MPS11_IRQ_JIGONBR_MASK, | ||
109 | }, | ||
110 | [S2MPS14_IRQ_ACOKBF] = { | ||
111 | .reg_offset = 0, | ||
112 | .mask = S2MPS11_IRQ_ACOKBF_MASK, | ||
113 | }, | ||
114 | [S2MPS14_IRQ_ACOKBR] = { | ||
115 | .reg_offset = 0, | ||
116 | .mask = S2MPS11_IRQ_ACOKBR_MASK, | ||
117 | }, | ||
118 | [S2MPS14_IRQ_PWRON1S] = { | ||
119 | .reg_offset = 0, | ||
120 | .mask = S2MPS11_IRQ_PWRON1S_MASK, | ||
121 | }, | ||
122 | [S2MPS14_IRQ_MRB] = { | ||
123 | .reg_offset = 0, | ||
124 | .mask = S2MPS11_IRQ_MRB_MASK, | ||
125 | }, | ||
126 | [S2MPS14_IRQ_RTC60S] = { | ||
127 | .reg_offset = 1, | ||
128 | .mask = S2MPS11_IRQ_RTC60S_MASK, | ||
129 | }, | ||
130 | [S2MPS14_IRQ_RTCA1] = { | ||
131 | .reg_offset = 1, | ||
132 | .mask = S2MPS11_IRQ_RTCA1_MASK, | ||
133 | }, | ||
134 | [S2MPS14_IRQ_RTCA0] = { | ||
135 | .reg_offset = 1, | ||
136 | .mask = S2MPS11_IRQ_RTCA0_MASK, | ||
137 | }, | ||
138 | [S2MPS14_IRQ_SMPL] = { | ||
139 | .reg_offset = 1, | ||
140 | .mask = S2MPS11_IRQ_SMPL_MASK, | ||
141 | }, | ||
142 | [S2MPS14_IRQ_RTC1S] = { | ||
143 | .reg_offset = 1, | ||
144 | .mask = S2MPS11_IRQ_RTC1S_MASK, | ||
145 | }, | ||
146 | [S2MPS14_IRQ_WTSR] = { | ||
147 | .reg_offset = 1, | ||
148 | .mask = S2MPS11_IRQ_WTSR_MASK, | ||
149 | }, | ||
150 | [S2MPS14_IRQ_INT120C] = { | ||
151 | .reg_offset = 2, | ||
152 | .mask = S2MPS11_IRQ_INT120C_MASK, | ||
153 | }, | ||
154 | [S2MPS14_IRQ_INT140C] = { | ||
155 | .reg_offset = 2, | ||
156 | .mask = S2MPS11_IRQ_INT140C_MASK, | ||
157 | }, | ||
158 | [S2MPS14_IRQ_TSD] = { | ||
159 | .reg_offset = 2, | ||
160 | .mask = S2MPS14_IRQ_TSD_MASK, | ||
161 | }, | ||
162 | }; | ||
92 | 163 | ||
93 | static const struct regmap_irq s5m8767_irqs[] = { | 164 | static const struct regmap_irq s5m8767_irqs[] = { |
94 | [S5M8767_IRQ_PWRR] = { | 165 | [S5M8767_IRQ_PWRR] = { |
@@ -246,6 +317,16 @@ static const struct regmap_irq_chip s2mps11_irq_chip = { | |||
246 | .ack_base = S2MPS11_REG_INT1, | 317 | .ack_base = S2MPS11_REG_INT1, |
247 | }; | 318 | }; |
248 | 319 | ||
320 | static const struct regmap_irq_chip s2mps14_irq_chip = { | ||
321 | .name = "s2mps14", | ||
322 | .irqs = s2mps14_irqs, | ||
323 | .num_irqs = ARRAY_SIZE(s2mps14_irqs), | ||
324 | .num_regs = 3, | ||
325 | .status_base = S2MPS14_REG_INT1, | ||
326 | .mask_base = S2MPS14_REG_INT1M, | ||
327 | .ack_base = S2MPS14_REG_INT1, | ||
328 | }; | ||
329 | |||
249 | static const struct regmap_irq_chip s5m8767_irq_chip = { | 330 | static const struct regmap_irq_chip s5m8767_irq_chip = { |
250 | .name = "s5m8767", | 331 | .name = "s5m8767", |
251 | .irqs = s5m8767_irqs, | 332 | .irqs = s5m8767_irqs, |
@@ -297,6 +378,12 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) | |||
297 | sec_pmic->irq_base, &s2mps11_irq_chip, | 378 | sec_pmic->irq_base, &s2mps11_irq_chip, |
298 | &sec_pmic->irq_data); | 379 | &sec_pmic->irq_data); |
299 | break; | 380 | break; |
381 | case S2MPS14X: | ||
382 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, | ||
383 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | ||
384 | sec_pmic->irq_base, &s2mps14_irq_chip, | ||
385 | &sec_pmic->irq_data); | ||
386 | break; | ||
300 | default: | 387 | default: |
301 | dev_err(sec_pmic->dev, "Unknown device type %d\n", | 388 | dev_err(sec_pmic->dev, "Unknown device type %d\n", |
302 | sec_pmic->device_type); | 389 | sec_pmic->device_type); |
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index 41c9bde410c5..8e9bbb1083d4 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h | |||
@@ -19,6 +19,7 @@ enum sec_device_type { | |||
19 | S5M8763X, | 19 | S5M8763X, |
20 | S5M8767X, | 20 | S5M8767X, |
21 | S2MPS11X, | 21 | S2MPS11X, |
22 | S2MPS14X, | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | /** | 25 | /** |
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h index abe1a6aae3b7..0065f6f1daf4 100644 --- a/include/linux/mfd/samsung/irq.h +++ b/include/linux/mfd/samsung/irq.h | |||
@@ -55,6 +55,33 @@ enum s2mps11_irq { | |||
55 | #define S2MPS11_IRQ_INT120C_MASK (1 << 0) | 55 | #define S2MPS11_IRQ_INT120C_MASK (1 << 0) |
56 | #define S2MPS11_IRQ_INT140C_MASK (1 << 1) | 56 | #define S2MPS11_IRQ_INT140C_MASK (1 << 1) |
57 | 57 | ||
58 | enum s2mps14_irq { | ||
59 | S2MPS14_IRQ_PWRONF, | ||
60 | S2MPS14_IRQ_PWRONR, | ||
61 | S2MPS14_IRQ_JIGONBF, | ||
62 | S2MPS14_IRQ_JIGONBR, | ||
63 | S2MPS14_IRQ_ACOKBF, | ||
64 | S2MPS14_IRQ_ACOKBR, | ||
65 | S2MPS14_IRQ_PWRON1S, | ||
66 | S2MPS14_IRQ_MRB, | ||
67 | |||
68 | S2MPS14_IRQ_RTC60S, | ||
69 | S2MPS14_IRQ_RTCA1, | ||
70 | S2MPS14_IRQ_RTCA0, | ||
71 | S2MPS14_IRQ_SMPL, | ||
72 | S2MPS14_IRQ_RTC1S, | ||
73 | S2MPS14_IRQ_WTSR, | ||
74 | |||
75 | S2MPS14_IRQ_INT120C, | ||
76 | S2MPS14_IRQ_INT140C, | ||
77 | S2MPS14_IRQ_TSD, | ||
78 | |||
79 | S2MPS14_IRQ_NR, | ||
80 | }; | ||
81 | |||
82 | /* Masks for interrupts are the same as in s2mps11 */ | ||
83 | #define S2MPS14_IRQ_TSD_MASK (1 << 2) | ||
84 | |||
58 | enum s5m8767_irq { | 85 | enum s5m8767_irq { |
59 | S5M8767_IRQ_PWRR, | 86 | S5M8767_IRQ_PWRR, |
60 | S5M8767_IRQ_PWRF, | 87 | S5M8767_IRQ_PWRF, |
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h index 4627f59ebd84..3e02b768d537 100644 --- a/include/linux/mfd/samsung/rtc.h +++ b/include/linux/mfd/samsung/rtc.h | |||
@@ -1,12 +1,17 @@ | |||
1 | /* rtc.h | 1 | /* rtc.h |
2 | * | 2 | * |
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd | 3 | * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd |
4 | * http://www.samsung.com | 4 | * http://www.samsung.com |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms of the GNU General Public License as published by the | 7 | * under the terms of the GNU General Public License as published by the |
8 | * Free Software Foundation; either version 2 of the License, or (at your | 8 | * Free Software Foundation; either version 2 of the License, or (at your |
9 | * option) any later version. | 9 | * option) any later version. |
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
10 | * | 15 | * |
11 | */ | 16 | */ |
12 | 17 | ||
@@ -47,6 +52,37 @@ enum sec_rtc_reg { | |||
47 | SEC_RTC_REG_MAX, | 52 | SEC_RTC_REG_MAX, |
48 | }; | 53 | }; |
49 | 54 | ||
55 | enum s2mps_rtc_reg { | ||
56 | S2MPS_RTC_CTRL, | ||
57 | S2MPS_WTSR_SMPL_CNTL, | ||
58 | S2MPS_RTC_UDR_CON, | ||
59 | S2MPS_RSVD, | ||
60 | S2MPS_RTC_SEC, | ||
61 | S2MPS_RTC_MIN, | ||
62 | S2MPS_RTC_HOUR, | ||
63 | S2MPS_RTC_WEEKDAY, | ||
64 | S2MPS_RTC_DATE, | ||
65 | S2MPS_RTC_MONTH, | ||
66 | S2MPS_RTC_YEAR, | ||
67 | S2MPS_ALARM0_SEC, | ||
68 | S2MPS_ALARM0_MIN, | ||
69 | S2MPS_ALARM0_HOUR, | ||
70 | S2MPS_ALARM0_WEEKDAY, | ||
71 | S2MPS_ALARM0_DATE, | ||
72 | S2MPS_ALARM0_MONTH, | ||
73 | S2MPS_ALARM0_YEAR, | ||
74 | S2MPS_ALARM1_SEC, | ||
75 | S2MPS_ALARM1_MIN, | ||
76 | S2MPS_ALARM1_HOUR, | ||
77 | S2MPS_ALARM1_WEEKDAY, | ||
78 | S2MPS_ALARM1_DATE, | ||
79 | S2MPS_ALARM1_MONTH, | ||
80 | S2MPS_ALARM1_YEAR, | ||
81 | S2MPS_OFFSRC, | ||
82 | |||
83 | S2MPS_RTC_REG_MAX, | ||
84 | }; | ||
85 | |||
50 | #define RTC_I2C_ADDR (0x0C >> 1) | 86 | #define RTC_I2C_ADDR (0x0C >> 1) |
51 | 87 | ||
52 | #define HOUR_12 (1 << 7) | 88 | #define HOUR_12 (1 << 7) |
@@ -56,6 +92,9 @@ enum sec_rtc_reg { | |||
56 | #define ALARM1_STATUS (1 << 2) | 92 | #define ALARM1_STATUS (1 << 2) |
57 | #define UPDATE_AD (1 << 0) | 93 | #define UPDATE_AD (1 << 0) |
58 | 94 | ||
95 | #define S2MPS_ALARM0_STATUS (1 << 2) | ||
96 | #define S2MPS_ALARM1_STATUS (1 << 1) | ||
97 | |||
59 | /* RTC Control Register */ | 98 | /* RTC Control Register */ |
60 | #define BCD_EN_SHIFT 0 | 99 | #define BCD_EN_SHIFT 0 |
61 | #define BCD_EN_MASK (1 << BCD_EN_SHIFT) | 100 | #define BCD_EN_MASK (1 << BCD_EN_SHIFT) |
@@ -64,6 +103,10 @@ enum sec_rtc_reg { | |||
64 | /* RTC Update Register1 */ | 103 | /* RTC Update Register1 */ |
65 | #define RTC_UDR_SHIFT 0 | 104 | #define RTC_UDR_SHIFT 0 |
66 | #define RTC_UDR_MASK (1 << RTC_UDR_SHIFT) | 105 | #define RTC_UDR_MASK (1 << RTC_UDR_SHIFT) |
106 | #define S2MPS_RTC_WUDR_SHIFT 4 | ||
107 | #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) | ||
108 | #define S2MPS_RTC_RUDR_SHIFT 0 | ||
109 | #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) | ||
67 | #define RTC_TCON_SHIFT 1 | 110 | #define RTC_TCON_SHIFT 1 |
68 | #define RTC_TCON_MASK (1 << RTC_TCON_SHIFT) | 111 | #define RTC_TCON_MASK (1 << RTC_TCON_SHIFT) |
69 | #define RTC_TIME_EN_SHIFT 3 | 112 | #define RTC_TIME_EN_SHIFT 3 |
diff --git a/include/linux/mfd/samsung/s2mps14.h b/include/linux/mfd/samsung/s2mps14.h new file mode 100644 index 000000000000..ec1e0857ddde --- /dev/null +++ b/include/linux/mfd/samsung/s2mps14.h | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | * s2mps14.h | ||
3 | * | ||
4 | * Copyright (c) 2014 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 | * 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 | */ | ||
18 | |||
19 | #ifndef __LINUX_MFD_S2MPS14_H | ||
20 | #define __LINUX_MFD_S2MPS14_H | ||
21 | |||
22 | /* S2MPS14 registers */ | ||
23 | enum s2mps14_reg { | ||
24 | S2MPS14_REG_ID, | ||
25 | S2MPS14_REG_INT1, | ||
26 | S2MPS14_REG_INT2, | ||
27 | S2MPS14_REG_INT3, | ||
28 | S2MPS14_REG_INT1M, | ||
29 | S2MPS14_REG_INT2M, | ||
30 | S2MPS14_REG_INT3M, | ||
31 | S2MPS14_REG_ST1, | ||
32 | S2MPS14_REG_ST2, | ||
33 | S2MPS14_REG_PWRONSRC, | ||
34 | S2MPS14_REG_OFFSRC, | ||
35 | S2MPS14_REG_BU_CHG, | ||
36 | S2MPS14_REG_RTCCTRL, | ||
37 | S2MPS14_REG_CTRL1, | ||
38 | S2MPS14_REG_CTRL2, | ||
39 | S2MPS14_REG_RSVD1, | ||
40 | S2MPS14_REG_RSVD2, | ||
41 | S2MPS14_REG_RSVD3, | ||
42 | S2MPS14_REG_RSVD4, | ||
43 | S2MPS14_REG_RSVD5, | ||
44 | S2MPS14_REG_RSVD6, | ||
45 | S2MPS14_REG_CTRL3, | ||
46 | S2MPS14_REG_RSVD7, | ||
47 | S2MPS14_REG_RSVD8, | ||
48 | S2MPS14_REG_WRSTBI, | ||
49 | S2MPS14_REG_B1CTRL1, | ||
50 | S2MPS14_REG_B1CTRL2, | ||
51 | S2MPS14_REG_B2CTRL1, | ||
52 | S2MPS14_REG_B2CTRL2, | ||
53 | S2MPS14_REG_B3CTRL1, | ||
54 | S2MPS14_REG_B3CTRL2, | ||
55 | S2MPS14_REG_B4CTRL1, | ||
56 | S2MPS14_REG_B4CTRL2, | ||
57 | S2MPS14_REG_B5CTRL1, | ||
58 | S2MPS14_REG_B5CTRL2, | ||
59 | S2MPS14_REG_L1CTRL, | ||
60 | S2MPS14_REG_L2CTRL, | ||
61 | S2MPS14_REG_L3CTRL, | ||
62 | S2MPS14_REG_L4CTRL, | ||
63 | S2MPS14_REG_L5CTRL, | ||
64 | S2MPS14_REG_L6CTRL, | ||
65 | S2MPS14_REG_L7CTRL, | ||
66 | S2MPS14_REG_L8CTRL, | ||
67 | S2MPS14_REG_L9CTRL, | ||
68 | S2MPS14_REG_L10CTRL, | ||
69 | S2MPS14_REG_L11CTRL, | ||
70 | S2MPS14_REG_L12CTRL, | ||
71 | S2MPS14_REG_L13CTRL, | ||
72 | S2MPS14_REG_L14CTRL, | ||
73 | S2MPS14_REG_L15CTRL, | ||
74 | S2MPS14_REG_L16CTRL, | ||
75 | S2MPS14_REG_L17CTRL, | ||
76 | S2MPS14_REG_L18CTRL, | ||
77 | S2MPS14_REG_L19CTRL, | ||
78 | S2MPS14_REG_L20CTRL, | ||
79 | S2MPS14_REG_L21CTRL, | ||
80 | S2MPS14_REG_L22CTRL, | ||
81 | S2MPS14_REG_L23CTRL, | ||
82 | S2MPS14_REG_L24CTRL, | ||
83 | S2MPS14_REG_L25CTRL, | ||
84 | S2MPS14_REG_LDODSCH1, | ||
85 | S2MPS14_REG_LDODSCH2, | ||
86 | S2MPS14_REG_LDODSCH3, | ||
87 | }; | ||
88 | |||
89 | /* S2MPS14 regulator ids */ | ||
90 | enum s2mps14_regulators { | ||
91 | S2MPS14_LDO1, | ||
92 | S2MPS14_LDO2, | ||
93 | S2MPS14_LDO3, | ||
94 | S2MPS14_LDO4, | ||
95 | S2MPS14_LDO5, | ||
96 | S2MPS14_LDO6, | ||
97 | S2MPS14_LDO7, | ||
98 | S2MPS14_LDO8, | ||
99 | S2MPS14_LDO9, | ||
100 | S2MPS14_LDO10, | ||
101 | S2MPS14_LDO11, | ||
102 | S2MPS14_LDO12, | ||
103 | S2MPS14_LDO13, | ||
104 | S2MPS14_LDO14, | ||
105 | S2MPS14_LDO15, | ||
106 | S2MPS14_LDO16, | ||
107 | S2MPS14_LDO17, | ||
108 | S2MPS14_LDO18, | ||
109 | S2MPS14_LDO19, | ||
110 | S2MPS14_LDO20, | ||
111 | S2MPS14_LDO21, | ||
112 | S2MPS14_LDO22, | ||
113 | S2MPS14_LDO23, | ||
114 | S2MPS14_LDO24, | ||
115 | S2MPS14_LDO25, | ||
116 | S2MPS14_BUCK1, | ||
117 | S2MPS14_BUCK2, | ||
118 | S2MPS14_BUCK3, | ||
119 | S2MPS14_BUCK4, | ||
120 | S2MPS14_BUCK5, | ||
121 | |||
122 | S2MPS14_REGULATOR_MAX, | ||
123 | }; | ||
124 | |||
125 | /* Regulator constraints for BUCKx */ | ||
126 | #define S2MPS14_BUCK1235_MIN_600MV 600000 | ||
127 | #define S2MPS14_BUCK4_MIN_1400MV 1400000 | ||
128 | #define S2MPS14_BUCK1235_STEP_6_25MV 6250 | ||
129 | #define S2MPS14_BUCK4_STEP_12_5MV 12500 | ||
130 | #define S2MPS14_BUCK1235_START_SEL 0x20 | ||
131 | #define S2MPS14_BUCK4_START_SEL 0x40 | ||
132 | /* | ||
133 | * Default ramp delay in uv/us. Datasheet says that ramp delay can be | ||
134 | * controlled however it does not specify which register is used for that. | ||
135 | * Let's assume that default value will be set. | ||
136 | */ | ||
137 | #define S2MPS14_BUCK_RAMP_DELAY 12500 | ||
138 | |||
139 | /* Regulator constraints for different types of LDOx */ | ||
140 | #define S2MPS14_LDO_MIN_800MV 800000 | ||
141 | #define S2MPS14_LDO_MIN_1800MV 1800000 | ||
142 | #define S2MPS14_LDO_STEP_12_5MV 12500 | ||
143 | #define S2MPS14_LDO_STEP_25MV 25000 | ||
144 | |||
145 | #define S2MPS14_LDO_VSEL_MASK 0x3F | ||
146 | #define S2MPS14_BUCK_VSEL_MASK 0xFF | ||
147 | #define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT) | ||
148 | #define S2MPS14_ENABLE_SHIFT 6 | ||
149 | #define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1) | ||
150 | #define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1) | ||
151 | |||
152 | #endif /* __LINUX_MFD_S2MPS14_H */ | ||