blob: af94f37b0f108f79c9c10d1f850a0a137f4913a7 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Tim Harvey7f1fbc82014-04-22 21:53:58 -07002/*
3 * Copyright (C) 2014 Gateworks Corporation
4 * Tim Harvey <tharvey@gateworks.com>
Tim Harvey7f1fbc82014-04-22 21:53:58 -07005 */
6
7#include <common.h>
8#include <errno.h>
9#include <i2c.h>
10#include <power/pmic.h>
11#include <power/ltc3676_pmic.h>
12
13int power_ltc3676_init(unsigned char bus)
14{
15 static const char name[] = "LTC3676_PMIC";
16 struct pmic *p = pmic_alloc();
17
18 if (!p) {
19 printf("%s: POWER allocation error!\n", __func__);
20 return -ENOMEM;
21 }
22
23 p->name = name;
24 p->interface = PMIC_I2C;
25 p->number_of_regs = LTC3676_NUM_OF_REGS;
Tom Rini6e4344e2022-12-04 10:13:34 -050026 p->hw.i2c.addr = CFG_POWER_LTC3676_I2C_ADDR;
Tim Harvey7f1fbc82014-04-22 21:53:58 -070027 p->hw.i2c.tx_num = 1;
28 p->bus = bus;
29
30 return 0;
31}