qcacld-3.0: Update time sync period based on tsf sync start/stop

Add pld_pcie_set_tsf_sync_period and pld_reset_tsf_sync_period to
update time sync period vote from wlan driver based on use-case
e.g. tsf sync start / stop. Extend gtsf_ptp_options ini config
to control this functionality.

Change-Id: Ie4a6c80beccd6d315c9f3b31263de7f3b8e0ac2a
CRs-Fixed: 3501976
This commit is contained in:
Shailendra Singh
2023-05-17 20:07:49 +05:30
committed by Rahul Choudhary
parent 1a65fafdf4
commit 47f9e0f6c0
6 changed files with 120 additions and 1 deletions

View File

@@ -591,6 +591,7 @@
* CFG_SET_TSF_PTP_OPT_RAW (0x4) * CFG_SET_TSF_PTP_OPT_RAW (0x4)
* CFG_SET_TSF_DBG_FS (0x8) * CFG_SET_TSF_DBG_FS (0x8)
* CFG_SET_TSF_PTP_OPT_TSF64_TX (0x10) * CFG_SET_TSF_PTP_OPT_TSF64_TX (0x10)
* CFG_SET_TSF_PTP_SYNC_PERIOD (0x20)
* *
* Related: None * Related: None
* *
@@ -603,12 +604,13 @@
#define CFG_SET_TSF_PTP_OPT_RAW (0x4) #define CFG_SET_TSF_PTP_OPT_RAW (0x4)
#define CFG_SET_TSF_DBG_FS (0x8) #define CFG_SET_TSF_DBG_FS (0x8)
#define CFG_SET_TSF_PTP_OPT_TSF64_TX (0x10) #define CFG_SET_TSF_PTP_OPT_TSF64_TX (0x10)
#define CFG_SET_TSF_PTP_SYNC_PERIOD (0x20)
#define CFG_SET_TSF_PTP_OPT CFG_INI_UINT( \ #define CFG_SET_TSF_PTP_OPT CFG_INI_UINT( \
"gtsf_ptp_options", \ "gtsf_ptp_options", \
0, \ 0, \
0xff, \ 0xff, \
0xf, \ 0x2f, \
CFG_VALUE_OR_DEFAULT, \ CFG_VALUE_OR_DEFAULT, \
"TSF Plus feature options") "TSF Plus feature options")

View File

@@ -393,6 +393,16 @@ void hdd_capture_req_timer_expired_handler(void *arg);
*/ */
bool hdd_tsf_is_tsf64_tx_set(struct hdd_context *hdd); bool hdd_tsf_is_tsf64_tx_set(struct hdd_context *hdd);
/**
* hdd_tsf_is_time_sync_enabled_cfg() - check ini configuration
* @hdd_ctx: pointer to hdd context
*
* This function checks tsf configuration for ptp for tsf
* sync period
* Return: true on enable, false on disable
*/
bool hdd_tsf_is_time_sync_enabled_cfg(struct hdd_context *hdd_ctx);
/** /**
* hdd_update_dynamic_tsf_sync - Configure TSF mode for vdev * hdd_update_dynamic_tsf_sync - Configure TSF mode for vdev
* @adapter: pointer to hdd adapter * @adapter: pointer to hdd adapter
@@ -449,6 +459,12 @@ bool hdd_tsf_is_tsf64_tx_set(struct hdd_context *hdd)
return FALSE; return FALSE;
} }
static inline
bool hdd_tsf_is_time_sync_enabled_cfg(struct hdd_context *hdd_ctx)
{
return false;
}
static inline static inline
void hdd_update_dynamic_tsf_sync(struct hdd_adapter *adapter) void hdd_update_dynamic_tsf_sync(struct hdd_adapter *adapter)
{ {

View File

@@ -318,6 +318,17 @@ bool hdd_tsf_is_tsf64_tx_set(struct hdd_context *hdd)
return false; return false;
} }
bool hdd_tsf_is_time_sync_enabled_cfg(struct hdd_context *hdd_ctx)
{
uint32_t tsf_ptp_options;
if (hdd_ctx && QDF_IS_STATUS_SUCCESS(
ucfg_fwol_get_tsf_ptp_options(hdd_ctx->psoc, &tsf_ptp_options)))
return tsf_ptp_options & CFG_SET_TSF_PTP_SYNC_PERIOD;
else
return false;
}
static bool hdd_is_tsf_sync_enabled(struct hdd_context *hdd) static bool hdd_is_tsf_sync_enabled(struct hdd_context *hdd)
{ {
bool is_tsf_sync_enable; bool is_tsf_sync_enable;
@@ -2259,6 +2270,9 @@ static int hdd_handle_tsf_dynamic_start(struct hdd_adapter *adapter,
tsf->dynamic_tsf_sync_interval = dynamic_tsf_sync_interval; tsf->dynamic_tsf_sync_interval = dynamic_tsf_sync_interval;
tsf->enable_dynamic_tsf_sync = true; tsf->enable_dynamic_tsf_sync = true;
if (hdd_tsf_is_time_sync_enabled_cfg(hdd_ctx))
pld_set_tsf_sync_period(hdd_ctx->parent_dev,
dynamic_tsf_sync_interval);
return hdd_start_tsf_sync(adapter); return hdd_start_tsf_sync(adapter);
} }
@@ -2287,6 +2301,9 @@ static int hdd_handle_tsf_dynamic_stop(struct hdd_adapter *adapter)
adapter->tsf.enable_dynamic_tsf_sync = false; adapter->tsf.enable_dynamic_tsf_sync = false;
adapter->tsf.dynamic_tsf_sync_interval = 0; adapter->tsf.dynamic_tsf_sync_interval = 0;
if (hdd_tsf_is_time_sync_enabled_cfg(hdd_ctx))
pld_reset_tsf_sync_period(hdd_ctx->parent_dev);
return hdd_stop_tsf_sync(adapter); return hdd_stop_tsf_sync(adapter);
} }

View File

@@ -1838,6 +1838,23 @@ const char *pld_bus_width_type_to_str(enum pld_bus_width_type level);
int pld_get_thermal_state(struct device *dev, unsigned long *thermal_state, int pld_get_thermal_state(struct device *dev, unsigned long *thermal_state,
int mon_id); int mon_id);
/**
* pld_set_tsf_sync_period() - Set TSF sync period
* @dev: device
* @val: TSF sync time value
*
* Return: void
*/
void pld_set_tsf_sync_period(struct device *dev, u32 val);
/**
* pld_reset_tsf_sync_period() - Reset TSF sync period
* @dev: device
*
* Return: void
*/
void pld_reset_tsf_sync_period(struct device *dev);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
/** /**
* pld_is_ipa_offload_disabled() - Check if IPA offload is enabled or not * pld_is_ipa_offload_disabled() - Check if IPA offload is enabled or not

View File

@@ -2671,6 +2671,46 @@ int pld_get_wlan_unsafe_channel_sap(
} }
#endif #endif
void pld_set_tsf_sync_period(struct device *dev, u32 val)
{
switch (pld_get_bus_type(dev)) {
case PLD_BUS_TYPE_PCIE:
pld_pcie_set_tsf_sync_period(dev, val);
break;
case PLD_BUS_TYPE_PCIE_FW_SIM:
case PLD_BUS_TYPE_IPCI_FW_SIM:
case PLD_BUS_TYPE_SNOC_FW_SIM:
case PLD_BUS_TYPE_SNOC:
case PLD_BUS_TYPE_IPCI:
case PLD_BUS_TYPE_SDIO:
case PLD_BUS_TYPE_USB:
break;
default:
pr_err("Invalid device type\n");
break;
}
}
void pld_reset_tsf_sync_period(struct device *dev)
{
switch (pld_get_bus_type(dev)) {
case PLD_BUS_TYPE_PCIE:
pld_pcie_reset_tsf_sync_period(dev);
break;
case PLD_BUS_TYPE_PCIE_FW_SIM:
case PLD_BUS_TYPE_IPCI_FW_SIM:
case PLD_BUS_TYPE_SNOC_FW_SIM:
case PLD_BUS_TYPE_SNOC:
case PLD_BUS_TYPE_IPCI:
case PLD_BUS_TYPE_SDIO:
case PLD_BUS_TYPE_USB:
break;
default:
pr_err("Invalid device type\n");
break;
}
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
int pld_is_ipa_offload_disabled(struct device *dev) int pld_is_ipa_offload_disabled(struct device *dev)
{ {

View File

@@ -326,6 +326,14 @@ static inline void pld_pcie_remove_pm_qos(struct device *dev)
{ {
} }
static inline void pld_pcie_set_tsf_sync_period(struct device *dev, u32 val)
{
}
static inline void pld_pcie_reset_tsf_sync_period(struct device *dev)
{
}
static inline int pld_pcie_request_bus_bandwidth(struct device *dev, static inline int pld_pcie_request_bus_bandwidth(struct device *dev,
int bandwidth) int bandwidth)
{ {
@@ -743,6 +751,25 @@ static inline void pld_pcie_remove_pm_qos(struct device *dev)
cnss_remove_pm_qos(dev); cnss_remove_pm_qos(dev);
} }
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
static inline void pld_pcie_set_tsf_sync_period(struct device *dev, u32 val)
{
cnss_update_time_sync_period(dev, val);
}
static inline void pld_pcie_reset_tsf_sync_period(struct device *dev)
{
cnss_reset_time_sync_period(dev);
}
#else
static inline void pld_pcie_set_tsf_sync_period(struct device *dev, u32 val)
{
}
static inline void pld_pcie_reset_tsf_sync_period(struct device *dev)
{
}
#endif
static inline int pld_pcie_request_bus_bandwidth(struct device *dev, static inline int pld_pcie_request_bus_bandwidth(struct device *dev,
int bandwidth) int bandwidth)
{ {