static int wm831x_alive_ldo_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); struct wm831x *wm831x = ldo->wm831x; int sel, reg = ldo->base + WM831X_ALIVE_LDO_SLEEP_CONTROL; sel = regulator_map_voltage_linear(rdev, uV, uV); if (sel < 0) return sel; return wm831x_set_bits(wm831x, reg, WM831X_LDO11_ON_VSEL_MASK, sel); }
static int ltc3676_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct ltc3676 *ltc3676 = rdev_get_drvdata(rdev); struct device *dev = ltc3676->dev; int dcdc = rdev_get_id(rdev); int sel; dev_dbg(dev, "%s id=%d uV=%d\n", __func__, dcdc, uV); sel = regulator_map_voltage_linear(rdev, uV, uV); if (sel < 0) return sel; /* DVBB register follows right after the corresponding DVBA register */ return regmap_update_bits(ltc3676->regmap, rdev->desc->vsel_reg + 1, rdev->desc->vsel_mask, sel); }
static int da9063_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct da9063_regulator *regl = rdev_get_drvdata(rdev); const struct da9063_regulator_info *rinfo = regl->info; int ret, sel; sel = regulator_map_voltage_linear(rdev, uV, uV); if (sel < 0) return sel; sel <<= ffs(rdev->desc->vsel_mask) - 1; ret = regmap_update_bits(regl->hw->regmap, rinfo->suspend_vsel_reg, rdev->desc->vsel_mask, sel); return ret; }
static int tps80031_ldo_map_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) { struct tps80031_regulator *ri = rdev_get_drvdata(rdev); struct device *parent = to_tps80031_dev(rdev); /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */ if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) && (ri->device_flags & TRACK_MODE_ENABLE)) { if (((tps80031_get_chip_info(parent) == TPS80031) || ((tps80031_get_chip_info(parent) == TPS80032) && (tps80031_get_pmu_version(parent) == 0x0)))) { return regulator_map_voltage_iterate(rdev, min_uV, max_uV); } } return regulator_map_voltage_linear(rdev, min_uV, max_uV); }
static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct fan53555_device_info *di = rdev_get_drvdata(rdev); int ret; if (di->sleep_vol_cache == uV) return 0; ret = regulator_map_voltage_linear(rdev, uV, uV); if (ret < 0) return -EINVAL; ret = regmap_update_bits(di->regmap, di->sleep_reg, VSEL_NSEL_MASK, ret); if (ret < 0) return -EINVAL; /* Cache the sleep voltage setting. * Might not be the real voltage which is rounded */ di->sleep_vol_cache = uV; return 0; }
static int wm8350_dcdc_set_suspend_voltage(struct regulator_dev *rdev, int uV) { struct wm8350 *wm8350 = rdev_get_drvdata(rdev); int sel, volt_reg, dcdc = rdev_get_id(rdev); u16 val; dev_dbg(wm8350->dev, "%s %d mV %d\n", __func__, dcdc, uV / 1000); switch (dcdc) { case WM8350_DCDC_1: volt_reg = WM8350_DCDC1_LOW_POWER; break; case WM8350_DCDC_3: volt_reg = WM8350_DCDC3_LOW_POWER; break; case WM8350_DCDC_4: volt_reg = WM8350_DCDC4_LOW_POWER; break; case WM8350_DCDC_6: volt_reg = WM8350_DCDC6_LOW_POWER; break; case WM8350_DCDC_2: case WM8350_DCDC_5: default: return -EINVAL; } sel = regulator_map_voltage_linear(rdev, uV, uV); if (sel < 0) return sel; /* all DCDCs have same mV bits */ val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_DC1_VSEL_MASK; wm8350_reg_write(wm8350, volt_reg, val | sel); return 0; }