blob: fc95d5a10e5c3906cf48ba04c4ce1d4c4517b39f [file] [log] [blame]
Fabio Estevam20831062012-03-20 11:40:06 +00001/*
2 * Copyright (C) 2011 Samsung Electronics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Fabio Estevam20831062012-03-20 11:40:06 +00006 */
7
8#include <common.h>
Łukasz Majewskic7336812012-11-13 03:21:55 +00009#include <power/pmic.h>
Fabio Estevam20831062012-03-20 11:40:06 +000010#include <dialog_pmic.h>
Łukasz Majewskic7336812012-11-13 03:21:55 +000011#include <errno.h>
Fabio Estevam20831062012-03-20 11:40:06 +000012
Łukasz Majewskic7336812012-11-13 03:21:55 +000013int pmic_dialog_init(unsigned char bus)
Fabio Estevam20831062012-03-20 11:40:06 +000014{
Fabio Estevam20831062012-03-20 11:40:06 +000015 static const char name[] = "DIALOG_PMIC";
Łukasz Majewskic7336812012-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 Estevam20831062012-03-20 11:40:06 +000022
23 p->name = name;
Fabio Estevamed5157e2012-05-07 10:25:58 +000024 p->number_of_regs = DIALOG_NUM_OF_REGS;
Fabio Estevam20831062012-03-20 11:40:06 +000025
26 p->interface = PMIC_I2C;
27 p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
28 p->hw.i2c.tx_num = 1;
Łukasz Majewskic7336812012-11-13 03:21:55 +000029 p->bus = bus;
Fabio Estevam20831062012-03-20 11:40:06 +000030
31 return 0;
32}