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