[Optimus One, P500 Android Development] bigsupersquid:
Experimental test of wifi voltage reduction, and activate commented out msm-7627 regulator for ldo12 (wlan)

Read: EXPERIMENTAL.

It has been flashed to one thunderg p500 which seems to still be completely functional (which I don't own one of unfortunately, but I've been testing this patch on the thunderc with basically the same kernel for a while with no ill effects.)

Use at your own risk, of course, but this is an experiment to try to reduce the wifi power drain with the 3.0 kernel. Needs testers to give opinions or evaluation.

If it actually can be verified to cut power consumption noticeably, I'd like to send it upstream, but first it needs tested to be more than a placebo.

For androidarmv6 kitkat (muklsoni's or jenkins nightly)

dunno how it'll get along with other kitkat ROMS. Doubt it'll work on anything under Jellybean.

source:

https://github.com/androidarmv6/android_kernel_lge_msm7x27-3.0.x branch cm-11.0

with this patch

Subject: [PATCH] wifi regulator and voltage reduction test

---
arch/arm/mach-msm/board-msm7627-regulator.c | 3 ++-
arch/arm/mach-msm/lge/board-thunderg-mmc.c | 27 ++++++++++++++-------------
2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-msm/board-msm7627-regulator.c b/arch/arm/mach-msm/board-msm7627-regulator.c
index 6ab2977..4540e6e 100644
--- a/arch/arm/mach-msm/board-msm7627-regulator.c
+++ b/arch/arm/mach-msm/board-msm7627-regulator.c
@@ -226,7 +226,8 @@ static struct proccomm_regulator_info msm7627_pcom_vreg_info[] = {
PCOM_VREG_LDO(ldo09, 8, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0),
PCOM_VREG_LDO(ldo10, 7, NULL, 2600000, 2600000, 0, -1, 0, 0, 0, 0),
PCOM_VREG_LDO(ldo11, 21, NULL, 2800000, 2800000, 0, -1, 0, 0, 0, 0),
-	PCOM_VREG_LDO(ldo12, 11, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0),
+//	PCOM_VREG_LDO(ldo12, 11, NULL, 1800000, 1800000, 0, -1, 0, 0, 0, 0),
+	PCOM_VREG_LDO(ldo12, 11, NULL, 1800000, 2400000, 0, -1, 0, 0, 0, 0),
PCOM_VREG_LDO(ldo13, 15, NULL, 2850000, 3000000, 0, -1, 0, 0, 0, 0),
PCOM_VREG_LDO(ldo14, 24, NULL, 2700000, 2700000, 0, -1, 0, 0, 0, 0),
PCOM_VREG_LDO(ldo15, 23, NULL, 2800000, 2800000, 0, -1, 0, 0, 0, 0),
diff --git a/arch/arm/mach-msm/lge/board-thunderg-mmc.c b/arch/arm/mach-msm/lge/board-thunderg-mmc.c
index 056bcfa..20f9575 100644
--- a/arch/arm/mach-msm/lge/board-thunderg-mmc.c
+++ b/arch/arm/mach-msm/lge/board-thunderg-mmc.c
@@ -181,8 +181,8 @@ static unsigned sdcc_cfg_data[][6] = {

static unsigned long vreg_sts, gpio_sts;
static unsigned mpp_mmc = 2;
-static struct vreg *vreg_mmc;
-//static struct regulator *vreg_mmc;
+//static struct vreg *vreg_mmc;
+static struct regulator *vreg_mmc;

static void msm_sdcc_setup_gpio(int dev_id, unsigned int enable)
{
@@ -226,8 +226,8 @@ static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
MPP_CFG(MPP_DLOGIC_LVL_MSMP,
MPP_DLOGIC_OUT_CTRL_LOW));
} else
-	rc = vreg_disable(vreg_mmc);
-//	rc = regulator_disable(vreg_mmc);
+//	rc = vreg_disable(vreg_mmc);
+	rc = regulator_disable(vreg_mmc);
if (rc)
printk(KERN_ERR "%s: return val: %d \n",
__func__, rc);
@@ -242,15 +242,16 @@ static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
MPP_DLOGIC_OUT_CTRL_HIGH));
} else {
#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
-	rc = vreg_set_level(vreg_mmc, VREG_SD_LEVEL);
-//	rc = regulator_set_voltage(vreg_mmc, VREG_SD_LEVEL*1000, VREG_SD_LEVEL*1000);
+//	rc = vreg_set_level(vreg_mmc, VREG_SD_LEVEL);
+	rc = regulator_set_voltage(vreg_mmc, VREG_SD_LEVEL*1000, VREG_SD_LEVEL*1000);
#else
-	rc = vreg_set_level(vreg_mmc, 2850);
+//	rc = vreg_set_level(vreg_mmc, 2850);
//	rc = regulator_set_voltage(vreg_mmc, 2850000, 2850000);
+	rc = regulator_set_voltage(vreg_mmc, 1800000, 2400000);
#endif
if (!rc)
-	rc = vreg_enable(vreg_mmc);
-//	rc = regulator_enable(vreg_mmc);
+//	rc = vreg_enable(vreg_mmc);
+	rc = regulator_enable(vreg_mmc);
}
if (rc)
printk(KERN_ERR "%s: return val: %d \n",
@@ -313,11 +314,11 @@ static struct mmc_platform_data msm7x2x_sdc1_data = {
static void __init msm7x2x_init_mmc(void)
{
if (!machine_is_msm7x25_ffa() && !machine_is_msm7x27_ffa()) {
-	vreg_mmc = vreg_get(NULL, "wlan");
-//	vreg_mmc = regulator_get(NULL, "wlan");
+//	vreg_mmc = vreg_get(NULL, "wlan");
+	vreg_mmc = regulator_get(NULL, "wlan");
if (IS_ERR(vreg_mmc)) {
-//	printk(KERN_ERR "%s: regulator get failed (%ld)\n",
-	printk(KERN_ERR "%s: vreg get failed (%ld)\n",
+	printk(KERN_ERR "%s: regulator get failed (%ld)\n",
+//	printk(KERN_ERR "%s: vreg get failed (%ld)\n",
__func__, PTR_ERR(vreg_mmc));
return;
}
--
1.7.9.5

This enables the regulator instead of vreg for ldo12 (wlan) like the other board devices.

It also reduces wlan voltage from 2.85V to 2.4V max and allows a low setting of 1.8V instead of the original off/2.85V mode

built with custom ct-ng linaro 4.7 armv6k toolchain branch 4.7.4

(the few v6k instructions in the toolchain should be no issue for your msm7227, especially compared to the armv7 ones in the 4.8 and newer toolchains I've tried.)

Download link in 2nd post.