MT6573 Android Batttery Driver Customer Document [0.1 ed.]

  • Commentary
  • https://github.com/luckasfb/Development_Documents
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

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 Android Battery Driver 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 24

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................................................................................................................................... 5 1.1

1.2 1.3 1.4

2

Design............................................................................................................................................ 7 2.1 2.2 2.3 2.4 2.5 2.6

3

Software/Hardware Environment.......................................................................................... 5 1.1.1 Software Environment .......................................................................................... 5 1.1.2 Hardware Environment......................................................................................... 5 Functionality.......................................................................................................................... 5 Hardware background .......................................................................................................... 5 Hardware Component used in this driver ............................................................................. 6 Architecture........................................................................................................................... 7 Procedure & Flow ................................................................................................................. 8 AUXADC Measuring............................................................................................................. 8 Information Processing......................................................................................................... 9 Battery Percentage ............................................................................................................... 9 Battery Temperature........................................................................................................... 10

Interface....................................................................................................................................... 11 3.1

FO

3.2

Data Structure..................................................................................................................... 11 3.1.1 cust_charging_current_enum ................................................................... 11 3.1.2

VBAT_TO_PERCENT ........................................................................................... 11

3.1.3

PMU_ChargerStruct....................................................................................... 11

3.1.4

PMU_STATUS...................................................................................................... 12

3.1.5

usb_state_enum ............................................................................................. 12

3.1.6

CHARGER_TYPE ................................................................................................. 12

3.1.7 mt6573_ac_data................................................................................................. 12 3.1.8 mt6573_usb_data............................................................................................... 13 3.1.9 mt6573_battery_data ......................................................................................... 13 3.1.10 mt6573_ac_props............................................................................................... 13 3.1.11 mt6573_usb_props............................................................................................. 13 3.1.12 mt6573_battery_props ....................................................................................... 14 3.1.13 mt6573_ac_main................................................................................................ 14 3.1.14 mt6573_usb_main.............................................................................................. 14 3.1.15 mt6573_battery_mains....................................................................................... 15 Functions ............................................................................................................................ 15 3.2.1 select_charging_curret ....................................................................................... 15 3.2.2 pchr_turn_off_charging ...................................................................................... 15 3.2.3 pchr_turn_on_charging ...................................................................................... 16 3.2.4 BAT_PreChargeModeAction.............................................................................. 16 3.2.5 BAT_ConstantCurrentModeAction..................................................................... 16 3.2.6 BAT_TopOffModeAction .................................................................................... 16

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 24

BAT_CheckPMUStatusReg ............................................................................... 17 BAT_GetVoltage ................................................................................................ 17 BattVoltToPercent .............................................................................................. 17 BAT_CheckBatteryStatus .................................................................................. 17 BAT_BatteryFullAction ....................................................................................... 18 BAT_ChargingOTAction..................................................................................... 18 BAT_BatteryStatusFailAction............................................................................. 18 BAT_thread ........................................................................................................ 19 BattVoltToTemp ................................................................................................. 19 BattThermistorConverTemp............................................................................... 19 BATTERY_SetUSBState ................................................................................... 19 adc_cali_ioctl...................................................................................................... 20 mt6573_ac_get_property ................................................................................... 20 mt6573_usb_get_propertys ............................................................................... 20 mt6573_battery_get_property ............................................................................ 21 mt6573_ac_update............................................................................................. 21 mt6573_usb_update........................................................................................... 21 mt6573_battery_update ..................................................................................... 22

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.7 3.2.8 3.2.9 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.20 3.2.21 3.2.22 3.2.23 3.2.24

LY

MT6573 Confidential B

4

ustomization ............................................................................................................................... 23 4.1

5

Customization Items ........................................................................................................... 23

Build............................................................................................................................................. 24

FO

5.1 5.2

Source Code Structure & File Description.......................................................................... 24 Build Option ........................................................................................................................ 24

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 24

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 Linux Kernel 2.6.32 and Android 2.3.

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) 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

Figure 1-1 Battery charging diagram

FO

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 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 24

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

procedure. The following example is our test result (Note that the charging full time is depending on the system power consumption) :

Figure 1-2 Battery 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

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 24

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.

FO

The following figure is the detail of architecture of this driver in this section.

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 24

Procedure & Flow

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.2

LY

MT6573 Confidential B

The following figure is the procedure of this driver.

The following figure is the flow of this driver.

2.3

AUXADC Measuring

FO

This feature can get the BAT_SENSE voltage, I_SENSE voltage, Charger voltage and battery temperature voltage. The AUXADC need the post processing for getting the real value of the BAT_SENSE voltage, I_SENSE voltage, Charger voltage and battery temperature voltage. 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 8 of 24

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.4

Information Processing

These are two methods for information processing 1. Linear Interpolation Method 2. Moving Averaging Method

2.5

Battery Percentage

FO

This feature is used for getting the battery percentage (0~100%) depending on the battery voltage.

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 24

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.6

Battery Temperature

FO

This feature is used for getting the battery temperature depending on the AUXADC voltage.

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 24

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.

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 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; ISENSE;

© 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 24

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 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.1.5

usb_state_enum

It ‘s used in this driver. typedef enum { USB_SUSPEND = 0, USB_UNCONFIGURED, USB_CONFIGURED }usb_state_enum;

3.1.6

CHARGER_TYPE

It ‘s used in this driver. typedef enum { CHARGER_UNKNOWN = 0, STANDARD_HOST, CHARGING_HOST, NONSTANDARD_CHARGER, STANDARD_CHARGER, } CHARGER_TYPE;

FO

3.1.7

// USB : 450mA

// AC : 450mA~1A // AC : ~1A

mt6573_ac_data

It ‘s used in 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 12 of 24

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

struct mt6573_ac_data { struct power_supply psy; int AC_ONLINE; };

3.1.8

mt6573_usb_data

It ‘s used in this driver. struct mt6573_usb_data { struct power_supply psy; int USB_ONLINE; };

3.1.9

mt6573_battery_data

It ‘s used in this driver. struct mt6573_battery_data { struct power_supply psy; int BAT_STATUS; int BAT_HEALTH; int BAT_PRESENT; int BAT_TECHNOLOGY; int BAT_CAPACITY; int BAT_batt_vol; int BAT_batt_temp; int BAT_TemperatureR; int BAT_TempBattVoltage; int BAT_InstatVolt; int BAT_BatteryAverageCurrent; int BAT_BatterySenseVoltage; int BAT_ISenseVoltage; int BAT_ChargerVoltage; };

3.1.10 mt6573_ac_props

It ‘s used in this driver. static enum power_supply_property mt6573_ac_props[] = { POWER_SUPPLY_PROP_ONLINE, };

3.1.11 mt6573_usb_props

FO

It ‘s used in this driver. static enum power_supply_property mt6573_usb_props[] = { POWER_SUPPLY_PROP_ONLINE, }; 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 24

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

3.1.12 mt6573_battery_props It ‘s used in this driver. static enum power_supply_property mt6573_battery_props[] = { POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_batt_vol, POWER_SUPPLY_PROP_batt_temp, POWER_SUPPLY_PROP_TemperatureR, POWER_SUPPLY_PROP_TempBattVoltage, POWER_SUPPLY_PROP_InstatVolt, POWER_SUPPLY_PROP_BatteryAverageCurrent, POWER_SUPPLY_PROP_BatterySenseVoltage, POWER_SUPPLY_PROP_ISenseVoltage, POWER_SUPPLY_PROP_ChargerVoltage, };

3.1.13 mt6573_ac_main

It ‘s used in this driver. static struct mt6573_ac_data mt6573_ac_main = { .psy = { .name = "ac", .type = POWER_SUPPLY_TYPE_MAINS, .properties = mt6573_ac_props, .num_properties = ARRAY_SIZE(mt6573_ac_props), .get_property = mt6573_ac_get_property, }, .AC_ONLINE = 0, };

3.1.14 mt6573_usb_main

FO

It ‘s used in this driver. static struct mt6573_usb_data mt6573_usb_main = { .psy = { .name = "usb", .type = POWER_SUPPLY_TYPE_USB, .properties = mt6573_usb_props, .num_properties = ARRAY_SIZE(mt6573_usb_props), .get_property = mt6573_usb_get_property, }, .USB_ONLINE = 0, }; 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 24

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.1.15 mt6573_battery_mains

LY

MT6573 Confidential B

It ‘s used in this driver. static struct mt6573_battery_data mt6573_battery_main = { .psy = { .name = "battery", .type = POWER_SUPPLY_TYPE_BATTERY, .properties = mt6573_battery_props, .num_properties = ARRAY_SIZE(mt6573_battery_props), .get_property = mt6573_battery_get_property, }, .BAT_STATUS = POWER_SUPPLY_STATUS_UNKNOWN, .BAT_HEALTH = POWER_SUPPLY_HEALTH_UNKNOWN, .BAT_PRESENT = 0, .BAT_TECHNOLOGY = POWER_SUPPLY_TECHNOLOGY_UNKNOWN, .BAT_CAPACITY = 0, .BAT_batt_vol = 0, .BAT_batt_temp = 0, };

3.2

Functions

3.2.1

select_charging_curret

Prototype

void select_charging_curret() Description

Select the charging current by customer setting (charger type / USB state) Parameters none

none

none

Return Value none

3.2.2

pchr_turn_off_charging

Prototype

void pchr_turn_off_charging (void) Description

Do the HW charging “turn off” action 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 15 of 24

pchr_turn_on_charging

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.3

LY

MT6573 Confidential B

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

Returns the setting result (OK or FAIL)

3.2.6

BAT_TopOffModeAction

Prototype

PMU_STATUS BAT_TopOffModeAction(void) Description

FO

Kick the charging watchdog for satfy charging and set the TopOff mode charging current Run pchr_turn_on_charging() 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 16 of 24

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

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 teperature, charging current, charger voltage Parameters none

none

none

Return Value none

3.2.9

BattVoltToPercent

Prototype

UINT32 BattVoltToPercent(UINT16 dwVoltage) Description

Convert the battery voltage to battery percentage Parameters in

UINT16

Battery voltage

Return Value

Returns the battery percentage

3.2.10 BAT_CheckBatteryStatus

FO

Prototype

UINT32 BAT_CheckBatteryStatus(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 17 of 24

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

1. Averaging the battery voltage and current for avoiding I-R drop 2. 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 Prototype

PMU_STATUS BAT_BatteryStatusFailAction(void) Description

Reset driver safety timer and turn off 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 18 of 24

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

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 none

3.2.15 BattVoltToTemp Prototype

INT16 BattVoltToTemp(UINT32 dwVolt) Description

convert ADC_bat_temp_volt to temperature Parameters IN

UINT32

The voltage of measuring temperature from AUXADC

Return Value

Returns the battery temperature depending the voltage

3.2.16 BattThermistorConverTemp Prototype

INT16 BattThermistorConverTemp(UINT32 Res) Description

convert register to temperature by 47K or 10K ohm table (depending the battery SPEC) Parameters IN

UINT32

The temperature related register

Return Value

Returns the battery temperature depending the register

3.2.17 BATTERY_SetUSBState Prototype

void BATTERY_SetUSBState(int usb_state_value) Description

FO

Set the USB state for deciding the USB charging current 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 19 of 24

Prototype int

The value of the USB state

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

IN

LY

MT6573 Confidential B

Return Value none

3.2.18 adc_cali_ioctl Prototype

static int adc_cali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) Description

This is a IOCTL function for SET_ADC_CALI_Slop, SET_ADC_CALI_Offset, SET_ADC_CALI_Cal, ADC_CHANNEL_READ, BAT_STATUS_READ and Set_Charger_Current Parameters IN

unsigned int

command

IN

unsigned long

The arg is the message passed form the user space

Return Value

Returns the result of adc_cali_ioctl

3.2.19 mt6573_ac_get_property Prototype

static int mt6573_ac_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) Description

Android service use this function to get ac property Parameters IN

power_supply

Descript in the Linux kernel

IN

power_supply_property

Descript in the Linux kernel

IN

power_supply_propval

Descript in the Linux kernel

Return Value

Returns the result for getting the ac property

3.2.20 mt6573_usb_get_propertys Prototype

static int mt6573_usb_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) Description

FO

Android service use this function to get usb property Parameters IN

power_supply

MediaTek Confidential

Descript in the Linux kernel © 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 20 of 24

Prototype power_supply_property

Descript in the Linux kernel

IN

power_supply_propval

Descript in the Linux kernel

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

IN

LY

MT6573 Confidential B

Return Value

Returns the result for getting the usb property

3.2.21 mt6573_battery_get_property Prototype

static int mt6573_battery_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) Description

Android service use this function to get battery property Parameters IN

power_supply

Descript in the Linux kernel

IN

power_supply_property

Descript in the Linux kernel

IN

power_supply_propval

Descript in the Linux kernel

Return Value

Returns the result for getting the battery property

3.2.22 mt6573_ac_update Prototype

static void mt6573_ac_update(struct mt6573_ac_data *ac_data) Description

Battery driver use this function to inform the Android service to get information Parameters IN

mt6573_ac_data

The data of the ac, please see the data structure section

Return Value none

3.2.23 mt6573_usb_update Prototype

static void mt6573_usb_update(struct mt6573_usb_data *usb_data) Description

Battery driver use this function to inform the Android service to get information Parameters IN

mt6573_usb_data

The data of the usb, please see the data structure section

FO

Return Value 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 21 of 24

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

3.2.24 mt6573_battery_update Prototype

static void mt6573_battery_update(struct mt6573_battery_data *bat_data) Description

Battery driver use this function to inform the Android service to get information Parameters IN

mt6573_battery_data

The data of the battery, please see the data structure section

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 22 of 24

Customization

4.1

Customization Items

FO

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

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 23 of 24

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\kernel\drivers\power mt6573_battery.c

The implementation of battery charging related APIs.

alps\mediatek\platform\mt6573\kernel\drivers\power mt6573_battery.h

The battery charging related settings (internal).

alps\mediatek\custom\[project_name]\kernel\battery\battery cust_battery.h

5.2

The battery charging related settings (customer).

Build Option

FO

In alps\mediatek\config\[project_name]\autoconfig\kconfig\project, CONFIG_MTK_SMART_BATTERY=y for enabling the battery 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.

use

Page 24 of 24