linux/drivers/mxc/pmic/mc13783/pmic_battery.c File Reference

This is the main file of PMIC(mc13783) Battery driver. More...

Functions

static void callback_chg_detect (void)
static int pmic_battery_suspend (struct platform_device *pdev, pm_message_t state)
static int pmic_battery_resume (struct platform_device *pdev)
PMIC_STATUS pmic_batt_enable_charger (t_batt_charger chgr, unsigned char c_voltage, unsigned char c_current)
PMIC_STATUS pmic_batt_disable_charger (t_batt_charger chgr)
PMIC_STATUS pmic_batt_set_charger (t_batt_charger chgr, unsigned char c_voltage, unsigned char c_current)
PMIC_STATUS pmic_batt_get_charger_setting (t_batt_charger chgr, unsigned char *c_voltage, unsigned char *c_current)
PMIC_STATUS pmic_batt_get_batt_voltage (unsigned short *b_voltage)
PMIC_STATUS pmic_batt_get_batt_current (unsigned short *b_current)
PMIC_STATUS pmic_batt_get_batt_temperature (unsigned short *b_temper)
PMIC_STATUS pmic_batt_get_charge_voltage (unsigned short *c_voltage)
PMIC_STATUS pmic_batt_get_charge_current (unsigned short *c_current)
PMIC_STATUS pmic_batt_enable_eol (unsigned char threshold)

Variables

static int swait
static int suspend_flag
static wait_queue_head_t suspendq

Detailed Description

This is the main file of PMIC(mc13783) Battery driver.


Function Documentation

static void callback_chg_detect ( void   )  [static]

Callback function for events, we want on MGN board

References pmic_get_sensors().

PMIC_STATUS pmic_batt_disable_charger ( t_batt_charger  chgr  ) 

This function turns off a charger.

Parameters:
chgr Charger as defined in t_batt_charger.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg(), and suspend_flag.

PMIC_STATUS pmic_batt_enable_charger ( t_batt_charger  chgr,
unsigned char  c_voltage,
unsigned char  c_current 
)

This function is used to start charging a battery. For different charger, different voltage and current range are supported.

Parameters:
chgr Charger as defined in t_batt_charger.
c_voltage Charging voltage.
c_current Charging current.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg(), and suspend_flag.

PMIC_STATUS pmic_batt_enable_eol ( unsigned char  threshold  ) 

This function enables End-of-Life comparator. Not supported on mc13783. Use pmic_batt_bp_enable_eol function.

Parameters:
threshold End-of-Life threshold.
Returns:
This function returns PMIC_UNSUPPORTED
PMIC_STATUS pmic_batt_get_batt_current ( unsigned short *  b_current  ) 

This function is retrives the main battery current.

Parameters:
b_current Output parameter for current setting.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_adc_convert(), and suspend_flag.

PMIC_STATUS pmic_batt_get_batt_temperature ( unsigned short *  b_temper  ) 

This function is retrives the main battery temperature.

Parameters:
b_temper Output parameter for temperature setting.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_adc_convert(), and suspend_flag.

PMIC_STATUS pmic_batt_get_batt_voltage ( unsigned short *  b_voltage  ) 

This function is retrives the main battery voltage.

Parameters:
b_voltage Output parameter for voltage setting.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_adc_convert(), and suspend_flag.

PMIC_STATUS pmic_batt_get_charge_current ( unsigned short *  c_current  ) 

This function is retrives the main battery charging current.

Parameters:
c_current Output parameter for charging current setting.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_adc_convert(), and suspend_flag.

PMIC_STATUS pmic_batt_get_charge_voltage ( unsigned short *  c_voltage  ) 

This function is retrives the main battery charging voltage.

Parameters:
c_voltage Output parameter for charging voltage setting.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_adc_convert(), and suspend_flag.

PMIC_STATUS pmic_batt_get_charger_setting ( t_batt_charger  chgr,
unsigned char *  c_voltage,
unsigned char *  c_current 
)

This function is used to retrive the charger setting.

Parameters:
chgr Charger as defined in t_batt_charger.
c_voltage Output parameter for charging voltage setting.
c_current Output parameter for charging current setting.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg(), and suspend_flag.

PMIC_STATUS pmic_batt_set_charger ( t_batt_charger  chgr,
unsigned char  c_voltage,
unsigned char  c_current 
)

This function is used to change the charger setting.

Parameters:
chgr Charger as defined in t_batt_charger.
c_voltage Charging voltage.
c_current Charging current.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg(), and suspend_flag.

static int pmic_battery_resume ( struct platform_device *  pdev  )  [static]

This is the resume of power management for the pmic battery API. It suports RESTORE state.

Parameters:
pdev the device
Returns:
This function returns 0 if successful.

References suspend_flag, suspendq, and swait.

static int pmic_battery_suspend ( struct platform_device *  pdev,
pm_message_t  state 
) [static]

This is the suspend of power management for the pmic battery API. It suports SAVE and POWER_DOWN state.

Parameters:
pdev the device
state the state
Returns:
This function returns 0 if successful.

References pmic_write_reg(), and suspend_flag.


Variable Documentation

int suspend_flag [static]
wait_queue_head_t suspendq [static]

The suspendq is used to block application calls

Referenced by pmic_battery_resume().

int swait [static]

Number of users waiting in suspendq

Referenced by pmic_battery_resume().

footer
©  Freescale Semiconductor, Inc., 2007.  All rights reserved.
Freescale Confidential Proprietary
NDA Required
doxygen