blob: f058238c9217555a2ccde23b8be23ad6d7f835cc [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Łukasz Majewski99385852011-10-03 19:45:50 +00002/*
3 * Copyright (C) 2011 Samsung Electronics
4 * Lukasz Majewski <l.majewski@samsung.com>
Łukasz Majewski99385852011-10-03 19:45:50 +00005 */
6
7#include <common.h>
Łukasz Majewskic7336812012-11-13 03:21:55 +00008#include <power/pmic.h>
9#include <power/max8998_pmic.h>
10#include <errno.h>
Łukasz Majewski99385852011-10-03 19:45:50 +000011
Łukasz Majewskic7336812012-11-13 03:21:55 +000012int pmic_init(unsigned char bus)
Łukasz Majewski99385852011-10-03 19:45:50 +000013{
Łukasz Majewski99385852011-10-03 19:45:50 +000014 static const char name[] = "MAX8998_PMIC";
Łukasz Majewskic7336812012-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 Majewski99385852011-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 Majewskic7336812012-11-13 03:21:55 +000029 p->bus = bus;
Łukasz Majewski99385852011-10-03 19:45:50 +000030
31 return 0;
32}