xref: /openbmc/u-boot/drivers/power/power_dialog.c (revision 6e87ae1c)
1 /*
2  *  Copyright (C) 2011 Samsung Electronics
3  *  Lukasz Majewski <l.majewski@samsung.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <power/pmic.h>
10 #include <dialog_pmic.h>
11 #include <errno.h>
12 
13 int pmic_dialog_init(unsigned char bus)
14 {
15 	static const char name[] = "DIALOG_PMIC";
16 	struct pmic *p = pmic_alloc();
17 
18 	if (!p) {
19 		printf("%s: POWER allocation error!\n", __func__);
20 		return -ENOMEM;
21 	}
22 
23 	p->name = name;
24 	p->number_of_regs = DIALOG_NUM_OF_REGS;
25 
26 	p->interface = PMIC_I2C;
27 	p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
28 	p->hw.i2c.tx_num = 1;
29 	p->bus = bus;
30 
31 	return 0;
32 }
33