qcacld-3.0: Add PLD API to send WFC mode to FW

Add PLD API to send WFC(WiFi Calling) mode to WLAN FW.

Change-Id: I4aef58caa93d255233d2412aa6d03017da4b5f10
CRs-Fixed: 3346545
This commit is contained in:
Krupali Dhanvijay 2023-01-12 19:31:23 +05:30 • committed by Madan Koyyalamudi
commit 6054d6c4da
4 changed files with 91 additions and 2 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016-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
@ -133,6 +133,16 @@ enum pld_platform_cap_flag {
PLD_HAS_DRV_SUPPORT = 0x04,
};
/**
* enum pld_wfc_mode - WFC Mode
* @PLD_WFC_MODE_OFF: WFC Inactive
* @PLD_WFC_MODE_ON: WFC Active
*/
enum pld_wfc_mode {
PLD_WFC_MODE_OFF,
PLD_WFC_MODE_ON,
};
/**
* struct pld_platform_cap - platform capabilities
* @cap_flag: capabilities flag
@ -946,6 +956,15 @@ int pld_thermal_register(struct device *dev, unsigned long state, int mon_id);
*/
void pld_thermal_unregister(struct device *dev, int mon_id);
/**
* pld_set_wfc_mode() - Sent WFC mode to FW via platform driver
* @dev: The device structure
* @wfc_mode: WFC Modes (0 => Inactive, 1 => Active)
*
* Return: Error code on error
*/
int pld_set_wfc_mode(struct device *dev, enum pld_wfc_mode wfc_mode);
/**
* pld_bus_width_type_to_str() - Helper function to convert PLD bandwidth level
* to string

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016-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
@ -3154,6 +3154,32 @@ void pld_thermal_unregister(struct device *dev, int mon_id)
}
}
int pld_set_wfc_mode(struct device *dev, enum pld_wfc_mode wfc_mode)
{
int errno = -ENOTSUPP;
enum pld_bus_type type;
type = pld_get_bus_type(dev);
switch (type) {
case PLD_BUS_TYPE_SDIO:
case PLD_BUS_TYPE_USB:
case PLD_BUS_TYPE_SNOC:
case PLD_BUS_TYPE_IPCI_FW_SIM:
case PLD_BUS_TYPE_SNOC_FW_SIM:
case PLD_BUS_TYPE_IPCI:
case PLD_BUS_TYPE_PCIE_FW_SIM:
break;
case PLD_BUS_TYPE_PCIE:
errno = pld_pcie_set_wfc_mode(dev, wfc_mode);
break;
default:
pr_err("Invalid device type %d\n", type);
break;
}
return errno;
}
const char *pld_bus_width_type_to_str(enum pld_bus_width_type level)
{
switch (level) {

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 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
@ -940,5 +941,30 @@ void pld_pcie_device_self_recovery(struct device *dev,
}
cnss_self_recovery(dev, cnss_reason);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
int pld_pcie_set_wfc_mode(struct device *dev,
enum pld_wfc_mode wfc_mode)
{
struct cnss_wfc_cfg cfg;
int ret;
switch (wfc_mode) {
case PLD_WFC_MODE_OFF:
cfg.mode = CNSS_WFC_MODE_OFF;
break;
case PLD_WFC_MODE_ON:
cfg.mode = CNSS_WFC_MODE_ON;
break;
default:
ret = -EINVAL;
goto out;
}
ret = cnss_set_wfc_mode(dev, cfg);
out:
return ret;
}
#endif
#endif
#endif

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 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
@ -404,7 +405,24 @@ static inline bool pld_pcie_platform_driver_support(void)
{
return false;
}
static inline int pld_pcie_set_wfc_mode(struct device *dev,
enum pld_wfc_mode wfc_mode)
{
return 0;
}
#else
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
int pld_pcie_set_wfc_mode(struct device *dev,
enum pld_wfc_mode wfc_mode);
#else
static inline int pld_pcie_set_wfc_mode(struct device *dev,
enum pld_wfc_mode wfc_mode)
{
return 0;
}
#endif
int pld_pcie_get_fw_files_for_target(struct device *dev,
struct pld_fw_files *pfw_files,
u32 target_type, u32 target_version);