power_dialog.c 631 B

1234567891011121314151617181920212223242526272829303132
  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 <log.h>
  8. #include <power/pmic.h>
  9. #include <dialog_pmic.h>
  10. #include <errno.h>
  11. int pmic_dialog_init(unsigned char bus)
  12. {
  13. static const char name[] = "DIALOG_PMIC";
  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->number_of_regs = DIALOG_NUM_OF_REGS;
  21. p->interface = PMIC_I2C;
  22. p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR;
  23. p->hw.i2c.tx_num = 1;
  24. p->bus = bus;
  25. return 0;
  26. }