Lines Matching refs:tps

121 static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg)  in tps6507x_pmic_read()  argument
126 err = tps->mfd->read_dev(tps->mfd, reg, 1, &val); in tps6507x_pmic_read()
134 static inline int tps6507x_pmic_write(struct tps6507x_pmic *tps, u8 reg, u8 val) in tps6507x_pmic_write() argument
136 return tps->mfd->write_dev(tps->mfd, reg, 1, &val); in tps6507x_pmic_write()
139 static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) in tps6507x_pmic_set_bits() argument
143 mutex_lock(&tps->io_lock); in tps6507x_pmic_set_bits()
145 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_set_bits()
147 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_set_bits()
153 err = tps6507x_pmic_write(tps, reg, data); in tps6507x_pmic_set_bits()
155 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_set_bits()
158 mutex_unlock(&tps->io_lock); in tps6507x_pmic_set_bits()
162 static int tps6507x_pmic_clear_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) in tps6507x_pmic_clear_bits() argument
166 mutex_lock(&tps->io_lock); in tps6507x_pmic_clear_bits()
168 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_clear_bits()
170 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_clear_bits()
176 err = tps6507x_pmic_write(tps, reg, data); in tps6507x_pmic_clear_bits()
178 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_clear_bits()
181 mutex_unlock(&tps->io_lock); in tps6507x_pmic_clear_bits()
185 static int tps6507x_pmic_reg_read(struct tps6507x_pmic *tps, u8 reg) in tps6507x_pmic_reg_read() argument
189 mutex_lock(&tps->io_lock); in tps6507x_pmic_reg_read()
191 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_reg_read()
193 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_reg_read()
195 mutex_unlock(&tps->io_lock); in tps6507x_pmic_reg_read()
199 static int tps6507x_pmic_reg_write(struct tps6507x_pmic *tps, u8 reg, u8 val) in tps6507x_pmic_reg_write() argument
203 mutex_lock(&tps->io_lock); in tps6507x_pmic_reg_write()
205 err = tps6507x_pmic_write(tps, reg, val); in tps6507x_pmic_reg_write()
207 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_reg_write()
209 mutex_unlock(&tps->io_lock); in tps6507x_pmic_reg_write()
215 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_is_enabled() local
223 data = tps6507x_pmic_reg_read(tps, TPS6507X_REG_CON_CTRL1); in tps6507x_pmic_is_enabled()
233 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_enable() local
241 return tps6507x_pmic_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift); in tps6507x_pmic_enable()
246 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_disable() local
254 return tps6507x_pmic_clear_bits(tps, TPS6507X_REG_CON_CTRL1, in tps6507x_pmic_disable()
260 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_get_voltage_sel() local
270 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_get_voltage_sel()
277 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_get_voltage_sel()
295 data = tps6507x_pmic_reg_read(tps, reg); in tps6507x_pmic_get_voltage_sel()
306 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_set_voltage_sel() local
316 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_set_voltage_sel()
323 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_set_voltage_sel()
341 data = tps6507x_pmic_reg_read(tps, reg); in tps6507x_pmic_set_voltage_sel()
348 return tps6507x_pmic_reg_write(tps, reg, data); in tps6507x_pmic_set_voltage_sel()
365 struct tps6507x_pmic *tps = config->driver_data; in tps6507x_pmic_of_parse_cb() local
366 struct tps_info *info = tps->info[desc->id]; in tps6507x_pmic_of_parse_cb()
384 struct tps6507x_pmic *tps; in tps6507x_pmic_probe() local
397 tps = devm_kzalloc(&pdev->dev, sizeof(*tps), GFP_KERNEL); in tps6507x_pmic_probe()
398 if (!tps) in tps6507x_pmic_probe()
401 mutex_init(&tps->io_lock); in tps6507x_pmic_probe()
404 tps->mfd = tps6507x_dev; in tps6507x_pmic_probe()
408 tps->info[i] = info; in tps6507x_pmic_probe()
415 tps->desc[i].name = info->name; in tps6507x_pmic_probe()
416 tps->desc[i].of_match = of_match_ptr(info->name); in tps6507x_pmic_probe()
417 tps->desc[i].regulators_node = of_match_ptr("regulators"); in tps6507x_pmic_probe()
418 tps->desc[i].of_parse_cb = tps6507x_pmic_of_parse_cb; in tps6507x_pmic_probe()
419 tps->desc[i].id = i; in tps6507x_pmic_probe()
420 tps->desc[i].n_voltages = info->table_len; in tps6507x_pmic_probe()
421 tps->desc[i].volt_table = info->table; in tps6507x_pmic_probe()
422 tps->desc[i].ops = &tps6507x_pmic_ops; in tps6507x_pmic_probe()
423 tps->desc[i].type = REGULATOR_VOLTAGE; in tps6507x_pmic_probe()
424 tps->desc[i].owner = THIS_MODULE; in tps6507x_pmic_probe()
428 config.driver_data = tps; in tps6507x_pmic_probe()
430 rdev = devm_regulator_register(&pdev->dev, &tps->desc[i], in tps6507x_pmic_probe()
440 tps6507x_dev->pmic = tps; in tps6507x_pmic_probe()