11 #include <linux/kernel.h>
12 #include <linux/module.h>
15 #include <linux/i2c.h>
21 #define SD1_DVM_VMIN 850000
22 #define SD1_DVM_VMAX 1000000
23 #define SD1_DVM_STEP 50000
24 #define SD1_DVM_SHIFT 5
28 #define LDO_SEQ_I2C 0x7
29 #define LDO_SEQ_MASK 0x7
30 #define LDO_SEQ_SHIFT 2
31 #define LDO_I2C_EN 0x1
32 #define LDO_I2C_EN_MASK 0x1
33 #define LDO_I2C_EN_SHIFT 0
49 unsigned char mask = rdev->
desc->n_voltages - 1;
63 mask = rdev->
desc->n_voltages - 1;
105 static int max8925_set_dvm_voltage(
struct regulator_dev *rdev,
int uV)
120 static int max8925_set_dvm_enable(
struct regulator_dev *rdev)
128 static int max8925_set_dvm_disable(
struct regulator_dev *rdev)
138 .set_voltage_sel = max8925_set_voltage_sel,
139 .get_voltage_sel = max8925_get_voltage_sel,
140 .enable = max8925_enable,
141 .disable = max8925_disable,
142 .is_enabled = max8925_is_enabled,
143 .set_suspend_voltage = max8925_set_dvm_voltage,
144 .set_suspend_enable = max8925_set_dvm_enable,
145 .set_suspend_disable = max8925_set_dvm_disable,
151 .set_voltage_sel = max8925_set_voltage_sel,
152 .get_voltage_sel = max8925_get_voltage_sel,
153 .enable = max8925_enable,
154 .disable = max8925_disable,
155 .is_enabled = max8925_is_enabled,
158 #define MAX8925_SDV(_id, min, max, step) \
161 .name = "SDV" #_id, \
162 .ops = &max8925_regulator_sdv_ops, \
163 .type = REGULATOR_VOLTAGE, \
164 .id = MAX8925_ID_SD##_id, \
165 .owner = THIS_MODULE, \
167 .min_uV = min * 1000, \
168 .uV_step = step * 1000, \
170 .vol_reg = MAX8925_SDV##_id, \
171 .enable_reg = MAX8925_SDCTL##_id, \
174 #define MAX8925_LDO(_id, min, max, step) \
177 .name = "LDO" #_id, \
178 .ops = &max8925_regulator_ldo_ops, \
179 .type = REGULATOR_VOLTAGE, \
180 .id = MAX8925_ID_LDO##_id, \
181 .owner = THIS_MODULE, \
183 .min_uV = min * 1000, \
184 .uV_step = step * 1000, \
186 .vol_reg = MAX8925_LDOVOUT##_id, \
187 .enable_reg = MAX8925_LDOCTL##_id, \
222 struct max8925_regulator_info *ri;
232 for (i = 0; i <
ARRAY_SIZE(max8925_regulator_info); i++) {
233 ri = &max8925_regulator_info[
i];
237 if (i ==
ARRAY_SIZE(max8925_regulator_info)) {
238 dev_err(&pdev->
dev,
"Failed to find regulator %llu\n",
239 (
unsigned long long)res->
start);
251 dev_err(&pdev->
dev,
"failed to register regulator %s\n",
253 return PTR_ERR(rdev);
256 platform_set_drvdata(pdev, rdev);
264 platform_set_drvdata(pdev,
NULL);
272 .name =
"max8925-regulator",
275 .probe = max8925_regulator_probe,
279 static int __init max8925_regulator_init(
void)
285 static void __exit max8925_regulator_exit(
void)