1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2014 Texas Instruments Incorporated - http://www.ti.com
4 * Author: Felipe Balbi <balbi@ti.com>
9 #include <linux/errno.h>
10 #include <power/pmic.h>
11 #include <power/tps62362.h>
14 struct udevice *tps62362_dev __attribute__((section(".data"))) = NULL;
18 * tps62362_voltage_update() - Function to change a voltage level, as this
19 * is a multi-step process.
20 * @reg: Register address to write to
21 * @volt_sel: Voltage register value to write
22 * @return: 0 on success, 1 on failure
24 int tps62362_voltage_update(unsigned char reg, unsigned char volt_sel)
26 if (reg > TPS62362_NUM_REGS)
30 return i2c_write(TPS62362_I2C_ADDR, reg, 1, &volt_sel, 1);
34 return dm_i2c_reg_write(tps62362_dev, reg, volt_sel);
39 int power_tps62362_init(unsigned char bus)
41 static const char name[] = "TPS62362";
42 struct pmic *p = pmic_alloc();
45 printf("%s: POWER allocation error!\n", __func__);
50 p->interface = PMIC_I2C;
51 p->number_of_regs = TPS62362_NUM_REGS;
52 p->hw.i2c.addr = TPS62362_I2C_ADDR;
59 int power_tps62362_init(unsigned char bus)
61 struct udevice *dev = NULL;
64 rc = i2c_get_chip_for_busnum(bus, TPS62362_I2C_ADDR, 1, &dev);