]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/power/pmic/pmic_tps65218.c
tps65218/am43xx_evm: Add power framework support to TPS65218
[people/ms/u-boot.git] / drivers / power / pmic / pmic_tps65218.c
index 095245637995d3f6cf44f35accb468ff1770efd9..dbc7a73a7235eb090efccb350238eebba8f31f3f 100644 (file)
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <asm/errno.h>
+#include <power/pmic.h>
 #include <power/tps65218.h>
 
 /**
@@ -95,3 +97,23 @@ int tps65218_voltage_update(uchar dc_cntrl_reg, uchar volt_sel)
 
        return 0;
 }
+
+int power_tps65218_init(unsigned char bus)
+{
+       static const char name[] = "TPS65218_PMIC";
+       struct pmic *p = pmic_alloc();
+
+       if (!p) {
+               printf("%s: POWER allocation error!\n", __func__);
+               return -ENOMEM;
+       }
+
+       p->name = name;
+       p->interface = PMIC_I2C;
+       p->number_of_regs = TPS65218_PMIC_NUM_OF_REGS;
+       p->hw.i2c.addr = TPS65218_CHIP_PM;
+       p->hw.i2c.tx_num = 1;
+       p->bus = bus;
+
+       return 0;
+}