Better voltage controller configuration for droid4
Tony Lindgren
maintainercover Better voltage controller configuration for droid4
Hi,
Here are two more patches to change droid4 to use low-speed configuration like the Motorola Mapphone Android Linux kernel does.
This gains us a power saving of 7mW bringing the whole device power consumption in retention idle mode to about 32mW between wakeups with screen blanked, modem off, usb and phy modules unloaded and wlan connected. That's about the same number as I measured Android do in flight mode suspended.
With the pending modem patches with modem online, I'm now seeing average power consumption of about 60 - 70mW for the whole device as measured once a minute from /sys/class/power_supply/battery/power_avg.
The patches are against v5.4-rc1 on top of the related patches:
[PATCH 0/8] Improve PM for omap4 devices
Regards,
Tony
Tony Lindgren (2):
ARM: OMAP2+: Configure voltage controller for retention
ARM: OMAP2+: Configure voltage controller for cpcap to low-speed
arch/arm/mach-omap2/pmic-cpcap.c | 18 ++++++++++++----- arch/arm/mach-omap2/vc.c | 34 ++++++++++++++++++++++++++++---- arch/arm/mach-omap2/vc.h | 2 +- 3 files changed, 44 insertions(+), 10 deletions(-)
Signature · 1 line
2.23.0
Tony Lindgren
maintainerPATCH 1/2 ARM: OMAP2+: Configure voltage controller for retention
Similar to existing omap3_vc_set_pmic_signaling(), let's add omap4 specific omap4_vc_set_pmic_signaling(). This allows the configured devices to enable voltage controller for retention later on during init.
--- arch/arm/mach-omap2/vc.c | 32 +++++++++++++++++++++++++++++--- arch/arm/mach-omap2/vc.h | 2 +- 2 files changed, 30 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/vc.c +29 -3
@@ -36,15 +36,21 @@#define OMAP4430_AUTO_CTRL_VDD_CORE (x) ((x) << 0)#define OMAP4430_AUTO_CTRL_VDD_RET 2 -#define OMAP4_VDD_DEFAULT_VAL \ +#define OMAP4430_VDD_I2C_DISABLE_MASK \ (OMAP4430_VDD_IVA_I2C_DISABLE | \ - OMAP4430_VDD_MPU_I2C_DISABLE | \ - OMAP4430_VDD_CORE_I2C_DISABLE | \ + OMAP4430_VDD_MPU_I2C_DISABLE | \ + OMAP4430_VDD_CORE_I2C_DISABLE) + +#define OMAP4_VDD_DEFAULT_VAL \ + (OMAP4430_VDD_I2C_DISABLE_MASK | \ OMAP4430_VDD_IVA_PRESENCE | OMAP4430_VDD_MPU_PRESENCE | \ OMAP4430_AUTO_CTRL_VDD_IVA(OMAP4430_AUTO_CTRL_VDD_RET) | \ OMAP4430_AUTO_CTRL_VDD_MPU(OMAP4430_AUTO_CTRL_VDD_RET) | \ OMAP4430_AUTO_CTRL_VDD_CORE(OMAP4430_AUTO_CTRL_VDD_RET)) +#define OMAP4_VDD_RET_VAL \ + (OMAP4_VDD_DEFAULT_VAL & ~OMAP4430_VDD_I2C_DISABLE_MASK) +/** * struct omap_vc_channel_cfg - describe the cfg_channel bitfield * @sa: bit for slave address
@@ -299,6 +305,26 @@ void omap3_vc_set_pmic_signaling(int core_next_state) } } +void omap4_vc_set_pmic_signaling (int core_next_state) +{ +struct voltagedomain *vd = vc.vd; +u32 val; + +if (!vd) +return ; + +switch (core_next_state) { +case PWRDM_POWER_RET : + val =OMAP4_VDD_RET_VAL ; +break ; +default : + val =OMAP4_VDD_DEFAULT_VAL ; +break ; + } + + vd->write (val,OMAP4_PRM_VOLTCTRL_OFFSET ); +} +/* * Configure signal polarity for sys_clkreq and sys_off_mode pins * as the default values are wrong and can cause the system to hang
arch/arm/mach-omap2/vc.h +1 -1
@@ -117,7 +117,7 @@ extern struct omap_vc_param omap4_iva_vc_data;extern struct omap_vc_param omap4_core_vc_data;void omap3_vc_set_pmic_signaling (int core_next_state); - +void omap4_vc_set_pmic_signaling (int core_next_state);void omap_vc_init_channel (struct voltagedomain *voltdm); int omap_vc_pre_scale(struct voltagedomain *voltdm,
Signature · 1 line
2.23.0
Tony Lindgren
maintainerPATCH 2/2 ARM: OMAP2+: Configure voltage controller for cpcap to low-speed
In reply to Tony LindgrenLooks like the i2c timings in high-speed mode do not work properly to allow us to clear I2C_DISABLE bits for PRM_VOLTCTRL register and the device reboots if I2C_DISABLE bits are cleared.
Let's configure the voltage controller i2c for low-speed mode as done in the Motorola Mapphone Android Linux kernel. This saves us about 7mW of power during retention compared to the high-speed values.
Let's also change the low-speed warning to pr_info about relying on the bootloader configured low-speed values like we currently do.
--- arch/arm/mach-omap2/pmic-cpcap.c | 18 +++++++++++++----- arch/arm/mach-omap2/vc.c | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/pmic-cpcap.c +13 -5
@@ -61,7 +61,7 @@ static struct omap_voltdm_pmic omap_cpcap_core = { .i2c_slave_addr = 0x02, .volt_reg_addr = 0x00, .cmd_reg_addr = 0x01, - .i2c_high_speed = true, + .i2c_high_speed = false, .vsel_to_uv = omap_cpcap_vsel_to_uv, .uv_to_vsel = omap_cpcap_uv_to_vsel, };
@@ -78,7 +78,7 @@ static struct omap_voltdm_pmic omap_cpcap_iva = { .i2c_slave_addr = 0x44, .volt_reg_addr = 0x0, .cmd_reg_addr = 0x01, - .i2c_high_speed = true, + .i2c_high_speed = false, .vsel_to_uv = omap_cpcap_vsel_to_uv, .uv_to_vsel = omap_cpcap_uv_to_vsel, };
@@ -125,7 +125,7 @@ static struct omap_voltdm_pmic omap443x_max8952_mpu = { .i2c_slave_addr = 0x60, .volt_reg_addr = 0x03, .cmd_reg_addr = 0x03, - .i2c_high_speed = true, + .i2c_high_speed = false, .vsel_to_uv = omap_max8952_vsel_to_uv, .uv_to_vsel = omap_max8952_uv_to_vsel, };
@@ -212,7 +212,7 @@ static struct omap_voltdm_pmic omap4_fan_core = { .vddmax = 1375000, .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, .i2c_slave_addr = 0x4A, - .i2c_high_speed = true, + .i2c_high_speed = false, .volt_reg_addr = 0x01, .cmd_reg_addr = 0x01, .vsel_to_uv = omap_fan535508_vsel_to_uv,
@@ -232,7 +232,7 @@ static struct omap_voltdm_pmic omap4_fan_iva = { .i2c_slave_addr = 0x48, .volt_reg_addr = 0x01, .cmd_reg_addr = 0x01, - .i2c_high_speed = true, + .i2c_high_speed = false, .vsel_to_uv = omap_fan535503_vsel_to_uv, .uv_to_vsel = omap_fan535503_uv_to_vsel, };
@@ -263,3 +263,11 @@ int __init omap4_cpcap_init(void)return 0 ; } + +static int __init cpcap_late_init (void ) +{ +omap4_vc_set_pmic_signaling (PWRDM_POWER_RET ); + +return 0 ; +} +omap_late_initcall (cpcap_late_init);
arch/arm/mach-omap2/vc.c +1 -1
@@ -670,7 +670,7 @@ static void __init omap4_vc_i2c_timing_init(struct voltagedomain *voltdm)const struct i2c_init_data *i2c_data;if (!voltdm->pmic->i2c_high_speed) { -pr_warn ("%s: only high speed supported!\n" , __func__); +pr_info ("%s: using bootloader low-speed timings\n" , __func__);return ; }
Signature · 1 line
2.23.0