pmic: Redesign PMIC framework to support multiple instances of devices
Subsystems (3)
cover pmic: Redesign PMIC framework to support multiple instances of devices
PMIC framework has been redesigned to support multiple instances of power related devices (e.g. fuel gauge, PMICs, chargers, micro USB IC).
Due to that, code at other architectures and boards have been adjusted properly.
New power_board_init() method at ./lib/board.c file has been introduced. It is meant to be an architecture dependent function to support advanced power management. Since PMIC framework uses lists internally to link different devices, its initialization must be done just after malloc initialization.
Please consider commits from this patch set as the example of advanced power management for a particular HW (Trats board in this case).
In the new approach PMICs are selected with their names (e.g. 'pmic dump MAX8997_PMIC') Presented patch set is a first step to change 'pmic' command to more generic (i.e. power) to provide control for multiple devices.
Dependencies:
1. gpio:fix: Proper handling of GPIO subsystem parts at Samsung devices
http://patchwork.ozlabs.org/patch/181768/
2. i2c:soft:multi: Support for multiple soft I2C buses at Samsung boards
http://patchwork.ozlabs.org/patch/181789/
3. i2c:soft:multi: Enable soft I2C multibus at Trats development board
http://patchwork.ozlabs.org/patch/181788/
Test HW:
- Exynos4210 Trats development board
Lukasz Majewski (16):
pmic:i2c: Handle PMIC I2C transmission comprising of two bytes pmic:i2c: Add I2C byte order to PMIC framework pmic:max8997: Switch the MAX8997 PMIC to be used with multibus I2C
pmic: Extend PMIC framework to support multiple instances of PMIC
devices
pmic: Introduce power_board_init() method at ./lib/board.c file
pmic: Enable power_board_init() support at TRATS pmic:chrg: Common information about charger and battery
(power_chrg.h)
pmic:muic: Support for MUIC built into MAX8997 device pmic:fuel-gauge: Support for MAX17042 fuel-gauge pmic:max8997: Function for calculating LDO internal register value arm:trats:pmic: Default PMIC(MAX8997) initialization for Samsung's
TRATS board
arm:trats:pmic: Enable MUIC (MAX8997) at Samsung's TRATS board arm:trats:pmic: Enable fuel-gauge (MAX17042) at Samsung's TRATS board pmic:max8997: Support for MAX8997 internal charger control arm:trats:pmic: Support for charging battery at Samsung's TRATS board arm:trats:pmic: Power consumption reduction state for Samsung's TRATS
board
arch/arm/lib/board.c | 4 +
board/davedenx/qong/qong.c | 6 +-
board/freescale/mx31pdk/mx31pdk.c | 6 +-
board/freescale/mx35pdk/mx35pdk.c | 8 +-
board/freescale/mx51evk/mx51evk.c | 6 +-
board/freescale/mx53evk/mx53evk.c | 6 +-
board/freescale/mx53loco/mx53loco.c | 10 +-
board/hale/tt01/tt01.c | 6 +-
board/samsung/goni/goni.c | 9 +-
board/samsung/trats/trats.c | 259 ++++++++++++++++++++++++++++-
board/samsung/universal_c210/universal.c | 10 +-
board/ttcontrol/vision2/vision2.c | 6 +-
drivers/misc/Makefile | 2 +
drivers/misc/fg_max17042.c | 235 +++++++++++++++++++++++++++
drivers/misc/muic_max8997.c | 80 +++++++++
drivers/misc/pmic_core.c | 108 +++++++++----
drivers/misc/pmic_dialog.c | 8 +-
drivers/misc/pmic_fsl.c | 8 +-
drivers/misc/pmic_i2c.c | 40 ++++-
drivers/misc/pmic_max8997.c | 80 +++++++++-
drivers/misc/pmic_max8998.c | 10 +-
drivers/misc/pmic_spi.c | 4 +-
drivers/rtc/mc13xxx-rtc.c | 6 +-
include/common.h | 3 +
include/configs/trats.h | 7 +
include/power/fg_battery_cell_params.h | 88 ++++++++++
include/power/max17042_fg.h | 74 +++++++++
include/power/max8997_muic.h | 61 +++++++
include/{ => power}/max8997_pmic.h | 27 +++-
include/{ => power}/max8998_pmic.h | 0
include/{ => power}/pmic.h | 20 ++-
include/power/power_chrg.h | 56 +++++++
32 files changed, 1143 insertions(+), 110 deletions(-)
create mode 100644 drivers/misc/fg_max17042.c
create mode 100644 drivers/misc/muic_max8997.c
create mode 100644 include/power/fg_battery_cell_params.h
create mode 100644 include/power/max17042_fg.h
create mode 100644 include/power/max8997_muic.h
rename include/{ => power}/max8997_pmic.h (87%)
rename include/{ => power}/max8998_pmic.h (100%)
rename include/{ => power}/pmic.h (80%)
create mode 100644 include/power/power_chrg.hSignature · 1 line
1.7.2.3
PATCH 1/16 pmic:i2c: Handle PMIC I2C transmission comprising of two bytes
This patch adds support for proper handling of a PMIC I2C transmission comprising of two bytes.
--- drivers/misc/pmic_i2c.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/misc/pmic_i2c.c +8 -1
@@ -44,6 +44,10 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val) buf[1 ] = (val >>8 ) &0xff ; buf[2 ] = val &0xff ;break ; +case 2 : + buf[0 ] = (val >>8 ) &0xff ; + buf[1 ] = val &0xff ; +break ;case 1 : buf[0 ] = val &0xff ;break ;
@@ -73,6 +77,9 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)case 3 : ret_val = buf[0 ] <<16 | buf[1 ] <<8 | buf[2 ];break ; +case 2 : + ret_val = buf[0 ] <<8 | buf[1 ]; +break ;case 1 : ret_val = buf[0 ];break ;
@@ -88,7 +95,7 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)int pmic_probe (struct pmic *p) {I2C_SET_BUS (p->bus); -debug ("PMIC:%s probed!\n" , p->name); +debug ("Bus: %d PMIC:%s probed!\n" , p->bus, p->name);if (i2c_probe (pmic_i2c_addr)) {printf ("Can't find PMIC:%s\n" , p->name);return -1 ;
Signature · 1 line
1.7.2.3
PATCH 2/16 pmic:i2c: Add I2C byte order to PMIC framework
In reply to Lukasz MajewskiSince the pmic_reg_read is the u32 value, the order in which bytes are placed to form u32 value is important.
This commit adds the reverse (which is default) and normal byte order.
--- drivers/misc/pmic_i2c.c | 31 ++++++++++++++++++++++++------- include/pmic.h | 3 +++ 2 files changed, 27 insertions(+), 7 deletions(-)
drivers/misc/pmic_i2c.c +24 -7
@@ -40,13 +40,24 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)switch (pmic_i2c_tx_num) {case 3 : - buf[0 ] = (val >>16 ) &0xff ; - buf[1 ] = (val >>8 ) &0xff ; - buf[2 ] = val &0xff ; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) { + buf[2 ] = (val >>16 ) &0xff ; + buf[1 ] = (val >>8 ) &0xff ; + buf[0 ] = val &0xff ; + }else { + buf[0 ] = (val >>16 ) &0xff ; + buf[1 ] = (val >>8 ) &0xff ; + buf[2 ] = val &0xff ; + }break ;case 2 : - buf[0 ] = (val >>8 ) &0xff ; - buf[1 ] = val &0xff ; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) { + buf[1 ] = (val >>8 ) &0xff ; + buf[0 ] = val &0xff ; + }else { + buf[0 ] = (val >>8 ) &0xff ; + buf[1 ] = val &0xff ; + }break ;case 1 : buf[0 ] = val &0xff ;
@@ -75,10 +86,16 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)switch (pmic_i2c_tx_num) {case 3 : - ret_val = buf[0 ] <<16 | buf[1 ] <<8 | buf[2 ]; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) + ret_val = buf[2 ] <<16 | buf[1 ] <<8 | buf[0 ]; +else + ret_val = buf[0 ] <<16 | buf[1 ] <<8 | buf[2 ];break ;case 2 : - ret_val = buf[0 ] <<8 | buf[1 ]; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) + ret_val = buf[1 ] <<8 | buf[0 ]; +else + ret_val = buf[0 ] <<8 | buf[1 ];break ;case 1 : ret_val = buf[0 ];
include/pmic.h +3 -0
@@ -27,11 +27,13 @@enum {PMIC_I2C ,PMIC_SPI , };enum {I2C_PMIC ,I2C_NUM , };enum {PMIC_READ ,PMIC_WRITE , }; +enum {PMIC_BYTE_ORDER_REVERSED ,PMIC_BYTE_ORDER_NORMAL , };struct p_i2c {unsigned char addr;unsigned char *buf;unsigned char tx_num; +unsigned char byte_order; };struct p_spi {
@@ -65,6 +67,7 @@ int pmic_set_output(struct pmic *p, u32 reg, int ldo, int on);#define pmic_i2c_addr (p->hw.i2c.addr)#define pmic_i2c_tx_num (p->hw.i2c.tx_num) +#define pmic_i2c_byte_order (p->hw.i2c.byte_order)#define pmic_spi_bitlen (p->hw.spi.bitlen)#define pmic_spi_flags (p->hw.spi.flags)
Signature · 1 line
1.7.2.3
PATCH 2/16 pmic:i2c: Add I2C byte order to PMIC framework
Quoted 8 lines · Lukasz Majewski
Since the
pmic_reg_readis the u32 value, the order in which bytes are placed to form u32 value is important.This commit adds the reverse (which is default) and normal byte order.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>---
Hi,
Quoted 62 lines
drivers/misc/pmic_i2c.c | 31 ++++++++++++++++++++++++------- include/pmic.h | 3 +++ 2 files changed, 27 insertions(+), 7 deletions(-)drivers/misc/pmic_i2c.c +24
-7@@ -40,13 +40,24 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)switch (pmic_i2c_tx_num) {case 3 : - buf[0 ] = (val >>16 ) &0xff ; - buf[1 ] = (val >>8 ) &0xff ; - buf[2 ] = val &0xff ; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) { + buf[2 ] = (val >>16 ) &0xff ; + buf[1 ] = (val >>8 ) &0xff ; + buf[0 ] = val &0xff ; + }else { + buf[0 ] = (val >>16 ) &0xff ; + buf[1 ] = (val >>8 ) &0xff ; + buf[2 ] = val &0xff ; + }break ;case 2 : - buf[0 ] = (val >>8 ) &0xff ; - buf[1 ] = val &0xff ; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) { + buf[1 ] = (val >>8 ) &0xff ; + buf[0 ] = val &0xff ; + }else { + buf[0 ] = (val >>8 ) &0xff ; + buf[1 ] = val &0xff ; + }break ;case 1 : buf[0 ] = val &0xff ;@@ -75,10 +86,16 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)switch (pmic_i2c_tx_num) {case 3 : - ret_val = buf[0 ] <<16 | buf[1 ] <<8 | buf[2 ]; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) + ret_val = buf[2 ] <<16 | buf[1 ] <<8 | buf[0 ]; +else + ret_val = buf[0 ] <<16 | buf[1 ] <<8 | buf[2 ];break ;case 2 : - ret_val = buf[0 ] <<8 | buf[1 ]; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) + ret_val = buf[1 ] <<8 | buf[0 ]; +else + ret_val = buf[0 ] <<8 | buf[1 ];break ;case 1 : ret_val = buf[0 ];include/pmic.h +0
-0
include/pmic.h line 36
Quoted 10 lines
include/pmic.h +2
-0@@ -27,11 +27,13 @@enum {PMIC_I2C ,PMIC_SPI , };enum {I2C_PMIC ,I2C_NUM , };enum {PMIC_READ ,PMIC_WRITE , }; +enum {PMIC_BYTE_ORDER_REVERSED ,PMIC_BYTE_ORDER_NORMAL , };struct p_i2c {unsigned char addr;unsigned char *buf;unsigned char tx_num; +unsigned char byte_order;
I can imagine we could have the same issue with SPI and not only with I2C. The byte order is not strictly related to the interface type, and I think this should add to the "struct pmic" instead of the "struct p_i2c".
Regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 2/16 pmic:i2c: Add I2C byte order to PMIC framework
Hi Stefano,
Quoted 83 lines · Lukasz Majewski
Quoted 9 lines
Since the
pmic_reg_readis the u32 value, the order in which bytes are placed to form u32 value is important.This commit adds the reverse (which is default) and normal byte order.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>---
Hi,
Quoted 70 lines
drivers/misc/pmic_i2c.c | 31 ++++++++++++++++++++++++------- include/pmic.h | 3 +++ 2 files changed, 27 insertions(+), 7 deletions(-)drivers/misc/pmic_i2c.c +16
-5@@ -40,13 +40,24 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)switch (pmic_i2c_tx_num) {case 3 : - buf[0 ] = (val >>16 ) &0xff ; - buf[1 ] = (val >>8 ) &0xff ; - buf[2 ] = val &0xff ; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) { + buf[2 ] = (val >>16 ) &0xff ; + buf[1 ] = (val >>8 ) &0xff ; + buf[0 ] = val &0xff ; + }else { + buf[0 ] = (val >>16 ) &0xff ; + buf[1 ] = (val >>8 ) &0xff ; + buf[2 ] = val &0xff ; + }break ;case 2 : - buf[0 ] = (val >>8 ) &0xff ; - buf[1 ] = val &0xff ; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) { + buf[1 ] = (val >>8 ) &0xff ; + buf[0 ] = val &0xff ; + }else { + buf[0 ] = (val >>8 ) &0xff ; + buf[1 ] = val &0xff ; + }break ;drivers/misc/pmic_i2c.c +8
-2case 1 : buf[0 ] = val &0xff ;@@ -75,10 +86,16 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)switch (pmic_i2c_tx_num) {case 3 : - ret_val = buf[0 ] <<16 | buf[1 ] <<8 | buf[2 ]; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) + ret_val = buf[2 ] <<16 | buf[1 ] <<8 | buf[0 ]; +else + ret_val = buf[0 ] <<16 | buf[1 ] <<8 | buf[2 ];break ;case 2 : - ret_val = buf[0 ] <<8 | buf[1 ]; +if (pmic_i2c_byte_order ==PMIC_BYTE_ORDER_NORMAL ) + ret_val = buf[1 ] <<8 | buf[0 ]; +else + ret_val = buf[0 ] <<8 | buf[1 ];break ;case 1 :drivers/misc/pmic_i2c.c +0
-0ret_val = buf[0 ];include/pmic.h +1
-0@@ -27,11 +27,13 @@enum {PMIC_I2C ,PMIC_SPI , };enum {I2C_PMIC ,I2C_NUM , };enum {PMIC_READ ,PMIC_WRITE , }; +enum {PMIC_BYTE_ORDER_REVERSED ,PMIC_BYTE_ORDER_NORMAL , };
Quoted 11 lines
include/pmic.h line 36
Quoted 5 lines
include/pmic.h +1
-0struct p_i2c {unsigned char addr;unsigned char *buf;unsigned char tx_num; +unsigned char byte_order;I can imagine we could have the same issue with SPI and not only with I2C. The byte order is not strictly related to the interface type, and I think this should add to the "struct pmic" instead of the "struct
p_i2c".
Thanks for reply.
Good point. I will move this to struct pmic.
Best regards,
Lukasz Majewski
PATCH 3/16 pmic:max8997: Switch the MAX8997 PMIC to be used with multibus I2C
In reply to Lukasz MajewskiPMIC MAX8997 is now ready to work with single and multibus soft I2C implementation.
--- drivers/misc/pmic_max8997.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/misc/pmic_max8997.c +2 -1
@@ -24,6 +24,7 @@#include <common.h> #include <pmic.h> #include <max8997_pmic.h> +#include <i2c.h> int pmic_init (void ) {
@@ -37,7 +38,7 @@ int pmic_init(void) p->number_of_regs =PMIC_NUM_OF_REGS ; p->hw.i2c.addr =MAX8997_I2C_ADDR ; p->hw.i2c.tx_num =1 ; - p->bus =I2C_PMIC ; + p->bus =I2C_0 ;return 0 ; }
Signature · 1 line
1.7.2.3
PATCH 3/16 pmic:max8997: Switch the MAX8997 PMIC to be used with multibus I2C
Quoted 22 lines · Lukasz Majewski
PMIC MAX8997 is now ready to work with single and multibus soft I2C implementation.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- drivers/misc/pmic_max8997.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/misc/pmic_max8997.c +1
-0@@ -24,6 +24,7 @@#include <common.h> #include <pmic.h> #include <max8997_pmic.h> +#include <i2c.h> int pmic_init (void ) {
drivers/misc/pmic_max8997.c int pmic_init(void) · line 42
Quoted 6 lines
drivers/misc/pmic_max8997.c +1
-1@@ -37,7 +38,7 @@ int pmic_init(void) p->number_of_regs =PMIC_NUM_OF_REGS ; p->hw.i2c.addr =MAX8997_I2C_ADDR ; p->hw.i2c.tx_num =1 ; - p->bus =I2C_PMIC ; + p->bus =I2C_0 ;
I do not see so useful to add an enum for each instance of the I2C bus. And we have to add it if the number of i2c busses grows. IMHO it is better to use directly the constant, so later in another patch pmic_init(5) instead of pmic(I2C_5).
Regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 3/16 pmic:max8997: Switch the MAX8997 PMIC to be used with multibus I2C
Hi Stefano,
Quoted 20 lines · Lukasz Majewski
Quoted 19 lines
PMIC MAX8997 is now ready to work with single and multibus soft I2C implementation.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- drivers/misc/pmic_max8997.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/misc/pmic_max8997.cindex 62dbc05..4943f66 100644drivers/misc/pmic_max8997.c +1
-0@@ -24,6 +24,7 @@#include <common.h> #include <pmic.h> #include <max8997_pmic.h> +#include <i2c.h>
Quoted 15 lines
drivers/misc/pmic_max8997.c int pmic_init(void) · line 42
Quoted 9 lines
drivers/misc/pmic_max8997.c +1
-1int pmic_init (void ) {@@ -37,7 +38,7 @@ int pmic_init(void) p->number_of_regs =PMIC_NUM_OF_REGS ; p->hw.i2c.addr =MAX8997_I2C_ADDR ; p->hw.i2c.tx_num =1 ; - p->bus =I2C_PMIC ; + p->bus =I2C_0 ;I do not see so useful to add an enum for each instance of the I2C bus. And we have to add it if the number of i2c busses grows. IMHO it is better to use directly the constant, so later in another patch
pmic_init(5)instead ofpmic(I2C_5).
This problem has been already discussed with Heiko:
http://patchwork.ozlabs.org/patch/181789/
I think, that we will have to have an enum of available I2C_x busses at <i2c.h> header file.
In the case of Trats and PMIC framework, the I2C_0 is done on purpose to keep the trats board working (since the PMIC is in reality connected to I2C_5). This numbering (I2C_0) needs to be there until prerequisite patches aren't accepted (the multibus I2C support on trats board)
Regards,
Lukasz Majewski
PATCH 4/16 pmic: Extend PMIC framework to support multiple instances of PMIC devices
In reply to Lukasz MajewskiThe 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
---
board/davedenx/qong/qong.c | 6 +-
board/freescale/mx31pdk/mx31pdk.c | 6 +-
board/freescale/mx35pdk/mx35pdk.c | 8 +-
board/freescale/mx51evk/mx51evk.c | 6 +-
board/freescale/mx53evk/mx53evk.c | 6 +-
board/freescale/mx53loco/mx53loco.c | 10 ++--
board/hale/tt01/tt01.c | 6 +-
board/samsung/goni/goni.c | 9 ++-
board/samsung/trats/trats.c | 12 ++--
board/samsung/universal_c210/universal.c | 10 ++--
board/ttcontrol/vision2/vision2.c | 6 +-
drivers/misc/pmic_core.c | 108 ++++++++++++++++++++++--------
drivers/misc/pmic_dialog.c | 8 +-
drivers/misc/pmic_fsl.c | 8 +-
drivers/misc/pmic_i2c.c | 6 +-
drivers/misc/pmic_max8997.c | 10 ++--
drivers/misc/pmic_max8998.c | 10 ++--
drivers/misc/pmic_spi.c | 4 +-
drivers/rtc/mc13xxx-rtc.c | 6 +-
include/{ => power}/max8997_pmic.h | 17 +++++-
include/{ => power}/max8998_pmic.h | 0
include/{ => power}/pmic.h | 17 +++--
22 files changed, 177 insertions(+), 102 deletions(-)
rename include/{ => power}/max8997_pmic.h (92%)
rename include/{ => power}/max8998_pmic.h (100%)
rename include/{ => power}/pmic.h (86%)board/davedenx/qong/qong.c +3 -3
@@ -28,7 +28,7 @@#include <asm/arch/sys_proto.h> #include <asm/io.h> #include <nand.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> #include <asm/gpio.h> #include "qong_fpga.h"
@@ -173,8 +173,8 @@ int board_late_init(void)u32 val;struct pmic *p; -pmic_init (); - p =get_pmic (); +pmic_init (I2C_PMIC ); + p =pmic_get ("FSL_PMIC" );/* Enable RTC battery */ pmic_reg_read (p,REG_POWER_CTL0 , &val);
board/freescale/mx31pdk/mx31pdk.c +3 -3
@@ -30,7 +30,7 @@#include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> #include <watchdog.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -84,8 +84,8 @@ int board_late_init(void)u32 val;struct pmic *p; -pmic_init (); - p =get_pmic (); +pmic_init (I2C_PMIC ); + p =pmic_get ("FSL_PMIC" );/* Enable RTC battery */ pmic_reg_read (p,REG_POWER_CTL0 , &val);
board/freescale/mx35pdk/mx35pdk.c +4 -4
@@ -30,7 +30,7 @@#include <asm/arch/mx35_pins.h> #include <asm/arch/iomux.h> #include <i2c.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> #include <mc9sdz60.h> #include <mc13892.h>
@@ -204,7 +204,7 @@ int board_init(void)static inline int pmic_detect (void ) {unsigned int id; -struct pmic *p =get_pmic (); +struct pmic *p =pmic_get ("FSL_PMIC" );pmic_reg_read (p,REG_IDENTIFICATION , &id);
@@ -229,9 +229,9 @@ int board_late_init(void)u32 pmic_val;struct pmic *p; -pmic_init (); +pmic_init (I2C_PMIC );if (pmic_detect ()) { - p =get_pmic (); + p =pmic_get ("FSL_PMIC" );mxc_request_iomux (MX35_PIN_WATCHDOG_RST ,MUX_CONFIG_SION |MUX_CONFIG_ALT1 );
board/freescale/mx51evk/mx51evk.c +3 -3
@@ -32,7 +32,7 @@#include <i2c.h> #include <mmc.h> #include <fsl_esdhc.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> #include <mc13892.h> #include <usb/ehci-fsl.h>
@@ -244,8 +244,8 @@ static void power_init(void)struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE ;struct pmic *p; -pmic_init (); - p =get_pmic (); +pmic_init (I2C_PMIC ); + p =pmic_get ("FSL_PMIC" );/* Write needed to Power Gate 2 register */ pmic_reg_read (p,REG_POWER_MISC , &val);
board/freescale/mx53evk/mx53evk.c +3 -3
@@ -33,7 +33,7 @@#include <i2c.h> #include <mmc.h> #include <fsl_esdhc.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> #include <asm/gpio.h> #include <mc13892.h>
@@ -123,8 +123,8 @@ void power_init(void)unsigned int val;struct pmic *p; -pmic_init (); - p =get_pmic (); +pmic_init (I2C_PMIC ); + p =pmic_get ("FSL_PMIC" );/* Set VDDA to 1.25V */ pmic_reg_read (p,REG_SW_2 , &val);
board/freescale/mx53loco/mx53loco.c +5 -5
@@ -36,7 +36,7 @@#include <mmc.h> #include <fsl_esdhc.h> #include <asm/gpio.h> -#include <pmic.h> +#include <power/pmic.h> #include <dialog_pmic.h> #include <fsl_pmic.h> #include <linux/fb.h>
@@ -343,8 +343,8 @@ static int power_init(void)struct pmic *p;if (!i2c_probe (CONFIG_SYS_DIALOG_PMIC_I2C_ADDR )) { -pmic_dialog_init (); - p =get_pmic (); +pmic_dialog_init (I2C_PMIC ); + p =pmic_get ("DIALOG_PMIC" );/* Set VDDA to 1.25V */ val =DA9052_BUCKCORE_BCOREEN |DA_BUCKCORE_VBCORE_1_250V ;
@@ -360,8 +360,8 @@ static int power_init(void) }if (!i2c_probe (CONFIG_SYS_FSL_PMIC_I2C_ADDR )) { -pmic_init (); - p =get_pmic (); +pmic_init (I2C_PMIC ); + p =pmic_get ("DIALOG_PMIC" );/* Set VDDGP to 1.25V for 1GHz on SW1 */ pmic_reg_read (p,REG_SW_0 , &val);
board/hale/tt01/tt01.c +3 -3
@@ -25,7 +25,7 @@#include <common.h> #include <netdev.h> #include <command.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> #include <mc13783.h> #include <asm/arch/clock.h>
@@ -201,8 +201,8 @@ int board_mmc_init(bd_t *bis)* pmic_init() here. board_late_init() is too late for * the MMC driver. */ -pmic_init (); - p =get_pmic (); +pmic_init (I2C_PMIC ); + p =pmic_get ("FSL_PMIC" );/* configure pins for SDHC1 only */ mx31_gpio_mux (IOMUX_MODE (MUX_CTL_SD1_CLK ,MUX_CTL_FUNC ));
board/samsung/goni/goni.c +5 -4
@@ -25,10 +25,10 @@#include <common.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h> -#include <pmic.h> +#include <power/pmic.h> #include <usb/s3c_udc.h> #include <asm/arch/cpu.h> -#include <max8998_pmic.h> +#include <power/max8998_pmic.h> DECLARE_GLOBAL_DATA_PTR ;static struct s5pc110_gpio *s5pc110_gpio;
@@ -42,8 +42,9 @@ int board_init(void) gd->bd->bi_boot_params =PHYS_SDRAM_1 +0x100 ;#if defined(CONFIG_PMIC ) -pmic_init (); +pmic_init (I2C_5 );#endif +return 0 ; }
@@ -108,7 +109,7 @@ static int s5pc1xx_phy_control(int on) {int ret;static int status; -struct pmic *p =get_pmic (); +struct pmic *p =pmic_get ("MAX8998_PMIC" );if (pmic_probe (p))return -1 ;
board/samsung/trats/trats.c +6 -6
@@ -34,9 +34,9 @@#include <asm/arch/mipi_dsim.h> #include <asm/arch/watchdog.h> #include <asm/arch/power.h> -#include <pmic.h> +#include <power/pmic.h> #include <usb/s3c_udc.h> -#include <max8997_pmic.h> +#include <power/max8997_pmic.h> #include <libtizen.h> #include "setup.h"
@@ -69,7 +69,7 @@ int board_init(void)printf ("HW Revision:\t0x%x\n" , board_rev);#if defined(CONFIG_PMIC ) -pmic_init (); +pmic_init (I2C_5 );#endif return 0 ;
@@ -238,7 +238,7 @@ static int s5pc210_phy_control(int on) {int ret =0 ;u32 val =0 ; -struct pmic *p =get_pmic (); +struct pmic *p =pmic_get ("MAX8997_PMIC" );if (pmic_probe (p))return -1 ;
@@ -413,7 +413,7 @@ static void lcd_reset(void)static int lcd_power (void ) {int ret =0 ; -struct pmic *p =get_pmic (); +struct pmic *p =pmic_get ("MAX8997_PMIC" );if (pmic_probe (p))return 0 ;
@@ -473,7 +473,7 @@ static struct mipi_dsim_lcd_device mipi_lcd_device = {static int mipi_power (void ) {int ret =0 ; -struct pmic *p =get_pmic (); +struct pmic *p =pmic_get ("MAX8997_PMIC" );if (pmic_probe (p))return 0 ;
board/samsung/universal_c210/universal.c +5 -5
@@ -27,10 +27,10 @@#include <asm/arch/adc.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h> -#include <pmic.h> +#include <power/pmic.h> #include <usb/s3c_udc.h> #include <asm/arch/cpu.h> -#include <max8998_pmic.h> +#include <power/max8998_pmic.h> 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,7 @@ 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 (pmic_probe (p))return -1 ;
@@ -280,7 +280,7 @@ 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 (pmic_probe (p))return -1 ;
board/ttcontrol/vision2/vision2.c +3 -3
@@ -33,7 +33,7 @@#include <asm/arch/sys_proto.h> #include <i2c.h> #include <mmc.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_esdhc.h> #include <fsl_pmic.h> #include <mc13892.h>
@@ -306,8 +306,8 @@ static void power_init_mx51(void)unsigned int val;struct pmic *p; -pmic_init (); - p =get_pmic (); +pmic_init (I2C_PMIC ); + p =pmic_get ("FSL_PMIC" );/* Write needed to Power Gate 2 register */ pmic_reg_read (p,REG_POWER_MISC , &val);
drivers/misc/pmic_core.c +80 -28
174 lines not on this page · raw message
drivers/misc/pmic_dialog.c +4 -4
@@ -17,12 +17,12 @@*/ #include <common.h> -#include <pmic.h> +#include <power/pmic.h> #include <dialog_pmic.h> -int pmic_dialog_init (void ) +int pmic_dialog_init (unsigned char bus) { -struct pmic *p =get_pmic (); +struct pmic *p =pmic_alloc ();static const char name[] ="DIALOG_PMIC" ; p->name = name;
@@ -31,7 +31,7 @@ int pmic_dialog_init(void) p->interface =PMIC_I2C ; p->hw.i2c.addr =CONFIG_SYS_DIALOG_PMIC_I2C_ADDR ; p->hw.i2c.tx_num =1 ; - p->bus =I2C_PMIC ; + p->bus = bus;return 0 ; }
drivers/misc/pmic_fsl.c +4 -4
@@ -23,7 +23,7 @@#include <common.h> #include <spi.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> #if defined(CONFIG_PMIC_SPI )
@@ -33,9 +33,9 @@ static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write) }#endif -int pmic_init (void ) +int pmic_init (unsigned char bus) { -struct pmic *p =get_pmic (); +struct pmic *p =pmic_alloc ();static const char name[] ="FSL_PMIC" ; p->name = name;
@@ -54,7 +54,7 @@ int pmic_init(void) p->interface =PMIC_I2C ; p->hw.i2c.addr =CONFIG_SYS_FSL_PMIC_I2C_ADDR ; p->hw.i2c.tx_num =3 ; - p->bus =I2C_PMIC ; + p->bus = bus;#else #error "You must select CONFIG_PMIC_SPI or CONFIG_PMIC_I2C"#endif
drivers/misc/pmic_i2c.c +3 -3
@@ -28,14 +28,14 @@#include <common.h> #include <linux/types.h> -#include <pmic.h> +#include <power/pmic.h> #include <i2c.h> int pmic_reg_write (struct pmic *p,u32 reg,u32 val) {unsigned char buf[4 ] = {0 }; -if (check_reg (reg)) +if (check_reg (p, reg))return -1 ;switch (pmic_i2c_tx_num) {
@@ -78,7 +78,7 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)unsigned char buf[4 ] = {0 };u32 ret_val =0 ; -if (check_reg (reg)) +if (check_reg (p, reg))return -1 ;if (i2c_read (pmic_i2c_addr, reg,1 , buf, pmic_i2c_tx_num))
drivers/misc/pmic_max8997.c +5 -5
@@ -22,13 +22,13 @@*/ #include <common.h> -#include <pmic.h> -#include <max8997_pmic.h> +#include <power/pmic.h> +#include <power/max8997_pmic.h> #include <i2c.h> -int pmic_init (void ) +int pmic_init (unsigned char bus) { -struct pmic *p =get_pmic (); +struct pmic *p =pmic_alloc ();static const char name[] ="MAX8997_PMIC" ;puts ("Board PMIC init\n" );
@@ -38,7 +38,7 @@ int pmic_init(void) p->number_of_regs =PMIC_NUM_OF_REGS ; p->hw.i2c.addr =MAX8997_I2C_ADDR ; p->hw.i2c.tx_num =1 ; - p->bus =I2C_0 ; + p->bus = bus;return 0 ; }
drivers/misc/pmic_max8998.c +5 -5
@@ -22,12 +22,12 @@*/ #include <common.h> -#include <pmic.h> -#include <max8998_pmic.h> +#include <power/pmic.h> +#include <power/max8998_pmic.h> -int pmic_init (void ) +int pmic_init (unsigned char bus) { -struct pmic *p =get_pmic (); +struct pmic *p =pmic_alloc ();static const char name[] ="MAX8998_PMIC" ;puts ("Board PMIC init\n" );
@@ -37,7 +37,7 @@ int pmic_init(void) p->number_of_regs =PMIC_NUM_OF_REGS ; p->hw.i2c.addr =MAX8998_I2C_ADDR ; p->hw.i2c.tx_num =1 ; - p->bus =I2C_PMIC ; + p->bus = bus;return 0 ; }
drivers/misc/pmic_spi.c +2 -2
@@ -28,7 +28,7 @@#include <common.h> #include <linux/types.h> -#include <pmic.h> +#include <power/pmic.h> #include <spi.h> static struct spi_slave *slave;
@@ -59,7 +59,7 @@ static u32 pmic_reg(struct pmic *p, u32 reg, u32 *val, u32 write)return -1 ; } -if (check_reg (reg)) +if (check_reg (p, reg))return -1 ;if (spi_claim_bus (slave))
drivers/rtc/mc13xxx-rtc.c +3 -3
@@ -23,14 +23,14 @@#include <common.h> #include <rtc.h> #include <spi.h> -#include <pmic.h> +#include <power/pmic.h> #include <fsl_pmic.h> int rtc_get (struct rtc_time *rtc) {u32 day1, day2, time;int tim, i =0 ; -struct pmic *p =get_pmic (); +struct pmic *p =pmic_get ("FSL_PMIC" );int ret; do {
@@ -61,7 +61,7 @@ int rtc_get(struct rtc_time *rtc)int rtc_set (struct rtc_time *rtc) {u32 time, day; -struct pmic *p =get_pmic (); +struct pmic *p =pmic_get ("FSL_PMIC" ); time =mktime (rtc->tm_year, rtc->tm_mon, rtc->tm_mday, rtc->tm_hour, rtc->tm_min, rtc->tm_sec);
include/power/max8997_pmic.h renamed from include/max8997_pmic.h +16 -1
@@ -111,7 +111,7 @@ enum {MAX8997_REG_MBCCTRL6 =0x55 ,MAX8997_REG_OTPCGHCVS =0x56 , -MAX8997_REG_SAFEOUTCTRL =0x5a , +MAX8997_REG_SAFEOUTCTRL =0x5a ,MAX8997_REG_LBCNFG1 =0x5e , MAX8997_REG_LBCNFG2 = 0x5f,
@@ -171,9 +171,22 @@ enum { PMIC_NUM_OF_REGS = 0x9b, }; +#define ACTDISSAFEO1 (1 << 4) +#define ACTDISSAFEO2 (1 << 5)#define ENSAFEOUT1 (1 << 6)#define ENSAFEOUT2 (1 << 7) +/* Charger */ +enum {CHARGER_ENABLE ,CHARGER_DISABLE }; +#define DETBAT (1 << 2) +#define MBCICHFCSET (1 << 4) +#define MBCHOSTEN (1 << 6) +#define VCHGR_FC (1 << 7) + +#define CHARGER_MIN_CURRENT 200 +#define CHARGER_MAX_CURRENT 950 +#define CHARGER_CURRENT_RESOLUTION 50 +#define MAX8997_I2C_ADDR (0xCC >> 1)#define MAX8997_RTC_ADDR (0x0C >> 1)#define MAX8997_MUIC_ADDR (0x4A >> 1)
@@ -187,4 +200,6 @@ enum { EN_LDO = (0x3 << 6), }; +unsigned char max8997_reg_ldo (int uV); +#endif /* __MAX8997_PMIC_H_ */
include/power/max8998_pmic.h renamed from include/max8998_pmic.h +0 -0
include/power/pmic.h renamed from include/pmic.h +12 -5
@@ -1,5 +1,5 @@/* -* Copyright (C) 2011 Samsung Electronics +* Copyright (C) 2011-2012 Samsung Electronics * Lukasz Majewski <[email protected]> * * See file CREDITS for list of people who contributed to this
@@ -24,6 +24,10 @@#ifndef __CORE_PMIC_H_#define __CORE_PMIC_H_ +#include <common.h> +#include <linux/list.h> +#include <i2c.h> +enum {PMIC_I2C ,PMIC_SPI , };enum {I2C_PMIC ,I2C_NUM , };enum {PMIC_READ ,PMIC_WRITE , };
@@ -49,17 +53,20 @@ struct pmic {const char *name;unsigned char bus;unsigned char interface; -unsigned char number_of_regs; +unsigned int number_of_regs;union hw {struct p_i2c i2c;struct p_spi spi; } hw; + +struct list_head list; }; -int pmic_init (void ); +int pmic_init (unsigned char bus);int pmic_dialog_init (void ); -int check_reg (u32 reg); -struct pmic *get_pmic (void ); +int check_reg (struct pmic *p,u32 reg); +struct pmic *pmic_alloc (void ); +struct pmic *pmic_get (const char *s);int pmic_probe (struct pmic *p);int pmic_reg_read (struct pmic *p,u32 reg,u32 *val);int pmic_reg_write (struct pmic *p,u32 reg,u32 val);
Signature · 1 line
1.7.2.3
PATCH 5/16 pmic: Introduce power_board_init() method at ./lib/board.c file
In reply to Lukasz MajewskiIt is necessary to introduce a new system wide function- power_board_init()
It turns out, that power initialization must be done as early as possible. In the case of PMIC framework redesign, which aims to support multiple instances of PMIC devices the initialization shall be performed just after malloc configuration.
The arch_early_init_r() could be used instead, but it doesn't reflect that the "power" subsystem is going to be initialized.
--- arch/arm/lib/board.c | 4 ++++ include/common.h | 3 +++ 2 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/lib/board.c +4 -0
@@ -510,6 +510,10 @@ void board_init_r(gd_t *id, ulong dest_addr)arch_early_init_r ();#endif +#ifdef CONFIG_POWER_INIT +power_board_init (); +#endif +#if !defined(CONFIG_SYS_NO_FLASH )puts ("Flash: " );
include/common.h +3 -0
@@ -487,6 +487,9 @@ int board_late_init (void);int board_postclk_init (void );/* after clocks/timebase, before env/serial */ int board_early_init_r (void );void board_poweroff (void ); +#ifdef CONFIG_POWER_INIT +int power_board_init (void ); +#endif #if defined(CONFIG_SYS_DRAM_TEST )int testdram (void );
Signature · 1 line
1.7.2.3
PATCH 6/16 pmic: Enable power_board_init() support at TRATS
In reply to Lukasz MajewskiEnable support for power_board_init() method at TRATS board.
--- board/samsung/trats/trats.c | 15 +++++++++++---- include/configs/trats.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-)
board/samsung/trats/trats.c +11 -4
@@ -68,10 +68,6 @@ int board_init(void)check_hw_revision ();printf ("HW Revision:\t0x%x\n" , board_rev); -#if defined(CONFIG_PMIC ) -pmic_init (I2C_5 ); -#endif -return 0 ; }
@@ -90,6 +86,17 @@ void i2c_init_board(void)s5p_gpio_direction_output (&gpio2->y4,1 ,1 ); } +#ifdef CONFIG_POWER_INIT +int power_board_init (void ) +{ + +#ifdef CONFIG_PMIC +pmic_init (I2C_5 ); +#endif +return 0 ; +} +#endif +int dram_init (void ) { gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE) +
include/configs/trats.h +1 -0
@@ -255,6 +255,7 @@#define CONFIG_SOFT_I2C_GPIO_SDA get_multi_sda_pin()#define I2C_INIT multi_i2c_init() +#define CONFIG_POWER_INIT #define CONFIG_PMIC #define CONFIG_PMIC_I2C #define CONFIG_PMIC_MAX8997
Signature · 1 line
1.7.2.3
PATCH 7/16 pmic:chrg: Common information about charger and battery (power_chrg.h)
In reply to Lukasz MajewskiNew power_chrg.h file has been added to "bind" together common information about charging battery available in the system.
--- include/power/power_chrg.h | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) create mode 100644 include/power/power_chrg.h
include/power/power_chrg.h new file +53 -0
@@ -0,0 +1,53 @@ +/* +* Copyright (C) 2012 Samsung Electronics +* Lukasz Majewski <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __POWER_CHARGER_H_ +#define __POWER_CHARGER_H_ + +/* Type of available chargers */ +enum { +CHARGER_NO =0 , +CHARGER_TA , +CHARGER_USB , +CHARGER_TA_500 , +CHARGER_UNKNOWN , +}; + +enum { +UNKNOWN , +EXT_SOURCE , +CHARGE , +NORMAL , +}; + +struct battery { +unsigned int version; +unsigned int state_of_chrg; +unsigned int time_to_empty; +unsigned int capacity; +unsigned int voltage_uV; + +unsigned int state; +}; + +#endif /* __POWER_CHARGER_H_ */
Signature · 1 line
1.7.2.3
PATCH 8/16 pmic:muic: Support for MUIC built into MAX8997 device
In reply to Lukasz MajewskiSupport for MUIC (Micro USB Integrated Circuit) built into the MAX8997 power management device.
The MUIC device will work with redesigned PMIC framework.
--- drivers/misc/Makefile | 1 + drivers/misc/muic_max8997.c | 80 ++++++++++++++++++++++++++++++++++++++++++ include/power/max8997_muic.h | 61 ++++++++++++++++++++++++++++++++ include/power/power_chrg.h | 1 + 4 files changed, 143 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/muic_max8997.c create mode 100644 include/power/max8997_muic.h
drivers/misc/Makefile +1 -0
@@ -41,6 +41,7 @@ COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o +COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/misc/muic_max8997.c new file +80 -0
80 lines not on this page · raw message
include/power/max8997_muic.h new file +61 -0
61 lines not on this page · raw message
include/power/power_chrg.h +1 -0
@@ -50,4 +50,5 @@ struct battery { unsigned int state; }; +int power_chrg_get_type (void );#endif /* __POWER_CHARGER_H_ */
Signature · 1 line
1.7.2.3
PATCH 8/16 pmic:muic: Support for MUIC built into MAX8997 device
Quoted 9 lines · Lukasz Majewski
Support for MUIC (Micro USB Integrated Circuit) built into the MAX8997 power management device.
The MUIC device will work with redesigned PMIC framework.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Stefano Babic <[email protected]>---
Hi Lukasz,
Quoted 8 lines
drivers/misc/Makefile | 1 + drivers/misc/muic_max8997.c | 80 ++++++++++++++++++++++++++++++++++++++++++ include/power/max8997_muic.h | 61 ++++++++++++++++++++++++++++++++ include/power/power_chrg.h | 1 + 4 files changed, 143 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/muic_max8997.c create mode 100644 include/power/max8997_muic.h
I see now with this patch, but we have a mix between drivers/misc and drivers/power. I think this was done because the power directory was introduced later, but really all pmics under drivers/misc should be moved into drivers/power.
Maybe belong this one also to drivers/power ?
You added several "add-ons" for MAX8997. Maybe it is clearer if everything goes into a separate directory, such as power/max8997/
Quoted 38 lines
drivers/misc/Makefile +1
-0@@ -41,6 +41,7 @@ COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o +COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)drivers/misc/muic_max8997.c new file +20
-0@@ -0,0 +1,80 @@ +/* +* Copyright (C) 2012 Samsung Electronics +* Lukasz Majewski <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
drivers/misc/muic_max8997.c line 30
Quoted 10 lines
drivers/misc/muic_max8997.c new file +10
-0+* MA 02111-1307 USA +*/ + +#include <common.h> +#include <power/pmic.h> +#include <power/power_chrg.h> +#include <power/max8997_muic.h> +#include <i2c.h> + +int power_muic_init (unsigned int bus)
You add a different function to initialize it, but this is a version opf pmic_init(). Why cannot we consider this one as all other pmics, avoiding to introduce new and undocumented functions ?
If I do not misunderstand, you use the different functions to select the pmic. In other words, calling power_update_battery() in the trats code selects automatically the fulel-gauge, because this code implements this function. But this is against the goal of your patches, that is to add multi instances of the pmics (and maybe a second instance of fuel_gauge..).
I think this should be solved moving this function to the general API and calling it via pointer. For example, something like:
p = pmic_get("MAX_8997);
p->read(...);
p = pmic_get("MAX17042_FG");
p->power_update_battery(..);What do you think ?
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 8/16 pmic:muic: Support for MUIC built into MAX8997 device
Hi Stefano,
Quoted 23 lines · Lukasz Majewski
Quoted 9 lines
Support for MUIC (Micro USB Integrated Circuit) built into the MAX8997 power management device.
The MUIC device will work with redesigned PMIC framework.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Stefano Babic <[email protected]>---
Hi Lukasz,
Quoted 9 lines
drivers/misc/Makefile | 1 + drivers/misc/muic_max8997.c | 80++++++++++++++++++++++++++++++++++++++++++
include/power/max8997_muic.h| 61
++++++++++++++++++++++++++++++++include/power/power_chrg.h|
1 + 4 files changed, 143 insertions(+), 0 deletions(-) create mode 100644drivers/misc/muic_max8997.ccreate mode 100644include/power/max8997_muic.h
Quoted 4 lines
I see now with this patch, but we have a mix between
drivers/miscanddrivers/power. I think this was done because the power directory was introduced later, but really all pmics underdrivers/miscshould be moved intodrivers/power.
Yes, I agree about that. PMIC (or in the future POWER) related code shall be moved to drivers/power/{subdir_per_PMIC_device}
Please also keep in mind, that I plan to rename the "pmic" command/framework to "power" to better reflect its purpose.
Quoted 5 lines
Maybe belong this one also to
drivers/power?You added several "add-ons" for MAX8997. Maybe it is clearer if everything goes into a separate directory, such as power/max8997/
Very good idea.
I've already proposed a little "cleanup" with putting all power related includes to ./include/power/ directory.
Quoted 65 lines
Quoted 42 lines
drivers/misc/Makefile +1
-0@@ -41,6 +41,7 @@ COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o +COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)(quoted diff) +0
-0
b/drivers/misc/muic_max8997.cnew file mode 100644 index 0000000..d332c09drivers/misc/muic_max8997.c new file +18
-0@@ -0,0 +1,80 @@ +/* +* Copyright (C) 2012 Samsung Electronics +* Lukasz Majewski <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */drivers/misc/muic_max8997.c line 30
Quoted 8 lines
drivers/misc/muic_max8997.c new file +8
-0+ +#include <common.h> +#include <power/pmic.h> +#include <power/power_chrg.h> +#include <power/max8997_muic.h> +#include <i2c.h> + +int power_muic_init (unsigned int bus)You add a different function to initialize it, but this is a version opf
pmic_init(). Why cannot we consider this one as all other pmics, avoiding to introduce new and undocumented functions ?If I do not misunderstand, you use the different functions to select the pmic. In other words, calling
power_update_battery()in the trats code selects automatically the fulel-gauge, because this code implements this function. But this is against the goal of your patches, that is to add multi instances of the pmics (and maybe a second instance offuel_gauge..).I think this should be solved moving this function to the general API and calling it via pointer. For example, something like:
Quoted 7 lines
p = pmic_get("MAX_8997); p->read(...); p = pmic_get("MAX17042_FG"); p->power_update_battery(..);What do you think ?
I will think about that and give you an answer.
Quoted 5 lines
Best regards,
Stefano Babic
Regards,
Lukasz
PATCH 8/16 pmic:muic: Support for MUIC built into MAX8997 device
In reply to Stefano BabicHi Stefano,
Quoted 97 lines · Lukasz Majewski
Quoted 9 lines
Support for MUIC (Micro USB Integrated Circuit) built into the MAX8997 power management device.
The MUIC device will work with redesigned PMIC framework.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Stefano Babic <[email protected]>---
Hi Lukasz,
Quoted 9 lines
drivers/misc/Makefile | 1 + drivers/misc/muic_max8997.c | 80++++++++++++++++++++++++++++++++++++++++++
include/power/max8997_muic.h| 61
++++++++++++++++++++++++++++++++include/power/power_chrg.h|
1 + 4 files changed, 143 insertions(+), 0 deletions(-) create mode 100644drivers/misc/muic_max8997.ccreate mode 100644include/power/max8997_muic.hI see now with this patch, but we have a mix between
drivers/miscanddrivers/power. I think this was done because the power directory was introduced later, but really all pmics underdrivers/miscshould be moved intodrivers/power.Maybe belong this one also to
drivers/power?You added several "add-ons" for MAX8997. Maybe it is clearer if everything goes into a separate directory, such as power/max8997/
Quoted 41 lines
drivers/misc/Makefile +1
-0@@ -41,6 +41,7 @@ COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o +COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)(quoted diff) +0
-0
b/drivers/misc/muic_max8997.cnew file mode 100644 index 0000000..d332c09drivers/misc/muic_max8997.c new file +18
-0@@ -0,0 +1,80 @@ +/* +* Copyright (C) 2012 Samsung Electronics +* Lukasz Majewski <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */drivers/misc/muic_max8997.c line 30
Quoted 8 lines
drivers/misc/muic_max8997.c new file +8
-0+ +#include <common.h> +#include <power/pmic.h> +#include <power/power_chrg.h> +#include <power/max8997_muic.h> +#include <i2c.h> + +int power_muic_init (unsigned int bus)You add a different function to initialize it, but this is a version opf
pmic_init(). Why cannot we consider this one as all other pmics, avoiding to introduce new and undocumented functions ?If I do not misunderstand, you use the different functions to select the pmic. In other words, calling
power_update_battery()in the trats code selects automatically the fulel-gauge, because this code implements this function. But this is against the goal of your patches, that is to add multi instances of the pmics (and maybe a second instance offuel_gauge..).I think this should be solved moving this function to the general API and calling it via pointer. For example, something like:
Quoted 7 lines
p = pmic_get("MAX_8997); p->read(...); p = pmic_get("MAX17042_FG"); p->power_update_battery(..);What do you think ?
I think that struct pmic shall be extended by another field:
struct pmic {
struct power_ops *p_ops;
};
struct bat_ops {
int (*check_battery) (struct pmic *p);
int (*update_battery) (struct pmic *p);
int (*init_battery) (struct pmic *p);
[other battery related callbacks]
};Each instance of struct bat_ops is tied with power related device.
I will post v2 of the framework very soon.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung Poland R&D Center | Linux Platform Group
PATCH 9/16 pmic:fuel-gauge: Support for MAX17042 fuel-gauge
In reply to Lukasz MajewskiSupport for MAX17042 fuel-gauge (FG), which is built into the MAX8997 power management device.
Special file - fg_battery_cell_params.h with cells characteristics added.
The FG device will work with redesigned PMIC framework.
--- drivers/misc/Makefile | 1 + drivers/misc/fg_max17042.c | 235 ++++++++++++++++++++++++++++++++ include/power/fg_battery_cell_params.h | 88 ++++++++++++ include/power/max17042_fg.h | 74 ++++++++++ include/power/power_chrg.h | 2 + 5 files changed, 400 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/fg_max17042.c create mode 100644 include/power/fg_battery_cell_params.h create mode 100644 include/power/max17042_fg.h
drivers/misc/Makefile +1 -0
@@ -41,6 +41,7 @@ COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o COBJS-$(CONFIG_PMIC_MAX8997) += pmic_max8997.o +COBJS-$(CONFIG_POWER_FG_MAX17042) += fg_max17042.o COBJS-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o COBJS := $(COBJS-y)
drivers/misc/fg_max17042.c new file +235 -0
235 lines not on this page · raw message
include/power/fg_battery_cell_params.h new file +88 -0
88 lines not on this page · raw message
include/power/max17042_fg.h new file +74 -0
74 lines not on this page · raw message
include/power/power_chrg.h +2 -0
@@ -50,5 +50,7 @@ struct battery { unsigned int state; }; +int power_update_battery (struct battery *bat); +int power_check_battery (struct battery *bat);int power_chrg_get_type (void );#endif /* __POWER_CHARGER_H_ */
Signature · 1 line
1.7.2.3
PATCH 9/16 pmic:fuel-gauge: Support for MAX17042 fuel-gauge
Quoted 4 lines · Lukasz Majewski
Support for MAX17042 fuel-gauge (FG), which is built into the MAX8997 power management device.
Special file -fg_battery_cell_params.hwith cells characteristics added.
[snip]
include/power/fg_battery_cell_params.h line 32
Quoted 9 lines
include/power/fg_battery_cell_params.h new file +9
-0+#ifndef __FG_BATTERY_CELL_PARAMS_H_ +#define __FG_BATTERY_CELL_PARAMS_H_ + +#if defined(CONFIG_POWER_FG_MAX17042 ) && defined(CONFIG_TRATS ) + +/* Cell characteristics - Exynos4 TRATS development board */ + +u16 cell_character0[16 ]/* Shall be written to addr 0x80h */ += { 0xA2A0,
This (and the rest of the file) should be:
/* Shall be written to addr 0x80h */
u16 cell_character0[16] = {
0xA2A0,...
Thanks.
Also:
[snip]
include/power/max17042_fg.h line 35
Quoted 3 lines
include/power/max17042_fg.h new file +3
-0+MAX17042_AVG_CURRENT =0x0B , +MAX17042_SOCMIX =0x0D , + MAX17042_SOCAV = 0x0E,
I assume this is just odd formatting in the mail and once applied it's aligned. If not, please fix (and check the rest of the series). Thanks!
Signature · 1 line
Tom
PATCH 9/16 pmic:fuel-gauge: Support for MAX17042 fuel-gauge
Hi Tom ,
Quoted 19 lines · Lukasz Majewski
Quoted 5 lines
Support for MAX17042 fuel-gauge (FG), which is built into the MAX8997 power management device.
Special file -fg_battery_cell_params.hwith cells characteristics added.[snip]
include/power/fg_battery_cell_params.h line 32
Quoted 9 lines
include/power/fg_battery_cell_params.h new file +9
-0+#ifndef __FG_BATTERY_CELL_PARAMS_H_ +#define __FG_BATTERY_CELL_PARAMS_H_ + +#if defined(CONFIG_POWER_FG_MAX17042 ) && defined(CONFIG_TRATS ) + +/* Cell characteristics - Exynos4 TRATS development board */ + +u16 cell_character0[16 ]/* Shall be written to addr 0x80h */ += { 0xA2A0,This (and the rest of the file) should be:
/* Shall be written to addr 0x80h */
Quoted 4 lines
u16 cell_character0[16] = { 0xA2A0,...
Ok, I will fix this.
Quoted 4 lines
Thanks.
Also:
[snip]
Quoted 8 lines
include/power/max17042_fg.h line 35
Quoted 3 lines
include/power/max17042_fg.h new file +3
-0+MAX17042_AVG_CURRENT =0x0B , +MAX17042_SOCMIX =0x0D , + MAX17042_SOCAV = 0x0E,I assume this is just odd formatting in the mail and once applied it's aligned. If not, please fix (and check the rest of the series). Thanks!
I will double check that. Nether checkpatch nor emac's whitespace-cleanup weren't complaining.
Regards,
Lukasz
PATCH 10/16 pmic:max8997: Function for calculating LDO internal register value
In reply to Lukasz MajewskiFunction for calculating LDO internal register value from passed micro Volt.
--- drivers/misc/pmic_max8997.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/misc/pmic_max8997.c +17 -0
@@ -42,3 +42,20 @@ int pmic_init(unsigned char bus)return 0 ; } + +unsigned char max8997_reg_ldo (int uV) +{ +unsigned char ret; +if (uV <=800000 ) +return 0 ; +if (uV >=3950000 ) +return 0x3f ; + ret = (uV -800000 ) /50000 ; +if (ret >0x3f ) { +printf ("MAX8997 LDO SETTING ERROR (%duV) -> %u\n" , uV, ret); + ret =0x3f ; + } + +return ret; +} +
Signature · 1 line
1.7.2.3
PATCH 10/16 pmic:max8997: Function for calculating LDO internal register value
Quoted 21 lines · Lukasz Majewski
Function for calculating LDO internal register value from passed micro Volt.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Stefano Babic <[email protected]>--- drivers/misc/pmic_max8997.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)drivers/misc/pmic_max8997.c +3
-0@@ -42,3 +42,20 @@ int pmic_init(unsigned char bus)return 0 ; } + +unsigned char max8997_reg_ldo (int uV) +{
drivers/misc/pmic_max8997.c int pmic_init(unsigned char bus) · line 57
Quoted 10 lines
drivers/misc/pmic_max8997.c +10
-0+unsigned char ret; +if (uV <=800000 ) +return 0 ; +if (uV >=3950000 ) +return 0x3f ; + ret = (uV -800000 ) /50000 ; +if (ret >0x3f ) { +printf ("MAX8997 LDO SETTING ERROR (%duV) -> %u\n" , uV, ret); + ret =0x3f ; + }
Can we get a comment to point at the doc that says what these values are? Maybe even a #define for the return values.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/a9a5251a/attachment.pgp>
PATCH 10/16 pmic:max8997: Function for calculating LDO internal register value
Quoted 29 lines · On Fri, 14 Sep 2012 10:24:49 -0700 Tom Rini <[email protected]> wrote:
Quoted 27 lines · Lukasz Majewski
Function for calculating LDO internal register value from passed micro Volt.
Signed-off-by Lukasz Majewski <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Cc Stefano Babic <[email protected]>--- drivers/misc/pmic_max8997.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/drivers/misc/pmic_max8997.cindex 4e8283a..a4158e2 100644drivers/misc/pmic_max8997.c +9
-0@@ -42,3 +42,20 @@ int pmic_init(unsigned char bus)return 0 ; } + +unsigned char max8997_reg_ldo (int uV) +{ +unsigned char ret; +if (uV <=800000 ) +return 0 ; +if (uV >=3950000 ) +return 0x3f ; + ret = (uV -800000 ) /50000 ;
Quoted 9 lines
drivers/misc/pmic_max8997.c
Quoted 5 lines
drivers/misc/pmic_max8997.c +2
-0+if (ret >0x3f ) { + printf("MAX8997 LDO SETTING ERROR (%duV) -> %u\n",uV, ret);
drivers/misc/pmic_max8997.c +2
-0+ ret =0x3f ; + }Can we get a comment to point at the doc that says what these values are? Maybe even a #define for the return values.
Yes, explanation will be provided.
Regards,
Lukasz Majewski
PATCH 11/16 arm:trats:pmic: Default PMIC(MAX8997) initialization for Samsung's TRATS board
In reply to Lukasz MajewskiDefault PMIC (MAX8997) initialization for Samsung's TRATS development board.
--- board/samsung/trats/trats.c | 150 ++++++++++++++++++++++++++++++++++++++++++ include/power/max8997_pmic.h | 9 +++ 2 files changed, 159 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +150 -0
@@ -86,6 +86,155 @@ void i2c_init_board(void)s5p_gpio_direction_output (&gpio2->y4,1 ,1 ); } +static int pmic_init_max8997 (void ) +{ +struct pmic *p =pmic_get ("MAX8997_PMIC" ); +int i =0 , ret =0 ; +u32 val; + +if (pmic_probe (p)) +return -1 ; + +/* BUCK1 VARM: 1.2V */ + val = (1200000 -650000 ) /25000 ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK1DVS1 , val); + val =ENBUCK |ACTIVE_DISCHARGE ;/* DVS OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_BUCK1CTRL , val); + +/* BUCK2 VINT: 1.1V */ + val = (1100000 -650000 ) /25000 ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK2DVS1 , val); + val =ENBUCK |ACTIVE_DISCHARGE ;/* DVS OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_BUCK2CTRL , val); + + +/* BUCK3 G3D: 1.1V - OFF */ + ret |=pmic_reg_read (p,MAX8997_REG_BUCK3CTRL , &val); + val &= ~ENBUCK ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK3CTRL , val); + + val = (1100000 -750000 ) /50000 ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK3DVS , val); + +/* BUCK4 CAMISP: 1.2V - OFF */ + ret |=pmic_reg_read (p,MAX8997_REG_BUCK4CTRL , &val); + val &= ~ENBUCK ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK4CTRL , val); + + val = (1200000 -650000 ) /25000 ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK4DVS , val); + +/* BUCK5 VMEM: 1.2V */ + val = (1200000 -650000 ) /25000 ; +for (i =0 ; i <8 ; i++) + ret |=pmic_reg_write (p,MAX8997_REG_BUCK5DVS1 + i, val); + + val =ENBUCK |ACTIVE_DISCHARGE ;/* DVS OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_BUCK5CTRL , val); + +/* BUCK6 CAM AF: 2.8V */ +/* No Voltage Setting Register */ +/* GNSLCT 3.0X */ + val =GNSLCT ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK6CTRL , val); + +/* BUCK7 VCC_SUB: 2.0V */ + val = (2000000 -750000 ) /50000 ; + ret |=pmic_reg_write (p,MAX8997_REG_BUCK7DVS , val); + +/* LDO1 VADC: 3.3V */ + val =max8997_reg_ldo (3300000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO1CTRL , val); + +/* LDO1 Disable active discharging */ + ret |=pmic_reg_read (p,MAX8997_REG_LDO1CONFIG , &val); + val &= ~LDO_ADE ; + ret |=pmic_reg_write (p,MAX8997_REG_LDO1CONFIG , val); + +/* LDO2 VALIVE: 1.1V */ + val =max8997_reg_ldo (1100000 ) |EN_LDO ; + ret |=pmic_reg_write (p,MAX8997_REG_LDO2CTRL , val); + +/* LDO3 VUSB/MIPI: 1.1V */ + val =max8997_reg_ldo (1100000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO3CTRL , val); + +/* LDO4 VMIPI: 1.8V */ + val =max8997_reg_ldo (1800000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO4CTRL , val); + +/* LDO5 VHSIC: 1.2V */ + val =max8997_reg_ldo (1200000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO5CTRL , val); + +/* LDO6 VCC_1.8V_PDA: 1.8V */ + val =max8997_reg_ldo (1800000 ) |EN_LDO ; + ret |=pmic_reg_write (p,MAX8997_REG_LDO6CTRL , val); + +/* LDO7 CAM_ISP: 1.8V */ + val =max8997_reg_ldo (1800000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO7CTRL , val); + +/* LDO8 VDAC/VUSB: 3.3V */ + val =max8997_reg_ldo (3300000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO8CTRL , val); + +/* LDO9 VCC_2.8V_PDA: 2.8V */ + val =max8997_reg_ldo (2800000 ) |EN_LDO ; + ret |=pmic_reg_write (p,MAX8997_REG_LDO9CTRL , val); + +/* LDO10 VPLL: 1.1V */ + val =max8997_reg_ldo (1100000 ) |EN_LDO ; + ret |=pmic_reg_write (p,MAX8997_REG_LDO10CTRL , val); + +/* LDO11 TOUCH: 2.8V */ + val =max8997_reg_ldo (2800000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO11CTRL , val); + +/* LDO12 VTCAM: 1.8V */ + val =max8997_reg_ldo (1800000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO12CTRL , val); + +/* LDO13 VCC_3.0_LCD: 3.0V */ + val =max8997_reg_ldo (3000000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO13CTRL , val); + +/* LDO14 MOTOR: 3.0V */ + val =max8997_reg_ldo (3000000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO14CTRL , val); + +/* LDO15 LED_A: 2.8V */ + val =max8997_reg_ldo (2800000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO15CTRL , val); + +/* LDO16 CAM_SENSOR: 1.8V */ + val =max8997_reg_ldo (1800000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO16CTRL , val); + +/* LDO17 VTF: 2.8V */ + val =max8997_reg_ldo (2800000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO17CTRL , val); + +/* LDO18 TOUCH_LED 3.3V */ + val =max8997_reg_ldo (3300000 ) |DIS_LDO ;/* OFF */ + ret |=pmic_reg_write (p,MAX8997_REG_LDO18CTRL , val); + +/* LDO21 VDDQ: 1.2V */ + val =max8997_reg_ldo (1200000 ) |EN_LDO ; + ret |=pmic_reg_write (p,MAX8997_REG_LDO21CTRL , val); + +/* SAFEOUT for both 1 and 2: 4.9V, Active discharge, Enable */ + val = (SAFEOUT_4_90V <<0 ) | (SAFEOUT_4_90V <<2 ) | +ACTDISSAFEO1 |ACTDISSAFEO2 |ENSAFEOUT1 |ENSAFEOUT2 ; + ret |=pmic_reg_write (p,MAX8997_REG_SAFEOUTCTRL , val); + +if (ret) { +puts ("MAX8997 PMIC setting error!\n" ); +return -1 ; + } +return 0 ; +} +#ifdef CONFIG_POWER_INIT int power_board_init (void ) {
@@ -93,6 +242,7 @@ int power_board_init(void)#ifdef CONFIG_PMIC pmic_init (I2C_5 );#endif +pmic_init_max8997 (); return 0; }#endif
include/power/max8997_pmic.h +9 -0
@@ -176,6 +176,15 @@ enum {#define ENSAFEOUT1 (1 << 6)#define ENSAFEOUT2 (1 << 7) +#define ENBUCK (1 << 0) +#define ACTIVE_DISCHARGE (1 << 3) +#define GNSLCT (1 << 2) +#define LDO_ADE (1 << 1) +#define SAFEOUT_4_85V 0x00 +#define SAFEOUT_4_90V 0x01 +#define SAFEOUT_4_95V 0x02 +#define SAFEOUT_3_30V 0x03 +/* Charger */ enum {CHARGER_ENABLE ,CHARGER_DISABLE };#define DETBAT (1 << 2)
Signature · 1 line
1.7.2.3
PATCH 12/16 arm:trats:pmic: Enable MUIC (MAX8997) at Samsung's TRATS board
In reply to Lukasz MajewskiMUIC IC built into the MAX8997 device is enabled at TRATS.
--- board/samsung/trats/trats.c | 2 ++ include/configs/trats.h | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +2 -0
@@ -38,6 +38,7 @@#include <usb/s3c_udc.h> #include <power/max8997_pmic.h> #include <libtizen.h> +#include <power/max8997_muic.h> #include "setup.h"
@@ -243,6 +244,7 @@ int power_board_init(void)pmic_init (I2C_5 );#endif pmic_init_max8997 (); +power_muic_init (I2C_5 ); return 0; }#endif
include/configs/trats.h +2 -0
@@ -260,6 +260,8 @@#define CONFIG_PMIC_I2C #define CONFIG_PMIC_MAX8997 +#define CONFIG_POWER_MUIC +#define CONFIG_POWER_MUIC_MAX8997 #define CONFIG_USB_GADGET #define CONFIG_USB_GADGET_S3C_UDC_OTG #define CONFIG_USB_GADGET_DUALSPEED
Signature · 1 line
1.7.2.3
PATCH 13/16 arm:trats:pmic: Enable fuel-gauge (MAX17042) at Samsung's TRATS board
In reply to Lukasz MajewskiFG IC built into the MAX8997 device (compliant to MAX17042) is enabled at TRATS.
--- board/samsung/trats/trats.c | 2 ++ include/configs/trats.h | 4 ++++ 2 files changed, 6 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +2 -0
@@ -39,6 +39,7 @@#include <power/max8997_pmic.h> #include <libtizen.h> #include <power/max8997_muic.h> +#include <power/max17042_fg.h> #include "setup.h"
@@ -244,6 +245,7 @@ int power_board_init(void)pmic_init (I2C_5 );#endif pmic_init_max8997 (); +power_fg_init (I2C_9 );power_muic_init (I2C_5 );return 0 ; }
include/configs/trats.h +4 -0
@@ -260,8 +260,12 @@#define CONFIG_PMIC_I2C #define CONFIG_PMIC_MAX8997 +#define CONFIG_POWER_FG +#define CONFIG_POWER_FG_MAX17042 #define CONFIG_POWER_MUIC #define CONFIG_POWER_MUIC_MAX8997 + +#define CONFIG_USB_GADGET #define CONFIG_USB_GADGET_S3C_UDC_OTG #define CONFIG_USB_GADGET_DUALSPEED
Signature · 1 line
1.7.2.3
PATCH 13/16 arm:trats:pmic: Enable fuel-gauge (MAX17042) at Samsung's TRATS board
Quoted 2 lines · Lukasz Majewski
FG IC built into the MAX8997 device (compliant to MAX17042) is enabled at TRATS.
[snip]
include/configs/trats.h line 269
Quoted 7 lines
include/configs/trats.h +4
-0+#define CONFIG_POWER_FG +#define CONFIG_POWER_FG_MAX17042 #define CONFIG_POWER_MUIC #define CONFIG_POWER_MUIC_MAX8997 + +#define CONFIG_USB_GADGET
Double space? :)
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/346268bf/attachment.pgp>
PATCH 13/16 arm:trats:pmic: Enable fuel-gauge (MAX17042) at Samsung's TRATS board
Hi Tom,
Quoted 5 lines · Lukasz Majewski
Quoted 3 lines
FG IC built into the MAX8997 device (compliant to MAX17042) is enabled at TRATS.
[snip]
Quoted 10 lines
include/configs/trats.h line 269
Quoted 7 lines
include/configs/trats.h +4
-0+#define CONFIG_POWER_FG +#define CONFIG_POWER_FG_MAX17042 #define CONFIG_POWER_MUIC #define CONFIG_POWER_MUIC_MAX8997 + +#define CONFIG_USB_GADGET Double space? :)
Will be fixed :-)
Regards,
Lukasz
PATCH 14/16 pmic:max8997: Support for MAX8997 internal charger control
In reply to Lukasz MajewskiSupport for MAX8997 built-in charger.
--- drivers/misc/pmic_max8997.c | 52 ++++++++++++++++++++++++++++++++++++++++++ include/power/max8997_pmic.h | 3 +- 2 files changed, 54 insertions(+), 1 deletions(-)
drivers/misc/pmic_max8997.c +52 -0
@@ -59,3 +59,55 @@ unsigned char max8997_reg_ldo(int uV)return ret; } +int pmic_charger_state (int state,int current) +{ +struct pmic *p =pmic_get ("MAX8997_PMIC" ); +unsigned char fc; +u32 val =0 ; + +if (pmic_probe (p)) +return -1 ; + +if (state ==CHARGER_DISABLE ) { +puts ("Disable the charger.\n" ); +pmic_reg_read (p,MAX8997_REG_MBCCTRL2 , &val); + val &= ~(MBCHOSTEN |VCHGR_FC ); +pmic_reg_write (p,MAX8997_REG_MBCCTRL2 , val); + +return -1 ; + } + +if (current <CHARGER_MIN_CURRENT || current >CHARGER_MAX_CURRENT ) { +printf ("%s: Wrong charge current: %d [mA]\n" , + __func__, current); +return -1 ; + } + + fc = (current -CHARGER_MIN_CURRENT ) /CHARGER_CURRENT_RESOLUTION ; + fc = fc &0xf ;/* up to 950 mA */ + +printf ("Enable the charger @ %d [mA]\n" , fc *CHARGER_CURRENT_RESOLUTION + +CHARGER_MIN_CURRENT ); + + val = fc |MBCICHFCSET ; +pmic_reg_write (p,MAX8997_REG_MBCCTRL4 , val); + +pmic_reg_read (p,MAX8997_REG_MBCCTRL2 , &val); + val =MBCHOSTEN |VCHGR_FC ;/* enable charger & fast charge */ +pmic_reg_write (p,MAX8997_REG_MBCCTRL2 , val); + +return 0 ; +} + +int pmic_charger_bat_present (void ) +{ +struct pmic *p =pmic_get ("MAX8997_PMIC" ); +u32 val; + +if (pmic_probe (p)) +return -1 ; + +pmic_reg_read (p,MAX8997_REG_STATUS4 , &val); + +return !(val &DETBAT ); +}
include/power/max8997_pmic.h +2 -1
@@ -209,6 +209,7 @@ enum { EN_LDO = (0x3 << 6), }; +int pmic_charger_state (int state,int current);unsigned char max8997_reg_ldo (int uV); - +int pmic_charger_bat_present (void );#endif /* __MAX8997_PMIC_H_ */
Signature · 1 line
1.7.2.3
PATCH 15/16 arm:trats:pmic: Support for charging battery at Samsung's TRATS board
In reply to Lukasz MajewskiThe battery connected to Samsung's Trats development board is now charged when voltage drops below threshold.
--- board/samsung/trats/trats.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +37 -0
@@ -39,6 +39,7 @@#include <power/max8997_pmic.h> #include <libtizen.h> #include <power/max8997_muic.h> +#include <power/power_chrg.h> #include <power/max17042_fg.h> #include "setup.h"
@@ -240,6 +241,8 @@ static int pmic_init_max8997(void)#ifdef CONFIG_POWER_INIT int power_board_init (void ) { +int chrg, k; +struct battery bat;#ifdef CONFIG_PMIC pmic_init (I2C_5 );
@@ -247,6 +250,40 @@ int power_board_init(void)pmic_init_max8997 ();power_fg_init (I2C_9 );power_muic_init (I2C_5 ); + + chrg =power_chrg_get_type (); +debug ("CHARGER TYPE: %d\n" , chrg); + +if (!pmic_charger_bat_present ()) { +puts ("No battery detected\n" ); +return -1 ; + } + +power_check_battery (&bat); + +if (bat.state ==CHARGE && chrg ==CHARGER_USB ) { +puts ("CHARGER ENABLE\n" ); +if (pmic_charger_state (CHARGER_ENABLE ,450 )) +return -1 ; + +for (k =0 ;pmic_charger_bat_present () && +power_chrg_get_type () && + bat.state_of_chrg <5 ; k++) { +udelay (10000000 ); +puts ("." ); +power_update_battery (&bat); + +if (k ==100 ) { +printf (" %d [V]\n" , bat.voltage_uV); + k =0 ; + } + + } + +puts ("CHARGER DISABLE\n" ); +pmic_charger_state (CHARGER_DISABLE ,0 ); + } + return 0; }#endif
Signature · 1 line
1.7.2.3
PATCH 15/16 arm:trats:pmic: Support for charging battery at Samsung's TRATS board
Quoted 2 lines · Lukasz Majewski
The battery connected to Samsung's Trats development board is now charged when voltage drops below threshold.
[snip]
Quoted 27 lines
board/samsung/trats/trats.c +23
-0@@ -247,6 +250,40 @@ int power_board_init(void)pmic_init_max8997 ();power_fg_init (I2C_9 );power_muic_init (I2C_5 ); + + chrg =power_chrg_get_type (); +debug ("CHARGER TYPE: %d\n" , chrg); + +if (!pmic_charger_bat_present ()) { +puts ("No battery detected\n" ); +return -1 ; + } + +power_check_battery (&bat); + +if (bat.state ==CHARGE && chrg ==CHARGER_USB ) { +puts ("CHARGER ENABLE\n" ); +if (pmic_charger_state (CHARGER_ENABLE ,450 )) +return -1 ; + +for (k =0 ;pmic_charger_bat_present () && +power_chrg_get_type () && + bat.state_of_chrg <5 ; k++) { +udelay (10000000 ); +puts ("." ); +power_update_battery (&bat); +
board/samsung/trats/trats.c int power_board_init(void) · line 285
Quoted 10 lines
board/samsung/trats/trats.c +10
-0+if (k ==100 ) { +printf (" %d [V]\n" , bat.voltage_uV); + k =0 ; + } + + } + +puts ("CHARGER DISABLE\n" ); +pmic_charger_state (CHARGER_DISABLE ,0 ); + }
If I read this right we'll pause in the middle of start up to charge the battery for possibly a long time right? And this could be a while loop even, yes? If so to the first one, this really should be under some sort of CONFIG option. I know the value of showing proof of concept type examples in development boards but that should still be an opt-in thing I would think.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/f5af9820/attachment.pgp>
PATCH 15/16 arm:trats:pmic: Support for charging battery at Samsung's TRATS board
Hi Tom ,
Quoted 4 lines
If I read this right we'll pause in the middle of start up to charge the battery for possibly a long time right? And this could be a while loop even, yes? If so to the first one, this really should be under some sort of CONFIG option.
This is one of the options. Other option is to extend the pmic/power command to:
pmic charger on/off to recharge battery when needed.
I think, that above is a better solution.
Quoted 3 lines
I know the value of showing proof of concept
type examples in development boards but that should still be an opt-in thing I would think.
Yes, indeed this shall be regarded as a proof-of-concept to show that battery is automatically charged when needed.
Instead, I think, that it would be a good idea to write a warning on the u-boot starting (when PMIC driver is initialized):
e.g. WARNING: Battery needs charging (voltage: 3.5V capacity: 8%)
And then user can on its own decide if he/she will charge the battery or not.
Regards,
Lukasz Majewski
PATCH 15/16 arm:trats:pmic: Support for charging battery at Samsung's TRATS board
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 21 lines · Lukasz Majewski
Hi Tom ,
Quoted 4 lines
If I read this right we'll pause in the middle of start up to charge the battery for possibly a long time right? And this could be a while loop even, yes? If so to the first one, this really should be under some sort of CONFIG option.
This is one of the options. Other option is to extend the pmic/power command to:
pmic charger on/off to recharge battery when needed.
I think, that above is a better solution.
Quoted 3 lines
I know the value of showing proof of concept type examples in development boards but that should still be an opt-in thing I would think.
Yes, indeed this shall be regarded as a proof-of-concept to show that battery is automatically charged when needed.
Quoted 7 lines
Instead, I think, that it would be a good idea to write a warning on the u-boot starting (when PMIC driver is initialized):
e.g. WARNING: Battery needs charging (voltage: 3.5V capacity: 8%)
And then user can on its own decide if he/she will charge the battery or not.
Yes, sounds good, thanks!
- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iQIcBAEBAgAGBQJQV5XMAAoJENk4IS6UOR1WnXYP/iZdtirR6Rflcp/YZSna/ld0 SsW0cW8fGT+Hy44T2pOsd4m0ne/WnTq6EUPJqQ1xs+ZIjj55Uh2ngLdc3/PpMC10 mi+vzm3E1wi8Wm83205r+7DAWnD20JXE413WimaBnP+EbVJzBjtZDFyFwtpvKnFd G2SyVyUsyBATsMFpfz7yFwNPYB9JoG/XgsLK64nP3wCVt/gSB6hE+ZBrRQgKvvsn AvQV3JhZbPMSWIj9Qq1qY8ReA2fC5SXBft/mcOt6cee7dTlaTzXkK3dxDQkmzOF8 l1Lhm3h/QMQ6/+mlghk9tZmfR7kXH54Ak0tZWLXQiT86namTymvgQ/SyOE8B0Rf8 p0+rD6X9WcuirhyeoKOmQS/cx6S1evNuPXJiRRGN3Y52nwWEnYlsDyDWEOqqLa70 466hdJhLm14HguJCsRbjs2l+rJ4pRj0WaKio7dq3uk0ojwueZRqSZyI6UEBQLMQU NBZExliUI+6TNBFVdmpaRe9cKVaDIbmtFWH8yl6xNAsU0MgOH15OsZOdQUO3bTgb sZPKHWKhiZbS16kMGGdvcb18up1qA/oXZJcnPD/rmyCQ4Tq/Z6eOt9CRwZyLss9p cUVb2PXJ6X4r6eTaK9HMAAk9zYZkk0pcmZcczsdcNhVv3MJlxwmNEfYY6RXfRdaI Dh3242syeDsez5ZQ3Uou
=v4oy
-----END PGP SIGNATURE-----
PATCH 16/16 arm:trats:pmic: Power consumption reduction state for Samsung's TRATS board
In reply to Lukasz MajewskiWhen charging battery is necessary, the development board needs to be turned into low power mode for better efficiency.
--- board/samsung/trats/trats.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-)
board/samsung/trats/trats.c +43 -0
@@ -89,6 +89,48 @@ void i2c_init_board(void)s5p_gpio_direction_output (&gpio2->y4,1 ,1 ); } +static void trats_low_power_mode (void ) +{ +struct exynos4_clock *clk = + (struct exynos4_clock *)samsung_get_base_clock (); +struct exynos4_power *pwr = + (struct exynos4_power *)samsung_get_base_power (); + +/* Power down CORE1 */ +writel (0x0 , &pwr->arm_core1_configuration); + +/* Change the APLL frequency */ +writel (0xa0c80604 , &clk->apll_con0); +/* Change CPU0 clock divider */ +writel (0x00000100 , &clk->div_cpu0); +/* CLK_DIV_STAT_CPU0 - wait until clock gets stable */ +while (readl (&clk->div_stat_cpu0) &0x1111111 ) + ; + +/* Change clock divider ratio for DMC */ +writel (0x13113117 , &clk->div_dmc0); +while (readl (&clk->div_stat_dmc0) &0x11111111 ) + ; + +/* Turn off unnecessary power domains */ +writel (0x0 , &pwr->xxti_configuration);/* XXTI */ +writel (0x0 , &pwr->cam_configuration);/* CAM */ +writel (0x0 , &pwr->tv_configuration);/* TV */ +writel (0x0 , &pwr->mfc_configuration);/* MFC */ +writel (0x0 , &pwr->g3d_configuration);/* G3D */ +writel (0x0 , &pwr->gps_configuration);/* GPS */ +writel (0x0 , &pwr->gps_alive_configuration);/* GPS_ALIVE */ + +/* Turn off unnecessary clocks */ +writel (0x0 , &clk->gate_ip_cam);/* CAM */ +writel (0x0 , &clk->gate_ip_tv);/* TV */ +writel (0x0 , &clk->gate_ip_mfc);/* MFC */ +writel (0x0 , &clk->gate_ip_g3d);/* G3D */ +writel (0x0 , &clk->gate_ip_image);/* IMAGE */ +writel (0x0 , &clk->gate_ip_gps);/* GPS */ +} + +static int pmic_init_max8997 (void ) {struct pmic *p =pmic_get ("MAX8997_PMIC" );
@@ -262,6 +304,7 @@ int power_board_init(void)power_check_battery (&bat);if (bat.state ==CHARGE && chrg ==CHARGER_USB ) { +trats_low_power_mode ();puts ("CHARGER ENABLE\n" );if (pmic_charger_state (CHARGER_ENABLE ,450 ))return -1 ;
Signature · 1 line
1.7.2.3
cover pmic: Redesign PMIC framework to support multiple instances of devices
In reply to Lukasz MajewskiQuoted 9 lines · Lukasz Majewski
PMIC framework has been redesigned to support multiple instances of power related devices (e.g. fuel gauge, PMICs, chargers, micro USB IC).
Due to that, code at other architectures and boards have been adjusted properly.
New
power_board_init()method at./lib/board.cfile has been introduced. It is meant to be an architecture dependent function to support advanced power management. Since PMIC framework uses lists internally to link different devices, its initialization must be done just after malloc initialization.
The framework itself looks OK, but I'd appreciate others reviewing as well.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/3c2a22da/attachment.pgp>
cover pmic: Redesign PMIC framework to support multiple instances of devices
Hi Tom,
Quoted 9 lines · Lukasz Majewski
Quoted 8 lines
PMIC framework has been redesigned to support multiple instances of power related devices (e.g. fuel gauge, PMICs, chargers, micro USB IC).
Due to that, code at other architectures and boards have been adjusted properly.
Quoted 9 lines
Quoted 5 lines
New
power_board_init()method at./lib/board.cfile has been introduced. It is meant to be an architecture dependent function to support advanced power management. Since PMIC framework uses lists internally to link different devices, its initialization must be done just after malloc initialization.The framework itself looks OK, but I'd appreciate others reviewing as well.
That was my intention to start a discussion. I'm welcome for other opinions.
Regards,
Lukasz