blob: 12500ba9990117d6ff08865455983d32f1ca2675 [file] [log] [blame]
Ye Lic3ee9092019-10-15 02:15:18 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2019 NXP
4 */
5
Ye Lic3ee9092019-10-15 02:15:18 -07006#include <errno.h>
7#include <i2c.h>
8#include <power/pmic.h>
9#include <power/pca9450.h>
10
11static const char pca9450_name[] = "PCA9450";
12
Peng Fanff866412021-03-19 15:57:06 +080013int power_pca9450_init(unsigned char bus, unsigned char addr)
Ye Lic3ee9092019-10-15 02:15:18 -070014{
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 = pca9450_name;
23 p->interface = PMIC_I2C;
24 p->number_of_regs = PCA9450_REG_NUM;
Peng Fanff866412021-03-19 15:57:06 +080025 p->hw.i2c.addr = addr;
Ye Lic3ee9092019-10-15 02:15:18 -070026 p->hw.i2c.tx_num = 1;
27 p->bus = bus;
28
29 return 0;
30}