ASoC: msm: qdsp6v2: support decode of g711 clips
Add support in audio stream manager to configure decode of g711 related clips. CRs-Fixed: 1094107 Change-Id: Ie90fd68e24e7e793aaac64290e3c1e41682d6d5a Signed-off-by: Yamit Mehta <ymehta@codeaurora.org> Signed-off-by: Surendar karka <sukark@codeaurora.org>
This commit is contained in:
parent
823875c46e
commit
b23b342e6c
3 changed files with 87 additions and 0 deletions
|
@ -3581,6 +3581,10 @@ struct asm_alac_cfg {
|
||||||
u32 channel_layout_tag;
|
u32 channel_layout_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct asm_g711_dec_cfg {
|
||||||
|
u32 sample_rate;
|
||||||
|
};
|
||||||
|
|
||||||
struct asm_vorbis_cfg {
|
struct asm_vorbis_cfg {
|
||||||
u32 bit_stream_fmt;
|
u32 bit_stream_fmt;
|
||||||
};
|
};
|
||||||
|
@ -4309,6 +4313,12 @@ struct asm_alac_fmt_blk_v2 {
|
||||||
|
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
struct asm_g711_dec_fmt_blk_v2 {
|
||||||
|
struct apr_hdr hdr;
|
||||||
|
struct asm_data_cmd_media_fmt_update_v2 fmtblk;
|
||||||
|
u32 sample_rate;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
struct asm_ape_fmt_blk_v2 {
|
struct asm_ape_fmt_blk_v2 {
|
||||||
struct apr_hdr hdr;
|
struct apr_hdr hdr;
|
||||||
struct asm_data_cmd_media_fmt_update_v2 fmtblk;
|
struct asm_data_cmd_media_fmt_update_v2 fmtblk;
|
||||||
|
|
|
@ -534,6 +534,9 @@ int q6asm_stream_media_format_block_flac(struct audio_client *ac,
|
||||||
int q6asm_media_format_block_alac(struct audio_client *ac,
|
int q6asm_media_format_block_alac(struct audio_client *ac,
|
||||||
struct asm_alac_cfg *cfg, int stream_id);
|
struct asm_alac_cfg *cfg, int stream_id);
|
||||||
|
|
||||||
|
int q6asm_media_format_block_g711(struct audio_client *ac,
|
||||||
|
struct asm_g711_dec_cfg *cfg, int stream_id);
|
||||||
|
|
||||||
int q6asm_stream_media_format_block_vorbis(struct audio_client *ac,
|
int q6asm_stream_media_format_block_vorbis(struct audio_client *ac,
|
||||||
struct asm_vorbis_cfg *cfg, int stream_id);
|
struct asm_vorbis_cfg *cfg, int stream_id);
|
||||||
|
|
||||||
|
|
|
@ -2863,6 +2863,11 @@ static int __q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format,
|
||||||
break;
|
break;
|
||||||
case FORMAT_DSD:
|
case FORMAT_DSD:
|
||||||
open.dec_fmt_id = ASM_MEDIA_FMT_DSD;
|
open.dec_fmt_id = ASM_MEDIA_FMT_DSD;
|
||||||
|
case FORMAT_G711_ALAW_FS:
|
||||||
|
open.dec_fmt_id = ASM_MEDIA_FMT_G711_ALAW_FS;
|
||||||
|
break;
|
||||||
|
case FORMAT_G711_MLAW_FS:
|
||||||
|
open.dec_fmt_id = ASM_MEDIA_FMT_G711_MLAW_FS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr_err("%s: Invalid format 0x%x\n",
|
pr_err("%s: Invalid format 0x%x\n",
|
||||||
|
@ -5485,6 +5490,75 @@ fail_cmd:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* q6asm_media_format_block_g711 - sends g711 decoder configuration
|
||||||
|
* parameters
|
||||||
|
* @ac: Client session handle
|
||||||
|
* @cfg: Audio stream manager configuration parameters
|
||||||
|
* @stream_id: Stream id
|
||||||
|
*/
|
||||||
|
int q6asm_media_format_block_g711(struct audio_client *ac,
|
||||||
|
struct asm_g711_dec_cfg *cfg, int stream_id)
|
||||||
|
{
|
||||||
|
struct asm_g711_dec_fmt_blk_v2 fmt;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
if (!ac) {
|
||||||
|
pr_err("%s: audio client is null\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
if (!cfg) {
|
||||||
|
pr_err("%s: Invalid ASM config\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream_id <= 0) {
|
||||||
|
pr_err("%s: Invalid stream id\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pr_debug("%s :session[%d]rate[%d]\n", __func__,
|
||||||
|
ac->session, cfg->sample_rate);
|
||||||
|
|
||||||
|
memset(&fmt, 0, sizeof(struct asm_g711_dec_fmt_blk_v2));
|
||||||
|
|
||||||
|
q6asm_stream_add_hdr(ac, &fmt.hdr, sizeof(fmt), TRUE, stream_id);
|
||||||
|
atomic_set(&ac->cmd_state, -1);
|
||||||
|
|
||||||
|
fmt.hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
|
||||||
|
fmt.fmtblk.fmt_blk_size = sizeof(fmt) - sizeof(fmt.hdr) -
|
||||||
|
sizeof(fmt.fmtblk);
|
||||||
|
|
||||||
|
fmt.sample_rate = cfg->sample_rate;
|
||||||
|
|
||||||
|
rc = apr_send_pkt(ac->apr, (uint32_t *) &fmt);
|
||||||
|
if (rc < 0) {
|
||||||
|
pr_err("%s :Command media format update failed %d\n",
|
||||||
|
__func__, rc);
|
||||||
|
goto fail_cmd;
|
||||||
|
}
|
||||||
|
rc = wait_event_timeout(ac->cmd_wait,
|
||||||
|
(atomic_read(&ac->cmd_state) >= 0), 5*HZ);
|
||||||
|
if (!rc) {
|
||||||
|
pr_err("%s :timeout. waited for FORMAT_UPDATE\n", __func__);
|
||||||
|
rc = -ETIMEDOUT;
|
||||||
|
goto fail_cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (atomic_read(&ac->cmd_state) > 0) {
|
||||||
|
pr_err("%s: DSP returned error[%s]\n",
|
||||||
|
__func__, adsp_err_get_err_str(
|
||||||
|
atomic_read(&ac->cmd_state)));
|
||||||
|
rc = adsp_err_get_lnx_err_code(
|
||||||
|
atomic_read(&ac->cmd_state));
|
||||||
|
goto fail_cmd;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
fail_cmd:
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(q6asm_media_format_block_g711);
|
||||||
|
|
||||||
int q6asm_stream_media_format_block_vorbis(struct audio_client *ac,
|
int q6asm_stream_media_format_block_vorbis(struct audio_client *ac,
|
||||||
struct asm_vorbis_cfg *cfg, int stream_id)
|
struct asm_vorbis_cfg *cfg, int stream_id)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue