Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Samsung Electronics |
| 3 | * Lukasz Majewski <l.majewski@samsung.com> |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 9 | #include <power/pmic.h> |
Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 10 | #include <dialog_pmic.h> |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 11 | #include <errno.h> |
Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 12 | |
Łukasz Majewski | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 13 | int pmic_dialog_init(unsigned char bus) |
Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 14 | { |
Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 15 | static const char name[] = "DIALOG_PMIC"; |
Łukasz Majewski | c733681 | 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 | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 22 | |
| 23 | p->name = name; |
Fabio Estevam | ed5157e | 2012-05-07 10:25:58 +0000 | [diff] [blame] | 24 | p->number_of_regs = DIALOG_NUM_OF_REGS; |
Fabio Estevam | 2083106 | 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 | c733681 | 2012-11-13 03:21:55 +0000 | [diff] [blame] | 29 | p->bus = bus; |
Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 30 | |
| 31 | return 0; |
| 32 | } |