Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Adrian Alonso | 9072cb2 | 2015-08-11 11:19:49 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Freescale Semiconductor, Inc. |
| 4 | * Peng Fan <Peng.Fan@freescale.com> |
Adrian Alonso | 9072cb2 | 2015-08-11 11:19:49 -0500 | [diff] [blame] | 5 | */ |
| 6 | |
Adrian Alonso | 9072cb2 | 2015-08-11 11:19:49 -0500 | [diff] [blame] | 7 | #include <errno.h> |
| 8 | #include <i2c.h> |
| 9 | #include <power/pmic.h> |
| 10 | #include <power/pfuze3000_pmic.h> |
| 11 | |
| 12 | int power_pfuze3000_init(unsigned char bus) |
| 13 | { |
| 14 | static const char name[] = "PFUZE3000"; |
| 15 | 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; |
Trent Piepho | 3713c9b | 2018-04-25 10:06:00 -0700 | [diff] [blame] | 24 | p->number_of_regs = PFUZE3000_NUM_OF_REGS; |
Tom Rini | adce81d | 2022-12-04 10:13:36 -0500 | [diff] [blame] | 25 | p->hw.i2c.addr = CFG_POWER_PFUZE3000_I2C_ADDR; |
Adrian Alonso | 9072cb2 | 2015-08-11 11:19:49 -0500 | [diff] [blame] | 26 | p->hw.i2c.tx_num = 1; |
| 27 | p->bus = bus; |
| 28 | |
| 29 | return 0; |
| 30 | } |