AsahiLinux / linux

Linux kernel source tree
Other
2.26k stars 90 forks source link

[brcmfmac] Fix regulatory domain handling to reset bands properly #220

Closed dberlin closed 11 months ago

dberlin commented 11 months ago

Currently, we ignore the default country in the reg notifier. We also register a custom regulatory domain, which is set as the default. As a result, the chip is likely to be set to the correct country, but the regulatory domain will not match it.

When the regulatory notifier is then called, we see the countries are the same and do not change anything, even though the domain is wrong.

This patch forces us to reset the bands on the first country change even if the chip is already set to that country.

We also restore the original band info before reconstructing channel info, as the new regdom power limits may be higher than what is currently set.

Without this patch, we are stuck in the custom regulatory domain the driver defines, which are very low (20dbm vs 30dbm).

dberlin commented 11 months ago

Here's a before/after for channels https://gist.github.com/dberlin/ee03679b6a6e93395219de2034f1c4db

marcan commented 11 months ago

Manually cherry-picked, thanks!