Lines Matching refs:tps
122 static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg) in tps6507x_pmic_read() argument
127 err = tps->mfd->read_dev(tps->mfd, reg, 1, &val); in tps6507x_pmic_read()
135 static inline int tps6507x_pmic_write(struct tps6507x_pmic *tps, u8 reg, u8 val) in tps6507x_pmic_write() argument
137 return tps->mfd->write_dev(tps->mfd, reg, 1, &val); in tps6507x_pmic_write()
140 static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) in tps6507x_pmic_set_bits() argument
144 mutex_lock(&tps->io_lock); in tps6507x_pmic_set_bits()
146 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_set_bits()
148 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_set_bits()
154 err = tps6507x_pmic_write(tps, reg, data); in tps6507x_pmic_set_bits()
156 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_set_bits()
159 mutex_unlock(&tps->io_lock); in tps6507x_pmic_set_bits()
163 static int tps6507x_pmic_clear_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) in tps6507x_pmic_clear_bits() argument
167 mutex_lock(&tps->io_lock); in tps6507x_pmic_clear_bits()
169 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_clear_bits()
171 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_clear_bits()
177 err = tps6507x_pmic_write(tps, reg, data); in tps6507x_pmic_clear_bits()
179 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_clear_bits()
182 mutex_unlock(&tps->io_lock); in tps6507x_pmic_clear_bits()
186 static int tps6507x_pmic_reg_read(struct tps6507x_pmic *tps, u8 reg) in tps6507x_pmic_reg_read() argument
190 mutex_lock(&tps->io_lock); in tps6507x_pmic_reg_read()
192 data = tps6507x_pmic_read(tps, reg); in tps6507x_pmic_reg_read()
194 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg); in tps6507x_pmic_reg_read()
196 mutex_unlock(&tps->io_lock); in tps6507x_pmic_reg_read()
200 static int tps6507x_pmic_reg_write(struct tps6507x_pmic *tps, u8 reg, u8 val) in tps6507x_pmic_reg_write() argument
204 mutex_lock(&tps->io_lock); in tps6507x_pmic_reg_write()
206 err = tps6507x_pmic_write(tps, reg, val); in tps6507x_pmic_reg_write()
208 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg); in tps6507x_pmic_reg_write()
210 mutex_unlock(&tps->io_lock); in tps6507x_pmic_reg_write()
216 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_is_enabled() local
224 data = tps6507x_pmic_reg_read(tps, TPS6507X_REG_CON_CTRL1); in tps6507x_pmic_is_enabled()
234 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_enable() local
242 return tps6507x_pmic_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift); in tps6507x_pmic_enable()
247 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_disable() local
255 return tps6507x_pmic_clear_bits(tps, TPS6507X_REG_CON_CTRL1, in tps6507x_pmic_disable()
261 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_get_voltage_sel() local
271 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_get_voltage_sel()
278 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_get_voltage_sel()
296 data = tps6507x_pmic_reg_read(tps, reg); in tps6507x_pmic_get_voltage_sel()
307 struct tps6507x_pmic *tps = rdev_get_drvdata(dev); in tps6507x_pmic_set_voltage_sel() local
317 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_set_voltage_sel()
324 if (tps->info[rid]->defdcdc_default) in tps6507x_pmic_set_voltage_sel()
342 data = tps6507x_pmic_reg_read(tps, reg); in tps6507x_pmic_set_voltage_sel()
349 return tps6507x_pmic_reg_write(tps, reg, data); in tps6507x_pmic_set_voltage_sel()
443 struct tps6507x_pmic *tps; in tps6507x_pmic_probe() local
470 tps = devm_kzalloc(&pdev->dev, sizeof(*tps), GFP_KERNEL); in tps6507x_pmic_probe()
471 if (!tps) in tps6507x_pmic_probe()
474 mutex_init(&tps->io_lock); in tps6507x_pmic_probe()
477 tps->mfd = tps6507x_dev; in tps6507x_pmic_probe()
481 tps->info[i] = info; in tps6507x_pmic_probe()
485 tps->info[i]->defdcdc_default = data->defdcdc_default; in tps6507x_pmic_probe()
488 tps->desc[i].name = info->name; in tps6507x_pmic_probe()
489 tps->desc[i].id = i; in tps6507x_pmic_probe()
490 tps->desc[i].n_voltages = info->table_len; in tps6507x_pmic_probe()
491 tps->desc[i].volt_table = info->table; in tps6507x_pmic_probe()
492 tps->desc[i].ops = &tps6507x_pmic_ops; in tps6507x_pmic_probe()
493 tps->desc[i].type = REGULATOR_VOLTAGE; in tps6507x_pmic_probe()
494 tps->desc[i].owner = THIS_MODULE; in tps6507x_pmic_probe()
498 config.driver_data = tps; in tps6507x_pmic_probe()
506 tps->info[i]->defdcdc_default = prop; in tps6507x_pmic_probe()
511 rdev = regulator_register(&tps->desc[i], &config); in tps6507x_pmic_probe()
521 tps->rdev[i] = rdev; in tps6507x_pmic_probe()
524 tps6507x_dev->pmic = tps; in tps6507x_pmic_probe()
531 regulator_unregister(tps->rdev[i]); in tps6507x_pmic_probe()
538 struct tps6507x_pmic *tps = tps6507x_dev->pmic; in tps6507x_pmic_remove() local
542 regulator_unregister(tps->rdev[i]); in tps6507x_pmic_remove()