15 #include <linux/module.h>
21 #include <linux/i2c.h>
22 #include <linux/slab.h>
27 #define FAN53555_VSEL0 0x00
28 #define FAN53555_VSEL1 0x01
30 #define FAN53555_CONTROL 0x02
32 #define FAN53555_ID1 0x03
34 #define FAN53555_ID2 0x04
36 #define FAN53555_MONITOR 0x05
39 #define VSEL_BUCK_EN (1 << 7)
40 #define VSEL_MODE (1 << 6)
41 #define VSEL_NSEL_MASK 0x3F
46 #define CTL_OUTPUT_DISCHG (1 << 7)
47 #define CTL_SLEW_MASK (0x7 << 4)
48 #define CTL_SLEW_SHIFT 4
49 #define CTL_RESET (1 << 2)
51 #define FAN53555_NVOLTAGES 64
123 static unsigned int fan53555_get_mode(
struct regulator_dev *rdev)
143 .set_suspend_voltage = fan53555_set_suspend_voltage,
147 .set_mode = fan53555_set_mode,
148 .get_mode = fan53555_get_mode,
190 "Chip ID[%d]\n not supported!\n", di->
chip_id);
209 rdesc->
name =
"fan53555-reg";
210 rdesc->
ops = &fan53555_regulator_ops;
222 if (IS_ERR(di->
rdev))
223 return PTR_ERR(di->
rdev);
228 static struct regmap_config fan53555_regmap_config = {
242 pdata = client->
dev.platform_data;
244 dev_err(&client->
dev,
"Platform data not found!\n");
251 dev_err(&client->
dev,
"Failed to allocate device info data!\n");
256 dev_err(&client->
dev,
"Failed to allocate regmap!\n");
257 return PTR_ERR(di->
regmap);
261 i2c_set_clientdata(client, di);
265 dev_err(&client->
dev,
"Failed to get chip ID!\n");
272 dev_err(&client->
dev,
"Failed to get chip Rev!\n");
276 dev_info(&client->
dev,
"FAN53555 Option[%d] Rev[%d] Detected!\n",
279 ret = fan53555_device_setup(di, pdata);
281 dev_err(&client->
dev,
"Failed to setup device!\n");
289 ret = fan53555_regulator_register(di, &config);
291 dev_err(&client->
dev,
"Failed to register regulator!\n");
309 static struct i2c_driver fan53555_regulator_driver = {
311 .name =
"fan53555-regulator",
313 .probe = fan53555_regulator_probe,
315 .id_table = fan53555_id,