ASoC: msm: qdsp6: Add support to configure ISO and ARIB coefficients

Add support for configuring ISO or ARIB stereo mixing
coefficients. This change introduces a function with whichi,
AAC multi-channel driver can configure ISO or ARIB coefficients
according to configuration done by the client.

Change-Id: I72b74033532a276fa3bc1d305a04720ff6767409
Signed-off-by: Amal Paul <amal@codeaurora.org>
This commit is contained in:
Amal Paul 2013-02-21 19:36:35 -08:00 committed by Iliyan Malchev
parent 80bfb30768
commit ed056a5a55
5 changed files with 56 additions and 1 deletions

View file

@ -1,6 +1,6 @@
/* /*
* *
* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -1278,6 +1278,17 @@ struct asm_stream_cmd_encdec_dualmono {
struct asm_dual_mono channel_map; struct asm_dual_mono channel_map;
} __packed; } __packed;
#define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG 0x00010DD8
/* Structure for AAC decoder stereo coefficient setting. */
struct asm_aac_stereo_mix_coeff_selection_param {
struct apr_hdr hdr;
u32 param_id;
u32 param_size;
u32 aac_stereo_mix_coeff_flag;
} __packed;
#define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82 #define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82
struct asm_stream_cmd_encdec_channelmap { struct asm_stream_cmd_encdec_channelmap {
struct apr_hdr hdr; struct apr_hdr hdr;

View file

@ -242,6 +242,8 @@ int q6asm_enable_sbrps(struct audio_client *ac,
int q6asm_cfg_dual_mono_aac(struct audio_client *ac, int q6asm_cfg_dual_mono_aac(struct audio_client *ac,
uint16_t sce_left, uint16_t sce_right); uint16_t sce_left, uint16_t sce_right);
int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff);
int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf, int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf,
uint16_t min_rate, uint16_t max_rate, uint16_t min_rate, uint16_t max_rate,
uint16_t reduced_rate_level, uint16_t rate_modulation_cmd); uint16_t reduced_rate_level, uint16_t rate_modulation_cmd);

View file

@ -262,6 +262,8 @@ int q6asm_enable_sbrps(struct audio_client *ac,
int q6asm_cfg_dual_mono_aac(struct audio_client *ac, int q6asm_cfg_dual_mono_aac(struct audio_client *ac,
uint16_t sce_left, uint16_t sce_right); uint16_t sce_left, uint16_t sce_right);
int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff);
int q6asm_set_encdec_chan_map(struct audio_client *ac, int q6asm_set_encdec_chan_map(struct audio_client *ac,
uint32_t num_channels); uint32_t num_channels);

View file

@ -2044,6 +2044,39 @@ fail_cmd:
return -EINVAL; return -EINVAL;
} }
int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff)
{
struct asm_aac_stereo_mix_coeff_selection_param aac_mix_coeff;
int rc = 0;
q6asm_add_hdr(ac, &aac_mix_coeff.hdr, sizeof(aac_mix_coeff), TRUE);
aac_mix_coeff.hdr.opcode =
ASM_STREAM_CMD_SET_ENCDEC_PARAM;
aac_mix_coeff.param_id =
ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG;
aac_mix_coeff.param_size =
sizeof(struct asm_aac_stereo_mix_coeff_selection_param);
aac_mix_coeff.aac_stereo_mix_coeff_flag = mix_coeff;
pr_debug("%s, mix_coeff = %u", __func__, mix_coeff);
rc = apr_send_pkt(ac->apr, (uint32_t *) &aac_mix_coeff);
if (rc < 0) {
pr_err("%s:Command opcode[0x%x]paramid[0x%x] failed\n",
__func__, ASM_STREAM_CMD_SET_ENCDEC_PARAM,
ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG);
rc = -EINVAL;
goto fail_cmd;
}
rc = wait_event_timeout(ac->cmd_wait,
(atomic_read(&ac->cmd_state) == 0), 5*HZ);
if (!rc) {
pr_err("%s:timeout opcode[0x%x]\n", __func__,
aac_mix_coeff.hdr.opcode);
goto fail_cmd;
}
return 0;
fail_cmd:
return -EINVAL;
}
int q6asm_set_encdec_chan_map(struct audio_client *ac, int q6asm_set_encdec_chan_map(struct audio_client *ac,
uint32_t num_channels) uint32_t num_channels)
{ {

View file

@ -1887,6 +1887,13 @@ fail_cmd:
return -EINVAL; return -EINVAL;
} }
/* Support for selecting stereo mixing coefficients for B family not done */
int q6asm_cfg_aac_sel_mix_coef(struct audio_client *ac, uint32_t mix_coeff)
{
/* To Be Done */
return 0;
}
int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf, int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf,
uint16_t min_rate, uint16_t max_rate, uint16_t min_rate, uint16_t max_rate,
uint16_t reduced_rate_level, uint16_t rate_modulation_cmd) uint16_t reduced_rate_level, uint16_t rate_modulation_cmd)