Lines Matching refs:tps549b22
61 struct tps549b22 { struct
86 struct tps549b22 *tps549b22 = rdev_get_drvdata(rdev); in tps549b22_dcdc_list_voltage() argument
91 return REG2VOL(index + VOL_MIN_IDX, tps549b22->vol_step); in tps549b22_dcdc_list_voltage()
94 static int tps549b22_reg_init(struct tps549b22 *tps549b22) in tps549b22_reg_init() argument
96 if (regmap_update_bits(tps549b22->regmap_8bits, in tps549b22_reg_init()
100 return regmap_update_bits(tps549b22->regmap_8bits, in tps549b22_reg_init()
105 dev_err(tps549b22->dev, "regulator init err\n"); in tps549b22_reg_init()
112 struct tps549b22 *tps549b22 = rdev_get_drvdata(rdev); in tps549b22dcdc_is_enabled() local
116 err = regmap_read(tps549b22->regmap_8bits, TPS549b22_REG_ST_BYTE, &val); in tps549b22dcdc_is_enabled()
125 struct tps549b22 *tps549b22 = rdev_get_drvdata(rdev); in tps549b22dcdc_enable() local
127 return regmap_update_bits(tps549b22->regmap_8bits, in tps549b22dcdc_enable()
135 struct tps549b22 *tps549b22 = rdev_get_drvdata(rdev); in tps549b22dcdc_disable() local
137 return regmap_update_bits(tps549b22->regmap_8bits, in tps549b22dcdc_disable()
145 struct tps549b22 *tps549b22 = rdev_get_drvdata(rdev); in tps549b22dcdc_get_voltage() local
149 err = regmap_read(tps549b22->regmap_16bits, in tps549b22dcdc_get_voltage()
153 return REG2VOL(val, tps549b22->vol_step); in tps549b22dcdc_get_voltage()
163 struct tps549b22 *tps549b22 = rdev_get_drvdata(rdev); in tps549b22dcdc_set_voltage() local
167 if (min_uV < REG2VOL(VOL_MIN_IDX, tps549b22->vol_step) || in tps549b22dcdc_set_voltage()
168 min_uV > REG2VOL(VOL_MAX_IDX, tps549b22->vol_step)) { in tps549b22dcdc_set_voltage()
171 REG2VOL(min_uV, tps549b22->vol_step)); in tps549b22dcdc_set_voltage()
176 if (REG2VOL(val, tps549b22->vol_step) >= min_uV) in tps549b22dcdc_set_voltage()
179 if (REG2VOL(val, tps549b22->vol_step) > max_uV) in tps549b22dcdc_set_voltage()
182 REG2VOL(val, tps549b22->vol_step)); in tps549b22dcdc_set_voltage()
184 err = regmap_update_bits(tps549b22->regmap_16bits, in tps549b22dcdc_set_voltage()
191 REG2VOL(val, tps549b22->vol_step)); in tps549b22dcdc_set_voltage()
221 tps549b22_parse_dt(struct tps549b22 *tps549b22) in tps549b22_parse_dt() argument
228 tps549b22_np = of_node_get(tps549b22->dev->of_node); in tps549b22_parse_dt()
238 count = of_regulator_match(tps549b22->dev, in tps549b22_parse_dt()
245 &tps549b22->vol_step)) in tps549b22_parse_dt()
246 tps549b22->vol_step = VOL_STEP_DEF; in tps549b22_parse_dt()
248 dev_info(tps549b22->dev, "voltage-step: %duV\n", tps549b22->vol_step); in tps549b22_parse_dt()
256 pdata = devm_kzalloc(tps549b22->dev, sizeof(*pdata), GFP_KERNEL); in tps549b22_parse_dt()
293 struct tps549b22 *tps549b22; in tps549b22_i2c_probe() local
310 tps549b22 = devm_kzalloc(&i2c->dev, in tps549b22_i2c_probe()
311 sizeof(struct tps549b22), in tps549b22_i2c_probe()
313 if (!tps549b22) { in tps549b22_i2c_probe()
318 tps549b22->regmap_8bits = in tps549b22_i2c_probe()
320 if (IS_ERR(tps549b22->regmap_8bits)) { in tps549b22_i2c_probe()
322 return PTR_ERR(tps549b22->regmap_8bits); in tps549b22_i2c_probe()
325 tps549b22->regmap_16bits = in tps549b22_i2c_probe()
327 if (IS_ERR(tps549b22->regmap_16bits)) { in tps549b22_i2c_probe()
329 return PTR_ERR(tps549b22->regmap_16bits); in tps549b22_i2c_probe()
332 tps549b22->i2c = i2c; in tps549b22_i2c_probe()
333 tps549b22->dev = &i2c->dev; in tps549b22_i2c_probe()
334 i2c_set_clientdata(i2c, tps549b22); in tps549b22_i2c_probe()
336 ret = regmap_read(tps549b22->regmap_16bits, in tps549b22_i2c_probe()
341 dev_warn(tps549b22->dev, in tps549b22_i2c_probe()
345 dev_err(tps549b22->dev, in tps549b22_i2c_probe()
351 tps549b22_reg_init(tps549b22); in tps549b22_i2c_probe()
353 if (tps549b22->dev->of_node) in tps549b22_i2c_probe()
354 pdev = tps549b22_parse_dt(tps549b22); in tps549b22_i2c_probe()
357 tps549b22->num_regulators = TPS549b22_NUM_REGULATORS; in tps549b22_i2c_probe()
358 tps549b22->rdev = in tps549b22_i2c_probe()
359 devm_kmalloc_array(tps549b22->dev, in tps549b22_i2c_probe()
363 if (!tps549b22->rdev) in tps549b22_i2c_probe()
368 config.dev = tps549b22->dev; in tps549b22_i2c_probe()
369 config.driver_data = tps549b22; in tps549b22_i2c_probe()
370 if (tps549b22->dev->of_node) in tps549b22_i2c_probe()
375 rdev = devm_regulator_register(tps549b22->dev, in tps549b22_i2c_probe()
383 tps549b22->rdev[0] = rdev; in tps549b22_i2c_probe()