MTK Android Driver: PMIC, mtkpmic
1. Basic Concepts
PMIC: Power Management IC
Related interface code:
U32 pmic_config_interface (U32 RegNum, U32 val, U32 MASK, U32 SHIFT)
Preload: alps \ mediatek \ platform \ mt6582 \ preloader \ src \ drivers \ pmic_6323.c
Lk: alps \ mediatek \ platform \ mt6582 \ lk \ mt_pmic.c
Kernel: alps \ mediatek \ platform \ mt6582 \ kernel \ drivers \ power \ pmic_mt6323.c
Low dropout regulator is a low dropout regulator, which is a low-voltage differential linear voltage regulator and a power conversion chip in the drop-down mode.
Related interface definition:
Power-on interface function: hwPowerOn power-down interface function: hwPowerDown
Alps \ mediatek \ platform \ mt6582 \ kernel \ core \ mt_pm_ldo.c
2. Power-on and power-down configuration methods (four phases after preload, lk, kernel, and system startup ):
2.1 preload and lk phase configuration: The following is the power-on/power-down method in LK phase: Use the APIs in the upmu_common.c file to control each LDO_VGPX. for example, upmu_set_rg_vgp6_vosel is used to control the power-on voltage value, and upmu_set_rg_vgp6_en is used to control the pin of enable VGP6.
2.2 kernel phase Configuration:
Power-on interface function: hwPowerOn power-down interface function: hwPowerDown the following uses PMIC6320 VGP6 as an example. Please call hwPowerOn in the file # include <mach/mt_pm_ldo.h> You Want to power on. If power is down, call hwPowerDownhwPowerOn (power, VOL_2800, "ldo_test"); bool hwPowerDown (power, "ldo_test ");
2.3 After system startup:
After the system is started normally, the kernel runs. Therefore, all power-on/power-down operations should be placed in the kernel.
3 drive voltage modification:
Lcm vgp1 drive voltage:
\ Alps \ mediatek \ custom \ common \ kernel \ lcm \ rgb_mt8193 \ rgb_mt8193.c
Static void lcm_init (void ){
Upmu_set_rg_vgp1_vosel (0x7); // driving voltage modification ---> pmic_config_interface ()
Upmu_set_rg_vgp1_en (0x1 );
}
Mt6323 voltage level file:
\ Alps \ mediatek \ platform \ mt6582 \ kernel \ drivers \ power \ pmic_mt6323.c
Example: vgp1 voltage level ing table:
Void dct_pmic_VGP1_sel (kal_uint32 volt)
{
If (volt = VOL_DEFAULT) {upmu_set_rg_vgp1_vosel (5 );}
Else if (volt = VOL_1200) {upmu_set_rg_vgp1_vosel (0 );}
Else if (volt = VOL_1300) {upmu_set_rg_vgp1_vosel (1 );}
Else if (volt = VOL_1500) {upmu_set_rg_vgp1_vosel (2 );}
Else if (volt = VOL_1800) {upmu_set_rg_vgp1_vosel (3 );}
Else if (volt = VOL_2000) {upmu_set_rg_vgp1_vosel (4 );}
Else if (volt = VOL_2800) {upmu_set_rg_vgp1_vosel (5 );}
Else if (volt = VOL_3000) {upmu_set_rg_vgp1_vosel (6 );}
Else if (volt = VOL_3300) {upmu_set_rg_vgp1_vosel (7 );}
Else {
}
}