22 #include <linux/module.h>
24 #include <linux/i2c.h>
31 #include <linux/slab.h>
65 static int max8952_write_reg(
struct max8952_data *max8952,
79 return (max8952->
pdata->dvs_mode[selector] * 10 + 770) * 1000;
82 static int max8952_get_voltage_sel(
struct regulator_dev *rdev)
95 static int max8952_set_voltage_sel(
struct regulator_dev *rdev,
100 if (!gpio_is_valid(max8952->
pdata->gpio_vid0) ||
101 !gpio_is_valid(max8952->
pdata->gpio_vid1)) {
106 max8952->
vid0 = selector & 0x1;
107 max8952->
vid1 = (selector >> 1) & 0x1;
115 .list_voltage = max8952_list_voltage,
116 .get_voltage_sel = max8952_get_voltage_sel,
117 .set_voltage_sel = max8952_set_voltage_sel,
121 .name =
"MAX8952_VOUT",
140 dev_err(&client->
dev,
"Require the platform data\n");
153 max8952->
dev = &client->
dev;
156 config.
dev = max8952->
dev;
161 if (pdata->
reg_data.constraints.boot_on)
166 if (IS_ERR(max8952->
rdev)) {
167 ret = PTR_ERR(max8952->
rdev);
168 dev_err(max8952->
dev,
"regulator init failed (%d)\n", ret);
197 "DVS not available.\n");
207 dev_err(max8952->
dev,
"DVS modes disabled because VID0 and VID1"
208 " do not have proper controls.\n");
222 (max8952_read_reg(max8952,
226 (max8952_read_reg(max8952,
230 (max8952_read_reg(max8952,
234 (max8952_read_reg(max8952,
245 i2c_set_clientdata(client, max8952);
252 struct max8952_data *max8952 = i2c_get_clientdata(client);
269 static struct i2c_driver max8952_pmic_driver = {
270 .probe = max8952_pmic_probe,
275 .id_table = max8952_ids,
278 static int __init max8952_pmic_init(
void)
280 return i2c_add_driver(&max8952_pmic_driver);
284 static void __exit max8952_pmic_exit(
void)