blob: b4939a213e84e76a629b888d9678660c327e5288 [file] [log] [blame]
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
* Copyright (c) 2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef ATH11K_REG_H
#define ATH11K_REG_H
#include <linux/kernel.h>
#include <net/regulatory.h>
struct ath11k_base;
struct ath11k;
struct ath11k_afc_info;
#define DEFAULT_MIN_POWER (-10)
#define AFC_AUTH_STATUS_OFFSET 1
#define AFC_AUTH_SUCCESS 1
#define AFC_AUTH_ERROR 0
/* DFS regdomains supported by Firmware */
enum ath11k_dfs_region {
ATH11K_DFS_REG_UNSET,
ATH11K_DFS_REG_FCC,
ATH11K_DFS_REG_ETSI,
ATH11K_DFS_REG_MKK,
ATH11K_DFS_REG_CN,
ATH11K_DFS_REG_KR,
ATH11K_DFS_REG_MKK_N,
ATH11K_DFS_REG_UNDEF,
};
enum ath11k_afc_power_update_status {
ATH11K_AFC_POWER_UPDATE_IGNORE = 0, /*used of rexpiry event*/
ATH11K_AFC_POWER_UPDATE_SUCCESS = 1,
ATH11K_AFC_POWER_UPDATE_FAIL = 3,
};
struct ath11k_afc_req_fixed_params {
u64 req_id;
u16 version_minor;
u16 version_major;
u16 req_length;
u16 status_code;
s16 min_des_power;
} __packed;
/* ATH11K Regulatory API's */
void ath11k_reg_init(struct ath11k *ar);
void ath11k_reg_free(struct ath11k_base *ab);
void ath11k_regd_update_work(struct work_struct *work);
struct ieee80211_regdomain *
ath11k_reg_build_regd(struct ath11k_base *ab,
struct cur_regulatory_info *reg_info,
enum ieee80211_ap_reg_power power_type);
enum wmi_reg_6g_ap_type
ath11k_ieee80211_ap_pwr_type_convert(enum ieee80211_ap_reg_power power_type);
int ath11k_regd_update(struct ath11k *ar, bool init);
int ath11k_reg_update_chan_list(struct ath11k *ar);
int ath11k_copy_afc_response(struct ath11k *ar, char *afc_resp, u32 len);
int ath11k_process_expiry_event(struct ath11k_base *ab, struct ath11k_afc_info *afc);
int ath11k_reg_process_afc_power_event(struct ath11k *ar);
s8 ath11k_reg_get_afc_eirp_power(struct ath11k *ar, enum nl80211_chan_width bw, int cfi);
void ath11k_reg_get_afc_eirp_power_for_bw(struct ath11k *ar, u16 *start_freq,
u16 *center_freq, int pwr_level,
struct cfg80211_chan_def *chan_def,
s8 *tx_power);
void ath11k_reg_update_cc(struct ath11k_base *ab, const char *country_code);
#endif