From 0b8e97ac32920b760d9897cd3f3a0ec24c769173 Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Wed, 11 Aug 2021 13:16:32 +0530 Subject: [PATCH] qcacmn: Add dispatcher APIs for AFC in the regulatory 1) Add an ucfg dispatcher for reg_afc_start. 2) Add an API wlan_reg_get_afc_req_id, to fetch AFC request id. 3) Add an API wlan_reg_is_afc_expiry_event_received, to check if the AFC expiry event is received from the target. Change-Id: I45841706c500e74632b60546d945cde4d634a5d2 CRs-Fixed: 3011675 --- .../regulatory/core/src/reg_services_common.c | 29 +++++++++++++++++++ .../regulatory/core/src/reg_services_common.h | 19 ++++++++++++ .../dispatcher/inc/wlan_reg_services_api.h | 20 +++++++++++++ .../dispatcher/inc/wlan_reg_ucfg_api.h | 10 +++++++ .../dispatcher/src/wlan_reg_services_api.c | 15 ++++++++++ .../dispatcher/src/wlan_reg_ucfg_api.c | 6 ++++ 6 files changed, 99 insertions(+) diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index 7ee79de8ca..dc656dc6b8 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -5869,4 +5869,33 @@ bool reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) return pdev_priv_obj->is_6g_afc_power_event_received; } + +QDF_STATUS reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, uint64_t *req_id) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + pdev_priv_obj = reg_get_pdev_obj(pdev); + + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("reg pdev priv obj is NULL"); + return QDF_STATUS_E_FAILURE; + } + + *req_id = pdev_priv_obj->afc_request_id; + + return QDF_STATUS_SUCCESS; +} + +bool reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + pdev_priv_obj = reg_get_pdev_obj(pdev); + if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { + reg_err("pdev reg component is NULL"); + return false; + } + + return pdev_priv_obj->is_6g_afc_expiry_event_received; +} #endif diff --git a/umac/regulatory/core/src/reg_services_common.h b/umac/regulatory/core/src/reg_services_common.h index 16c1fdc3f7..4b54ec931a 100644 --- a/umac/regulatory/core/src/reg_services_common.h +++ b/umac/regulatory/core/src/reg_services_common.h @@ -1706,5 +1706,24 @@ QDF_STATUS reg_send_afc_cmd(struct wlan_objmgr_pdev *pdev, * Return: true if AFC power event is received from the FW or false otherwise */ bool reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev); + +/** + * reg_get_afc_req_id() - Get the AFC request ID + * @pdev: pdev pointer + * @req_id: Pointer to request id + * + * Return: QDF_STATUS + */ +QDF_STATUS reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, uint64_t *req_id); + +/** + * reg_is_afc_expiry_event_received() - Checks if AFC power event is + * received from the FW. + * + * @pdev: pdev ptr + * + * Return: true if AFC expiry event is received from the FW or false otherwise + */ +bool reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev); #endif #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 063a92de79..1325ce8021 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -600,6 +600,26 @@ QDF_STATUS wlan_reg_psd_2_eirp(struct wlan_objmgr_pdev *pdev, * Return: true if AFC power event is received from the FW or false otherwise */ bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev); + +/** + * wlan_reg_get_afc_req_id() - Get the AFC request ID + * @pdev: pdev pointer + * @req_id: Pointer to request id + * + * Return: QDF_STATUS + */ +QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, + uint64_t *req_id); + +/** + * wlan_reg_is_afc_expiry_event_received() - Checks if AFC power event is + * received from the FW. + * + * @pdev: pdev ptr + * + * Return: true if AFC exipry event is received from the FW or false otherwise + */ +bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev); #else static inline bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index f5a7934fb4..5ec599607c 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -517,5 +517,15 @@ ucfg_reg_set_cur_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev, QDF_STATUS ucfg_reg_send_afc_resp_rx_ind(struct wlan_objmgr_pdev *pdev, struct reg_afc_resp_rx_ind_info *afc_ind_obj); + +/** + * ucfg_reg_afc_start() - Start the AFC request from regulatory. This finally + * sends the request to registered callbacks + * @pdev: Pointer to pdev + * @req_id: The AFC request ID + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_reg_afc_start(struct wlan_objmgr_pdev *pdev, uint64_t req_id); #endif #endif diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index a163cbaf55..edecf5cc13 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -1346,4 +1346,19 @@ bool wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev) } qdf_export_symbol(wlan_reg_is_afc_power_event_received); + +QDF_STATUS wlan_reg_get_afc_req_id(struct wlan_objmgr_pdev *pdev, + uint64_t *req_id) +{ + return reg_get_afc_req_id(pdev, req_id); +} + +qdf_export_symbol(wlan_reg_get_afc_req_id); + +bool wlan_reg_is_afc_expiry_event_received(struct wlan_objmgr_pdev *pdev) +{ + return reg_is_afc_expiry_event_received(pdev); +} + +qdf_export_symbol(wlan_reg_is_afc_expiry_event_received); #endif diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index 4090109eec..8f405239b9 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -393,4 +393,10 @@ ucfg_reg_send_afc_resp_rx_ind(struct wlan_objmgr_pdev *pdev, { return reg_send_afc_cmd(pdev, afc_ind_obj); } + +QDF_STATUS +ucfg_reg_afc_start(struct wlan_objmgr_pdev *pdev, uint64_t req_id) +{ + return reg_afc_start(pdev, req_id); +} #endif