高通平台 设置LDO电源域

高通平台如何设置LDO电压,以LDO17为例,默认给屏供电,设置为2.85V现在设置为3.3V。

修改的rpm和sbl部分代码,修改LDO17电压为3.3V 。
(1).
--- a/RPM.BF.2.2/rpm_proc/core/systemdrivers/pmic/config/msm8937/pm_config_target.c
+++ b/RPM.BF.2.2/rpm_proc/core/systemdrivers/pmic/config/msm8937/pm_config_target.c
@@ -66,7 +66,7 @@ static pm_rpm_ldo_rail_info_type ldo_rail_a[] =
     {5, 50,   0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__IPEAK, PM_NPA_BYPASS_DISALLOWED, PM_DROOP_DETECT_DIS, 1775, 3325, 0, PM_SETTLING_ERR_DIS, PM_SETTLING_EN, 0},   // LDO14  ULT P50
     {5, 50,   0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__IPEAK, PM_NPA_BYPASS_DISALLOWED, PM_DROOP_DETECT_DIS, 1775, 3325, 0, PM_SETTLING_ERR_DIS, PM_SETTLING_EN, 0},   // LDO15  ULT P50
     {5, 50,   0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__NPM, PM_NPA_BYPASS_DISALLOWED,   PM_DROOP_DETECT_DIS, 1800, 1800, 0, PM_SETTLING_ERR_EN, PM_SETTLING_EN, 0},   // LDO16   P50 - removed in 8909
-    {5, 50,   0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__NPM,   PM_NPA_BYPASS_DISALLOWED, PM_DROOP_DETECT_DIS, 2800, 2900, 0, PM_SETTLING_ERR_DIS, PM_SETTLING_EN, 0},   // LDO17  ULT P600
+    {5, 50,   0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__NPM,   PM_NPA_BYPASS_DISALLOWED, PM_DROOP_DETECT_DIS, 2800, 3300, 0, PM_SETTLING_ERR_DIS, PM_SETTLING_EN, 0},   // LDO17  ULT P600
     {5, 50,   0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__NPM,   PM_NPA_BYPASS_DISALLOWED, PM_DROOP_DETECT_DIS, 2675, 2725, 0, PM_SETTLING_ERR_DIS, PM_SETTLING_EN, 0},   // LDO18  ULT P150
     {5, 62.5,   0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__IPEAK,   PM_NPA_BYPASS_DISALLOWED, PM_DROOP_DETECT_DIS, 1225, 1375, 0, PM_SETTLING_ERR_DIS, PM_SETTLING_EN, 0},   // LDO19  LDO WLAN
     {5, 250,  0, PM_ACCESS_ALLOWED, PM_NONE,      PM_NPA_SW_MODE_LDO__NPM,   PM_NPA_BYPASS_DISALLOWED, PM_DROOP_DETECT_DIS, 1740, 1740, 0, PM_SETTLING_ERR_EN, PM_SETTLING_EN, 0},   // LDO20  LDO XO LDO  - LN_LDO

2)、

--- a/BOOT.BF.3.3/boot_images/core/systemdrivers/pmic/target/msm8937_pm8937_pmi8937/system/src/pm_sbl_boot_oem.c
+++ b/BOOT.BF.3.3/boot_images/core/systemdrivers/pmic/target/msm8937_pm8937_pmi8937/system/src/pm_sbl_boot_oem.c
@@ -75,7 +75,9 @@ pm_err_flag_type
 pm_driver_post_init (void)
 {
     pm_err_flag_type err_flag = PM_ERR_FLAG__SUCCESS;
-
+       pm_ldo_sw_enable(0, PM_LDO_17, PM_OFF); //disable LDO
+       pm_ldo_volt_level(0, PM_LDO_17, 3300000); //change LDO range
+       pm_ldo_sw_enable(0, PM_LDO_17, PM_ON); //enable LDO again
     return err_flag;
 }

3)、
--- a/kernel/msm-3.18/arch/arm/boot/dts/qcom/msm8937-mdss-panels.dtsi
+++ b/kernel/msm-3.18/arch/arm/boot/dts/qcom/msm8937-mdss-panels.dtsi
@@ -35,8 +35,8 @@
                qcom,panel-supply-entry@0 {
                        reg = <0>;
                        qcom,supply-name = "vdd";
-                       qcom,supply-min-voltage = <2850000>;
-                       qcom,supply-max-voltage = <2850000>;
+                       qcom,supply-min-voltage = <3300000>;
+                       qcom,supply-max-voltage = <3300000>;
                        qcom,supply-enable-load = <100000>;
                        qcom,supply-disable-load = <100>;
                };

高通官方给出的修改建议:

1. LDO default voltage, range and default using devices can be found at PMIC device specification
doc
Such as 80-NJ117-1 table 3-7 for PM8994, 80-NT390-1 table 3-6 for PM8952
2. If you want to change the LDO voltage, please check first
a. can't set the LDO voltage bigger than the max programmable range
b. check HW, confirm the voltage don't impact other devices
c. Don't suggest change the LDO which used by RF or GPS default to other devices
3. LDO comman range and index
File: \rpm_proc\core\systemdrivers\pmic\config\common\pm_config_common.c
N1200, such as PM8994 L1
pm_pwr_volt_info_type n1200_volt[3] =
{
{ 375000, 1537500, 12500}, //LDO 0 (auto low range)
{ 375000, 1537500, 12500}, //LDO 1 (ultra low range)
{ 750000, 1537500, 12500}, //LDO 2 (low range)
};
N600, such as L26
pm_pwr_volt_info_type n600_volt[3] =
{
{ 0, 0, 0}, //LDO //invalid range -- place holder
{ 375000, 1287500, 12500}, //LDO 1 (ultra low range)
{ 750000, 1537500, 12500}, //LDO 2 (low range)
};
Other, N300, such as L2
pm_pwr_volt_info_type nmos_volt[3] =
{
{ 0, 0, 0}, //invalid range -- place holder
{ 0, 0, 0}, //invalid range -- place holder
{ 750000, 1537500, 12500}, //LDO 2 (low range)
};
PMOS LDO,
pm_pwr_volt_info_type pmos_volt[5] =
{
{ 0, 0, 0}, //invalid range -- place holder
{ 0, 0, 0}, //invalid range -- place holder
{ 750000, 1537500, 12500}, //LDO 2 (low range)
{1500000, 3075000, 25000}, //LDO 3 (mid range)
{1750000, 4900000, 50000}, //LDO 4(high range)
};
 
 
4. LDO control by RPM, need to check or change the range at RPM first
You must set the voltage in one range according above table, RPM will check it, if it is not right, will
crash.
Such as PMOS,
index 2: 750mv to 1537MV
index 3: 1500mv to 3075mv
index 4: 1750mv to 4900mv
Example for L23 of PM8994,
rpm_proc\core\systemdrivers\pmic\config\msm8996\pm_config_target.c
pm_rpm_ldo_rail_info_type ldo_rail_a[] =
{
{10, 200, 0, PM_ACCESS_ALLOWED, PM_NONE, PM_NPA_SW_MODE_LDO__IPEAK,
PM_NPA_BYPASS_ALLOWED, PM_DROOP_DETECT_DIS, 2700, 2900, 0,
PM_SETTLING_ERR_EN, PM_SETTLING_EN, 0}, // LDO23 P600
}
L23 min voltage is 2700mv, max voltage is 2900mv,
From index range, L23 current index is 3,
If change L23 to 3V, can change 2900 to 3075 directly,
If change L23 to 3.3V, for PMOS index 3 max voltage is 3075V, need change to index 4,
So, can change min 1750 max 3300 or just change max to 3300, min still keep 2700
But can't change min to 1700, for index 4, min voltage is 1750
 
 
5. Change the codes at SBL
If LDO range is changed, must change it at SBL before RPM loaded, else will crash at RPM for
index diff.
a. If index don't change, don't need to enable LDO also, don't need to change any codes at SBL,
just need to change at kernel
b. If index don't change, need to enable LDO at SBL
pm_ldo_volt_level(0, PM_LDO_23, 3000000); //set LDO voltage
pm_ldo_sw_enable(0, PM_LDO_23, PM_ON); //enable LDO at SBL
c. If index change, LDO default is off
pm_ldo_volt_level(0, PM_LDO_23, 3300000); //change LDO range
pm_ldo_sw_enable(0, PM_LDO_23, PM_ON); //enable LDO
d. If index change, LDO default is on, need to disable it first, then change the index
pm_ldo_sw_enable(0, PM_LDO_23, PM_OFF); //disable LDO
pm_ldo_volt_level(0, PM_LDO_23, 3300000); //change LDO range
pm_ldo_sw_enable(0, PM_LDO_23, PM_ON); //enable LDO again
e. Where add the codes?
1) Old platform, such as msm8916, msm8939/8909
boot_images\core\systemdrivers\pmic\framework\src\pm_init.c
At the end of function pm_oem_init( )
2) msm8952/53/37/76 platform
This file is pm_sbl_boot_oem.c, but need to change at the right platform path,
At the end of function pm_driver_post_init ( )
Path for diff platform,
boot_images\core\systemdrivers\pmic\target\msm8953_pm8953_pmi8950\system\src\
boot_images\core\systemdrivers\pmic\target\msm8952_pm8950_pmi8950\system\src\
boot_images\core\systemdrivers\pmic\target\msm8976_pm8950_pmi8950_pm8004\
system\src
3) msm8994/96 change at XBL
\boot_images\QcomPkg\Library\PmicLib\target\msm8996_pm8994_pmi8994\system\src\
pm_sbl_boot_oem.c
At the end of function pm_driver_post_init ( )
4) At new platform must add in pm_driver_post_init ( ), if add in pm_device_post_init( ), for LDO
don't init, also will crash at RPM
6. Change the voltage at kernel
Change voltage min, max and init value at dtsi
\arch\arm\boot\dts\qcom\msm8996-regulator.dtsi
rpm-regulator-ldoa23 {
status = "okay";
pm8994_l23: regulator-l23 {
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
qcom,init-voltage = <2800000>;
status = "okay";
};
};
7. How to use the LDO at kernel side
Can check the doc 80-NV610-47 for PM8952 and 80-NM328-63 for PM8994.
One attention, must call egulator_set_optimum_mode( ) before enable LDO, it will set LDO to
normal mode.
Can check the sample codes in msm_hsusb_ldo_enable( )
static int msm_hsusb_ldo_enable( )
{
case USB_PHY_REG_3P3_ON:
ret = regulator_set_optimum_mode(hsusb_3p3,
USB_PHY_3P3_HPM_LOAD);
ret = regulator_enable(hsusb_3p3);
break;
case USB_PHY_REG_3P3_OFF:
ret = regulator_disable(hsusb_3p3);
ret = regulator_set_optimum_mode(hsusb_3p3, 0);
break;
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

linux顿悟吧

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值