Browse Source

qcacmn: Add API to get center frequency of sec80 seg

Add helper API to get the center frequency of secondary 80 MHz
segment. Make this API available to Spectral target if layer
via rxops.

CRs-Fixed: 2523690
Change-Id: If1cad90d9b27d1461e802b921aecda07031b1e0b
Edayilliam Jayadev 5 years ago
parent
commit
499d29e713

+ 10 - 0
spectral/dispatcher/inc/wlan_spectral_utils_api.h

@@ -88,11 +88,13 @@ wlan_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev,
 /**
  * struct spectral_legacy_cbacks - Spectral legacy callbacks
  * @vdev_get_chan_freq:          Get channel frequency
+ * @vdev_get_chan_freq_seg2:     Get secondary 80 center frequency
  * @vdev_get_ch_width:           Get channel width
  * @vdev_get_sec20chan_freq_mhz: Get seconadry 20 frequency
  */
 struct spectral_legacy_cbacks {
 	int16_t (*vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev);
+	int16_t (*vdev_get_chan_freq_seg2)(struct wlan_objmgr_vdev *vdev);
 	enum phy_ch_width (*vdev_get_ch_width)(struct wlan_objmgr_vdev *vdev);
 	int (*vdev_get_sec20chan_freq_mhz)(struct wlan_objmgr_vdev *vdev,
 					   uint16_t *sec20chan_freq);
@@ -106,6 +108,14 @@ struct spectral_legacy_cbacks {
  */
 int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev);
 
+/**
+ * spectral_vdev_get_chan_freq_seg2 - Get vdev's secondary 80 center frequency
+ * @vdev: vdev object
+ *
+ * Return: vdev secondary 80 center frequency
+ */
+int16_t spectral_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev);
+
 /**
  * spectral_vdev_get_sec20chan_freq_mhz - Get vdev secondary channel frequency
  * @vdev:   vdev object

+ 18 - 0
spectral/dispatcher/src/wlan_spectral_utils_api.c

@@ -119,6 +119,8 @@ spectral_register_legacy_cb(struct wlan_objmgr_psoc *psoc,
 
 	sc->legacy_cbacks.vdev_get_chan_freq =
 	    legacy_cbacks->vdev_get_chan_freq;
+	sc->legacy_cbacks.vdev_get_chan_freq_seg2 =
+	    legacy_cbacks->vdev_get_chan_freq_seg2;
 	sc->legacy_cbacks.vdev_get_ch_width = legacy_cbacks->vdev_get_ch_width;
 	sc->legacy_cbacks.vdev_get_sec20chan_freq_mhz =
 	    legacy_cbacks->vdev_get_sec20chan_freq_mhz;
@@ -141,6 +143,20 @@ spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
 	return sc->legacy_cbacks.vdev_get_chan_freq(vdev);
 }
 
+int16_t
+spectral_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev)
+{
+	struct spectral_context *sc;
+
+	sc = spectral_get_spectral_ctx_from_vdev(vdev);
+	if (!sc) {
+		spectral_err("spectral context is null");
+		return -EINVAL;
+	}
+
+	return sc->legacy_cbacks.vdev_get_chan_freq_seg2(vdev);
+}
+
 enum phy_ch_width
 spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev)
 {
@@ -179,6 +195,8 @@ wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
 	/* Spectral rx ops */
 	sptrl_rx_ops->sptrlro_get_target_handle = tgt_get_target_handle;
 	sptrl_rx_ops->sptrlro_vdev_get_chan_freq = spectral_vdev_get_chan_freq;
+	sptrl_rx_ops->sptrlro_vdev_get_chan_freq_seg2 =
+					spectral_vdev_get_chan_freq_seg2;
 	sptrl_rx_ops->sptrlro_vdev_get_ch_width = spectral_vdev_get_ch_width;
 	sptrl_rx_ops->sptrlro_vdev_get_sec20chan_freq_mhz =
 	    spectral_vdev_get_sec20chan_freq_mhz;

+ 24 - 0
target_if/spectral/target_if_spectral.h

@@ -1290,6 +1290,30 @@ int16_t target_if_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
 		vdev);
 }
 
+/**
+ * target_if_vdev_get_chan_freq_seg2() - Get center frequency of secondary 80 of
+ * given vdev
+ * @vdev: Pointer to vdev
+ *
+ * Get the center frequency of secondary 80 of given vdev
+ *
+ * Return: center frequency of secondary 80
+ */
+static inline
+int16_t target_if_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_objmgr_psoc *psoc = NULL;
+
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		spectral_err("psoc is NULL");
+		return -EINVAL;
+	}
+
+	return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_chan_freq_seg2(
+		vdev);
+}
+
 /**
  * target_if_vdev_get_ch_width() - Get the operating channel bandwidth of a
  * given vdev

+ 3 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -1202,11 +1202,14 @@ struct wlan_lmac_if_cfr_rx_ops {
  * struct wlan_lmac_if_sptrl_rx_ops - Spectral south bound Rx operations
  *
  * @sptrlro_get_target_handle: Get Spectral handle for target/LMAC private data
+ * @sptrlro_vdev_get_chan_freq_seg2: Get secondary 80 center frequency
  * @sptrlro_spectral_is_feature_disabled: Check if spectral feature is disabled
  */
 struct wlan_lmac_if_sptrl_rx_ops {
 	void * (*sptrlro_get_target_handle)(struct wlan_objmgr_pdev *pdev);
 	int16_t (*sptrlro_vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev);
+	int16_t (*sptrlro_vdev_get_chan_freq_seg2)
+					(struct wlan_objmgr_vdev *vdev);
 	enum phy_ch_width (*sptrlro_vdev_get_ch_width)(
 			struct wlan_objmgr_vdev *vdev);
 	int (*sptrlro_vdev_get_sec20chan_freq_mhz)(