Ye Li | 22172f6 | 2019-10-15 02:15:18 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2019 NXP |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <errno.h> |
| 8 | #include <i2c.h> |
| 9 | #include <power/pmic.h> |
| 10 | #include <power/pca9450.h> |
| 11 | |
| 12 | static const char pca9450_name[] = "PCA9450"; |
| 13 | |
| 14 | int power_pca9450a_init(unsigned char bus) |
| 15 | { |
| 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 = pca9450_name; |
| 24 | p->interface = PMIC_I2C; |
| 25 | p->number_of_regs = PCA9450_REG_NUM; |
| 26 | p->hw.i2c.addr = 0x35; |
| 27 | p->hw.i2c.tx_num = 1; |
| 28 | p->bus = bus; |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | int power_pca9450b_init(unsigned char bus) |
| 34 | { |
| 35 | struct pmic *p = pmic_alloc(); |
| 36 | |
| 37 | if (!p) { |
| 38 | printf("%s: POWER allocation error!\n", __func__); |
| 39 | return -ENOMEM; |
| 40 | } |
| 41 | |
| 42 | p->name = pca9450_name; |
| 43 | p->interface = PMIC_I2C; |
| 44 | p->number_of_regs = PCA9450_REG_NUM; |
| 45 | p->hw.i2c.addr = 0x25; |
| 46 | p->hw.i2c.tx_num = 1; |
| 47 | p->bus = bus; |
| 48 | |
| 49 | return 0; |
| 50 | } |