Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Fabio Estevam | 2083106 | 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 | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 5 | */ |
6 | |||||
7 | #include <common.h> | ||||
Simon Glass | f7ae49f | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 8 | #include <log.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; | ||||
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 27 | p->hw.i2c.addr = CFG_SYS_DIALOG_PMIC_I2C_ADDR; |
Fabio Estevam | 2083106 | 2012-03-20 11:40:06 +0000 | [diff] [blame] | 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 | } |