qcacld-3.0: Add pld API to get the audio timestamp

Add pld API to get audio timestamp needed in FTM wlan
timesync feature to synchronise the audio clocks of
master and slave devices

Change-Id: I6f08e33904e26728492286f516ce5a8074afd1ea
CRs-Fixed: 2616917
This commit is contained in:
Surabhi Vishnoi 2020-02-05 15:53:41 +05:30 • committed by nshrivas
commit 8333061e83
3 changed files with 93 additions and 1 deletions

View file

@ -334,6 +334,18 @@ enum pld_recovery_reason {
PLD_REASON_LINK_DOWN
};
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
/**
* enum pld_wlan_time_sync_trigger_type - WLAN time sync trigger type
* @PLD_TRIGGER_POSITIVE_EDGE: Positive edge trigger
* @PLD_TRIGGER_NEGATIVE_EDGE: Negative edge trigger
*/
enum pld_wlan_time_sync_trigger_type {
PLD_TRIGGER_POSITIVE_EDGE,
PLD_TRIGGER_NEGATIVE_EDGE
};
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
/**
* struct pld_driver_ops - driver callback functions
* @probe: required operation, will be called when device is detected
@ -419,6 +431,13 @@ void pld_is_pci_link_down(struct device *dev);
int pld_shadow_control(struct device *dev, bool enable);
void pld_schedule_recovery_work(struct device *dev,
enum pld_recovery_reason reason);
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
int pld_get_audio_wlan_timestamp(struct device *dev,
enum pld_wlan_time_sync_trigger_type type,
uint64_t *ts);
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
#ifdef CONFIG_CNSS_UTILS
/**
* pld_set_wlan_unsafe_channel() - Set unsafe channel

View file

@ -2641,3 +2641,42 @@ int pld_idle_restart(struct device *dev,
return errno;
}
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
/**
* pld_get_audio_wlan_timestamp() - Get audio timestamp
* @dev: device pointer
* @type: trigger type
* @ts: audio timestamp
*
* This API can be used to get audio timestamp.
*
* Return: 0 if trigger to get audio timestamp is successful
* Non zero failure code for errors
*/
int pld_get_audio_wlan_timestamp(struct device *dev,
enum pld_wlan_time_sync_trigger_type type,
uint64_t *ts)
{
int ret = 0;
enum pld_bus_type bus_type;
bus_type = pld_get_bus_type(dev);
switch (bus_type) {
case PLD_BUS_TYPE_SNOC:
ret = pld_snoc_get_audio_wlan_timestamp(dev, type, ts);
break;
case PLD_BUS_TYPE_PCIE:
case PLD_BUS_TYPE_SNOC_FW_SIM:
case PLD_BUS_TYPE_PCIE_FW_SIM:
case PLD_BUS_TYPE_SDIO:
case PLD_BUS_TYPE_USB:
case PLD_BUS_TYPE_IPCI:
break;
default:
ret = -EINVAL;
break;
}
return ret;
}
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-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
@ -150,6 +150,17 @@ static inline int pld_snoc_is_fw_rejuvenate(void)
static inline void pld_snoc_block_shutdown(bool status)
{
}
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
static inline int
pld_snoc_get_audio_wlan_timestamp(struct device *dev,
enum pld_wlan_time_sync_trigger_type type,
uint64_t *ts)
{
return 0;
}
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
#else
int pld_snoc_register_driver(void);
void pld_snoc_unregister_driver(void);
@ -159,6 +170,29 @@ int pld_snoc_wlan_enable(struct device *dev,
int pld_snoc_wlan_disable(struct device *dev, enum pld_driver_mode mode);
int pld_snoc_get_soc_info(struct device *dev, struct pld_soc_info *info);
#ifdef FEATURE_WLAN_TIME_SYNC_FTM
/**
* pld_snoc_get_audio_wlan_timestamp() - Get audio timestamp
* @dev: device
* @type: trigger type
* @ts: timestamp
*
* Return audio timestamp to the ts.
*
* Return: 0 for success
* Non zero failure code for errors
*/
static inline int
pld_snoc_get_audio_wlan_timestamp(struct device *dev,
enum pld_wlan_time_sync_trigger_type type,
uint64_t *ts)
{
if (!dev)
return -ENODEV;
return 0;
}
#endif /* FEATURE_WLAN_TIME_SYNC_FTM */
static inline int pld_snoc_ce_request_irq(struct device *dev,
unsigned int ce_id,
irqreturn_t (*handler)(int, void *),