1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
13 #include <power/pmic.h>
14 #include <power/tps65090.h>
16 static const struct pmic_child_info pmic_children_info[] = {
17 { .prefix = "fet", .driver = TPS65090_FET_DRIVER },
21 static int tps65090_reg_count(struct udevice *dev)
23 return TPS65090_NUM_REGS;
26 static int tps65090_write(struct udevice *dev, uint reg, const uint8_t *buff,
29 if (dm_i2c_write(dev, reg, buff, len)) {
30 pr_err("write error to device: %p register: %#x!\n", dev, reg);
37 static int tps65090_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
41 ret = dm_i2c_read(dev, reg, buff, len);
43 pr_err("read error %d from device: %p register: %#x!\n", ret,
51 static int tps65090_bind(struct udevice *dev)
53 ofnode regulators_node;
56 regulators_node = dev_read_subnode(dev, "regulators");
57 if (!ofnode_valid(regulators_node)) {
58 debug("%s: %s regulators subnode not found!\n", __func__,
63 debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
65 children = pmic_bind_children(dev, regulators_node, pmic_children_info);
67 debug("%s: %s - no child found\n", __func__, dev->name);
69 /* Always return success for this device */
73 static struct dm_pmic_ops tps65090_ops = {
74 .reg_count = tps65090_reg_count,
75 .read = tps65090_read,
76 .write = tps65090_write,
79 static const struct udevice_id tps65090_ids[] = {
80 { .compatible = "ti,tps65090" },
84 U_BOOT_DRIVER(pmic_tps65090) = {
85 .name = "tps65090 pmic",
87 .of_match = tps65090_ids,
88 .bind = tps65090_bind,