Lines Matching full:max8952

3  * max8952.c - Voltage and current regulation for the Maxim 8952
15 #include <linux/regulator/max8952.h>
44 static int max8952_read_reg(struct max8952_data *max8952, u8 reg) in max8952_read_reg() argument
46 int ret = i2c_smbus_read_byte_data(max8952->client, reg); in max8952_read_reg()
54 static int max8952_write_reg(struct max8952_data *max8952, in max8952_write_reg() argument
57 return i2c_smbus_write_byte_data(max8952->client, reg, value); in max8952_write_reg()
63 struct max8952_data *max8952 = rdev_get_drvdata(rdev); in max8952_list_voltage() local
68 return (max8952->pdata->dvs_mode[selector] * 10 + 770) * 1000; in max8952_list_voltage()
73 struct max8952_data *max8952 = rdev_get_drvdata(rdev); in max8952_get_voltage_sel() local
76 if (max8952->vid0) in max8952_get_voltage_sel()
78 if (max8952->vid1) in max8952_get_voltage_sel()
87 struct max8952_data *max8952 = rdev_get_drvdata(rdev); in max8952_set_voltage_sel() local
89 if (!max8952->vid0_gpiod || !max8952->vid1_gpiod) { in max8952_set_voltage_sel()
94 max8952->vid0 = selector & 0x1; in max8952_set_voltage_sel()
95 max8952->vid1 = (selector >> 1) & 0x1; in max8952_set_voltage_sel()
96 gpiod_set_value(max8952->vid0_gpiod, max8952->vid0); in max8952_set_voltage_sel()
97 gpiod_set_value(max8952->vid1_gpiod, max8952->vid1); in max8952_set_voltage_sel()
119 { .compatible = "maxim,max8952" },
135 if (of_property_read_u32(np, "max8952,default-mode", &pd->default_mode)) in max8952_parse_dt()
138 ret = of_property_read_u32_array(np, "max8952,dvs-mode-microvolt", in max8952_parse_dt()
141 dev_err(dev, "max8952,dvs-mode-microvolt property not specified"); in max8952_parse_dt()
153 if (of_property_read_u32(np, "max8952,sync-freq", &pd->sync_freq)) in max8952_parse_dt()
154 dev_warn(dev, "max8952,sync-freq property not specified, defaulting to 26MHz\n"); in max8952_parse_dt()
156 if (of_property_read_u32(np, "max8952,ramp-speed", &pd->ramp_speed)) in max8952_parse_dt()
157 dev_warn(dev, "max8952,ramp-speed property not specified, defaulting to 32mV/us\n"); in max8952_parse_dt()
180 struct max8952_data *max8952; in max8952_pmic_probe() local
198 max8952 = devm_kzalloc(&client->dev, sizeof(struct max8952_data), in max8952_pmic_probe()
200 if (!max8952) in max8952_pmic_probe()
203 max8952->client = client; in max8952_pmic_probe()
204 max8952->pdata = pdata; in max8952_pmic_probe()
208 config.driver_data = max8952; in max8952_pmic_probe()
221 "max8952,en", in max8952_pmic_probe()
235 max8952->vid0 = pdata->default_mode & 0x1; in max8952_pmic_probe()
236 max8952->vid1 = (pdata->default_mode >> 1) & 0x1; in max8952_pmic_probe()
239 gflags = max8952->vid0 ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; in max8952_pmic_probe()
240 max8952->vid0_gpiod = devm_gpiod_get_index_optional(&client->dev, in max8952_pmic_probe()
241 "max8952,vid", in max8952_pmic_probe()
243 if (IS_ERR(max8952->vid0_gpiod)) in max8952_pmic_probe()
244 return PTR_ERR(max8952->vid0_gpiod); in max8952_pmic_probe()
245 gflags = max8952->vid1 ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; in max8952_pmic_probe()
246 max8952->vid1_gpiod = devm_gpiod_get_index_optional(&client->dev, in max8952_pmic_probe()
247 "max8952,vid", in max8952_pmic_probe()
249 if (IS_ERR(max8952->vid1_gpiod)) in max8952_pmic_probe()
250 return PTR_ERR(max8952->vid1_gpiod); in max8952_pmic_probe()
253 if (!max8952->vid0_gpiod || !max8952->vid1_gpiod) { in max8952_pmic_probe()
256 max8952->vid0 = 0; in max8952_pmic_probe()
257 max8952->vid1 = 0; in max8952_pmic_probe()
259 if (max8952->vid0_gpiod) in max8952_pmic_probe()
260 gpiod_set_value(max8952->vid0_gpiod, 0); in max8952_pmic_probe()
261 if (max8952->vid1_gpiod) in max8952_pmic_probe()
262 gpiod_set_value(max8952->vid1_gpiod, 0); in max8952_pmic_probe()
265 max8952_write_reg(max8952, MAX8952_REG_CONTROL, 0x60); in max8952_pmic_probe()
272 * leakage current of MAX8952 assuming that MAX8952 in max8952_pmic_probe()
278 max8952_write_reg(max8952, MAX8952_REG_CONTROL, 0x0); in max8952_pmic_probe()
281 max8952_write_reg(max8952, MAX8952_REG_MODE0, in max8952_pmic_probe()
282 (max8952_read_reg(max8952, in max8952_pmic_probe()
285 max8952_write_reg(max8952, MAX8952_REG_MODE1, in max8952_pmic_probe()
286 (max8952_read_reg(max8952, in max8952_pmic_probe()
289 max8952_write_reg(max8952, MAX8952_REG_MODE2, in max8952_pmic_probe()
290 (max8952_read_reg(max8952, in max8952_pmic_probe()
293 max8952_write_reg(max8952, MAX8952_REG_MODE3, in max8952_pmic_probe()
294 (max8952_read_reg(max8952, in max8952_pmic_probe()
298 max8952_write_reg(max8952, MAX8952_REG_SYNC, in max8952_pmic_probe()
299 (max8952_read_reg(max8952, MAX8952_REG_SYNC) & 0x3F) | in max8952_pmic_probe()
301 max8952_write_reg(max8952, MAX8952_REG_RAMP, in max8952_pmic_probe()
302 (max8952_read_reg(max8952, MAX8952_REG_RAMP) & 0x1F) | in max8952_pmic_probe()
305 i2c_set_clientdata(client, max8952); in max8952_pmic_probe()
311 { "max8952", 0 },
319 .name = "max8952",