Lines Matching +full:regulator +full:- +full:v7
1 // SPDX-License-Identifier: GPL-2.0-only
3 * max8660.c -- Voltage regulation for the Maxim 8660/8661
5 * based on max1586.c and wm8400-regulator.c
11 * Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8660-MAX8661.pdf
13 * This chip is a bit nasty because it is a write-only device. Thus, the driver
23 * functions for V3-V7 is sufficient. For maximum flexibility during
31 #include <linux/regulator/driver.h>
33 #include <linux/regulator/max8660.h>
36 #include <linux/regulator/of_regulator.h>
80 u8 reg_val = (max8660->shadow_regs[reg] & mask) | val; in max8660_write()
82 dev_vdbg(&max8660->client->dev, "Writing reg %02x with %02x\n", in max8660_write()
85 ret = i2c_smbus_write_byte_data(max8660->client, in max8660_write()
88 max8660->shadow_regs[reg] = reg_val; in max8660_write()
101 u8 val = max8660->shadow_regs[MAX8660_OVER1]; in max8660_dcdc_is_enabled()
127 u8 selector = max8660->shadow_regs[reg]; in max8660_dcdc_get_voltage_sel()
166 u8 selector = max8660->shadow_regs[MAX8660_MDTV2]; in max8660_ldo5_get_voltage_sel()
199 u8 val = max8660->shadow_regs[MAX8660_OVER2]; in max8660_ldo67_is_enabled()
225 u8 selector = (max8660->shadow_regs[MAX8660_L12VCR] >> shift) & 0xf; in max8660_ldo67_get_voltage_sel()
294 .name = "V7(LDO)",
327 np = of_get_child_by_name(dev->of_node, "regulators"); in max8660_pdata_from_dt()
330 return -EINVAL; in max8660_pdata_from_dt()
341 pdata->subdevs = devm_kcalloc(dev, in max8660_pdata_from_dt()
345 if (!pdata->subdevs) in max8660_pdata_from_dt()
346 return -ENOMEM; in max8660_pdata_from_dt()
348 pdata->num_subdevs = matched; in max8660_pdata_from_dt()
349 sub = pdata->subdevs; in max8660_pdata_from_dt()
352 sub->id = i; in max8660_pdata_from_dt()
353 sub->name = rmatch[i].name; in max8660_pdata_from_dt()
354 sub->platform_data = rmatch[i].init_data; in max8660_pdata_from_dt()
373 struct device *dev = &client->dev; in max8660_probe()
377 int boot_on, i, id, ret = -EINVAL; in max8660_probe()
381 if (dev->of_node && !pdata) { in max8660_probe()
386 return -ENODEV; in max8660_probe()
393 type = (unsigned long) id->data; in max8660_probe()
395 type = i2c_id->driver_data; in max8660_probe()
399 if (pdata->num_subdevs > MAX8660_V_END) { in max8660_probe()
401 return -EINVAL; in max8660_probe()
406 return -ENOMEM; in max8660_probe()
408 max8660->client = client; in max8660_probe()
410 if (pdata->en34_is_high) { in max8660_probe()
412 max8660->shadow_regs[MAX8660_OVER1] = 5; in max8660_probe()
424 max8660->shadow_regs[MAX8660_ADTV1] = in max8660_probe()
425 max8660->shadow_regs[MAX8660_ADTV2] = in max8660_probe()
426 max8660->shadow_regs[MAX8660_SDTV1] = in max8660_probe()
427 max8660->shadow_regs[MAX8660_SDTV2] = 0x1b; in max8660_probe()
428 max8660->shadow_regs[MAX8660_MDTV1] = in max8660_probe()
429 max8660->shadow_regs[MAX8660_MDTV2] = 0x04; in max8660_probe()
431 for (i = 0; i < pdata->num_subdevs; i++) { in max8660_probe()
433 if (!pdata->subdevs[i].platform_data) in max8660_probe()
436 boot_on = pdata->subdevs[i].platform_data->constraints.boot_on; in max8660_probe()
438 switch (pdata->subdevs[i].id) { in max8660_probe()
441 max8660->shadow_regs[MAX8660_OVER1] |= 1; in max8660_probe()
446 max8660->shadow_regs[MAX8660_OVER1] |= 4; in max8660_probe()
454 max8660->shadow_regs[MAX8660_OVER2] |= 2; in max8660_probe()
459 dev_err(dev, "Regulator not on this chip!\n"); in max8660_probe()
460 return -EINVAL; in max8660_probe()
464 max8660->shadow_regs[MAX8660_OVER2] |= 4; in max8660_probe()
468 dev_err(dev, "invalid regulator %s\n", in max8660_probe()
469 pdata->subdevs[i].name); in max8660_probe()
475 for (i = 0; i < pdata->num_subdevs; i++) { in max8660_probe()
478 id = pdata->subdevs[i].id; in max8660_probe()
481 config.init_data = pdata->subdevs[i].platform_data; in max8660_probe()
485 rdev = devm_regulator_register(&client->dev, in max8660_probe()
488 dev_err(&client->dev, "failed to register %s\n", in max8660_probe()
527 MODULE_DESCRIPTION("MAXIM 8660/8661 voltage regulator driver");