Lines Matching defs:tps

42  * @tps: Device to write to.
47 int tps65218_reg_write(struct tps65218 *tps, unsigned int reg,
55 return regmap_write(tps->regmap, reg, val);
58 ret = regmap_write(tps->regmap, TPS65218_REG_PASSWORD,
63 return regmap_write(tps->regmap, reg, val);
73 * @tps: Device to write to.
79 static int tps65218_update_bits(struct tps65218 *tps, unsigned int reg,
85 ret = regmap_read(tps->regmap, reg, &data);
87 dev_err(tps->dev, "Read from reg 0x%x failed\n", reg);
94 mutex_lock(&tps->tps_lock);
95 ret = tps65218_reg_write(tps, reg, data, level);
97 dev_err(tps->dev, "Write for reg 0x%x failed\n", reg);
98 mutex_unlock(&tps->tps_lock);
103 int tps65218_set_bits(struct tps65218 *tps, unsigned int reg,
106 return tps65218_update_bits(tps, reg, mask, val, level);
110 int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
113 return tps65218_update_bits(tps, reg, mask, 0, level);
205 static int tps65218_voltage_set_strict(struct tps65218 *tps)
209 if (of_property_read_u32(tps->dev->of_node,
215 dev_err(tps->dev,
220 tps65218_update_bits(tps, TPS65218_REG_CONFIG1,
227 static int tps65218_voltage_set_uv_hyst(struct tps65218 *tps)
231 if (of_property_read_u32(tps->dev->of_node,
236 dev_err(tps->dev,
241 tps65218_update_bits(tps, TPS65218_REG_CONFIG2,
248 static int tps65218_voltage_set_uvlo(struct tps65218 *tps)
253 if (of_property_read_u32(tps->dev->of_node,
271 dev_err(tps->dev,
276 tps65218_update_bits(tps, TPS65218_REG_CONFIG1,
284 struct tps65218 *tps;
288 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
289 if (!tps)
292 i2c_set_clientdata(client, tps);
293 tps->dev = &client->dev;
294 tps->irq = client->irq;
295 tps->regmap = devm_regmap_init_i2c(client, &tps65218_regmap_config);
296 if (IS_ERR(tps->regmap)) {
297 ret = PTR_ERR(tps->regmap);
298 dev_err(tps->dev, "Failed to allocate register map: %d\n",
303 mutex_init(&tps->tps_lock);
305 ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq,
307 &tps->irq_data);
311 ret = regmap_read(tps->regmap, TPS65218_REG_CHIPID, &chipid);
313 dev_err(tps->dev, "Failed to read chipid: %d\n", ret);
317 tps->rev = chipid & TPS65218_CHIPID_REV_MASK;
319 ret = tps65218_voltage_set_strict(tps);
323 ret = tps65218_voltage_set_uvlo(tps);
327 ret = tps65218_voltage_set_uv_hyst(tps);
331 ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65218_cells,
333 regmap_irq_get_domain(tps->irq_data));