191 73 587KB
English Pages 15 Year 2011
LY M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
MT6573 Power off Charging Specification Customer Document
Version: Release date:
0.1 2011/2/16
© 2008 - 2011 MediaTek Inc. This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
FO
Specifications are subject to change without notice.
LY
MT6573 Confidential B
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
Document Revision History
Revision
FO
0.1
Date
Author
2011-02-16
James Lo
MediaTek Confidential
Description Initial Draft
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 2 of 15
LY
MT6573 Confidential B
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
Table of Contents
Document Revision History .................................................................................................................. 2 Table of Contents................................................................................................................................... 3 1
Introduction................................................................................................................................... 4 1.1
1.2 1.3 1.4
2
Design............................................................................................................................................ 6 2.1 2.2
3
3.2
Data Structure....................................................................................................................... 8 3.1.1 cust_charging_current_enum ..................................................................... 8 3.1.2
VBAT_TO_PERCENT ............................................................................................. 8
3.1.3
PMU_ChargerStruct......................................................................................... 8
3.1.4 PMU_STATUS........................................................................................................ 9 Functions .............................................................................................................................. 9 3.2.1 BAT_ConstantCurrentModeAction..................................................................... 10 3.2.2 BAT_ConstantVoltageModeAction.....................Error! Bookmark not defined.9 3.2.3 BAT_CheckPMUStatusReg ............................................................................... 11 3.2.4 BAT_GetVoltage ................................................................................................ 11 3.2.5 BattVoltToPercent .............................................................................................. 11 3.2.6 BAT_CheckBatteryStatus .................................................................................. 12 3.2.7 BAT_BatteryFullAction ....................................................................................... 12 3.2.8 BAT_ChargingOTAction..................................................................................... 12 3.2.9 BAT_BatteryStatusFailAction............................................................................. 12 3.2.10 BAT_thread ........................................................................................................ 13
Customization............................................................................................................................. 14 4.1
5
Architecture........................................................................................................................... 6 Procedure & Flow ................................................................................................................. 6
Interface......................................................................................................................................... 8 3.1
4
Software/Hardware Environment.......................................................................................... 4 1.1.1 Software Environment .......................................................................................... 4 1.1.2 Hardware Environment......................................................................................... 4 Functionality.......................................................................................................................... 4 Hardware background .......................................................................................................... 4 Hardware Component used in this driver ............................................................................. 5
Customization Items ........................................................................................................... 14
Build............................................................................................................................................. 15
FO
5.1 5.2
Source Code Structure & File Description.......................................................................... 15 Build Option ........................................................................................................................ 15
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 3 of 15
LY
MT6573 Confidential B
Introduction
1.1
Software/Hardware Environment
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
1
1.1.1
Software Environment
Driver discussed in this document is designed based on UBOOT.
1.1.2
Hardware Environment
Driver discussed in this document can run on MT6573 ZTE phone SOC: MT6573 (included internal PMU) Battery Meter Solution: MT6573 AUXADC Battery: Li-ion, 3.7V 1280mAh Limited: battery charging voltage 4.2V
1.2
Functionality
The Battery driver’s main functionality is: (1) Charger plug in / out detection. (2) If the charger is inserted, run the charging procedure. (3) If the charger is removed, stop the charging procedure. (4) Different charging current support: depends on charger type. (5) Charging idle mode for faster charging (6) Software safety timer for charging protection
1.3
Hardware background
There are 3 key points affect the battery charging time. 1. Battery Capacity (BC) BatteryFull 2. Charging Current (CC) 3. System Loading Power Consumption (SLPC)
t
BC CC SLPC
FO
Figure 1-1 Battery charging diagram
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 4 of 15
LY
MT6573 Confidential B
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
Since MT6573 support the battery power path, the battery always consumed by the system. For keeping the battery voltage while charger exist, the software support the re-charging stage in charging procedure. The following example is our test result:
Figure 1-2 MTK Power Off Charging Procedure
1.4
Hardware Component used in this driver
FO
In this project, battery driver use the following hardware component: 1. The charging related registers of MT6573 PMU 2. The battery information monitor related registers of MT6573 AUXADC 3. The key monitor related registers of MT6573 keypad 4. The backlight monitor related registers of MT6573 LCM
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 5 of 15
Design
2.1
Architecture
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
2
LY
MT6573 Confidential B
The following figure is the architecture of this driver in this section.
2.2
Procedure & Flow
FO
The following figure is the procedure & flow of this driver.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 6 of 15
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
LY
MT6573 Confidential B
2.3
Charging idle mode
This feature can charge battery in the lower power consumption stage. – Behavior in this mode – Turn off backlight – NLED light still on – Enter charging idle mode condition from normal mode: – No user activity happens for 6 seconds – Exit charging idle mode condition : – User press the middle key
FO
Normal Mode
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 7 of 15
Interface
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
3
LY
MT6573 Confidential B
Describe the data structure and interface used by other kernel module. An example about GPIO is descirbed in the following section
3.1
Data Structure
3.1.1
cust_charging_current_enum
It ‘s used in BAT_ConstantCurrentModeAction() functions. typedef enum { Cust_CC_800MA = 800, Cust_CC_700MA = 700, Cust_CC_600MA = 600, Cust_CC_500MA = 500, Cust_CC_400MA = 400, Cust_CC_300MA = 300, Cust_CC_200MA = 200, Cust_CC_100MA = 100, Cust_CC_0MA = 0 }cust_charging_current_enum;
3.1.2
VBAT_TO_PERCENT
It ‘s used in BattVoltToPercent() functions. typedef struct{ UINT32 BattVolt; UINT32 BattPercent; }VBAT_TO_PERCENT;
3.1.3
PMU_ChargerStruct
FO
It ‘s used in this driver. typedef struct { kal_bool kal_bool kal_bool UINT32 UINT32 kal_bool UINT32 UINT32 UINT32 UINT32 MediaTek Confidential
bat_exist; bat_full; bat_low; bat_charging_state; bat_vol; charger_exist; pre_charging_current; charging_current; charger_vol; charger_protect_status;
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 8 of 15
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
UINT32 ISENSE; UINT32 ICharging; UINT32 temperature; UINT32 total_charging_time; UINT32 PRE_charging_time; UINT32 CC_charging_time; UINT32 TOPOFF_charging_time; UINT32 POSTFULL_charging_time; UINT32 charger_type; UINT32 PWR_SRC; UINT32 SOC; UINT32 ADC_BAT_SENSE; UINT32 ADC_I_SENSE; } PMU_ChargerStruct; PMU_ChargerStruct BMT_status;
LY
MT6573 Confidential B
3.1.4
PMU_STATUS
It ‘s used in this driver. typedef enum { PMU_STATUS_OK = 0, PMU_STATUS_FAIL = 1, }PMU_STATUS;
3.2
Functions
3.2.1
select_charging_curret
Prototype
void select_charging_curret() Description
Select the charging current by customer setting (charger type) Parameters none
none
none
Return Value none
3.2.2
pchr_turn_off_charging
Prototype
void pchr_turn_off_charging (void) Description
FO
Do the HW charging “turn off” action Parameters MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 9 of 15
LY
MT6573 Confidential B
Prototype none
none
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
none
Return Value none
3.2.3
pchr_turn_on_charging
Prototype
void pchr_turn_on_charging (void) Description
Do the HW charging “turn on” action Parameters none
none
none
Return Value none
3.2.4
BAT_PreChargeModeAction
Prototype
PMU_STATUS BAT_PreChargeModeAction(void) Description
Kick the charging watchdog for satfy charging and set the Pre-CC mode charging current Run pchr_turn_on_charging() Parameters none
none
none
Return Value
Returns the setting result (OK or FAIL)
3.2.5
BAT_ConstantCurrentModeAction
Prototype
PMU_STATUS BAT_ConstantCurrentModeAction(void) Description
Kick the charging watchdog for satfy charging and set the CC mode charging current Run pchr_turn_on_charging() Parameters none
none
none
Return Value
FO
Returns the setting result (OK or FAIL)
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 10 of 15
BAT_TopOffModeAction
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
3.2.6
LY
MT6573 Confidential B
Prototype
PMU_STATUS BAT_TopOffModeAction(void) Description
Kick the charging watchdog for satfy charging and set the TopOff mode charging current Run pchr_turn_on_charging() Parameters none
none
none
Return Value
Returns the setting result (OK or FAIL)
3.2.7
BAT_CheckPMUStatusReg
Prototype
UINT32 BAT_CheckPMUStatusReg(void) Description
Check the charger exist or loss Parameters none
none
none
Return Value
Returns the setting result (OK or FAIL)
3.2.8
BAT_GetVoltage
Prototype
void BAT_GetVoltage(void) Description
Get battery information : battery voltage, battery temperature, charging current, charger voltage Parameters none
none
none
Return Value
Returns the battery information
3.2.9
BattVoltToPercent
Prototype
UINT32 BattVoltToPercent(UINT16 dwVoltage) Description
Convert the battery voltage to battery percentage
FO
Parameters in
UINT16
Battery voltage
Return Value MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 11 of 15
LY
MT6573 Confidential B
Prototype
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
Returns the battery percentage
3.2.10 BAT_CheckBatteryStatus Prototype
UINT32 BAT_CheckBatteryStatus(void) Description
1. Averaging the battery voltage and current for avoiding I-R drop 2. Enable / disable charging idle mode by keypad monitoring 3. Recharging technique for keeping the battery voltage while charger exist Parameters none
none
none
Return Value
Returns the setting result (OK or FAIL)
3.2.11 BAT_BatteryFullAction Prototype
PMU_STATUS BAT_BatteryFullAction(void) Description
Reset driver safety timer and turn off charging Parameters none
none
none
Return Value
Returns the setting result (OK or FAIL)
3.2.12 BAT_ChargingOTAction Prototype
PMU_STATUS BAT_ChargingOTAction(void) Description
Reset driver safety timer and turn off charging Parameters none
none
none
Return Value
Returns the setting result (OK or FAIL)
3.2.13 BAT_BatteryStatusFailAction
FO
Prototype
PMU_STATUS BAT_BatteryStatusFailAction(void) MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 12 of 15
LY
MT6573 Confidential B
Prototype
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
Description
Reset driver safety timer and turn off charging Parameters none
none
none
Return Value
Returns the setting result (OK or FAIL)
3.2.14 BAT_thread Prototype
void BAT_thread(void) Description 1. 2. 3. 4.
Battery Charging Main Thread Monitor the battery and charger status Enable the charging time protection and update safety timer Execute charging function
Parameters none
none
none
Return Value
FO
none
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 13 of 15
Customization
4.1
Customization Items
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
4
LY
MT6573 Confidential B
FO
The following table is the customization items.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 14 of 15
LY
MT6573 Confidential B
Build
5.1
Source Code Structure & File Description
M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N
5
File
Description
\alps\mediatek\platform\mt6573\uboot mt6573_bat.c
The implementation of battery charging related APIs.
alps\mediatek\custom\${project_name}\uboot\inc\cust_battery.h cust_battery.h
5.2
The battery charging related settings.
Build Option
FO
This is a build-in feature in the boot-loader.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 15 of 15