From c7336815078ff3745e3130aeff35991e3e98e61e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Majewski?= Date: Tue, 13 Nov 2012 03:21:55 +0000 Subject: pmic: Extend PMIC framework to support multiple instances of PMIC devices The PMIC framework has been extended to support multiple instances of the variety of devices responsible for power management. This change allows supporting of e.g. fuel gauge, charger, MUIC (Micro USB Interface Circuit). Power related includes have been moved to ./include/power directory. This is a first of a series of patches - in the future "pmic" will be replaced with "power". Two important issues: 1. The PMIC needs to be initialized just after malloc is configured 2. It uses list to hold information about available PMIC devices Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Cc: Stefano Babic --- board/samsung/universal_c210/universal.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'board/samsung/universal_c210') diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 90fff5cf5e..c4950ddc26 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -27,10 +27,10 @@ #include #include #include -#include +#include #include #include -#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -59,7 +59,7 @@ int board_init(void) gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; #if defined(CONFIG_PMIC) - pmic_init(); + pmic_init(I2C_5); #endif check_hw_revision(); @@ -112,7 +112,9 @@ static unsigned short get_adc_value(int channel) static int adc_power_control(int on) { int ret; - struct pmic *p = get_pmic(); + struct pmic *p = pmic_get("MAX8998_PMIC"); + if (!p) + return -ENODEV; if (pmic_probe(p)) return -1; @@ -280,7 +282,9 @@ int board_mmc_init(bd_t *bis) static int s5pc210_phy_control(int on) { int ret = 0; - struct pmic *p = get_pmic(); + struct pmic *p = pmic_get("MAX8998_PMIC"); + if (!p) + return -ENODEV; if (pmic_probe(p)) return -1; -- cgit v1.2.1 From be3b51aa4a450f3e3fcd9c6e5074ef435812a02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Majewski?= Date: Tue, 13 Nov 2012 03:22:14 +0000 Subject: power:pmic: Rename CONFIG_PMIC* defines to CONFIG_POWER Rename all CONFIG_PMIC* defines to CONFIG_POWER* Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Cc: Stefano Babic --- board/samsung/universal_c210/universal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board/samsung/universal_c210') diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index c4950ddc26..9849c6d111 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -58,7 +58,7 @@ int board_init(void) gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; -#if defined(CONFIG_PMIC) +#if defined(CONFIG_POWER) pmic_init(I2C_5); #endif -- cgit v1.2.1 From f5a7004cf772ad93dbfb1224cc02d882282c914e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Majewski?= Date: Tue, 13 Nov 2012 03:22:17 +0000 Subject: arm:universal_c210:pmic: Adjust C210 Universal target platform board to new PMIC framework Move pmic_init() function call from board_init() to power_init_board() to work with new PMIC/POWER framework. Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Cc: Minkyu Kang --- board/samsung/universal_c210/universal.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'board/samsung/universal_c210') diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 9849c6d111..36a047217c 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -58,16 +58,23 @@ int board_init(void) gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; -#if defined(CONFIG_POWER) - pmic_init(I2C_5); -#endif - check_hw_revision(); printf("HW Revision:\t0x%x\n", board_rev); return 0; } +int power_init_board(void) +{ + int ret; + + ret = pmic_init(I2C_5); + if (ret) + return ret; + + return 0; +} + int dram_init(void) { gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) + -- cgit v1.2.1