[HTC 10 Guides, News, & Discussion] devsk:
Update: Sept 28, 2016 - I have uploaded my kernel ZIP for 1.91 US Unlocked variant. This is a stock kernel patched by me to reduce the wifi drain. The patch and the kernel config changes are also attached. Note that these changes are with respect to the stock kernel. So, use stock kernel to build this change. Many kernels floating around here use different kernel config than stock e.g. HZ=100 is standard in HTC stock kernel but its different in many kernels here.

-------------------------------

For the poll, to confirm you have this issue: Best is to be stock ROM without root and run the commands in post #4 at http://xdaforums.com/showpost.php?p=67184793&postcount=4 using 'adb shell'. Also if possible follow the diagnostics in post #135 at http://xdaforums.com/showpost.php?p=67429554&postcount=135.

If you vote NO, please do provide information (like the output of commands). Please do not attach battery stats or battery usage screenshots.

Update: Jul 23, '16

Attached the Ex 0.10 modified to optimize wlan wakeups. I have restored the DHD OOB wakes to avoid missing some of the async updates over wifi.

Edit: Jul 17, '16

I am attaching the test kernel ZIP (its based on flar2's 0.09 kernel for HTC 10) and the script which you need to run to collect some stats before and after applying the fixed kernel. You can refer to post http://xdaforums.com/showpost.php?p=67594118&postcount=267 for details on the ZIP and http://xdaforums.com/showpost.php?p=67595029&postcount=271 for details on the script.

--------------------------- Original Post Follows ------------------------------

The wifi drains the battery much faster than the LTE, although I have a better signal for the wifi. I see these messages repeated every 1-2 seconds from stock kernel:

[ 8348.647538013/ 0xbc09507e74] DBG1:msm_pcie_pm_control: PCIe: RC0: pm_opt:1;busnr:1;options:0
[ 8348.647667232/ 0xbc09508816] DBG1:msm_pcie_pm_control: User of RC0 requests to resume the link
[ 8348.647689940/ 0xbc095089cb] ERR:msm_pcie_pm_resume: RC0: entry
[ 8348.647893169/ 0xbc09509908] ERR:msm_pcie_enable: RC0: entry
[ 8348.647937857/ 0xbc09509c63] INFO:msm_pcie_enable: PCIe: Assert the reset of endpoint of RC0.
[ 8348.649170513/ 0xbc0950f8df] DBG1:msm_pcie_vreg_init: RC0: entry
[ 8348.649604107/ 0xbc0951195b] DBG1:msm_pcie_vreg_init: RC0: exit
[ 8348.649655773/ 0xbc09511d3a] DBG1:msm_pcie_clk_init: RC0: entry
[ 8348.649809628/ 0xbc095128c4] DBG1:msm_pcie_clk_init: PCIe: requesting bus vote for RC0
[ 8348.651178846/ 0xbc09518f76] DBG1:msm_pcie_clk_init: RC0: exit
[ 8348.651267284/ 0xbc09519617] DBG1:pcie_phy_init: RC0: Initializing 14nm QMP phy - 19.2MHz with Common Mode Clock (SSC ON)
[ 8348.652631815/ 0xbc0951fc78] DBG1:msm_pcie_pipe_clk_init: RC0: entry
[ 8348.653214732/ 0xbc09522827] DBG1:msm_pcie_pipe_clk_init: RC0: exit
[ 8348.653241294/ 0xbc09522a24] DBG1:msm_pcie_enable: RC0: waiting for phy ready...
[ 8348.653266971/ 0xbc09522c11] DBG1:msm_pcie_enable: RC0: number of PHY retries:0.
[ 8348.653293221/ 0xbc09522e09] INFO:msm_pcie_enable: PCIe RC0 PHY is ready!
[ 8348.653364680/ 0xbc09523366] DBG1:pcie_pcs_port_phy_init: RC0: Initializing PCIe PHY Port
[ 8348.663910044/ 0xbc09554a58] INFO:msm_pcie_enable: PCIe: Release the reset of endpoint of RC0.
[ 8348.665250617/ 0xbc0955aeda] DBG1:msm_pcie_enable: check if link is up
[ 8348.692539940/ 0xbc095dad94] DBG1:msm_pcie_confirm_linkup: PCIe: device ID and vender ID of RC 0 are 0x10417cb.
[ 8348.692615253/ 0xbc095db330] DBG1:msm_pcie_confirm_linkup: PCIe: device ID and vender ID of RC 0 are 0x10417cb.
[ 8348.692638169/ 0xbc095db4e9] DBG1:msm_pcie_enable: Link is up after 4 checkings
[ 8348.692657701/ 0xbc095db65f] INFO:msm_pcie_enable: PCIe RC0 link initialized
[ 8348.692748221/ 0xbc095dbd2a] DBG1:msm_pcie_config_controller: RC0
[ 8348.692959628/ 0xbc095dcd04] DBG1:msm_pcie_config_controller: RC's PCIE20_CAP_DEVCTRLSTATUS:0x10581f
[ 8348.693029159/ 0xbc095dd23b] DBG1:msm_pcie_config_link_state: RC0: ep_link_cap_offset: 0xb8
[ 8348.693419055/ 0xbc095def7a] DBG1:msm_pcie_enable: RC0: exit
[ 8348.693434367/ 0xbc095df09f] DBG1:msm_pcie_pm_resume: dev->bus->number = 0 dev->bus->primary = 0
[ 8348.693457128/ 0xbc095df254] DBG1:msm_pcie_pm_resume: RC0: entry of PCI framework restore state
[ 8348.694266399/ 0xbc095e2f07] DBG1:msm_pcie_pm_resume: RC0: exit of PCI framework restore state
[ 8348.694286190/ 0xbc095e3083] DBG1:msm_pcie_pm_resume: RC0: exit
[ 8348.694301190/ 0xbc095e31a2] DBG1:msm_pcie_pm_control: PCIe: RC0: user succeeded to resume the link.
[ 8349.720218902/ 0xbc0a8ac178] DBG1:msm_pcie_pm_control: PCIe: RC0: pm_opt:0;busnr:1;options:0
[ 8349.720304995/ 0xbc0a8ac7ec] DBG1:msm_pcie_pm_control: User of RC0 requests to suspend the link

There are quite a few problems with the frequent repetition seen above:

1. The connection is unstable. The device is suspending, resuming inside the kernel repeatedly.

2. Its eats up CPU cycles in the kernel

3. It does IO to the disk in terms of /devlog/kernel.log. The log files are rotated inside the 25MB partition (mounted at /devlog) but it results in a very frequent IO to the internal storage, which not only wears out the eMMC but burns through the battery.

If I disable wifi and use LTE only, my standby battery drain is reduced to almost 1/3rd to 1/5th. Something is seriously wrong with the driver for bcm4359 chip on this device.

This issue reported earlier lay credence to this analysis (apart from the main battery drain thread):

http://xdaforums.com/verizon-htc-10/help/wifi-weirdness-cause-battery-drain-t3373425

I have tried few things:

1. Legacy DHCP client in developer options - affects only obtaining of the IP. Does not have any effect on the above issue.

2. Locked to 2.4Ghz.

3. Disable power management for wifi.

4. Power off wifi during sleep (instead of "Wifi always on during sleep" setting)

5. Try different routers.

6. Disable IPv6

None of this helps.

The question is why does the kernel driver think that the userspace is waking and suspending the wifi chip repeatedly every second? This is seen in the following:

...
[ 9037.210455166/ 0xbf1d4fe906] DBG1:msm_pcie_pm_control: User of RC0 requests to resume the link
[ 9038.280108450/ 0xbf1e894906] DBG1:msm_pcie_pm_control: User of RC0 requests to suspend the link
[ 9038.889849337/ 0xbf1f3beb97] DBG1:msm_pcie_pm_control: User of RC0 requests to resume the link
[ 9039.960290382/ 0xbf207586ab] DBG1:msm_pcie_pm_control: User of RC0 requests to suspend the link
[ 9040.250087623/ 0xbf20ca6d76] DBG1:msm_pcie_pm_control: User of RC0 requests to resume the link
[ 9041.329882470/ 0xbf2206c613] DBG1:msm_pcie_pm_control: User of RC0 requests to suspend the link
[ 9045.729661962/ 0xbf270fc585] DBG1:msm_pcie_pm_control: User of RC0 requests to resume the link
[ 9046.830260351/ 0xbf28523669] DBG1:msm_pcie_pm_control: User of RC0 requests to suspend the link
...