Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2011 Samsung Electronics |
| 4 | * Lukasz Majewski <l.majewski@samsung.com> |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 8 | #include <log.h> |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 9 | #include <power/pmic.h> |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 10 | #include <dialog_pmic.h> |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 11 | #include <errno.h> |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 12 | |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 13 | int pmic_dialog_init(unsigned char bus) |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 14 | { |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 15 | static const char name[] = "DIALOG_PMIC"; |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 16 | struct pmic *p = pmic_alloc(); |
| 17 | |
| 18 | if (!p) { |
| 19 | printf("%s: POWER allocation error!\n", __func__); |
| 20 | return -ENOMEM; |
| 21 | } |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 22 | |
| 23 | p->name = name; |
Fabio Estevam | 7a63a55 | 2012-05-07 10:25:58 +0000 | [diff] [blame] | 24 | p->number_of_regs = DIALOG_NUM_OF_REGS; |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 25 | |
| 26 | p->interface = PMIC_I2C; |
| 27 | p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR; |
| 28 | p->hw.i2c.tx_num = 1; |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 29 | p->bus = bus; |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 30 | |
| 31 | return 0; |
| 32 | } |