2 * (C) Copyright 2011-2013
3 * Texas Instruments, <www.ti.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <power/tps65910.h>
13 * tps65910_set_i2c_control() - Set the TPS65910 to be controlled via the I2C
15 * @return: 0 on success, not 0 on failure
17 int tps65910_set_i2c_control(void)
22 /* VDD1/2 voltage selection register access by control i/f */
23 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, TPS65910_DEVCTRL_REG, 1,
29 buf |= TPS65910_DEVCTRL_REG_SR_CTL_I2C_SEL_CTL_I2C;
31 return i2c_write(TPS65910_CTRL_I2C_ADDR, TPS65910_DEVCTRL_REG, 1,
36 * tps65910_voltage_update() - Voltage switching for MPU frequency switching.
37 * @module: mpu - 0, core - 1
38 * @vddx_op_vol_sel: vdd voltage to set
39 * @return: 0 on success, not 0 on failure
41 int tps65910_voltage_update(unsigned int module, unsigned char vddx_op_vol_sel)
44 unsigned int reg_offset;
48 reg_offset = TPS65910_VDD1_OP_REG;
50 reg_offset = TPS65910_VDD2_OP_REG;
53 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
57 buf &= ~TPS65910_OP_REG_CMD_MASK;
59 ret = i2c_write(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
63 /* Configure VDDx OP Voltage */
64 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
68 buf &= ~TPS65910_OP_REG_SEL_MASK;
69 buf |= vddx_op_vol_sel;
71 ret = i2c_write(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
75 ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
79 if ((buf & TPS65910_OP_REG_SEL_MASK) != vddx_op_vol_sel)