qcacmn: INI support to poison spectral buffers

Add INI support to enable the poisoning of spectral buffers during init

Change-Id: I599f7d85a4756a216d24144e1e8bf2a113a26abb
CRs-Fixed: 2554855
diff --git a/spectral/dispatcher/inc/cfg_spectral.h b/spectral/dispatcher/inc/cfg_spectral.h
index b997cd9..175d743 100644
--- a/spectral/dispatcher/inc/cfg_spectral.h
+++ b/spectral/dispatcher/inc/cfg_spectral.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 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
@@ -43,7 +43,29 @@
 	CFG_INI_BOOL("spectral_disable", false, \
 			"Spectral disable")
 
+/*
+ * <ini>
+ * poison_spectral_bufs - enable poisoning of spectral buffers
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini is used to enable the poisoning of spectral buffers.
+ *
+ * Related: None
+ *
+ * Supported Feature: Spectral
+ *
+ * Usage: Internal
+ *
+ * </ini>
+ */
+#define CFG_SPECTRAL_POISON_BUFS \
+	CFG_INI_BOOL("poison_spectral_bufs", false, \
+			"Enable spectral bufs poison at init")
+
 #define CFG_SPECTRAL_ALL \
-	CFG(CFG_SPECTRAL_DISABLE)
+	CFG(CFG_SPECTRAL_DISABLE) \
+	CFG(CFG_SPECTRAL_POISON_BUFS)
 
 #endif
diff --git a/spectral/dispatcher/src/wlan_spectral_utils_api.c b/spectral/dispatcher/src/wlan_spectral_utils_api.c
index 719ce48..5c96f5a 100644
--- a/spectral/dispatcher/src/wlan_spectral_utils_api.c
+++ b/spectral/dispatcher/src/wlan_spectral_utils_api.c
@@ -249,13 +249,19 @@
 
 QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev)
 {
+	struct wlan_objmgr_psoc *psoc;
 	QDF_STATUS status;
 
-	if (wlan_spectral_is_feature_disabled(wlan_pdev_get_psoc(pdev))) {
+	psoc = wlan_pdev_get_psoc(pdev);
+
+	if (wlan_spectral_is_feature_disabled(psoc)) {
 		spectral_info("Spectral is disabled");
 		return QDF_STATUS_COMP_DISABLED;
 	}
 
+	if (cfg_get(psoc, CFG_SPECTRAL_POISON_BUFS))
+		tgt_set_spectral_dma_debug(pdev, SPECTRAL_DMA_BUFFER_DEBUG, 1);
+
 	status = tgt_spectral_register_to_dbr(pdev);
 	return QDF_STATUS_SUCCESS;
 }