Lines Matching defs:tps

51  * @tps: Device to write to.
56 int tps65218_reg_write(struct tps65218 *tps, unsigned int reg,
64 return regmap_write(tps->regmap, reg, val);
67 ret = regmap_write(tps->regmap, TPS65218_REG_PASSWORD,
72 return regmap_write(tps->regmap, reg, val);
82 * @tps: Device to write to.
88 static int tps65218_update_bits(struct tps65218 *tps, unsigned int reg,
94 ret = regmap_read(tps->regmap, reg, &data);
96 dev_err(tps->dev, "Read from reg 0x%x failed\n", reg);
103 mutex_lock(&tps->tps_lock);
104 ret = tps65218_reg_write(tps, reg, data, level);
106 dev_err(tps->dev, "Write for reg 0x%x failed\n", reg);
107 mutex_unlock(&tps->tps_lock);
112 int tps65218_set_bits(struct tps65218 *tps, unsigned int reg,
115 return tps65218_update_bits(tps, reg, mask, val, level);
119 int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
122 return tps65218_update_bits(tps, reg, mask, 0, level);
214 static int tps65218_voltage_set_strict(struct tps65218 *tps)
218 if (of_property_read_u32(tps->dev->of_node,
224 dev_err(tps->dev,
229 tps65218_update_bits(tps, TPS65218_REG_CONFIG1,
236 static int tps65218_voltage_set_uv_hyst(struct tps65218 *tps)
240 if (of_property_read_u32(tps->dev->of_node,
245 dev_err(tps->dev,
250 tps65218_update_bits(tps, TPS65218_REG_CONFIG2,
257 static int tps65218_voltage_set_uvlo(struct tps65218 *tps)
262 if (of_property_read_u32(tps->dev->of_node,
280 dev_err(tps->dev,
285 tps65218_update_bits(tps, TPS65218_REG_CONFIG1,
294 struct tps65218 *tps;
298 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
299 if (!tps)
302 i2c_set_clientdata(client, tps);
303 tps->dev = &client->dev;
304 tps->irq = client->irq;
305 tps->regmap = devm_regmap_init_i2c(client, &tps65218_regmap_config);
306 if (IS_ERR(tps->regmap)) {
307 ret = PTR_ERR(tps->regmap);
308 dev_err(tps->dev, "Failed to allocate register map: %d\n",
313 mutex_init(&tps->tps_lock);
315 ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq,
317 &tps->irq_data);
321 ret = regmap_read(tps->regmap, TPS65218_REG_CHIPID, &chipid);
323 dev_err(tps->dev, "Failed to read chipid: %d\n", ret);
327 tps->rev = chipid & TPS65218_CHIPID_REV_MASK;
329 ret = tps65218_voltage_set_strict(tps);
333 ret = tps65218_voltage_set_uvlo(tps);
337 ret = tps65218_voltage_set_uv_hyst(tps);
341 ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65218_cells,
343 regmap_irq_get_domain(tps->irq_data));