11 #include <linux/kernel.h>
12 #include <linux/module.h>
14 #include <linux/i2c.h>
17 #include <linux/slab.h>
21 #define MAX8649_DCDC_VMIN 750000
22 #define MAX8649_DCDC_VMAX 1380000
23 #define MAX8649_DCDC_STEP 10000
24 #define MAX8649_VOL_MASK 0x3f
27 #define MAX8649_MODE0 0x00
28 #define MAX8649_MODE1 0x01
29 #define MAX8649_MODE2 0x02
30 #define MAX8649_MODE3 0x03
31 #define MAX8649_CONTROL 0x04
32 #define MAX8649_SYNC 0x05
33 #define MAX8649_RAMP 0x06
34 #define MAX8649_CHIP_ID1 0x08
35 #define MAX8649_CHIP_ID2 0x09
38 #define MAX8649_EN_PD (1 << 7)
39 #define MAX8649_VID0_PD (1 << 6)
40 #define MAX8649_VID1_PD (1 << 5)
41 #define MAX8649_VID_MASK (3 << 5)
43 #define MAX8649_FORCE_PWM (1 << 7)
44 #define MAX8649_SYNC_EXTCLK (1 << 6)
46 #define MAX8649_EXT_MASK (3 << 6)
48 #define MAX8649_RAMP_MASK (7 << 5)
49 #define MAX8649_RAMP_DOWN (1 << 1)
111 rate = (32 * 1000) >> ret;
135 static unsigned int max8649_get_mode(
struct regulator_dev *rdev)
154 .enable = max8649_enable,
155 .disable = max8649_disable,
156 .is_enabled = max8649_is_enabled,
157 .enable_time = max8649_enable_time,
158 .set_mode = max8649_set_mode,
159 .get_mode = max8649_get_mode,
165 .ops = &max8649_dcdc_ops,
167 .n_voltages = 1 << 6,
174 static struct regmap_config max8649_regmap_config = {
197 if (IS_ERR(info->
regmap)) {
198 ret = PTR_ERR(info->
regmap);
199 dev_err(&client->
dev,
"Failed to allocate register map: %d\n", ret);
204 i2c_set_clientdata(client, info);
207 switch (info->
mode) {
226 dev_err(info->
dev,
"Failed to detect ID of MAX8649:%d\n",
230 dev_info(info->
dev,
"Detected MAX8649 (ID:%x)\n", val);
259 config.
dev = &client->
dev;
266 dev_err(info->
dev,
"failed to register regulator %s\n",
293 .probe = max8649_regulator_probe,
298 .id_table = max8649_id,
301 static int __init max8649_init(
void)
303 return i2c_add_driver(&max8649_driver);
307 static void __exit max8649_exit(
void)