From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Guneshwor Singh Date: Wed, 5 Jul 2017 14:30:41 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Add dsp log level selection kcontrol Add platform kcontrol for DSP log level. User can select between QUIET, CRITICAL, HIGH, MEDIUM, LOW, VERBOSE levels before starting the compressed stream for log capture. Change-Id: I2cc1965fe58ed60defaa50fa494a0d9a39e4d477 Signed-off-by: Guneshwor Singh Reviewed-on: Reviewed-by: audio_build Reviewed-by: Kale, Sanyog R Tested-by: Avati, Santosh Kumar Reviewed-by: Diwakar, Praveen Signed-off-by: Guneshwor Singh --- sound/soc/intel/common/sst-dsp-priv.h | 2 ++ sound/soc/intel/skylake/skl-fwlog.c | 23 +++++++++++++++++++++++ sound/soc/intel/skylake/skl-fwlog.h | 2 ++ sound/soc/intel/skylake/skl-messages.c | 7 +------ sound/soc/intel/skylake/skl-pcm.c | 13 +++++++++++++ sound/soc/intel/skylake/skl-topology.c | 24 ++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 4 ++++ 7 files changed, 69 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h index e7151a7e6bae..8e80c6f177f8 100644 --- a/sound/soc/intel/common/sst-dsp-priv.h +++ b/sound/soc/intel/common/sst-dsp-priv.h @@ -128,6 +128,8 @@ struct sst_trace_window { u32 nr_dsp; /* indicates which DSPs have logging enabled */ u32 flags; + /* dsp fw log level*/ + u32 log_priority; }; /* diff --git a/sound/soc/intel/skylake/skl-fwlog.c b/sound/soc/intel/skylake/skl-fwlog.c index 1aacf8625658..f7506135e311 100644 --- a/sound/soc/intel/skylake/skl-fwlog.c +++ b/sound/soc/intel/skylake/skl-fwlog.c @@ -25,6 +25,8 @@ #include "skl.h" #include "skl-fwlog.h" +#define DEF_LOG_PRIORITY 3 + /* * Initialize trace window and firmware write pointers for the platform */ @@ -51,6 +53,7 @@ int skl_dsp_init_trace_window(struct sst_dsp *sst, u32 *wp, u32 offset, sst->trace_wind.flags = 0; sst->trace_wind.dbg_buffers = buff; sst->trace_wind.dsp_wps = (void __iomem**)dsp_wps; + sst->trace_wind.log_priority = DEF_LOG_PRIORITY; for (idx = 0; idx < cores; idx++) sst->trace_wind.dsp_wps[idx] = (void __iomem*)(sst->addr.lpe + wp[idx]); @@ -87,6 +90,26 @@ int skl_dsp_init_log_buffer(struct sst_dsp *sst, int size, int core, } EXPORT_SYMBOL_GPL(skl_dsp_init_log_buffer); +int update_dsp_log_priority(int value, struct skl *skl) +{ + int ret = 0; + struct skl_sst *ctx = skl->skl_sst; + + ctx->dsp->trace_wind.log_priority = value; + return ret; +} +EXPORT_SYMBOL_GPL(update_dsp_log_priority); + +int get_dsp_log_priority(struct skl *skl) +{ + u32 value; + struct skl_sst *ctx = skl->skl_sst; + + value = ctx->dsp->trace_wind.log_priority; + return value; +} +EXPORT_SYMBOL_GPL(get_dsp_log_priority); + unsigned long skl_dsp_log_avail(struct sst_dsp *sst, int core) { struct sst_dbg_rbuffer *buff = sst->trace_wind.dbg_buffers[core]; diff --git a/sound/soc/intel/skylake/skl-fwlog.h b/sound/soc/intel/skylake/skl-fwlog.h index d6307cafd156..df9146686ea2 100644 --- a/sound/soc/intel/skylake/skl-fwlog.h +++ b/sound/soc/intel/skylake/skl-fwlog.h @@ -18,4 +18,6 @@ void skl_dsp_get_log_buff(struct sst_dsp *sst, int core); void skl_dsp_put_log_buff(struct sst_dsp *sst, int core); void skl_dsp_done_log_buffer(struct sst_dsp *sst, int core); int skl_dsp_get_buff_users(struct sst_dsp *sst, int core); +int update_dsp_log_priority(int value, struct skl *skl); +int get_dsp_log_priority(struct skl *skl); #endif /* __SKL_FWLOG_H__ */ diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index 3336a23d9898..4f88595815a8 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c @@ -67,11 +67,6 @@ void skl_dsp_set_astate_cfg(struct skl_sst *ctx, u32 cnt, void *data) } #define ENABLE_LOGS 6 -#if defined(CONFIG_SND_SOC_INTEL_CNL_FPGA) -#define DEFAULT_LOG_PRIORITY 6 -#else -#define DEFAULT_LOG_PRIORITY 5 -#endif /* set firmware logging state via IPC */ int skl_dsp_enable_logging(struct sst_generic_ipc *ipc, int core, int enable) @@ -82,7 +77,7 @@ int skl_dsp_enable_logging(struct sst_generic_ipc *ipc, int core, int enable) log_msg.core_mask = (1 << core); log_msg.logs_core[core].enable = enable; - log_msg.logs_core[core].priority = DEFAULT_LOG_PRIORITY; + log_msg.logs_core[core].priority = ipc->dsp->trace_wind.log_priority; msg.large_param_id = ENABLE_LOGS; msg.param_data_size = sizeof(log_msg); diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index b02b9897b7cf..764e4dd7ed2d 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -1762,6 +1762,17 @@ static int skl_platform_soc_probe(struct snd_soc_component *component) return 0; } +static const char* const dsp_log_text[] = + {"QUIET", "CRITICAL", "HIGH", "MEDIUM", "LOW", "VERBOSE"}; + +static const struct soc_enum dsp_log_enum = + SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dsp_log_text), dsp_log_text); + +static struct snd_kcontrol_new skl_controls[] = { + SOC_ENUM_EXT("DSP Log Level", dsp_log_enum, skl_tplg_dsp_log_get, + skl_tplg_dsp_log_set), +}; + static const struct snd_soc_component_driver skl_component = { .name = "pcm", .probe = skl_platform_soc_probe, @@ -1769,6 +1780,8 @@ static const struct snd_soc_component_driver skl_component = { .compr_ops = &skl_platform_compr_ops, .pcm_new = skl_pcm_new, .pcm_free = skl_pcm_free, + .controls = skl_controls, + .num_controls = ARRAY_SIZE(skl_controls), }; int skl_platform_register(struct device *dev) diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 52d73a4fc917..95a2b6672dcb 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -30,6 +30,7 @@ #include "skl.h" #include "../common/sst-dsp.h" #include "../common/sst-dsp-priv.h" +#include "skl-fwlog.h" #define SKL_CH_FIXUP_MASK (1 << 0) #define SKL_RATE_FIXUP_MASK (1 << 1) @@ -1453,6 +1454,29 @@ static int skl_tplg_pga_event(struct snd_soc_dapm_widget *w, return 0; } +int skl_tplg_dsp_log_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct hdac_ext_bus *ebus = snd_soc_component_get_drvdata(component); + struct skl *skl = ebus_to_skl(ebus); + + ucontrol->value.integer.value[0] = get_dsp_log_priority(skl); + + return 0; +} + +int skl_tplg_dsp_log_set(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct hdac_ext_bus *ebus = snd_soc_component_get_drvdata(component); + struct skl *skl = ebus_to_skl(ebus); + + update_dsp_log_priority(ucontrol->value.integer.value[0], skl); + + return 0; +} static int skl_tplg_tlv_control_get(struct snd_kcontrol *kcontrol, unsigned int __user *data, unsigned int size) diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h index 44e4109ba4dc..5998e6926df3 100644 --- a/sound/soc/intel/skylake/skl-topology.h +++ b/sound/soc/intel/skylake/skl-topology.h @@ -533,4 +533,8 @@ int skl_dai_load(struct snd_soc_component *cmp, int index, struct snd_soc_tplg_pcm *pcm, struct snd_soc_dai *dai); void skl_tplg_add_moduleid_in_bind_params(struct skl *skl, struct snd_soc_dapm_widget *w); +int skl_tplg_dsp_log_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); +int skl_tplg_dsp_log_set(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); #endif -- https://clearlinux.org