1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+ 25e2f0177STim Harvey /* 35e2f0177STim Harvey * Copyright (C) 2014 Gateworks Corporation 45e2f0177STim Harvey * Tim Harvey <tharvey@gateworks.com> 55e2f0177STim Harvey */ 65e2f0177STim Harvey 75e2f0177STim Harvey #include <common.h> 85e2f0177STim Harvey #include <errno.h> 95e2f0177STim Harvey #include <i2c.h> 105e2f0177STim Harvey #include <power/pmic.h> 115e2f0177STim Harvey #include <power/ltc3676_pmic.h> 125e2f0177STim Harvey power_ltc3676_init(unsigned char bus)135e2f0177STim Harveyint power_ltc3676_init(unsigned char bus) 145e2f0177STim Harvey { 155e2f0177STim Harvey static const char name[] = "LTC3676_PMIC"; 165e2f0177STim Harvey struct pmic *p = pmic_alloc(); 175e2f0177STim Harvey 185e2f0177STim Harvey if (!p) { 195e2f0177STim Harvey printf("%s: POWER allocation error!\n", __func__); 205e2f0177STim Harvey return -ENOMEM; 215e2f0177STim Harvey } 225e2f0177STim Harvey 235e2f0177STim Harvey p->name = name; 245e2f0177STim Harvey p->interface = PMIC_I2C; 255e2f0177STim Harvey p->number_of_regs = LTC3676_NUM_OF_REGS; 265e2f0177STim Harvey p->hw.i2c.addr = CONFIG_POWER_LTC3676_I2C_ADDR; 275e2f0177STim Harvey p->hw.i2c.tx_num = 1; 285e2f0177STim Harvey p->bus = bus; 295e2f0177STim Harvey 305e2f0177STim Harvey return 0; 315e2f0177STim Harvey } 32