1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2011-2013
4 * Texas Instruments, <www.ti.com>
9 #include <power/tps65910.h>
12 * tps65910_set_i2c_control() - Set the TPS65910 to be controlled via the I2C
14 * @return: 0 on success, not 0 on failure
16 int tps65910_set_i2c_control(void)
21 /* VDD1/2 voltage selection register access by control i/f */
22 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, TPS65910_DEVCTRL_REG, 1,
28 buf |= TPS65910_DEVCTRL_REG_SR_CTL_I2C_SEL_CTL_I2C;
30 return i2c_write(TPS65910_CTRL_I2C_ADDR, TPS65910_DEVCTRL_REG, 1,
35 * tps65910_voltage_update() - Voltage switching for MPU frequency switching.
36 * @module: mpu - 0, core - 1
37 * @vddx_op_vol_sel: vdd voltage to set
38 * @return: 0 on success, not 0 on failure
40 int tps65910_voltage_update(unsigned int module, unsigned char vddx_op_vol_sel)
43 unsigned int reg_offset;
47 reg_offset = TPS65910_VDD1_OP_REG;
49 reg_offset = TPS65910_VDD2_OP_REG;
52 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
56 buf &= ~TPS65910_OP_REG_CMD_MASK;
58 ret = i2c_write(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
62 /* Configure VDDx OP Voltage */
63 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
67 buf &= ~TPS65910_OP_REG_SEL_MASK;
68 buf |= vddx_op_vol_sel;
70 ret = i2c_write(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
74 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
78 if ((buf & TPS65910_OP_REG_SEL_MASK) != vddx_op_vol_sel)