Tim Harvey | 91baa6f | 2014-02-12 23:48:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 Gateworks Corporation |
| 3 | * Tim Harvey <tharvey@gateworks.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <errno.h> |
| 10 | #include <i2c.h> |
| 11 | #include <power/pmic.h> |
| 12 | #include <power/pfuze100_pmic.h> |
| 13 | |
Tim Harvey | 93a6d92 | 2014-04-22 21:53:56 -0700 | [diff] [blame] | 14 | int power_pfuze100_init(unsigned char bus) |
Tim Harvey | 91baa6f | 2014-02-12 23:48:12 -0800 | [diff] [blame] | 15 | { |
Fabio Estevam | 676ac24 | 2014-08-01 08:50:03 -0300 | [diff] [blame] | 16 | static const char name[] = "PFUZE100"; |
Tim Harvey | 91baa6f | 2014-02-12 23:48:12 -0800 | [diff] [blame] | 17 | struct pmic *p = pmic_alloc(); |
| 18 | |
| 19 | if (!p) { |
| 20 | printf("%s: POWER allocation error!\n", __func__); |
| 21 | return -ENOMEM; |
| 22 | } |
| 23 | |
| 24 | p->name = name; |
| 25 | p->interface = PMIC_I2C; |
Peng Fan | 1c1f607 | 2015-08-14 11:36:16 +0200 | [diff] [blame] | 26 | p->number_of_regs = PFUZE100_NUM_OF_REGS; |
Tim Harvey | 91baa6f | 2014-02-12 23:48:12 -0800 | [diff] [blame] | 27 | p->hw.i2c.addr = CONFIG_POWER_PFUZE100_I2C_ADDR; |
| 28 | p->hw.i2c.tx_num = 1; |
| 29 | p->bus = bus; |
| 30 | |
| 31 | return 0; |
| 32 | } |