blob: a266709d8d078990801458d65108e371585ec731 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Tim Harvey4b00fcd2014-02-12 23:48:12 -08002/*
3 * Copyright (C) 2014 Gateworks Corporation
4 * Tim Harvey <tharvey@gateworks.com>
Tim Harvey4b00fcd2014-02-12 23:48:12 -08005 */
6
Tim Harvey4b00fcd2014-02-12 23:48:12 -08007#include <errno.h>
8#include <i2c.h>
9#include <power/pmic.h>
10#include <power/pfuze100_pmic.h>
11
Tim Harveyb34e3d82014-04-22 21:53:56 -070012int power_pfuze100_init(unsigned char bus)
Tim Harvey4b00fcd2014-02-12 23:48:12 -080013{
Fabio Estevamb96df4f2014-08-01 08:50:03 -030014 static const char name[] = "PFUZE100";
Tim Harvey4b00fcd2014-02-12 23:48:12 -080015 struct pmic *p = pmic_alloc();
16
17 if (!p) {
18 printf("%s: POWER allocation error!\n", __func__);
19 return -ENOMEM;
20 }
21
22 p->name = name;
23 p->interface = PMIC_I2C;
Peng Fan6f4f6d22015-08-14 11:36:16 +020024 p->number_of_regs = PFUZE100_NUM_OF_REGS;
Tom Rinif52f9072022-12-04 10:13:35 -050025 p->hw.i2c.addr = CFG_POWER_PFUZE100_I2C_ADDR;
Tim Harvey4b00fcd2014-02-12 23:48:12 -080026 p->hw.i2c.tx_num = 1;
27 p->bus = bus;
28
29 return 0;
30}