Files
bananarchy/patches/kernel/0006-msm8909-battery-wifi-gpu-power.patch
T

83 lines
3.0 KiB
Diff
Raw Normal View History

--- a/drivers/power/supply/pm8916_bms_vm.c
+++ b/drivers/power/supply/pm8916_bms_vm.c
@@ -39,6 +39,9 @@
#define PM8916_BMS_ENABLED BIT(7)
#define PM8916_BMS_VM_FIFO_LENGTH_CTL 0x47
+/* Sample the VM-BMS FIFO every 30 s instead of every 10 s. Each FIFO
+ * interrupt wakes the AP and (previously) emitted an unconditional
+ * power_supply_changed() uevent. */
#define PM8916_BMS_VM_S1_SAMPLE_INTERVAL_CTL 0x55
#define PM8916_BMS_VM_S2_SAMPLE_INTERVAL_CTL 0x56
#define PM8916_BMS_VM_S3_S7_OCV_DATA0 0x6A
@@ -47,8 +50,8 @@
/* Using only 1 fifo is broken in hardware */
#define PM8916_BMS_VM_FIFO_COUNT 2 /* 2 .. 8 */
-#define PM8916_BMS_VM_S1_SAMPLE_INTERVAL 10
-#define PM8916_BMS_VM_S2_SAMPLE_INTERVAL 10
+#define PM8916_BMS_VM_S1_SAMPLE_INTERVAL 30
+#define PM8916_BMS_VM_S2_SAMPLE_INTERVAL 30
struct pm8916_bms_vm_battery {
struct device *dev;
@@ -224,8 +227,18 @@
if (bat->fake_ocv > info->voltage_max_design_uv)
bat->fake_ocv = info->voltage_max_design_uv;
- power_supply_changed(bat->battery);
-
+ /* Only tell userspace when the reported capacity actually changed.
+ * The EMA filter moves slowly, so this drops most uevents (and the
+ * udev -> su -> sxmo_hook_battery.sh shell chain they trigger). */
+ {
+ static int last_reported_cap = -1;
+ int cap = power_supply_batinfo_ocv2cap(info, bat->fake_ocv, 20);
+
+ if (cap != last_reported_cap) {
+ last_reported_cap = cap;
+ power_supply_changed(bat->battery);
+ }
+ }
return IRQ_HANDLED;
}
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -3572,7 +3572,9 @@
/* Enable or disable keep alive */
#define WCN36XX_HAL_KEEP_ALIVE_DISABLE 0
#define WCN36XX_HAL_KEEP_ALIVE_ENABLE 1
-#define WCN36XX_KEEP_ALIVE_TIME_PERIOD 30 /* unit: s */
+/* 120 s keeps the association alive on typical APs while cutting the
+ * firmware null-data keep-alive TX wakeups by 4x. */
+#define WCN36XX_KEEP_ALIVE_TIME_PERIOD 120 /* unit: s */
/* Keep Alive request. */
struct wcn36xx_hal_keep_alive_req_msg {
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1456,6 +1456,10 @@
wcn->hw->max_listen_interval = 200;
wcn->hw->conf.dynamic_ps_timeout = 200;
wcn->hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
+ /* Wake for every 3rd beacon instead of every beacon. With beacon
+ * filtering + BMPS this roughly thirds the idle RX wakeup floor
+ * (measured ~1.8 wcn36xx_rx IRQs/s before this change). */
+ wcn->hw->conf.listen_interval = 3;
wcn->hw->queues = 4;
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
@@ -121,7 +121,9 @@
static struct devfreq_dev_profile msm_devfreq_profile = {
.timer = DEVFREQ_TIMER_DELAYED,
- .polling_ms = 50,
+ /* 100 ms halves the simple_ondemand sampling wakeups while the GPU
+ * is active; the device is runtime-suspended when idle anyway. */
+ .polling_ms = 100,
.target = msm_devfreq_target,
.get_dev_status = msm_devfreq_get_dev_status,
.get_cur_freq = msm_devfreq_get_cur_freq,