btfmcodec: Enable Dynamic logging

This change will enable dynamic logging based on below
flags
Below bit has to be set to enable respective logging.
 * Bit 0: Error message.
 * Bit 1: Warning message.
 * Bit 2: Debug message.
 * Bit 3: Info message.
 * 0x08 is similar to 0x0F.
 * 0x04 is similar to 0x07.
 * 0x02 is similar to 0x03.
 * 0x03 is default log level for BTFM Codec.

Change-Id: Ia986a49f73d6144f2631936b8d02985d3ccf98d0
Signed-off-by: Balakrishna Godavarthi <quic_bgodavar@quicinc.com>
This commit is contained in:
Balakrishna Godavarthi
2023-06-20 20:46:07 +05:30
committed by Gerrit - the friendly Code Review server
parent c49fc215ed
commit 8998587891
3 changed files with 37 additions and 10 deletions

View File

@@ -13,10 +13,24 @@
#include <linux/skbuff.h>
#include "btfm_codec_hw_interface.h"
#define BTFMCODEC_DBG(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg)
#define BTFMCODEC_INFO(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg)
#define BTM_BTFMCODEC_DEFAULT_LOG_LVL 0x03
#define BTM_BTFMCODEC_DEBUG_LOG_LVL 0x04
#define BTM_BTFMCODEC_INFO_LOG_LVL 0x08
static uint8_t log_lvl = BTM_BTFMCODEC_DEFAULT_LOG_LVL;
#define BTFMCODEC_ERR(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg)
#define BTFMCODEC_WARN(fmt, arg...) pr_warn("%s: " fmt "\n", __func__, ## arg)
#define BTFMCODEC_DBG(fmt, arg...) { if(log_lvl >= BTM_BTFMCODEC_DEBUG_LOG_LVL) \
pr_err("%s: " fmt "\n", __func__, ## arg); \
else \
pr_debug("%s: " fmt "\n", __func__, ## arg); \
}
#define BTFMCODEC_INFO(fmt, arg...) { if(log_lvl >= BTM_BTFMCODEC_INFO_LOG_LVL) \
pr_err("%s: " fmt "\n", __func__, ## arg);\
else \
pr_info("%s: " fmt "\n", __func__, ## arg);\
}
#define DEVICE_NAME_MAX_LEN 64