pmic_pfuze3000.c 645 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2015 Freescale Semiconductor, Inc.
  4. * Peng Fan <Peng.Fan@freescale.com>
  5. */
  6. #include <common.h>
  7. #include <errno.h>
  8. #include <i2c.h>
  9. #include <power/pmic.h>
  10. #include <power/pfuze3000_pmic.h>
  11. int power_pfuze3000_init(unsigned char bus)
  12. {
  13. static const char name[] = "PFUZE3000";
  14. struct pmic *p = pmic_alloc();
  15. if (!p) {
  16. printf("%s: POWER allocation error!\n", __func__);
  17. return -ENOMEM;
  18. }
  19. p->name = name;
  20. p->interface = PMIC_I2C;
  21. p->number_of_regs = PFUZE3000_NUM_OF_REGS;
  22. p->hw.i2c.addr = CONFIG_POWER_PFUZE3000_I2C_ADDR;
  23. p->hw.i2c.tx_num = 1;
  24. p->bus = bus;
  25. return 0;
  26. }