diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2014-03-14 07:51:57 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-03-18 06:56:17 -0400 |
commit | ce24991e1e4d7bee05bcc0e156b0b1c2ef791dd3 (patch) | |
tree | 385fd59e3e0f233b43e9180ca2eb01d61c9760d5 | |
parent | 8f695de515b9e08e30c5b7fae48c0672c8361c51 (diff) |
mfd: Add support for S2MPA01 device
Add the necessary entries required for S2MPA01 multi-function
device. While at it also convert whitespaces to tabs in core.h.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/sec-core.c | 49 | ||||
-rw-r--r-- | include/linux/mfd/samsung/core.h | 16 | ||||
-rw-r--r-- | include/linux/mfd/samsung/irq.h | 50 | ||||
-rw-r--r-- | include/linux/mfd/samsung/s2mpa01.h | 192 |
4 files changed, 297 insertions, 10 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 3fc3ebdd7b8a..281a82747275 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/mfd/samsung/core.h> | 26 | #include <linux/mfd/samsung/core.h> |
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/s2mpa01.h> | ||
29 | #include <linux/mfd/samsung/s2mps11.h> | 30 | #include <linux/mfd/samsung/s2mps11.h> |
30 | #include <linux/mfd/samsung/s2mps14.h> | 31 | #include <linux/mfd/samsung/s2mps14.h> |
31 | #include <linux/mfd/samsung/s5m8763.h> | 32 | #include <linux/mfd/samsung/s5m8763.h> |
@@ -80,21 +81,43 @@ static const struct mfd_cell s2mps14_devs[] = { | |||
80 | } | 81 | } |
81 | }; | 82 | }; |
82 | 83 | ||
84 | static const struct mfd_cell s2mpa01_devs[] = { | ||
85 | { | ||
86 | .name = "s2mpa01-pmic", | ||
87 | }, | ||
88 | }; | ||
89 | |||
83 | #ifdef CONFIG_OF | 90 | #ifdef CONFIG_OF |
84 | static struct of_device_id sec_dt_match[] = { | 91 | static struct of_device_id sec_dt_match[] = { |
85 | { .compatible = "samsung,s5m8767-pmic", | 92 | { .compatible = "samsung,s5m8767-pmic", |
86 | .data = (void *)S5M8767X, | 93 | .data = (void *)S5M8767X, |
87 | }, | 94 | }, { |
88 | { .compatible = "samsung,s2mps11-pmic", | 95 | .compatible = "samsung,s2mps11-pmic", |
89 | .data = (void *)S2MPS11X, | 96 | .data = (void *)S2MPS11X, |
90 | }, | 97 | }, { |
91 | { .compatible = "samsung,s2mps14-pmic", | 98 | .compatible = "samsung,s2mps14-pmic", |
92 | .data = (void *)S2MPS14X, | 99 | .data = (void *)S2MPS14X, |
100 | }, { | ||
101 | .compatible = "samsung,s2mpa01-pmic", | ||
102 | .data = (void *)S2MPA01, | ||
103 | }, { | ||
104 | /* Sentinel */ | ||
93 | }, | 105 | }, |
94 | {}, | ||
95 | }; | 106 | }; |
96 | #endif | 107 | #endif |
97 | 108 | ||
109 | static bool s2mpa01_volatile(struct device *dev, unsigned int reg) | ||
110 | { | ||
111 | switch (reg) { | ||
112 | case S2MPA01_REG_INT1M: | ||
113 | case S2MPA01_REG_INT2M: | ||
114 | case S2MPA01_REG_INT3M: | ||
115 | return false; | ||
116 | default: | ||
117 | return true; | ||
118 | } | ||
119 | } | ||
120 | |||
98 | static bool s2mps11_volatile(struct device *dev, unsigned int reg) | 121 | static bool s2mps11_volatile(struct device *dev, unsigned int reg) |
99 | { | 122 | { |
100 | switch (reg) { | 123 | switch (reg) { |
@@ -125,6 +148,15 @@ static const struct regmap_config sec_regmap_config = { | |||
125 | .val_bits = 8, | 148 | .val_bits = 8, |
126 | }; | 149 | }; |
127 | 150 | ||
151 | static const struct regmap_config s2mpa01_regmap_config = { | ||
152 | .reg_bits = 8, | ||
153 | .val_bits = 8, | ||
154 | |||
155 | .max_register = S2MPA01_REG_LDO_OVCB4, | ||
156 | .volatile_reg = s2mpa01_volatile, | ||
157 | .cache_type = REGCACHE_FLAT, | ||
158 | }; | ||
159 | |||
128 | static const struct regmap_config s2mps11_regmap_config = { | 160 | static const struct regmap_config s2mps11_regmap_config = { |
129 | .reg_bits = 8, | 161 | .reg_bits = 8, |
130 | .val_bits = 8, | 162 | .val_bits = 8, |
@@ -261,6 +293,9 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
261 | } | 293 | } |
262 | 294 | ||
263 | switch (sec_pmic->device_type) { | 295 | switch (sec_pmic->device_type) { |
296 | case S2MPA01: | ||
297 | regmap = &s2mpa01_regmap_config; | ||
298 | break; | ||
264 | case S2MPS11X: | 299 | case S2MPS11X: |
265 | regmap = &s2mps11_regmap_config; | 300 | regmap = &s2mps11_regmap_config; |
266 | /* | 301 | /* |
@@ -332,6 +367,10 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
332 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8767_devs, | 367 | ret = mfd_add_devices(sec_pmic->dev, -1, s5m8767_devs, |
333 | ARRAY_SIZE(s5m8767_devs), NULL, 0, NULL); | 368 | ARRAY_SIZE(s5m8767_devs), NULL, 0, NULL); |
334 | break; | 369 | break; |
370 | case S2MPA01: | ||
371 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mpa01_devs, | ||
372 | ARRAY_SIZE(s2mpa01_devs), NULL, 0, NULL); | ||
373 | break; | ||
335 | case S2MPS11X: | 374 | case S2MPS11X: |
336 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, | 375 | ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, |
337 | ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL); | 376 | ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL); |
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index 5073d81660e7..900bc9e1888b 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h | |||
@@ -18,6 +18,7 @@ enum sec_device_type { | |||
18 | S5M8751X, | 18 | S5M8751X, |
19 | S5M8763X, | 19 | S5M8763X, |
20 | S5M8767X, | 20 | S5M8767X, |
21 | S2MPA01, | ||
21 | S2MPS11X, | 22 | S2MPS11X, |
22 | S2MPS14X, | 23 | S2MPS14X, |
23 | }; | 24 | }; |
@@ -93,7 +94,7 @@ struct sec_platform_data { | |||
93 | int buck3_default_idx; | 94 | int buck3_default_idx; |
94 | int buck4_default_idx; | 95 | int buck4_default_idx; |
95 | 96 | ||
96 | int buck_ramp_delay; | 97 | int buck_ramp_delay; |
97 | 98 | ||
98 | int buck2_ramp_delay; | 99 | int buck2_ramp_delay; |
99 | int buck34_ramp_delay; | 100 | int buck34_ramp_delay; |
@@ -101,10 +102,15 @@ struct sec_platform_data { | |||
101 | int buck16_ramp_delay; | 102 | int buck16_ramp_delay; |
102 | int buck7810_ramp_delay; | 103 | int buck7810_ramp_delay; |
103 | int buck9_ramp_delay; | 104 | int buck9_ramp_delay; |
104 | 105 | int buck24_ramp_delay; | |
105 | bool buck2_ramp_enable; | 106 | int buck3_ramp_delay; |
106 | bool buck3_ramp_enable; | 107 | int buck7_ramp_delay; |
107 | bool buck4_ramp_enable; | 108 | int buck8910_ramp_delay; |
109 | |||
110 | bool buck1_ramp_enable; | ||
111 | bool buck2_ramp_enable; | ||
112 | bool buck3_ramp_enable; | ||
113 | bool buck4_ramp_enable; | ||
108 | bool buck6_ramp_enable; | 114 | bool buck6_ramp_enable; |
109 | 115 | ||
110 | int buck2_init; | 116 | int buck2_init; |
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h index 0065f6f1daf4..1224f447356b 100644 --- a/include/linux/mfd/samsung/irq.h +++ b/include/linux/mfd/samsung/irq.h | |||
@@ -13,6 +13,56 @@ | |||
13 | #ifndef __LINUX_MFD_SEC_IRQ_H | 13 | #ifndef __LINUX_MFD_SEC_IRQ_H |
14 | #define __LINUX_MFD_SEC_IRQ_H | 14 | #define __LINUX_MFD_SEC_IRQ_H |
15 | 15 | ||
16 | enum s2mpa01_irq { | ||
17 | S2MPA01_IRQ_PWRONF, | ||
18 | S2MPA01_IRQ_PWRONR, | ||
19 | S2MPA01_IRQ_JIGONBF, | ||
20 | S2MPA01_IRQ_JIGONBR, | ||
21 | S2MPA01_IRQ_ACOKBF, | ||
22 | S2MPA01_IRQ_ACOKBR, | ||
23 | S2MPA01_IRQ_PWRON1S, | ||
24 | S2MPA01_IRQ_MRB, | ||
25 | |||
26 | S2MPA01_IRQ_RTC60S, | ||
27 | S2MPA01_IRQ_RTCA1, | ||
28 | S2MPA01_IRQ_RTCA0, | ||
29 | S2MPA01_IRQ_SMPL, | ||
30 | S2MPA01_IRQ_RTC1S, | ||
31 | S2MPA01_IRQ_WTSR, | ||
32 | |||
33 | S2MPA01_IRQ_INT120C, | ||
34 | S2MPA01_IRQ_INT140C, | ||
35 | S2MPA01_IRQ_LDO3_TSD, | ||
36 | S2MPA01_IRQ_B16_TSD, | ||
37 | S2MPA01_IRQ_B24_TSD, | ||
38 | S2MPA01_IRQ_B35_TSD, | ||
39 | |||
40 | S2MPA01_IRQ_NR, | ||
41 | }; | ||
42 | |||
43 | #define S2MPA01_IRQ_PWRONF_MASK (1 << 0) | ||
44 | #define S2MPA01_IRQ_PWRONR_MASK (1 << 1) | ||
45 | #define S2MPA01_IRQ_JIGONBF_MASK (1 << 2) | ||
46 | #define S2MPA01_IRQ_JIGONBR_MASK (1 << 3) | ||
47 | #define S2MPA01_IRQ_ACOKBF_MASK (1 << 4) | ||
48 | #define S2MPA01_IRQ_ACOKBR_MASK (1 << 5) | ||
49 | #define S2MPA01_IRQ_PWRON1S_MASK (1 << 6) | ||
50 | #define S2MPA01_IRQ_MRB_MASK (1 << 7) | ||
51 | |||
52 | #define S2MPA01_IRQ_RTC60S_MASK (1 << 0) | ||
53 | #define S2MPA01_IRQ_RTCA1_MASK (1 << 1) | ||
54 | #define S2MPA01_IRQ_RTCA0_MASK (1 << 2) | ||
55 | #define S2MPA01_IRQ_SMPL_MASK (1 << 3) | ||
56 | #define S2MPA01_IRQ_RTC1S_MASK (1 << 4) | ||
57 | #define S2MPA01_IRQ_WTSR_MASK (1 << 5) | ||
58 | |||
59 | #define S2MPA01_IRQ_INT120C_MASK (1 << 0) | ||
60 | #define S2MPA01_IRQ_INT140C_MASK (1 << 1) | ||
61 | #define S2MPA01_IRQ_LDO3_TSD_MASK (1 << 2) | ||
62 | #define S2MPA01_IRQ_B16_TSD_MASK (1 << 3) | ||
63 | #define S2MPA01_IRQ_B24_TSD_MASK (1 << 4) | ||
64 | #define S2MPA01_IRQ_B35_TSD_MASK (1 << 5) | ||
65 | |||
16 | enum s2mps11_irq { | 66 | enum s2mps11_irq { |
17 | S2MPS11_IRQ_PWRONF, | 67 | S2MPS11_IRQ_PWRONF, |
18 | S2MPS11_IRQ_PWRONR, | 68 | S2MPS11_IRQ_PWRONR, |
diff --git a/include/linux/mfd/samsung/s2mpa01.h b/include/linux/mfd/samsung/s2mpa01.h new file mode 100644 index 000000000000..fbc63bc0d6a2 --- /dev/null +++ b/include/linux/mfd/samsung/s2mpa01.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Samsung Electronics Co., Ltd | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef __LINUX_MFD_S2MPA01_H | ||
13 | #define __LINUX_MFD_S2MPA01_H | ||
14 | |||
15 | /* S2MPA01 registers */ | ||
16 | enum s2mpa01_reg { | ||
17 | S2MPA01_REG_ID, | ||
18 | S2MPA01_REG_INT1, | ||
19 | S2MPA01_REG_INT2, | ||
20 | S2MPA01_REG_INT3, | ||
21 | S2MPA01_REG_INT1M, | ||
22 | S2MPA01_REG_INT2M, | ||
23 | S2MPA01_REG_INT3M, | ||
24 | S2MPA01_REG_ST1, | ||
25 | S2MPA01_REG_ST2, | ||
26 | S2MPA01_REG_PWRONSRC, | ||
27 | S2MPA01_REG_OFFSRC, | ||
28 | S2MPA01_REG_RTC_BUF, | ||
29 | S2MPA01_REG_CTRL1, | ||
30 | S2MPA01_REG_ETC_TEST, | ||
31 | S2MPA01_REG_RSVD1, | ||
32 | S2MPA01_REG_BU_CHG, | ||
33 | S2MPA01_REG_RAMP1, | ||
34 | S2MPA01_REG_RAMP2, | ||
35 | S2MPA01_REG_LDO_DSCH1, | ||
36 | S2MPA01_REG_LDO_DSCH2, | ||
37 | S2MPA01_REG_LDO_DSCH3, | ||
38 | S2MPA01_REG_LDO_DSCH4, | ||
39 | S2MPA01_REG_OTP_ADRL, | ||
40 | S2MPA01_REG_OTP_ADRH, | ||
41 | S2MPA01_REG_OTP_DATA, | ||
42 | S2MPA01_REG_MON1SEL, | ||
43 | S2MPA01_REG_MON2SEL, | ||
44 | S2MPA01_REG_LEE, | ||
45 | S2MPA01_REG_RSVD2, | ||
46 | S2MPA01_REG_RSVD3, | ||
47 | S2MPA01_REG_RSVD4, | ||
48 | S2MPA01_REG_RSVD5, | ||
49 | S2MPA01_REG_RSVD6, | ||
50 | S2MPA01_REG_TOP_RSVD, | ||
51 | S2MPA01_REG_DVS_SEL, | ||
52 | S2MPA01_REG_DVS_PTR, | ||
53 | S2MPA01_REG_DVS_DATA, | ||
54 | S2MPA01_REG_RSVD_NO, | ||
55 | S2MPA01_REG_UVLO, | ||
56 | S2MPA01_REG_LEE_NO, | ||
57 | S2MPA01_REG_B1CTRL1, | ||
58 | S2MPA01_REG_B1CTRL2, | ||
59 | S2MPA01_REG_B2CTRL1, | ||
60 | S2MPA01_REG_B2CTRL2, | ||
61 | S2MPA01_REG_B3CTRL1, | ||
62 | S2MPA01_REG_B3CTRL2, | ||
63 | S2MPA01_REG_B4CTRL1, | ||
64 | S2MPA01_REG_B4CTRL2, | ||
65 | S2MPA01_REG_B5CTRL1, | ||
66 | S2MPA01_REG_B5CTRL2, | ||
67 | S2MPA01_REG_B5CTRL3, | ||
68 | S2MPA01_REG_B5CTRL4, | ||
69 | S2MPA01_REG_B5CTRL5, | ||
70 | S2MPA01_REG_B5CTRL6, | ||
71 | S2MPA01_REG_B6CTRL1, | ||
72 | S2MPA01_REG_B6CTRL2, | ||
73 | S2MPA01_REG_B7CTRL1, | ||
74 | S2MPA01_REG_B7CTRL2, | ||
75 | S2MPA01_REG_B8CTRL1, | ||
76 | S2MPA01_REG_B8CTRL2, | ||
77 | S2MPA01_REG_B9CTRL1, | ||
78 | S2MPA01_REG_B9CTRL2, | ||
79 | S2MPA01_REG_B10CTRL1, | ||
80 | S2MPA01_REG_B10CTRL2, | ||
81 | S2MPA01_REG_L1CTRL, | ||
82 | S2MPA01_REG_L2CTRL, | ||
83 | S2MPA01_REG_L3CTRL, | ||
84 | S2MPA01_REG_L4CTRL, | ||
85 | S2MPA01_REG_L5CTRL, | ||
86 | S2MPA01_REG_L6CTRL, | ||
87 | S2MPA01_REG_L7CTRL, | ||
88 | S2MPA01_REG_L8CTRL, | ||
89 | S2MPA01_REG_L9CTRL, | ||
90 | S2MPA01_REG_L10CTRL, | ||
91 | S2MPA01_REG_L11CTRL, | ||
92 | S2MPA01_REG_L12CTRL, | ||
93 | S2MPA01_REG_L13CTRL, | ||
94 | S2MPA01_REG_L14CTRL, | ||
95 | S2MPA01_REG_L15CTRL, | ||
96 | S2MPA01_REG_L16CTRL, | ||
97 | S2MPA01_REG_L17CTRL, | ||
98 | S2MPA01_REG_L18CTRL, | ||
99 | S2MPA01_REG_L19CTRL, | ||
100 | S2MPA01_REG_L20CTRL, | ||
101 | S2MPA01_REG_L21CTRL, | ||
102 | S2MPA01_REG_L22CTRL, | ||
103 | S2MPA01_REG_L23CTRL, | ||
104 | S2MPA01_REG_L24CTRL, | ||
105 | S2MPA01_REG_L25CTRL, | ||
106 | S2MPA01_REG_L26CTRL, | ||
107 | |||
108 | S2MPA01_REG_LDO_OVCB1, | ||
109 | S2MPA01_REG_LDO_OVCB2, | ||
110 | S2MPA01_REG_LDO_OVCB3, | ||
111 | S2MPA01_REG_LDO_OVCB4, | ||
112 | |||
113 | }; | ||
114 | |||
115 | /* S2MPA01 regulator ids */ | ||
116 | enum s2mpa01_regulators { | ||
117 | S2MPA01_LDO1, | ||
118 | S2MPA01_LDO2, | ||
119 | S2MPA01_LDO3, | ||
120 | S2MPA01_LDO4, | ||
121 | S2MPA01_LDO5, | ||
122 | S2MPA01_LDO6, | ||
123 | S2MPA01_LDO7, | ||
124 | S2MPA01_LDO8, | ||
125 | S2MPA01_LDO9, | ||
126 | S2MPA01_LDO10, | ||
127 | S2MPA01_LDO11, | ||
128 | S2MPA01_LDO12, | ||
129 | S2MPA01_LDO13, | ||
130 | S2MPA01_LDO14, | ||
131 | S2MPA01_LDO15, | ||
132 | S2MPA01_LDO16, | ||
133 | S2MPA01_LDO17, | ||
134 | S2MPA01_LDO18, | ||
135 | S2MPA01_LDO19, | ||
136 | S2MPA01_LDO20, | ||
137 | S2MPA01_LDO21, | ||
138 | S2MPA01_LDO22, | ||
139 | S2MPA01_LDO23, | ||
140 | S2MPA01_LDO24, | ||
141 | S2MPA01_LDO25, | ||
142 | S2MPA01_LDO26, | ||
143 | |||
144 | S2MPA01_BUCK1, | ||
145 | S2MPA01_BUCK2, | ||
146 | S2MPA01_BUCK3, | ||
147 | S2MPA01_BUCK4, | ||
148 | S2MPA01_BUCK5, | ||
149 | S2MPA01_BUCK6, | ||
150 | S2MPA01_BUCK7, | ||
151 | S2MPA01_BUCK8, | ||
152 | S2MPA01_BUCK9, | ||
153 | S2MPA01_BUCK10, | ||
154 | |||
155 | S2MPA01_REGULATOR_MAX, | ||
156 | }; | ||
157 | |||
158 | #define S2MPA01_BUCK_MIN1 600000 | ||
159 | #define S2MPA01_BUCK_MIN2 800000 | ||
160 | #define S2MPA01_BUCK_MIN3 1000000 | ||
161 | #define S2MPA01_BUCK_MIN4 1500000 | ||
162 | #define S2MPA01_LDO_MIN 800000 | ||
163 | |||
164 | #define S2MPA01_BUCK_STEP1 6250 | ||
165 | #define S2MPA01_BUCK_STEP2 12500 | ||
166 | |||
167 | #define S2MPA01_LDO_STEP1 50000 | ||
168 | #define S2MPA01_LDO_STEP2 25000 | ||
169 | |||
170 | #define S2MPA01_LDO_VSEL_MASK 0x3F | ||
171 | #define S2MPA01_BUCK_VSEL_MASK 0xFF | ||
172 | #define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT) | ||
173 | #define S2MPA01_ENABLE_SHIFT 0x06 | ||
174 | #define S2MPA01_LDO_N_VOLTAGES (S2MPA01_LDO_VSEL_MASK + 1) | ||
175 | #define S2MPA01_BUCK_N_VOLTAGES (S2MPA01_BUCK_VSEL_MASK + 1) | ||
176 | |||
177 | #define S2MPA01_RAMP_DELAY 12500 /* uV/us */ | ||
178 | |||
179 | #define S2MPA01_BUCK16_RAMP_SHIFT 4 | ||
180 | #define S2MPA01_BUCK24_RAMP_SHIFT 6 | ||
181 | #define S2MPA01_BUCK3_RAMP_SHIFT 4 | ||
182 | #define S2MPA01_BUCK5_RAMP_SHIFT 6 | ||
183 | #define S2MPA01_BUCK7_RAMP_SHIFT 2 | ||
184 | #define S2MPA01_BUCK8910_RAMP_SHIFT 0 | ||
185 | |||
186 | #define S2MPA01_BUCK1_RAMP_EN_SHIFT 3 | ||
187 | #define S2MPA01_BUCK2_RAMP_EN_SHIFT 2 | ||
188 | #define S2MPA01_BUCK3_RAMP_EN_SHIFT 1 | ||
189 | #define S2MPA01_BUCK4_RAMP_EN_SHIFT 0 | ||
190 | #define S2MPA01_PMIC_EN_SHIFT 6 | ||
191 | |||
192 | #endif /*__LINUX_MFD_S2MPA01_H */ | ||