Lines Matching +full:ldo +full:-
1 // SPDX-License-Identifier: GPL-2.0-only
64 /* LDO output enable mask */
146 /* LDO voltage control registers shift:
147 LP3972_LDO1 -> 0, LP3972_LDO2 -> 4
148 LP3972_LDO3 -> 0, LP3972_LDO4 -> 4
149 LP3972_LDO5 -> 0
169 return -EIO; in lp3972_i2c_read()
182 return -EIO; in lp3972_i2c_write()
190 mutex_lock(&lp3972->io_lock); in lp3972_reg_read()
192 lp3972_i2c_read(lp3972->i2c, reg, 1, &val); in lp3972_reg_read()
194 dev_dbg(lp3972->dev, "reg read 0x%02x -> 0x%02x\n", (int)reg, in lp3972_reg_read()
197 mutex_unlock(&lp3972->io_lock); in lp3972_reg_read()
207 mutex_lock(&lp3972->io_lock); in lp3972_set_bits()
209 ret = lp3972_i2c_read(lp3972->i2c, reg, 1, &tmp); in lp3972_set_bits()
212 ret = lp3972_i2c_write(lp3972->i2c, reg, 1, &tmp); in lp3972_set_bits()
213 dev_dbg(lp3972->dev, "reg write 0x%02x -> 0x%02x\n", (int)reg, in lp3972_set_bits()
216 mutex_unlock(&lp3972->io_lock); in lp3972_set_bits()
224 int ldo = rdev_get_id(dev) - LP3972_LDO1; in lp3972_ldo_is_enabled() local
225 u16 mask = LP3972_LDO_OUTPUT_ENABLE_MASK(ldo); in lp3972_ldo_is_enabled()
228 val = lp3972_reg_read(lp3972, LP3972_LDO_OUTPUT_ENABLE_REG(ldo)); in lp3972_ldo_is_enabled()
235 int ldo = rdev_get_id(dev) - LP3972_LDO1; in lp3972_ldo_enable() local
236 u16 mask = LP3972_LDO_OUTPUT_ENABLE_MASK(ldo); in lp3972_ldo_enable()
238 return lp3972_set_bits(lp3972, LP3972_LDO_OUTPUT_ENABLE_REG(ldo), in lp3972_ldo_enable()
245 int ldo = rdev_get_id(dev) - LP3972_LDO1; in lp3972_ldo_disable() local
246 u16 mask = LP3972_LDO_OUTPUT_ENABLE_MASK(ldo); in lp3972_ldo_disable()
248 return lp3972_set_bits(lp3972, LP3972_LDO_OUTPUT_ENABLE_REG(ldo), in lp3972_ldo_disable()
255 int ldo = rdev_get_id(dev) - LP3972_LDO1; in lp3972_ldo_get_voltage_sel() local
256 u16 mask = LP3972_LDO_VOL_MASK(ldo); in lp3972_ldo_get_voltage_sel()
259 reg = lp3972_reg_read(lp3972, LP3972_LDO_VOL_CONTR_REG(ldo)); in lp3972_ldo_get_voltage_sel()
260 val = (reg >> LP3972_LDO_VOL_CONTR_SHIFT(ldo)) & mask; in lp3972_ldo_get_voltage_sel()
269 int ldo = rdev_get_id(dev) - LP3972_LDO1; in lp3972_ldo_set_voltage_sel() local
272 shift = LP3972_LDO_VOL_CONTR_SHIFT(ldo); in lp3972_ldo_set_voltage_sel()
273 ret = lp3972_set_bits(lp3972, LP3972_LDO_VOL_CONTR_REG(ldo), in lp3972_ldo_set_voltage_sel()
274 LP3972_LDO_VOL_MASK(ldo) << shift, selector << shift); in lp3972_ldo_set_voltage_sel()
286 switch (ldo) { in lp3972_ldo_set_voltage_sel()
289 shift = LP3972_LDO_VOL_CHANGE_SHIFT(ldo); in lp3972_ldo_set_voltage_sel()
317 int buck = rdev_get_id(dev) - LP3972_DCDC1; in lp3972_dcdc_is_enabled()
328 int buck = rdev_get_id(dev) - LP3972_DCDC1; in lp3972_dcdc_enable()
340 int buck = rdev_get_id(dev) - LP3972_DCDC1; in lp3972_dcdc_disable()
352 int buck = rdev_get_id(dev) - LP3972_DCDC1; in lp3972_dcdc_get_voltage_sel()
365 int buck = rdev_get_id(dev) - LP3972_DCDC1; in lp3972_dcdc_set_voltage_sel()
476 for (i = 0; i < pdata->num_regulators; i++) { in setup_regulators()
477 struct lp3972_regulator_subdev *reg = &pdata->regulators[i]; in setup_regulators()
481 config.dev = lp3972->dev; in setup_regulators()
482 config.init_data = reg->initdata; in setup_regulators()
485 rdev = devm_regulator_register(lp3972->dev, in setup_regulators()
486 ®ulators[reg->id], &config); in setup_regulators()
489 dev_err(lp3972->dev, "regulator init failed: %d\n", in setup_regulators()
501 struct lp3972_platform_data *pdata = dev_get_platdata(&i2c->dev); in lp3972_i2c_probe()
506 dev_dbg(&i2c->dev, "No platform init data supplied\n"); in lp3972_i2c_probe()
507 return -ENODEV; in lp3972_i2c_probe()
510 lp3972 = devm_kzalloc(&i2c->dev, sizeof(struct lp3972), GFP_KERNEL); in lp3972_i2c_probe()
512 return -ENOMEM; in lp3972_i2c_probe()
514 lp3972->i2c = i2c; in lp3972_i2c_probe()
515 lp3972->dev = &i2c->dev; in lp3972_i2c_probe()
517 mutex_init(&lp3972->io_lock); in lp3972_i2c_probe()
523 ret = -ENODEV; in lp3972_i2c_probe()
524 dev_err(&i2c->dev, "chip reported: val = 0x%x\n", val); in lp3972_i2c_probe()
527 dev_err(&i2c->dev, "failed to detect device. ret = %d\n", ret); in lp3972_i2c_probe()