Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

ddi_power_battery.c File Reference


Detailed Description

Implementation file for the power driver battery charger.

Definition in file ddi_power_battery.c.

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <asm/processor.h>
#include <mach/platform.h>
#include <mach/hardware.h>
#include <mach/ddi_bc.h>
#include <mach/lradc.h>
#include <mach/regs-power.h>
#include <mach/regs-lradc.h>
#include "ddi_bc_internal.h"

Go to the source code of this file.

Defines

#define BATT_BRWNOUT_ALKAL_BASE_MV   800
 Base voltage to start battery calculations for Alkaline/NiMH.
#define BATT_BRWNOUT_ALKAL_CEILING_OFFSET_MV   19
 Constant to help with determining whether to round up or not during calculation.
#define BATT_BRWNOUT_ALKAL_EQN_CONST   (BATT_BRWNOUT_ALKAL_BASE_MV - BATT_BRWNOUT_ALKAL_CEILING_OFFSET_MV)
 Constant value to be calculated by preprocessing.
#define BATT_BRWNOUT_ALKAL_LEVEL_STEP_MV   20
 Number of mV to add if rounding up in Alkaline/NiMH mode.
#define BATT_BRWNOUT_LIION_BASE_MV   2800
 Base voltage to start battery calculations for LiIon.
#define BATT_BRWNOUT_LIION_CEILING_OFFSET_MV   39
 Constant to help with determining whether to round up or not during calculation.
#define BATT_BRWNOUT_LIION_EQN_CONST   (BATT_BRWNOUT_LIION_BASE_MV - BATT_BRWNOUT_LIION_CEILING_OFFSET_MV)
 Constant value to be calculated by preprocessing.
#define BATT_BRWNOUT_LIION_LEVEL_STEP_MV   40
 Number of mV to add if rounding up in LiIon mode.
#define BATT_VOLTAGE_8_MV   8
 Report the voltage across the battery.
#define BATTERY_VOLTAGE_CMPTRIP100_THRESHOLD_MV   4000
#define BATTERY_VOLTAGE_CMPTRIP105_THRESHOLD_MV   3800
#define BP_POWER_BATTMONITOR_BATT_VAL   16
#define BP_POWER_CHARGE_BATTCHRG_I   0
#define BP_POWER_CHARGE_STOP_ILIMIT   8
#define DDI_POWER_BATTERY_XFER_THRESHOLD_MV   3200
#define DISABLE_VDDIO_BO_PROTECTION
#define GAIN_CORRECTION   1012
#define KELVIN_TO_CELSIUS_CONST   273
#define LINREG_OFFSET_STEP_BELOW   0x2
#define TEMP_READING_ERROR_MARGIN   5
 Report on the die temperature.
#define VBUSVALID_THRESH_2_90V   0x0
#define VBUSVALID_THRESH_4_00V   0x1
#define VBUSVALID_THRESH_4_10V   0x2
#define VBUSVALID_THRESH_4_20V   0x3
#define VBUSVALID_THRESH_4_30V   0x4
#define VBUSVALID_THRESH_4_40V   0x5
#define VBUSVALID_THRESH_4_50V   0x6
#define VBUSVALID_THRESH_4_60V   0x7
#define VDD4P2_ENABLED

Functions

uint16_t ddi_power_BringUp4p2Regulator (uint16_t target_current_limit_ma, bool b4p2_dcdc_enabled)
bool ddi_power_check_4p2_bits (void)
uint16_t ddi_power_convert_current_to_setting (uint16_t u16Current)
uint16_t ddi_power_convert_setting_to_current (uint16_t u16Setting)
void ddi_power_disable_5v_connection_irq (void)
void ddi_power_disable_power_interrupts (void)
void ddi_power_Enable4p2 (uint16_t target_current_limit_ma)
void ddi_power_Enable5vDetection (void)
void ddi_power_Enable5vDisconnectShutdown (bool bEnable)
void ddi_power_enable_5v_connect_detection (void)
void ddi_power_enable_5v_disconnect_detection (void)
void ddi_power_enable_5v_to_battery_handoff (void)
void ddi_power_enable_5v_to_battery_xfer (bool bEnable)
void ddi_power_enable_battery_to_5v_handoff (void)
void ddi_power_enable_vddio_interrupt (bool enable)
void ddi_power_EnableBatteryBoInterrupt (bool bEnable)
void ddi_power_EnableBatteryInterrupt (bool enable)
void ddi_power_EnableDcdc4p2BoInterrupt (bool bEnable)
void ddi_power_EnableVbusDroopIrq (void)
void ddi_power_EnableVdd5vDroopInterrupt (bool bEnable)
void ddi_power_execute_5v_to_battery_handoff (void)
void ddi_power_execute_battery_to_5v_handoff (void)
uint16_t ddi_power_ExpressibleCurrent (uint16_t u16Current)
 Compute the actual current expressible in the hardware.
bool ddi_power_Get5vDroopFlag (void)
bool ddi_power_Get5vPresentFlag (void)
uint16_t ddi_power_GetBattery (void)
uint16_t ddi_power_GetBatteryChargeCurrentThreshold (void)
bool ddi_power_GetBatteryChargerEnabled (void)
ddi_power_BatteryMode_t ddi_power_GetBatteryMode (void)
bool ddi_power_GetChargerPowered (void)
 Report if the charger hardware power is on.
int ddi_power_GetChargeStatus (void)
 Reports if the charging current has fallen below the threshold.
void ddi_power_GetDieTemp (int16_t *pLow, int16_t *pHigh)
uint16_t ddi_power_GetMaxBatteryChargeCurrent (void)
enum ddi_power_5v_status ddi_power_GetPmu5vStatus (void)
bool ddi_power_GetPowerClkGate (void)
void ddi_power_handle_cmptrip (void)
void ddi_power_handle_dcdc4p2_bo (void)
void ddi_power_handle_vdd5v_droop (void)
void ddi_power_handle_vddio_brnout (void)
void ddi_power_Init4p2Params (void)
void ddi_power_init_4p2_protection (void)
int ddi_power_init_battery (void)
void ddi_power_init_handoff (void)
void ddi_power_InitOutputBrownouts (void)
bool ddi_power_IsBattRdyForXfer (void)
bool ddi_power_IsDcdcOn (void)
 Checks to see if the DCDC has been manually enabled.
void ddi_power_Set4p2BoLevel (uint16_t bo_voltage_mv)
uint16_t ddi_power_set_4p2_ilimit (uint16_t ilimit)
uint16_t ddi_power_SetBatteryChargeCurrentThreshold (uint16_t u16Thresh)
void ddi_power_SetChargerPowered (bool bPowerOn)
 Turn the charging hardware on or off.
uint16_t ddi_power_SetMaxBatteryChargeCurrent (uint16_t u16MaxCur)
void ddi_power_SetPowerClkGate (bool bGate)
void ddi_power_shutdown (void)
void ddi_power_Start4p2Dcdc (bool battery_ready)
uint16_t MeasureInternalDieTemperature (void)

Variables

static const uint16_t currentPerBit [] = { 10, 20, 50, 100, 200, 400 }
static ddi_power_5vDetection_t DetectionMethod = DDI_POWER_5V_VBUSVALID


Generated by  Doxygen 1.6.0   Back to index