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> |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 8 | #include <power/pmic.h> |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 9 | #include <dialog_pmic.h> |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 10 | #include <errno.h> |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 11 | |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 12 | int pmic_dialog_init(unsigned char bus) |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 13 | { |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 14 | static const char name[] = "DIALOG_PMIC"; |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 15 | struct pmic *p = pmic_alloc(); |
| 16 | |
| 17 | if (!p) { |
| 18 | printf("%s: POWER allocation error!\n", __func__); |
| 19 | return -ENOMEM; |
| 20 | } |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 21 | |
| 22 | p->name = name; |
Fabio Estevam | 7a63a55 | 2012-05-07 10:25:58 +0000 | [diff] [blame] | 23 | p->number_of_regs = DIALOG_NUM_OF_REGS; |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 24 | |
| 25 | p->interface = PMIC_I2C; |
| 26 | p->hw.i2c.addr = CONFIG_SYS_DIALOG_PMIC_I2C_ADDR; |
| 27 | p->hw.i2c.tx_num = 1; |
Łukasz Majewski | 1c6dba1 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 28 | p->bus = bus; |
Fabio Estevam | 978923e | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 29 | |
| 30 | return 0; |
| 31 | } |