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

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

Functions

static int pmic_power_suspend (struct platform_device *pdev, pm_message_t state)
static int pmic_power_resume (struct platform_device *pdev)
void pmic_power_off (void)
PMIC_STATUS pmic_power_set_pc_config (t_pc_config *pc_config)
PMIC_STATUS pmic_power_get_pc_config (t_pc_config *pc_config)
PMIC_STATUS pmic_power_regulator_on (t_pmic_regulator regulator)
PMIC_STATUS pmic_power_regulator_off (t_pmic_regulator regulator)
PMIC_STATUS pmic_power_regulator_set_voltage (t_pmic_regulator regulator, t_regulator_voltage voltage)
PMIC_STATUS pmic_power_regulator_get_voltage (t_pmic_regulator regulator, t_regulator_voltage *voltage)
PMIC_STATUS pmic_power_switcher_set_dvs (t_pmic_regulator regulator, t_regulator_voltage dvs)
PMIC_STATUS pmic_power_switcher_get_dvs (t_pmic_regulator regulator, t_regulator_voltage *dvs)
PMIC_STATUS pmic_power_switcher_set_stby (t_pmic_regulator regulator, t_regulator_voltage stby)
PMIC_STATUS pmic_power_switcher_get_stby (t_pmic_regulator regulator, t_regulator_voltage *stby)
PMIC_STATUS pmic_power_switcher_set_mode (t_pmic_regulator regulator, t_regulator_sw_mode mode, bool stby)
PMIC_STATUS pmic_power_switcher_get_mode (t_pmic_regulator regulator, t_regulator_sw_mode *mode, bool stby)
PMIC_STATUS pmic_power_switcher_set_dvs_speed (t_pmic_regulator regulator, t_switcher_dvs_speed speed)
PMIC_STATUS pmic_power_switcher_get_dvs_speed (t_pmic_regulator regulator, t_switcher_dvs_speed *speed)
PMIC_STATUS pmic_power_switcher_set_panic_mode (t_pmic_regulator regulator, bool panic_mode)
PMIC_STATUS pmic_power_switcher_get_panic_mode (t_pmic_regulator regulator, bool *panic_mode)
PMIC_STATUS pmic_power_switcher_set_softstart (t_pmic_regulator regulator, bool softstart)
PMIC_STATUS pmic_power_switcher_get_softstart (t_pmic_regulator regulator, bool *softstart)
PMIC_STATUS pmic_power_switcher_set_factor (t_pmic_regulator regulator, t_switcher_factor factor)
PMIC_STATUS pmic_power_switcher_get_factor (t_pmic_regulator regulator, t_switcher_factor *factor)
PMIC_STATUS pmic_power_regulator_set_lp_mode (t_pmic_regulator regulator, t_regulator_lp_mode lp_mode)
PMIC_STATUS pmic_power_regulator_get_lp_mode (t_pmic_regulator regulator, t_regulator_lp_mode *lp_mode)
PMIC_STATUS pmic_power_regulator_set_config (t_pmic_regulator regulator, t_regulator_config *config)
PMIC_STATUS pmic_power_regulator_get_config (t_pmic_regulator regulator, t_regulator_config *config)
PMIC_STATUS pmic_power_vbkup2_auto_en (bool en)
PMIC_STATUS pmic_power_get_vbkup2_auto_state (bool *en)
PMIC_STATUS pmic_power_bat_det_en (bool en)
PMIC_STATUS pmic_power_get_bat_det_state (bool *en)
PMIC_STATUS pmic_power_vib_pin_en (bool en)
PMIC_STATUS pmic_power_gets_vib_pin_state (bool *en)
PMIC_STATUS pmic_power_get_power_mode_sense (struct t_p_up_sense *p_up_sense)
PMIC_STATUS pmic_power_set_regen_assig (t_pmic_regulator regulator, bool en_dis)
PMIC_STATUS pmic_power_get_regen_assig (t_pmic_regulator regulator, bool *en_dis)
PMIC_STATUS pmic_power_set_regen_inv (bool en_dis)
PMIC_STATUS pmic_power_get_regen_inv (bool *en_dis)
PMIC_STATUS pmic_power_esim_v_en (bool vesim, bool vmmc1, bool vmmc2)
PMIC_STATUS pmic_power_gets_esim_v_state (bool *vesim, bool *vmmc1, bool *vmmc2)
PMIC_STATUS pmic_power_set_auto_reset_en (bool en)
PMIC_STATUS pmic_power_get_auto_reset_en (bool *en)
PMIC_STATUS pmic_power_set_conf_button (t_button bt, bool sys_rst, int deb_time)
PMIC_STATUS pmic_power_get_conf_button (t_button bt, bool *sys_rst, int *deb_time)
PMIC_STATUS pmic_power_event (t_pwr_int event, void *callback, bool sub)
PMIC_STATUS pmic_power_event_sub (t_pwr_int event, void *callback)
PMIC_STATUS pmic_power_event_unsub (t_pwr_int event, void *callback)

Detailed Description

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


Function Documentation

PMIC_STATUS pmic_power_bat_det_en ( bool  en  ) 

This function enables battery detect function. Only on mc13783 2.0 or higher

Parameters:
en if true, enable BATTDETEN
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_get_version(), pmic_write_reg(), and pmic_version_t::revision.

PMIC_STATUS pmic_power_esim_v_en ( bool  vesim,
bool  vmmc1,
bool  vmmc2 
)

This function enables esim control voltage. Only on mc13783 2.0 or higher

Parameters:
vesim if true, enable VESIMESIMEN
vmmc1 if true, enable VMMC1ESIMEN
vmmc2 if true, enable VMMC2ESIMEN
Returns:
This function returns 0 if successful.

References pmic_get_version(), pmic_write_reg(), and pmic_version_t::revision.

PMIC_STATUS pmic_power_event ( t_pwr_int  event,
void *  callback,
bool  sub 
)

This function is used to un/subscribe on power event IT.

Parameters:
event type of event.
callback event callback function.
sub define if Un/subscribe event.
Returns:
This function returns 0 if successful.

References pmic_event_callback_t::func, pmic_event_callback_t::param, pmic_event_subscribe(), and pmic_event_unsubscribe().

Referenced by pmic_power_event_sub(), and pmic_power_event_unsub().

PMIC_STATUS pmic_power_event_sub ( t_pwr_int  event,
void *  callback 
)

This function is used to subscribe on power event IT.

Parameters:
event type of event.
callback event callback function.
Returns:
This function returns 0 if successful.

References pmic_power_event().

PMIC_STATUS pmic_power_event_unsub ( t_pwr_int  event,
void *  callback 
)

This function is used to un subscribe on power event IT.

Parameters:
event type of event.
callback event callback function.
Returns:
This function returns 0 if successful.

References pmic_power_event().

PMIC_STATUS pmic_power_get_auto_reset_en ( bool *  en  ) 

This function gets auto reset configuration.

Parameters:
en if true, the auto reset is enabled
Returns:
This function returns 0 if successful.

References pmic_read_reg().

PMIC_STATUS pmic_power_get_bat_det_state ( bool *  en  ) 

This function gets state of battery detect function. Only on mc13783 2.0 or higher

Parameters:
en if true, BATTDETEN is enabled
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_get_version(), pmic_read_reg(), and pmic_version_t::revision.

PMIC_STATUS pmic_power_get_conf_button ( t_button  bt,
bool *  sys_rst,
int *  deb_time 
)

This function gets configuration of a button.

Parameters:
bt type of button.
sys_rst if true, the system reset is enabled on this button
deb_time gets the debounce time on this button pin
Returns:
This function returns 0 if successful.

References pmic_read_reg().

PMIC_STATUS pmic_power_get_pc_config ( t_pc_config *  pc_config  ) 

This function retrives the power control configuration.

Parameters:
pc_config pointer to power control configuration.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

PMIC_STATUS pmic_power_get_power_mode_sense ( struct t_p_up_sense *  p_up_sense  ) 

This function returns power up sense value

Parameters:
p_up_sense value of power up sense
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

PMIC_STATUS pmic_power_get_regen_assig ( t_pmic_regulator  regulator,
bool *  en_dis 
)

This function gets the Regen assignment for all regulator

Parameters:
regulator type of regulator
en_dis return value, if true : the regulator is enabled by regen.
Returns:
This function returns 0 if successful.

References pmic_read_reg().

PMIC_STATUS pmic_power_get_regen_inv ( bool *  en_dis  ) 

This function gets the Regen polarity.

Parameters:
en_dis If true regen is inverted.
Returns:
This function returns 0 if successful.

References pmic_read_reg().

PMIC_STATUS pmic_power_get_vbkup2_auto_state ( bool *  en  ) 

This function gets state of automatically VBKUP2. Only on mc13783 2.0 or higher

Parameters:
en if true, VBKUP2AUTOMH is enabled
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_get_version(), pmic_read_reg(), and pmic_version_t::revision.

PMIC_STATUS pmic_power_gets_esim_v_state ( bool *  vesim,
bool *  vmmc1,
bool *  vmmc2 
)

This function gets esim control voltage values. Only on mc13783 2.0 or higher

Parameters:
vesim if true, enable VESIMESIMEN
vmmc1 if true, enable VMMC1ESIMEN
vmmc2 if true, enable VMMC2ESIMEN
Returns:
This function returns 0 if successful.

References pmic_get_version(), pmic_read_reg(), and pmic_version_t::revision.

PMIC_STATUS pmic_power_gets_vib_pin_state ( bool *  en  ) 

This function gets state of control of VVIB by VIBEN pin. Only on mc13783 2.0 or higher

Parameters:
en if true, VIBPINCTRL is enabled
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_get_version(), pmic_read_reg(), and pmic_version_t::revision.

void pmic_power_off ( void   ) 

This function sets user power off in power control register and thus powers off the phone.

Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

PMIC_STATUS pmic_power_regulator_get_config ( t_pmic_regulator  regulator,
t_regulator_config *  config 
)

This function retrives the regulator output configuration.

Parameters:
regulator The regulator to be truned off.
config Pointer to regulator configuration.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_power_regulator_get_lp_mode(), pmic_power_regulator_get_voltage(), pmic_power_switcher_get_dvs(), pmic_power_switcher_get_dvs_speed(), pmic_power_switcher_get_factor(), pmic_power_switcher_get_mode(), pmic_power_switcher_get_panic_mode(), pmic_power_switcher_get_softstart(), and pmic_power_switcher_get_stby().

PMIC_STATUS pmic_power_regulator_get_lp_mode ( t_pmic_regulator  regulator,
t_regulator_lp_mode *  lp_mode 
)

This function gets low power mode.

Parameters:
regulator The regulator to be handled
lp_mode Select nominal or low power mode.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_regulator_get_voltage ( t_pmic_regulator  regulator,
t_regulator_voltage *  voltage 
)

This function retrives the regulator output voltage.

Parameters:
regulator The regulator to be truned off.
voltage Pointer to regulator output voltage.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_regulator_off ( t_pmic_regulator  regulator  ) 

This function turns off a regulator.

Parameters:
regulator The regulator to be truned off.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

PMIC_STATUS pmic_power_regulator_on ( t_pmic_regulator  regulator  ) 

This function turns on a regulator.

Parameters:
regulator The regulator to be truned on.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

PMIC_STATUS pmic_power_regulator_set_config ( t_pmic_regulator  regulator,
t_regulator_config *  config 
)

This function sets the regulator configuration.

Parameters:
regulator The regulator to be configured.
config The regulator output configuration.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_power_regulator_set_lp_mode(), pmic_power_regulator_set_voltage(), pmic_power_switcher_set_dvs(), pmic_power_switcher_set_dvs_speed(), pmic_power_switcher_set_factor(), pmic_power_switcher_set_mode(), pmic_power_switcher_set_panic_mode(), pmic_power_switcher_set_softstart(), and pmic_power_switcher_set_stby().

PMIC_STATUS pmic_power_regulator_set_lp_mode ( t_pmic_regulator  regulator,
t_regulator_lp_mode  lp_mode 
)

This function enables or disables low power mode.

Parameters:
regulator The regulator to be configured.
lp_mode Select nominal or low power mode.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_regulator_set_voltage ( t_pmic_regulator  regulator,
t_regulator_voltage  voltage 
)

This function sets the regulator output voltage.

Parameters:
regulator The regulator to be configured.
voltage The regulator output voltage.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

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

This function is called to resume the power from a low power state.

Parameters:
pdev the device structure used to give information on which power device (0 through 3 channels) to suspend
Returns:
The function always returns 0.
PMIC_STATUS pmic_power_set_auto_reset_en ( bool  en  ) 

This function enables auto reset after a system reset.

Parameters:
en if true, the auto reset is enabled
Returns:
This function returns 0 if successful.

References pmic_write_reg().

PMIC_STATUS pmic_power_set_conf_button ( t_button  bt,
bool  sys_rst,
int  deb_time 
)

This function configures a system reset on a button.

Parameters:
bt type of button.
sys_rst if true, enable the system reset on this button
deb_time sets the debounce time on this button pin
Returns:
This function returns 0 if successful.

References pmic_write_reg().

PMIC_STATUS pmic_power_set_pc_config ( t_pc_config *  pc_config  ) 

This function sets the power control configuration.

Parameters:
pc_config power control configuration.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

PMIC_STATUS pmic_power_set_regen_assig ( t_pmic_regulator  regulator,
bool  en_dis 
)

This function configures the Regen assignment for all regulator

Parameters:
regulator type of regulator
en_dis if true, the regulator is enabled by regen.
Returns:
This function returns 0 if successful.

References pmic_write_reg().

PMIC_STATUS pmic_power_set_regen_inv ( bool  en_dis  ) 

This function sets the Regen polarity.

Parameters:
en_dis If true regen is inverted.
Returns:
This function returns 0 if successful.

References pmic_write_reg().

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

This function is called to put the power in a low power state. Switching off the platform cannot be decided by the power module. It has to be handled by the client application.

Parameters:
pdev the device structure used to give information on which power device (0 through 3 channels) to suspend
state the power state the device is entering
Returns:
The function always returns 0.
PMIC_STATUS pmic_power_switcher_get_dvs ( t_pmic_regulator  regulator,
t_regulator_voltage *  dvs 
)

This function gets the DVS voltage

Parameters:
regulator The regulator to be handled.
dvs The switch Dynamic Voltage Scaling
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_switcher_get_dvs_speed ( t_pmic_regulator  regulator,
t_switcher_dvs_speed *  speed 
)

This function gets the switch dvs speed

Parameters:
regulator The regulator to be handled.
speed The dvs speed.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_switcher_get_factor ( t_pmic_regulator  regulator,
t_switcher_factor *  factor 
)

This function gets the PLL multiplication factor

Parameters:
regulator The regulator to be handled
factor The multiplication factor.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_switcher_get_mode ( t_pmic_regulator  regulator,
t_regulator_sw_mode *  mode,
bool  stby 
)

This function gets the switchers mode.

Parameters:
regulator The regulator to be handled.
mode The switcher mode.
stby Switch between main and standby.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_switcher_get_panic_mode ( t_pmic_regulator  regulator,
bool *  panic_mode 
)

This function gets the switch panic mode

Parameters:
regulator The regulator to be handled
panic_mode Enable or disable panic mode
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_switcher_get_softstart ( t_pmic_regulator  regulator,
bool *  softstart 
)

This function gets the switch softstart mode

Parameters:
regulator The regulator to be handled
softstart Enable or disable softstart.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_switcher_get_stby ( t_pmic_regulator  regulator,
t_regulator_voltage *  stby 
)

This function gets the standiby voltage

Parameters:
regulator The regulator to be handled.
stby The switch standby voltage
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_read_reg().

Referenced by pmic_power_regulator_get_config().

PMIC_STATUS pmic_power_switcher_set_dvs ( t_pmic_regulator  regulator,
t_regulator_voltage  dvs 
)

This function sets the DVS voltage

Parameters:
regulator The regulator to be configured.
dvs The switch Dynamic Voltage Scaling
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_switcher_set_dvs_speed ( t_pmic_regulator  regulator,
t_switcher_dvs_speed  speed 
)

This function sets the switch dvs speed

Parameters:
regulator The regulator to be configured.
speed The dvs speed.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_switcher_set_factor ( t_pmic_regulator  regulator,
t_switcher_factor  factor 
)

This function sets the PLL multiplication factor

Parameters:
regulator The regulator to be configured.
factor The multiplication factor.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_switcher_set_mode ( t_pmic_regulator  regulator,
t_regulator_sw_mode  mode,
bool  stby 
)

This function sets the switchers mode.

Parameters:
regulator The regulator to be configured.
mode The switcher mode
stby Switch between main and standby.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_switcher_set_panic_mode ( t_pmic_regulator  regulator,
bool  panic_mode 
)

This function sets the switch panic mode

Parameters:
regulator The regulator to be configured.
panic_mode Enable or disable panic mode
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_switcher_set_softstart ( t_pmic_regulator  regulator,
bool  softstart 
)

This function sets the switch softstart mode

Parameters:
regulator The regulator to be configured.
softstart Enable or disable softstart.
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_switcher_set_stby ( t_pmic_regulator  regulator,
t_regulator_voltage  stby 
)

This function sets the standiby voltage

Parameters:
regulator The regulator to be configured.
stby The switch standby voltage
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_write_reg().

Referenced by pmic_power_regulator_set_config().

PMIC_STATUS pmic_power_vbkup2_auto_en ( bool  en  ) 

This function enables automatically VBKUP2 in the memory hold modes. Only on mc13783 2.0 or higher

Parameters:
en if true, enable VBKUP2AUTOMH
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_get_version(), pmic_write_reg(), and pmic_version_t::revision.

PMIC_STATUS pmic_power_vib_pin_en ( bool  en  ) 

This function enables control of VVIB by VIBEN pin. Only on mc13783 2.0 or higher

Parameters:
en if true, enable VIBPINCTRL
Returns:
This function returns PMIC_SUCCESS if successful.

References pmic_get_version(), pmic_write_reg(), and pmic_version_t::revision.

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