blob: ca2f504cc7a11cd0238dc29dd30eea5b38b69b11 [file] [log] [blame]
Łukasz Majewski99385852011-10-03 19:45:50 +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+
Łukasz Majewski99385852011-10-03 19:45:50 +00006 */
7
8#include <common.h>
Łukasz Majewskic7336812012-11-13 03:21:55 +00009#include <power/pmic.h>
10#include <power/max8998_pmic.h>
11#include <errno.h>
Łukasz Majewski99385852011-10-03 19:45:50 +000012
Łukasz Majewskic7336812012-11-13 03:21:55 +000013int pmic_init(unsigned char bus)
Łukasz Majewski99385852011-10-03 19:45:50 +000014{
Łukasz Majewski99385852011-10-03 19:45:50 +000015 static const char name[] = "MAX8998_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 }
Łukasz Majewski99385852011-10-03 19:45:50 +000022
23 puts("Board PMIC init\n");
24
25 p->name = name;
26 p->interface = PMIC_I2C;
27 p->number_of_regs = PMIC_NUM_OF_REGS;
28 p->hw.i2c.addr = MAX8998_I2C_ADDR;
29 p->hw.i2c.tx_num = 1;
Łukasz Majewskic7336812012-11-13 03:21:55 +000030 p->bus = bus;
Łukasz Majewski99385852011-10-03 19:45:50 +000031
32 return 0;
33}