Lines Matching refs:lp3972

17 struct lp3972 {  struct
186 static u8 lp3972_reg_read(struct lp3972 *lp3972, u8 reg) in lp3972_reg_read() argument
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()
202 static int lp3972_set_bits(struct lp3972 *lp3972, u8 reg, u16 mask, u16 val) in lp3972_set_bits() argument
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()
223 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_ldo_is_enabled() local
228 val = lp3972_reg_read(lp3972, LP3972_LDO_OUTPUT_ENABLE_REG(ldo)); in lp3972_ldo_is_enabled()
234 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_ldo_enable() local
238 return lp3972_set_bits(lp3972, LP3972_LDO_OUTPUT_ENABLE_REG(ldo), in lp3972_ldo_enable()
244 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_ldo_disable() local
248 return lp3972_set_bits(lp3972, LP3972_LDO_OUTPUT_ENABLE_REG(ldo), in lp3972_ldo_disable()
254 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_ldo_get_voltage_sel() local
259 reg = lp3972_reg_read(lp3972, LP3972_LDO_VOL_CONTR_REG(ldo)); in lp3972_ldo_get_voltage_sel()
268 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_ldo_set_voltage_sel() local
273 ret = lp3972_set_bits(lp3972, LP3972_LDO_VOL_CONTR_REG(ldo), in lp3972_ldo_set_voltage_sel()
290 ret = lp3972_set_bits(lp3972, LP3972_VOL_CHANGE_REG, in lp3972_ldo_set_voltage_sel()
296 ret = lp3972_set_bits(lp3972, LP3972_VOL_CHANGE_REG, in lp3972_ldo_set_voltage_sel()
316 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_dcdc_is_enabled() local
321 val = lp3972_reg_read(lp3972, LP3972_BUCK_VOL_ENABLE_REG(buck)); in lp3972_dcdc_is_enabled()
327 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_dcdc_enable() local
332 val = lp3972_set_bits(lp3972, LP3972_BUCK_VOL_ENABLE_REG(buck), in lp3972_dcdc_enable()
339 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_dcdc_disable() local
344 val = lp3972_set_bits(lp3972, LP3972_BUCK_VOL_ENABLE_REG(buck), in lp3972_dcdc_disable()
351 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_dcdc_get_voltage_sel() local
355 reg = lp3972_reg_read(lp3972, LP3972_BUCK_VOL1_REG(buck)); in lp3972_dcdc_get_voltage_sel()
364 struct lp3972 *lp3972 = rdev_get_drvdata(dev); in lp3972_dcdc_set_voltage_sel() local
368 ret = lp3972_set_bits(lp3972, LP3972_BUCK_VOL1_REG(buck), in lp3972_dcdc_set_voltage_sel()
376 ret = lp3972_set_bits(lp3972, LP3972_VOL_CHANGE_REG, in lp3972_dcdc_set_voltage_sel()
381 return lp3972_set_bits(lp3972, LP3972_VOL_CHANGE_REG, in lp3972_dcdc_set_voltage_sel()
470 static int setup_regulators(struct lp3972 *lp3972, in setup_regulators() argument
481 config.dev = lp3972->dev; in setup_regulators()
483 config.driver_data = lp3972; in setup_regulators()
485 rdev = devm_regulator_register(lp3972->dev, in setup_regulators()
489 dev_err(lp3972->dev, "regulator init failed: %d\n", in setup_regulators()
500 struct lp3972 *lp3972; in lp3972_i2c_probe() local
510 lp3972 = devm_kzalloc(&i2c->dev, sizeof(struct lp3972), GFP_KERNEL); in lp3972_i2c_probe()
511 if (!lp3972) 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()
531 ret = setup_regulators(lp3972, pdata); in lp3972_i2c_probe()
535 i2c_set_clientdata(i2c, lp3972); in lp3972_i2c_probe()