From 2250592dcd28188cb40facddaf9719e94597c27e Mon Sep 17 00:00:00 2001 From: Vinay Gannevaram Date: Fri, 7 Feb 2020 20:30:45 +0530 Subject: [PATCH] qcacmn: Add support to get fwr phymode for frequency Currently, wifi-pos uses channel number to get the fwr phymode. For adding 6g support wifi-pos need to get the phymode from frequency instead of channel number As a part of fix, Add handler for getting phymode based on frequency CRs-Fixed: 2617903 Change-Id: I007edebe41bf5ca750a1262c85043f628dc9f89f --- umac/wifi_pos/inc/wifi_pos_api.h | 13 +++++++++++++ umac/wifi_pos/src/wifi_pos_api.c | 28 +++++++++++++++++++++++++++- umac/wifi_pos/src/wifi_pos_utils_i.h | 8 ++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/umac/wifi_pos/inc/wifi_pos_api.h b/umac/wifi_pos/inc/wifi_pos_api.h index 1c0bc25c3f0e..05d75f63dbe4 100644 --- a/umac/wifi_pos/inc/wifi_pos_api.h +++ b/umac/wifi_pos/inc/wifi_pos_api.h @@ -409,6 +409,19 @@ static inline QDF_STATUS wifi_pos_init_cir_cfr_rings( } #endif +/** + * wifi_pos_register_get_fw_phy_mode_for_freq_cb: API to register callback + * to get current PHY mode + * @psoc: pointer to psoc object + * @handler: callback to be registered + * + * Return: QDF_STATUS_SUCCESS in case of success, error codes in + * case of failure + */ +QDF_STATUS wifi_pos_register_get_fw_phy_mode_for_freq_cb( + struct wlan_objmgr_psoc *psoc, + void (*handler)(uint32_t, uint32_t, uint32_t *)); + /** * wifi_pos_register_get_phy_mode_cb: API to register callback to get * current PHY mode diff --git a/umac/wifi_pos/src/wifi_pos_api.c b/umac/wifi_pos/src/wifi_pos_api.c index cbcf95cedd84..60e714cfa6a4 100644 --- a/umac/wifi_pos/src/wifi_pos_api.c +++ b/umac/wifi_pos/src/wifi_pos_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -350,6 +350,32 @@ QDF_STATUS wifi_pos_register_get_phy_mode_cb( return QDF_STATUS_SUCCESS; } +QDF_STATUS wifi_pos_register_get_fw_phy_mode_for_freq_cb( + struct wlan_objmgr_psoc *psoc, + void (*handler)(uint32_t, uint32_t, uint32_t *)) +{ + struct wifi_pos_psoc_priv_obj *wifi_pos_psoc; + + if (!psoc) { + wifi_pos_err("psoc is null"); + return QDF_STATUS_E_NULL_VALUE; + } + + if (!handler) { + wifi_pos_err("Null callback"); + return QDF_STATUS_E_NULL_VALUE; + } + wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(psoc); + if (!wifi_pos_psoc) { + wifi_pos_err("wifi_pos priv obj is null"); + return QDF_STATUS_E_NULL_VALUE; + } + + wifi_pos_psoc->wifi_pos_get_fw_phy_mode_for_freq = handler; + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS wifi_pos_register_send_action( struct wlan_objmgr_psoc *psoc, void (*handler)(struct wlan_objmgr_psoc *psoc, diff --git a/umac/wifi_pos/src/wifi_pos_utils_i.h b/umac/wifi_pos/src/wifi_pos_utils_i.h index cff0352532b2..a09d9012a1ae 100644 --- a/umac/wifi_pos/src/wifi_pos_utils_i.h +++ b/umac/wifi_pos/src/wifi_pos_utils_i.h @@ -304,6 +304,12 @@ struct wifi_pos_dma_rings_cfg { * @oem_6g_support_disable: oem target 6ghz support is disabled if set * @wifi_pos_req_handler: function pointer to handle TLV or non-TLV * @wifi_pos_send_rsp: function pointer to send msg to userspace APP + * @wifi_pos_get_phy_mode: function pointer to get wlan phymode for given + * channel, channel width + * @wifi_pos_get_fw_phy_mode_for_freq: function pointer to get fw phymode + * for given freq and channel width + * @wifi_pos_send_action: function pointer to send registered action frames + * to userspace APP * * wifi pos request messages * <----- fine_time_meas_cap (in bits) -----> @@ -344,6 +350,8 @@ struct wifi_pos_psoc_priv_obj { struct wifi_pos_req_msg *req); void (*wifi_pos_send_rsp)(uint32_t, uint32_t, uint32_t, uint8_t *); void (*wifi_pos_get_phy_mode)(uint8_t, uint32_t, uint32_t *); + void (*wifi_pos_get_fw_phy_mode_for_freq)(uint32_t, uint32_t, + uint32_t *); void (*wifi_pos_send_action)(struct wlan_objmgr_psoc *psoc, uint32_t oem_subtype, uint8_t *buf, uint32_t len);