linux-surface / kernel

Linux kernel with modifications for Microsoft Surface devices.
Other
124 stars 34 forks source link

mwifiex: Add quirk resetting the PCI bridge on MS Surface devices #72

Closed jonas2515 closed 3 years ago

jonas2515 commented 3 years ago

The most recent firmware of the 88W8897 card reports a hardcoded LTR value to the system during initialization, probably as an (unsuccessful) attempt of the developers to fix firmware crashes. This LTR value prevents most of the Microsoft Surface devices from entering deep powersaving states (either platform C-State 10 or S0ix state), because the exit latency of that state would be higher than what the card can tolerate.

Turns out the card works just the same (including the firmware crashes) no matter if that hardcoded LTR value is reported or not, so it's kind of useless and only prevents us from saving power.

To get rid of those hardcoded LTR reports, it's possible to reset the PCI bridge device after initializing the cards firmware. I'm not exactly sure why that works, maybe the power management subsystem of the PCH resets its stored LTR values when doing a function level reset of the bridge device. Doing the reset once after starting the wifi firmware works very well, probably because the firmware only reports that LTR value a single time during firmware startup.

kitakar5525 commented 3 years ago

Thanks to your work on fixing fw crashes, hopefully this bridge reset won't cause fw crashes anymore on all the devices.

So, what about applying this quirk to all the Surface devices? (No effect on Surface 3 and I guess SP3 is the same as well, though. So, you can skip applying for S3 and SP3 for now I think.)

Also, if you intend to revert suspend method back to Host Sleep, this quirk is required for S0ix on suspend.

jonas2515 commented 3 years ago

So, what about applying this quirk to all the Surface devices? (No effect on Surface 3 and I guess SP3 is the same as well, though. So, you can skip applying for S3 and SP3 for now I think.)

Also, if you intend to revert suspend method back to Host Sleep, this quirk is required for S0ix on suspend.

Sounds good, indeed I didn't think of the consequences for other devices when re-enabling Host Sleep on all devices.

jonas2515 commented 3 years ago

This targets branch v5.11-surface-devel now.

I've also updated this to add the quirk to all Surface devices except Surface 3 and Pro 3, as suggested by @kitakar5525.