blob: c646a0c31f82243c2655e49cf6c6b1378ce42359 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Tim Harvey91baa6f2014-02-12 23:48:12 -08002/*
3 * Copyright (C) 2014 Gateworks Corporation
4 * Tim Harvey <tharvey@gateworks.com>
Tim Harvey91baa6f2014-02-12 23:48:12 -08005 */
6
7#include <common.h>
8#include <errno.h>
9#include <i2c.h>
10#include <power/pmic.h>
11#include <power/pfuze100_pmic.h>
12
Tim Harvey93a6d922014-04-22 21:53:56 -070013int power_pfuze100_init(unsigned char bus)
Tim Harvey91baa6f2014-02-12 23:48:12 -080014{
Fabio Estevam676ac242014-08-01 08:50:03 -030015 static const char name[] = "PFUZE100";
Tim Harvey91baa6f2014-02-12 23:48:12 -080016 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;
Peng Fan1c1f6072015-08-14 11:36:16 +020025 p->number_of_regs = PFUZE100_NUM_OF_REGS;
Tim Harvey91baa6f2014-02-12 23:48:12 -080026 p->hw.i2c.addr = CONFIG_POWER_PFUZE100_I2C_ADDR;
27 p->hw.i2c.tx_num = 1;
28 p->bus = bus;
29
30 return 0;
31}