ASoC: q6dsp: audioreach: Add placeholder decoder for compress playback
Add placeholder decoder graph module for compressed playback feature. Co-developed-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com> Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230619101653.9750-5-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
69bff59459
commit
c7548f5990
@ -1140,6 +1140,8 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod
|
||||
case MODULE_ID_PCM_DEC:
|
||||
case MODULE_ID_PCM_ENC:
|
||||
case MODULE_ID_PCM_CNV:
|
||||
case MODULE_ID_PLACEHOLDER_DECODER:
|
||||
case MODULE_ID_PLACEHOLDER_ENCODER:
|
||||
rc = audioreach_pcm_set_media_format(graph, module, cfg);
|
||||
break;
|
||||
case MODULE_ID_DISPLAY_PORT_SINK:
|
||||
|
@ -15,6 +15,8 @@ struct q6apm_graph;
|
||||
#define MODULE_ID_PCM_CNV 0x07001003
|
||||
#define MODULE_ID_PCM_ENC 0x07001004
|
||||
#define MODULE_ID_PCM_DEC 0x07001005
|
||||
#define MODULE_ID_PLACEHOLDER_ENCODER 0x07001008
|
||||
#define MODULE_ID_PLACEHOLDER_DECODER 0x07001009
|
||||
#define MODULE_ID_SAL 0x07001010
|
||||
#define MODULE_ID_MFC 0x07001015
|
||||
#define MODULE_ID_CODEC_DMA_SINK 0x07001023
|
||||
@ -22,6 +24,9 @@ struct q6apm_graph;
|
||||
#define MODULE_ID_I2S_SINK 0x0700100A
|
||||
#define MODULE_ID_I2S_SOURCE 0x0700100B
|
||||
#define MODULE_ID_DATA_LOGGING 0x0700101A
|
||||
#define MODULE_ID_AAC_DEC 0x0700101F
|
||||
#define MODULE_ID_FLAC_DEC 0x0700102F
|
||||
#define MODULE_ID_MP3_DECODE 0x0700103B
|
||||
#define MODULE_ID_DISPLAY_PORT_SINK 0x07001069
|
||||
|
||||
#define APM_CMD_GET_SPF_STATE 0x01001021
|
||||
@ -608,6 +613,15 @@ struct param_id_vol_ctrl_master_gain {
|
||||
} __packed;
|
||||
|
||||
|
||||
#define PARAM_ID_REMOVE_INITIAL_SILENCE 0x0800114B
|
||||
#define PARAM_ID_REMOVE_TRAILING_SILENCE 0x0800115D
|
||||
|
||||
#define PARAM_ID_REAL_MODULE_ID 0x0800100B
|
||||
|
||||
struct param_id_placeholder_real_module_id {
|
||||
uint32_t real_module_id;
|
||||
} __packed;
|
||||
|
||||
/* Graph */
|
||||
struct audioreach_connection {
|
||||
/* Connections */
|
||||
|
@ -298,6 +298,71 @@ int q6apm_unmap_memory_regions(struct q6apm_graph *graph, unsigned int dir)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6apm_unmap_memory_regions);
|
||||
|
||||
int q6apm_remove_initial_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples)
|
||||
{
|
||||
struct audioreach_module *module;
|
||||
|
||||
module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER);
|
||||
if (!module)
|
||||
return -ENODEV;
|
||||
|
||||
return audioreach_send_u32_param(graph, module, PARAM_ID_REMOVE_INITIAL_SILENCE, samples);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6apm_remove_initial_silence);
|
||||
|
||||
int q6apm_remove_trailing_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples)
|
||||
{
|
||||
struct audioreach_module *module;
|
||||
|
||||
module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER);
|
||||
if (!module)
|
||||
return -ENODEV;
|
||||
|
||||
return audioreach_send_u32_param(graph, module, PARAM_ID_REMOVE_TRAILING_SILENCE, samples);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6apm_remove_trailing_silence);
|
||||
|
||||
int q6apm_enable_compress_module(struct device *dev, struct q6apm_graph *graph, bool en)
|
||||
{
|
||||
struct audioreach_module *module;
|
||||
|
||||
module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER);
|
||||
if (!module)
|
||||
return -ENODEV;
|
||||
|
||||
return audioreach_send_u32_param(graph, module, PARAM_ID_MODULE_ENABLE, en);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6apm_enable_compress_module);
|
||||
|
||||
int q6apm_set_real_module_id(struct device *dev, struct q6apm_graph *graph,
|
||||
uint32_t codec_id)
|
||||
{
|
||||
struct audioreach_module *module;
|
||||
uint32_t module_id;
|
||||
|
||||
module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER);
|
||||
if (!module)
|
||||
return -ENODEV;
|
||||
|
||||
switch (codec_id) {
|
||||
case SND_AUDIOCODEC_MP3:
|
||||
module_id = MODULE_ID_MP3_DECODE;
|
||||
break;
|
||||
case SND_AUDIOCODEC_AAC:
|
||||
module_id = MODULE_ID_AAC_DEC;
|
||||
break;
|
||||
case SND_AUDIOCODEC_FLAC:
|
||||
module_id = MODULE_ID_FLAC_DEC;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return audioreach_send_u32_param(graph, module, PARAM_ID_REAL_MODULE_ID,
|
||||
module_id);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6apm_set_real_module_id);
|
||||
|
||||
int q6apm_graph_media_format_pcm(struct q6apm_graph *graph, struct audioreach_module_config *cfg)
|
||||
{
|
||||
struct audioreach_graph_info *info = graph->info;
|
||||
|
@ -147,4 +147,8 @@ int q6apm_graph_get_rx_shmem_module_iid(struct q6apm_graph *graph);
|
||||
|
||||
bool q6apm_is_adsp_ready(void);
|
||||
|
||||
int q6apm_enable_compress_module(struct device *dev, struct q6apm_graph *graph, bool en);
|
||||
int q6apm_remove_initial_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples);
|
||||
int q6apm_remove_trailing_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples);
|
||||
int q6apm_set_real_module_id(struct device *dev, struct q6apm_graph *graph, uint32_t codec_id);
|
||||
#endif /* __APM_GRAPH_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user