From bebe7c189aae53015ff97d67bbab2d5494372a44 Mon Sep 17 00:00:00 2001 From: Krupali Dhanvijay Date: Thu, 12 Jan 2023 19:45:44 +0530 Subject: [PATCH] qcacld-3.0: Add an attribute to set wfc state via set wifi config Currently there is no attribute to set the wifi calling state from user space to fw. With this change add an attribute to set wifi config vendor command to configure wifi calling state to fw via platform driver. Change-Id: I982e9a7245b9e5108cd6cbcb4162daa4b4b6a412 CRs-Fixed: 3345705 --- core/hdd/src/wlan_hdd_cfg80211.c | 38 +++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index bc93b02a6359..e6e24943ab82 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. 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 @@ -7237,6 +7237,8 @@ const struct nla_policy wlan_hdd_wifi_config_policy[ [QCA_WLAN_VENDOR_ATTR_CONFIG_TX_NSS] = {.type = NLA_U8 }, [QCA_WLAN_VENDOR_ATTR_CONFIG_RX_NSS] = {.type = NLA_U8 }, [QCA_WLAN_VENDOR_ATTR_CONFIG_FT_OVER_DS] = {.type = NLA_U8 }, + [QCA_WLAN_VENDOR_ATTR_CONFIG_WFC_STATE] = { + .type = NLA_U8 }, }; static const struct nla_policy @@ -9017,6 +9019,38 @@ static int hdd_set_nss(struct hdd_adapter *adapter, return ret; } +/** + * hdd_set_wfc_state() - Set wfc state + * @adapter: hdd adapter + * @attr: pointer to nla attr + * + * Return: 0 on success, negative on failure + */ +static int hdd_set_wfc_state(struct hdd_adapter *adapter, + const struct nlattr *attr) +{ + uint8_t cfg_val; + enum pld_wfc_mode set_val; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + int errno; + + errno = wlan_hdd_validate_context(hdd_ctx); + if (errno) + return errno; + + cfg_val = nla_get_u8(attr); + + hdd_debug_rl("set wfc state %d", cfg_val); + if (cfg_val == 0) + set_val = PLD_WFC_MODE_OFF; + else if (cfg_val == 1) + set_val = PLD_WFC_MODE_ON; + else + return -EINVAL; + + return pld_set_wfc_mode(hdd_ctx->parent_dev, set_val); +} + /** * typedef independent_setter_fn - independent attribute handler * @adapter: The adapter being configured @@ -9129,6 +9163,8 @@ static const struct independent_setters independent_setters[] = { hdd_config_udp_qos_upgrade_threshold}, {QCA_WLAN_VENDOR_ATTR_CONFIG_FT_OVER_DS, hdd_set_ft_over_ds}, + {QCA_WLAN_VENDOR_ATTR_CONFIG_WFC_STATE, + hdd_set_wfc_state}, }; #ifdef WLAN_FEATURE_ELNA