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 <log.h>
9 #include <power/pmic.h>
10 #include <dialog_pmic.h>
11 #include <errno.h>
12 
pmic_dialog_init(unsigned char bus)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