power_dialog.c 614 B

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