Lines Matching refs:tps

113 static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg)  in tps6507x_pmic_read()  argument
118 err = tps->mfd->read_dev(tps->mfd, reg, 1, &val); in tps6507x_pmic_read()
126 static inline int tps6507x_pmic_write(struct tps6507x_pmic *tps, u8 reg, u8 val) in tps6507x_pmic_write() argument
128 return tps->mfd->write_dev(tps->mfd, reg, 1, &val); in tps6507x_pmic_write()
131 static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) in tps6507x_pmic_set_bits() argument
135 mutex_lock(&tps->io_lock); in tps6507x_pmic_set_bits()
137 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_set_bits()
139 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_set_bits()
145 err = tps6507x_pmic_write(tps, reg, data); in tps6507x_pmic_set_bits()
147 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_set_bits()
150 mutex_unlock(&tps->io_lock); in tps6507x_pmic_set_bits()
154 static int tps6507x_pmic_clear_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) in tps6507x_pmic_clear_bits() argument
158 mutex_lock(&tps->io_lock); in tps6507x_pmic_clear_bits()
160 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_clear_bits()
162 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_clear_bits()
168 err = tps6507x_pmic_write(tps, reg, data); in tps6507x_pmic_clear_bits()
170 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_clear_bits()
173 mutex_unlock(&tps->io_lock); in tps6507x_pmic_clear_bits()
177 static int tps6507x_pmic_reg_read(struct tps6507x_pmic *tps, u8 reg) in tps6507x_pmic_reg_read() argument
181 mutex_lock(&tps->io_lock); in tps6507x_pmic_reg_read()
183 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_reg_read()
185 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_reg_read()
187 mutex_unlock(&tps->io_lock); in tps6507x_pmic_reg_read()
191 static int tps6507x_pmic_reg_write(struct tps6507x_pmic *tps, u8 reg, u8 val) in tps6507x_pmic_reg_write() argument
195 mutex_lock(&tps->io_lock); in tps6507x_pmic_reg_write()
197 err = tps6507x_pmic_write(tps, reg, val); in tps6507x_pmic_reg_write()
199 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_reg_write()
201 mutex_unlock(&tps->io_lock); in tps6507x_pmic_reg_write()
207 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_is_enabled() local
215 data = tps6507x_pmic_reg_read(tps, TPS6507X_REG_CON_CTRL1); in tps6507x_pmic_is_enabled()
225 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_enable() local
233 return tps6507x_pmic_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift); in tps6507x_pmic_enable()
238 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_disable() local
246 return tps6507x_pmic_clear_bits(tps, TPS6507X_REG_CON_CTRL1, in tps6507x_pmic_disable()
252 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_get_voltage_sel() local
262 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_get_voltage_sel()
269 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_get_voltage_sel()
287 data = tps6507x_pmic_reg_read(tps, reg); in tps6507x_pmic_get_voltage_sel()
298 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_set_voltage_sel() local
308 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_set_voltage_sel()
315 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_set_voltage_sel()
333 data = tps6507x_pmic_reg_read(tps, reg); in tps6507x_pmic_set_voltage_sel()
340 return tps6507x_pmic_reg_write(tps, reg, data); in tps6507x_pmic_set_voltage_sel()
357 struct tps6507x_pmic *tps = config->driver_data; in tps6507x_pmic_of_parse_cb() local
358 struct tps_info *info = tps->info[desc->id]; in tps6507x_pmic_of_parse_cb()
376 struct tps6507x_pmic *tps; in tps6507x_pmic_probe() local
389 tps = devm_kzalloc(&pdev->dev, sizeof(*tps), GFP_KERNEL); in tps6507x_pmic_probe()
390 if (!tps) in tps6507x_pmic_probe()
393 mutex_init(&tps->io_lock); in tps6507x_pmic_probe()
396 tps->mfd = tps6507x_dev; in tps6507x_pmic_probe()
400 tps->info[i] = info; in tps6507x_pmic_probe()
407 tps->desc[i].name = info->name; in tps6507x_pmic_probe()
408 tps->desc[i].of_match = of_match_ptr(info->name); in tps6507x_pmic_probe()
409 tps->desc[i].regulators_node = of_match_ptr("regulators"); in tps6507x_pmic_probe()
410 tps->desc[i].of_parse_cb = tps6507x_pmic_of_parse_cb; in tps6507x_pmic_probe()
411 tps->desc[i].id = i; in tps6507x_pmic_probe()
412 tps->desc[i].n_voltages = info->table_len; in tps6507x_pmic_probe()
413 tps->desc[i].volt_table = info->table; in tps6507x_pmic_probe()
414 tps->desc[i].ops = &tps6507x_pmic_ops; in tps6507x_pmic_probe()
415 tps->desc[i].type = REGULATOR_VOLTAGE; in tps6507x_pmic_probe()
416 tps->desc[i].owner = THIS_MODULE; in tps6507x_pmic_probe()
420 config.driver_data = tps; in tps6507x_pmic_probe()
422 rdev = devm_regulator_register(&pdev->dev, &tps->desc[i], in tps6507x_pmic_probe()
432 tps6507x_dev->pmic = tps; in tps6507x_pmic_probe()