Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Fabio Estevam | a643acd | 2015-07-21 19:48:40 -0300 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Freescale Semiconductor, Inc. |
| 4 | * Fabio Estevam <fabio.estevam@freescale.com> |
Fabio Estevam | a643acd | 2015-07-21 19:48:40 -0300 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <errno.h> |
| 9 | #include <i2c.h> |
| 10 | #include <power/pmic.h> |
| 11 | #include <power/max77696_pmic.h> |
| 12 | |
| 13 | int power_max77696_init(unsigned char bus) |
| 14 | { |
| 15 | static const char name[] = "MAX77696"; |
| 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 = PMIC_NUM_OF_REGS; |
| 26 | p->hw.i2c.addr = CONFIG_POWER_MAX77696_I2C_ADDR; |
| 27 | p->hw.i2c.tx_num = 1; |
| 28 | p->bus = bus; |
| 29 | |
| 30 | return 0; |
| 31 | } |