blob: 9ecd358100aa7c7b85e52b879a580621de7a982f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Fabio Estevam978923e2012-03-20 11:40:06 +00002/*
3 * Copyright (C) 2011 Samsung Electronics
4 * Lukasz Majewski <l.majewski@samsung.com>
Fabio Estevam978923e2012-03-20 11:40:06 +00005 */
6
7#include <common.h>
Łukasz Majewski1c6dba12012-11-13 03:21:55 +00008#include <power/pmic.h>
Fabio Estevam978923e2012-03-20 11:40:06 +00009#include <dialog_pmic.h>
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000010#include <errno.h>
Fabio Estevam978923e2012-03-20 11:40:06 +000011
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000012int pmic_dialog_init(unsigned char bus)
Fabio Estevam978923e2012-03-20 11:40:06 +000013{
Fabio Estevam978923e2012-03-20 11:40:06 +000014 static const char name[] = "DIALOG_PMIC";
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000015 struct pmic *p = pmic_alloc();
16
17 if (!p) {
18 printf("%s: POWER allocation error!\n", __func__);
19 return -ENOMEM;
20 }
Fabio Estevam978923e2012-03-20 11:40:06 +000021
22 p->name = name;
Fabio Estevam7a63a552012-05-07 10:25:58 +000023 p->number_of_regs = DIALOG_NUM_OF_REGS;
Fabio Estevam978923e2012-03-20 11:40:06 +000024
25 p->interface = PMIC_I2C;
26 p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
27 p->hw.i2c.tx_num = 1;
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000028 p->bus = bus;
Fabio Estevam978923e2012-03-20 11:40:06 +000029
30 return 0;
31}