blob: a5c7ea34c4ae436b92a6b0a904f08979cbbc6fc9 [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
Tom Rinidec7ea02024-05-20 13:35:03 -06007#include <config.h>
Simon Glass0f2af882020-05-10 11:40:05 -06008#include <log.h>
Łukasz Majewski1c6dba12012-11-13 03:21:55 +00009#include <power/pmic.h>
Fabio Estevam978923e2012-03-20 11:40:06 +000010#include <dialog_pmic.h>
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000011#include <errno.h>
Fabio Estevam978923e2012-03-20 11:40:06 +000012
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000013int pmic_dialog_init(unsigned char bus)
Fabio Estevam978923e2012-03-20 11:40:06 +000014{
Fabio Estevam978923e2012-03-20 11:40:06 +000015 static const char name[] = "DIALOG_PMIC";
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000016 struct pmic *p = pmic_alloc();
17
18 if (!p) {
19 printf("%s: POWER allocation error!\n", __func__);
20 return -ENOMEM;
21 }
Fabio Estevam978923e2012-03-20 11:40:06 +000022
23 p->name = name;
Fabio Estevam7a63a552012-05-07 10:25:58 +000024 p->number_of_regs = DIALOG_NUM_OF_REGS;
Fabio Estevam978923e2012-03-20 11:40:06 +000025
26 p->interface = PMIC_I2C;
Tom Rini6a5dccc2022-11-16 13:10:41 -050027 p->hw.i2c.addr = CFG_SYS_DIALOG_PMIC_I2C_ADDR;
Fabio Estevam978923e2012-03-20 11:40:06 +000028 p->hw.i2c.tx_num = 1;
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000029 p->bus = bus;
Fabio Estevam978923e2012-03-20 11:40:06 +000030
31 return 0;
32}