pmic_max8998.c 629 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (C) 2011 Samsung Electronics
  3. * Lukasz Majewski <l.majewski@samsung.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <power/pmic.h>
  9. #include <power/max8998_pmic.h>
  10. #include <errno.h>
  11. int pmic_init(unsigned char bus)
  12. {
  13. static const char name[] = "MAX8998_PMIC";
  14. struct pmic *p = pmic_alloc();
  15. if (!p) {
  16. printf("%s: POWER allocation error!\n", __func__);
  17. return -ENOMEM;
  18. }
  19. puts("Board PMIC init\n");
  20. p->name = name;
  21. p->interface = PMIC_I2C;
  22. p->number_of_regs = PMIC_NUM_OF_REGS;
  23. p->hw.i2c.addr = MAX8998_I2C_ADDR;
  24. p->hw.i2c.tx_num = 1;
  25. p->bus = bus;
  26. return 0;
  27. }