blob: f058238c9217555a2ccde23b8be23ad6d7f835cc [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Łukasz Majewskibad888c2011-10-03 19:45:50 +00002/*
3 * Copyright (C) 2011 Samsung Electronics
4 * Lukasz Majewski <l.majewski@samsung.com>
Łukasz Majewskibad888c2011-10-03 19:45:50 +00005 */
6
7#include <common.h>
Łukasz Majewski1c6dba12012-11-13 03:21:55 +00008#include <power/pmic.h>
9#include <power/max8998_pmic.h>
10#include <errno.h>
Łukasz Majewskibad888c2011-10-03 19:45:50 +000011
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000012int pmic_init(unsigned char bus)
Łukasz Majewskibad888c2011-10-03 19:45:50 +000013{
Łukasz Majewskibad888c2011-10-03 19:45:50 +000014 static const char name[] = "MAX8998_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 }
Łukasz Majewskibad888c2011-10-03 19:45:50 +000021
22 puts("Board PMIC init\n");
23
24 p->name = name;
25 p->interface = PMIC_I2C;
26 p->number_of_regs = PMIC_NUM_OF_REGS;
27 p->hw.i2c.addr = MAX8998_I2C_ADDR;
28 p->hw.i2c.tx_num = 1;
Łukasz Majewski1c6dba12012-11-13 03:21:55 +000029 p->bus = bus;
Łukasz Majewskibad888c2011-10-03 19:45:50 +000030
31 return 0;
32}