[PATCH ath-next v3] wifi: ath12k: read country code from SMBIOS for WCN7850
Kang Yang
quic_kangyang at quicinc.com
Fri Mar 21 04:14:24 PDT 2025
On 3/21/2025 7:06 PM, Zong-Zhe Yang wrote:
> Kang Yang <quic_kangyang at quicinc.com> wrote:
>>
>> Read the country code from SMBIOS and send it to the firmware. The firmware will then
>> indicate the regulatory domain information for the country code, which ath12k will use.
>>
>> [...]
>>
>> static void ath12k_core_check_bdfext(const struct dmi_header *hdr, void *data)
>> return;
>> }
>>
>> + spin_lock_bh(&ab->base_lock);
>> +
>> + switch (smbios->country_code_flag) {
>> + case ATH12K_SMBIOS_CC_ISO:
>> + ab->new_alpha2[0] = u16_get_bits(smbios->cc_code, 0xff);
>> + ab->new_alpha2[1] = u16_get_bits(smbios->cc_code, 0xff);
>
> It seems that one of the masks is wrong.
>
Oh, yes.
>> + ath12k_dbg(ab, ATH12K_DBG_BOOT, "boot smbios cc_code %c%c\n",
>> + ab->new_alpha2[0], ab->new_alpha2[1]);
>> + break;
>> + case ATH12K_SMBIOS_CC_WW:
>> + ab->new_alpha2[0] = '0';
>> + ab->new_alpha2[1] = '0';
>> + ath12k_dbg(ab, ATH12K_DBG_BOOT, "boot smbios worldwide
>> regdomain\n");
>> + break;
>> + default:
>> + ath12k_dbg(ab, ATH12K_DBG_BOOT, "boot ignore smbios country code
>> setting %d\n",
>> + smbios->country_code_flag);
>> + break;
>> + }
>> +
>> + spin_unlock_bh(&ab->base_lock);
>> +
>> if (!smbios->bdf_enabled) {
>> ath12k_dbg(ab, ATH12K_DBG_BOOT, "bdf variant name not found.\n");
>> return;
>> @@ -690,7 +712,7 @@ static void ath12k_core_check_bdfext(const struct dmi_header *hdr,
>> void *data) int ath12k_core_check_smbios(struct ath12k_base *ab) {
>> ab->qmi.target.bdf_ext[0] = '\0';
>> - dmi_walk(ath12k_core_check_bdfext, ab);
>> + dmi_walk(ath12k_core_check_cc_code_bdfext, ab);
>>
>> if (ab->qmi.target.bdf_ext[0] == '\0')
>> return -ENODATA;
>> diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
>> index 116cf530621f..e2d300bd5972 100644
>> --- a/drivers/net/wireless/ath/ath12k/core.h
>> +++ b/drivers/net/wireless/ath/ath12k/core.h
>> @@ -172,9 +172,34 @@ struct ath12k_ext_irq_grp {
>> struct net_device *napi_ndev;
>> };
>>
>> +enum ath12k_smbios_cc_type {
>> + /* disable country code setting from SMBIOS */
>> + ATH12K_SMBIOS_CC_DISABLE = 0,
>> +
>> + /* set country code by ANSI country name, based on ISO3166-1 alpha2 */
>> + ATH12K_SMBIOS_CC_ISO = 1,
>> +
>> + /* worldwide regdomain */
>> + ATH12K_SMBIOS_CC_WW = 2,
>> +};
>> +
>> struct ath12k_smbios_bdf {
>> struct dmi_header hdr;
>> - u32 padding;
>> + u8 features_disabled;
>> +
>> + /* enum ath12k_smbios_cc_type */
>> + u8 country_code_flag;
>> +
>> + /* To set specific country, you need to set country code
>> + * flag=ATH12K_SMBIOS_CC_ISO first, then if country is United
>> + * States, then country code value = 0x5553 ("US",'U' = 0x55, 'S'=
>> + * 0x53). To set country to INDONESIA, then country code value =
>> + * 0x4944 ("IN", 'I'=0x49, 'D'=0x44). If country code flag =
>> + * ATH12K_SMBIOS_CC_WW, then you can use worldwide regulatory
>> + * setting.
>> + */
>> + u16 cc_code;
>> +
>> u8 bdf_enabled;
>> u8 bdf_ext[];
>> } __packed;
>>
>> [...]
>>
>
More information about the ath12k
mailing list