Lines Matching refs:tps

48 int tps65218_reg_write(struct tps65218 *tps, unsigned int reg,  in tps65218_reg_write()  argument
56 return regmap_write(tps->regmap, reg, val); in tps65218_reg_write()
59 ret = regmap_write(tps->regmap, TPS65218_REG_PASSWORD, in tps65218_reg_write()
64 return regmap_write(tps->regmap, reg, val); in tps65218_reg_write()
80 static int tps65218_update_bits(struct tps65218 *tps, unsigned int reg, in tps65218_update_bits() argument
86 ret = regmap_read(tps->regmap, reg, &data); in tps65218_update_bits()
88 dev_err(tps->dev, "Read from reg 0x%x failed\n", reg); in tps65218_update_bits()
95 mutex_lock(&tps->tps_lock); in tps65218_update_bits()
96 ret = tps65218_reg_write(tps, reg, data, level); in tps65218_update_bits()
98 dev_err(tps->dev, "Write for reg 0x%x failed\n", reg); in tps65218_update_bits()
99 mutex_unlock(&tps->tps_lock); in tps65218_update_bits()
104 int tps65218_set_bits(struct tps65218 *tps, unsigned int reg, in tps65218_set_bits() argument
107 return tps65218_update_bits(tps, reg, mask, val, level); in tps65218_set_bits()
111 int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg, in tps65218_clear_bits() argument
114 return tps65218_update_bits(tps, reg, mask, 0, level); in tps65218_clear_bits()
206 static int tps65218_voltage_set_strict(struct tps65218 *tps) in tps65218_voltage_set_strict() argument
210 if (of_property_read_u32(tps->dev->of_node, in tps65218_voltage_set_strict()
216 dev_err(tps->dev, in tps65218_voltage_set_strict()
221 tps65218_update_bits(tps, TPS65218_REG_CONFIG1, in tps65218_voltage_set_strict()
228 static int tps65218_voltage_set_uv_hyst(struct tps65218 *tps) in tps65218_voltage_set_uv_hyst() argument
232 if (of_property_read_u32(tps->dev->of_node, in tps65218_voltage_set_uv_hyst()
237 dev_err(tps->dev, in tps65218_voltage_set_uv_hyst()
242 tps65218_update_bits(tps, TPS65218_REG_CONFIG2, in tps65218_voltage_set_uv_hyst()
249 static int tps65218_voltage_set_uvlo(struct tps65218 *tps) in tps65218_voltage_set_uvlo() argument
254 if (of_property_read_u32(tps->dev->of_node, in tps65218_voltage_set_uvlo()
272 dev_err(tps->dev, in tps65218_voltage_set_uvlo()
277 tps65218_update_bits(tps, TPS65218_REG_CONFIG1, in tps65218_voltage_set_uvlo()
286 struct tps65218 *tps; in tps65218_probe() local
290 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); in tps65218_probe()
291 if (!tps) in tps65218_probe()
294 i2c_set_clientdata(client, tps); in tps65218_probe()
295 tps->dev = &client->dev; in tps65218_probe()
296 tps->irq = client->irq; in tps65218_probe()
297 tps->regmap = devm_regmap_init_i2c(client, &tps65218_regmap_config); in tps65218_probe()
298 if (IS_ERR(tps->regmap)) { in tps65218_probe()
299 ret = PTR_ERR(tps->regmap); in tps65218_probe()
300 dev_err(tps->dev, "Failed to allocate register map: %d\n", in tps65218_probe()
305 mutex_init(&tps->tps_lock); in tps65218_probe()
307 ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq, in tps65218_probe()
309 &tps->irq_data); in tps65218_probe()
313 ret = regmap_read(tps->regmap, TPS65218_REG_CHIPID, &chipid); in tps65218_probe()
315 dev_err(tps->dev, "Failed to read chipid: %d\n", ret); in tps65218_probe()
319 tps->rev = chipid & TPS65218_CHIPID_REV_MASK; in tps65218_probe()
321 ret = tps65218_voltage_set_strict(tps); in tps65218_probe()
325 ret = tps65218_voltage_set_uvlo(tps); in tps65218_probe()
329 ret = tps65218_voltage_set_uv_hyst(tps); in tps65218_probe()
333 ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65218_cells, in tps65218_probe()
335 regmap_irq_get_domain(tps->irq_data)); in tps65218_probe()