Lines Matching refs:lp3971

20 struct lp3971 {  struct
26 static u8 lp3971_reg_read(struct lp3971 *lp3971, u8 reg); argument
27 static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val);
108 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_ldo_is_enabled() local
113 val = lp3971_reg_read(lp3971, LP3971_LDO_ENABLE_REG); in lp3971_ldo_is_enabled()
119 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_ldo_enable() local
123 return lp3971_set_bits(lp3971, LP3971_LDO_ENABLE_REG, mask, mask); in lp3971_ldo_enable()
128 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_ldo_disable() local
132 return lp3971_set_bits(lp3971, LP3971_LDO_ENABLE_REG, mask, 0); in lp3971_ldo_disable()
137 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_ldo_get_voltage_sel() local
141 reg = lp3971_reg_read(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo)); in lp3971_ldo_get_voltage_sel()
150 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_ldo_set_voltage_sel() local
153 return lp3971_set_bits(lp3971, LP3971_LDO_VOL_CONTR_REG(ldo), in lp3971_ldo_set_voltage_sel()
170 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_dcdc_is_enabled() local
175 val = lp3971_reg_read(lp3971, LP3971_BUCK_VOL_ENABLE_REG); in lp3971_dcdc_is_enabled()
181 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_dcdc_enable() local
185 return lp3971_set_bits(lp3971, LP3971_BUCK_VOL_ENABLE_REG, mask, mask); in lp3971_dcdc_enable()
190 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_dcdc_disable() local
194 return lp3971_set_bits(lp3971, LP3971_BUCK_VOL_ENABLE_REG, mask, 0); in lp3971_dcdc_disable()
199 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_dcdc_get_voltage_sel() local
203 reg = lp3971_reg_read(lp3971, LP3971_BUCK_TARGET_VOL1_REG(buck)); in lp3971_dcdc_get_voltage_sel()
212 struct lp3971 *lp3971 = rdev_get_drvdata(dev); in lp3971_dcdc_set_voltage_sel() local
216 ret = lp3971_set_bits(lp3971, LP3971_BUCK_TARGET_VOL1_REG(buck), in lp3971_dcdc_set_voltage_sel()
221 ret = lp3971_set_bits(lp3971, LP3971_BUCK_VOL_CHANGE_REG, in lp3971_dcdc_set_voltage_sel()
227 return lp3971_set_bits(lp3971, LP3971_BUCK_VOL_CHANGE_REG, in lp3971_dcdc_set_voltage_sel()
340 static u8 lp3971_reg_read(struct lp3971 *lp3971, u8 reg) in lp3971_reg_read() argument
344 mutex_lock(&lp3971->io_lock); in lp3971_reg_read()
346 lp3971_i2c_read(lp3971->i2c, reg, 1, &val); in lp3971_reg_read()
348 dev_dbg(lp3971->dev, "reg read 0x%02x -> 0x%02x\n", (int)reg, in lp3971_reg_read()
351 mutex_unlock(&lp3971->io_lock); in lp3971_reg_read()
356 static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val) in lp3971_set_bits() argument
361 mutex_lock(&lp3971->io_lock); in lp3971_set_bits()
363 ret = lp3971_i2c_read(lp3971->i2c, reg, 1, &tmp); in lp3971_set_bits()
366 ret = lp3971_i2c_write(lp3971->i2c, reg, 1, &tmp); in lp3971_set_bits()
367 dev_dbg(lp3971->dev, "reg write 0x%02x -> 0x%02x\n", (int)reg, in lp3971_set_bits()
370 mutex_unlock(&lp3971->io_lock); in lp3971_set_bits()
375 static int setup_regulators(struct lp3971 *lp3971, in setup_regulators() argument
386 config.dev = lp3971->dev; in setup_regulators()
388 config.driver_data = lp3971; in setup_regulators()
390 rdev = devm_regulator_register(lp3971->dev, in setup_regulators()
394 dev_err(lp3971->dev, "regulator init failed: %d\n", in setup_regulators()
405 struct lp3971 *lp3971; in lp3971_i2c_probe() local
415 lp3971 = devm_kzalloc(&i2c->dev, sizeof(struct lp3971), GFP_KERNEL); in lp3971_i2c_probe()
416 if (lp3971 == NULL) in lp3971_i2c_probe()
419 lp3971->i2c = i2c; in lp3971_i2c_probe()
420 lp3971->dev = &i2c->dev; in lp3971_i2c_probe()
422 mutex_init(&lp3971->io_lock); in lp3971_i2c_probe()
433 ret = setup_regulators(lp3971, pdata); in lp3971_i2c_probe()
437 i2c_set_clientdata(i2c, lp3971); in lp3971_i2c_probe()