mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
dsp: Update ASM driver to support 32 ch
ASM supports now up to 32 channels. Extend the ASM Channel map structures from 8 to 32 channels. Change-Id: I958d15910785cf0c5707dec432b4dd3e272c3dc1 Signed-off-by: Dieter Luecking <dieterl@codeaurora.org> Signed-off-by: Mangesh Kunchamwar <mangeshk@codeaurora.org>
This commit is contained in:
parent
50c5535991
commit
39b3e3cc9e
2 changed files with 513 additions and 0 deletions
472
dsp/q6asm.c
472
dsp/q6asm.c
|
|
@ -40,6 +40,7 @@
|
|||
#include <dsp/q6asm-v2.h>
|
||||
#include <dsp/q6audio-v2.h>
|
||||
#include <dsp/q6common.h>
|
||||
#include <dsp/q6core.h>
|
||||
#include "adsp_err.h"
|
||||
|
||||
#define TRUE 0x01
|
||||
|
|
@ -228,6 +229,9 @@ static inline uint32_t q6asm_get_pcm_format_id(uint32_t media_format_block_ver)
|
|||
uint32_t pcm_format_id;
|
||||
|
||||
switch (media_format_block_ver) {
|
||||
case PCM_MEDIA_FORMAT_V5:
|
||||
pcm_format_id = ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V5;
|
||||
break;
|
||||
case PCM_MEDIA_FORMAT_V4:
|
||||
pcm_format_id = ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4;
|
||||
break;
|
||||
|
|
@ -3144,6 +3148,25 @@ int q6asm_open_read_v4(struct audio_client *ac, uint32_t format,
|
|||
}
|
||||
EXPORT_SYMBOL(q6asm_open_read_v4);
|
||||
|
||||
|
||||
/*
|
||||
* asm_open_read_v5 - Opens audio capture session
|
||||
*
|
||||
* @ac: Client session handle
|
||||
* @format: encoder format
|
||||
* @bits_per_sample: bit width of capture session
|
||||
* @ts_mode: timestamp mode
|
||||
*/
|
||||
int q6asm_open_read_v5(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample, bool ts_mode, uint32_t enc_cfg_id)
|
||||
{
|
||||
return __q6asm_open_read(ac, format, bits_per_sample,
|
||||
PCM_MEDIA_FORMAT_V5 /*media fmt block ver*/,
|
||||
ts_mode, enc_cfg_id);
|
||||
}
|
||||
EXPORT_SYMBOL(q6asm_open_read_v5);
|
||||
|
||||
|
||||
/**
|
||||
* q6asm_open_write_compressed -
|
||||
* command to open ASM in compressed write mode
|
||||
|
|
@ -3491,6 +3514,23 @@ int q6asm_stream_open_write_v3(struct audio_client *ac, uint32_t format,
|
|||
}
|
||||
EXPORT_SYMBOL(q6asm_stream_open_write_v3);
|
||||
|
||||
/*
|
||||
* q6asm_open_write_v5 - Opens audio playback session
|
||||
*
|
||||
* @ac: Client session handle
|
||||
* @format: decoder format
|
||||
* @bits_per_sample: bit width of playback session
|
||||
*/
|
||||
int q6asm_open_write_v5(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample)
|
||||
{
|
||||
return __q6asm_open_write(ac, format, bits_per_sample,
|
||||
ac->stream_id, false /*gapless*/,
|
||||
PCM_MEDIA_FORMAT_V5 /*pcm_format_block_ver*/);
|
||||
}
|
||||
EXPORT_SYMBOL(q6asm_open_write_v5);
|
||||
|
||||
|
||||
/*
|
||||
* q6asm_stream_open_write_v4 - Creates audio stream for playback
|
||||
*
|
||||
|
|
@ -3510,6 +3550,26 @@ int q6asm_stream_open_write_v4(struct audio_client *ac, uint32_t format,
|
|||
}
|
||||
EXPORT_SYMBOL(q6asm_stream_open_write_v4);
|
||||
|
||||
/*
|
||||
* q6asm_stream_open_write_v5 - Creates audio stream for playback
|
||||
*
|
||||
* @ac: Client session handle
|
||||
* @format: asm playback format
|
||||
* @bits_per_sample: bit width of requested stream
|
||||
* @stream_id: stream id of stream to be associated with this session
|
||||
* @is_gapless_mode: true if gapless mode needs to be enabled
|
||||
*/
|
||||
int q6asm_stream_open_write_v5(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample, int32_t stream_id,
|
||||
bool is_gapless_mode)
|
||||
{
|
||||
return __q6asm_open_write(ac, format, bits_per_sample,
|
||||
stream_id, is_gapless_mode,
|
||||
PCM_MEDIA_FORMAT_V5 /*pcm_format_block_ver*/);
|
||||
}
|
||||
EXPORT_SYMBOL(q6asm_stream_open_write_v5);
|
||||
|
||||
|
||||
static int __q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format,
|
||||
uint32_t wr_format, bool is_meta_data_mode,
|
||||
uint32_t bits_per_sample,
|
||||
|
|
@ -4747,6 +4807,108 @@ fail_cmd:
|
|||
}
|
||||
EXPORT_SYMBOL(q6asm_set_encdec_chan_map);
|
||||
|
||||
/*
|
||||
* q6asm_enc_cfg_blk_pcm_v5 - sends encoder configuration parameters
|
||||
*
|
||||
* @ac: Client session handle
|
||||
* @rate: sample rate
|
||||
* @channels: number of channels
|
||||
* @bits_per_sample: bit width of encoder session
|
||||
* @use_default_chmap: true if default channel map to be used
|
||||
* @use_back_flavor: to configure back left and right channel
|
||||
* @channel_map: input channel map
|
||||
* @sample_word_size: Size in bits of the word that holds a sample of a channel
|
||||
* @endianness: endianness of the pcm data
|
||||
* @mode: Mode to provide additional info about the pcm input data
|
||||
*/
|
||||
static int q6asm_enc_cfg_blk_pcm_v5(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
uint16_t bits_per_sample, bool use_default_chmap,
|
||||
bool use_back_flavor, u8 *channel_map,
|
||||
uint16_t sample_word_size, uint16_t endianness,
|
||||
uint16_t mode)
|
||||
{
|
||||
struct asm_multi_channel_pcm_enc_cfg_v5 enc_cfg;
|
||||
struct asm_enc_cfg_blk_param_v2 enc_fg_blk;
|
||||
u8 *channel_mapping;
|
||||
u32 frames_per_buf = 0;
|
||||
int rc;
|
||||
|
||||
if (!use_default_chmap && (channel_map == NULL)) {
|
||||
pr_err("%s: No valid chan map and can't use default\n",
|
||||
__func__);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
|
||||
pr_debug("%s: session[%d]rate[%d]ch[%d]bps[%d]wordsize[%d]\n", __func__,
|
||||
ac->session, rate, channels,
|
||||
bits_per_sample, sample_word_size);
|
||||
|
||||
memset(&enc_cfg, 0, sizeof(enc_cfg));
|
||||
q6asm_add_hdr(ac, &enc_cfg.hdr, sizeof(enc_cfg), TRUE);
|
||||
atomic_set(&ac->cmd_state, -1);
|
||||
enc_cfg.hdr.opcode = ASM_STREAM_CMD_SET_ENCDEC_PARAM;
|
||||
enc_cfg.encdec.param_id = ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2;
|
||||
enc_cfg.encdec.param_size = sizeof(enc_cfg) - sizeof(enc_cfg.hdr) -
|
||||
sizeof(enc_cfg.encdec);
|
||||
enc_cfg.encblk.frames_per_buf = frames_per_buf;
|
||||
enc_cfg.encblk.enc_cfg_blk_size = enc_cfg.encdec.param_size -
|
||||
sizeof(enc_fg_blk);
|
||||
enc_cfg.num_channels = channels;
|
||||
enc_cfg.bits_per_sample = bits_per_sample;
|
||||
enc_cfg.sample_rate = rate;
|
||||
enc_cfg.is_signed = 1;
|
||||
enc_cfg.sample_word_size = sample_word_size;
|
||||
enc_cfg.endianness = endianness;
|
||||
enc_cfg.mode = mode;
|
||||
channel_mapping = enc_cfg.channel_mapping;
|
||||
|
||||
memset(channel_mapping, 0, PCM_FORMAT_MAX_NUM_CHANNEL_V8);
|
||||
|
||||
if (use_default_chmap) {
|
||||
pr_debug("%s: setting default channel map for %d channels",
|
||||
__func__, channels);
|
||||
if (q6asm_map_channels(channel_mapping, channels,
|
||||
use_back_flavor)) {
|
||||
pr_err("%s: map channels failed %d\n",
|
||||
__func__, channels);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
} else {
|
||||
pr_debug("%s: Using pre-defined channel map", __func__);
|
||||
memcpy(channel_mapping, channel_map,
|
||||
PCM_FORMAT_MAX_NUM_CHANNEL_V8);
|
||||
}
|
||||
|
||||
rc = apr_send_pkt(ac->apr, (uint32_t *) &enc_cfg);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: Command open 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 opcode[0x%x]\n",
|
||||
__func__, enc_cfg.hdr.opcode);
|
||||
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_enc_cfg_blk_pcm_v5);
|
||||
|
||||
/*
|
||||
* q6asm_enc_cfg_blk_pcm_v4 - sends encoder configuration parameters
|
||||
*
|
||||
|
|
@ -5040,6 +5202,18 @@ fail_cmd:
|
|||
}
|
||||
EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_v2);
|
||||
|
||||
static int __q6asm_enc_cfg_blk_pcm_v5(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
uint16_t bits_per_sample,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode)
|
||||
{
|
||||
return q6asm_enc_cfg_blk_pcm_v5(ac, rate, channels,
|
||||
bits_per_sample, true, false, NULL,
|
||||
sample_word_size, endianness, mode);
|
||||
}
|
||||
|
||||
static int __q6asm_enc_cfg_blk_pcm_v4(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
uint16_t bits_per_sample,
|
||||
|
|
@ -5137,6 +5311,31 @@ int q6asm_enc_cfg_blk_pcm_format_support_v4(struct audio_client *ac,
|
|||
}
|
||||
EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_format_support_v4);
|
||||
|
||||
/*
|
||||
* q6asm_enc_cfg_blk_pcm_format_support_v5 - sends encoder configuration
|
||||
* parameters
|
||||
*
|
||||
* @ac: Client session handle
|
||||
* @rate: sample rate
|
||||
* @channels: number of channels
|
||||
* @bits_per_sample: bit width of encoder session
|
||||
* @sample_word_size: Size in bits of the word that holds a sample of a channel
|
||||
* @endianness: endianness of the pcm data
|
||||
* @mode: Mode to provide additional info about the pcm input data
|
||||
*/
|
||||
int q6asm_enc_cfg_blk_pcm_format_support_v5(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
uint16_t bits_per_sample,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode)
|
||||
{
|
||||
return __q6asm_enc_cfg_blk_pcm_v5(ac, rate, channels,
|
||||
bits_per_sample, sample_word_size,
|
||||
endianness, mode);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(q6asm_enc_cfg_blk_pcm_format_support_v5);
|
||||
/**
|
||||
* q6asm_enc_cfg_blk_pcm_native -
|
||||
* command to set encode config block for pcm_native
|
||||
|
|
@ -5274,6 +5473,44 @@ static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels,
|
|||
lchannel_mapping[5] = PCM_CHANNEL_RB;
|
||||
lchannel_mapping[6] = PCM_CHANNEL_LS;
|
||||
lchannel_mapping[7] = PCM_CHANNEL_RS;
|
||||
} else if (channels == 12) {
|
||||
/*
|
||||
* Configured for 7.1.4 channel mapping
|
||||
* Todo: Needs to be checked
|
||||
*/
|
||||
lchannel_mapping[0] = PCM_CHANNEL_FL;
|
||||
lchannel_mapping[1] = PCM_CHANNEL_FR;
|
||||
lchannel_mapping[2] = PCM_CHANNEL_FC;
|
||||
lchannel_mapping[3] = PCM_CHANNEL_LFE;
|
||||
lchannel_mapping[4] = PCM_CHANNEL_LB;
|
||||
lchannel_mapping[5] = PCM_CHANNEL_RB;
|
||||
lchannel_mapping[6] = PCM_CHANNEL_LS;
|
||||
lchannel_mapping[7] = PCM_CHANNEL_RS;
|
||||
lchannel_mapping[8] = PCM_CHANNEL_TFL;
|
||||
lchannel_mapping[9] = PCM_CHANNEL_TFR;
|
||||
lchannel_mapping[10] = PCM_CHANNEL_TSL;
|
||||
lchannel_mapping[11] = PCM_CHANNEL_TSR;
|
||||
} else if (channels == 16) {
|
||||
/*
|
||||
* Configured for 7.1.8 channel mapping
|
||||
* Todo: Needs to be checked
|
||||
*/
|
||||
lchannel_mapping[0] = PCM_CHANNEL_FL;
|
||||
lchannel_mapping[1] = PCM_CHANNEL_FR;
|
||||
lchannel_mapping[2] = PCM_CHANNEL_FC;
|
||||
lchannel_mapping[3] = PCM_CHANNEL_LFE;
|
||||
lchannel_mapping[4] = PCM_CHANNEL_LB;
|
||||
lchannel_mapping[5] = PCM_CHANNEL_RB;
|
||||
lchannel_mapping[6] = PCM_CHANNEL_LS;
|
||||
lchannel_mapping[7] = PCM_CHANNEL_RS;
|
||||
lchannel_mapping[8] = PCM_CHANNEL_TFL;
|
||||
lchannel_mapping[9] = PCM_CHANNEL_TFR;
|
||||
lchannel_mapping[10] = PCM_CHANNEL_TSL;
|
||||
lchannel_mapping[11] = PCM_CHANNEL_TSR;
|
||||
lchannel_mapping[12] = PCM_CHANNEL_FLC;
|
||||
lchannel_mapping[13] = PCM_CHANNEL_FRC;
|
||||
lchannel_mapping[14] = PCM_CHANNEL_RLC;
|
||||
lchannel_mapping[15] = PCM_CHANNEL_RRC;
|
||||
} else {
|
||||
pr_err("%s: ERROR.unsupported num_ch = %u\n",
|
||||
__func__, channels);
|
||||
|
|
@ -5953,6 +6190,92 @@ fail_cmd:
|
|||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int __q6asm_media_format_block_pcm_v5(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
uint16_t bits_per_sample,
|
||||
int stream_id,
|
||||
bool use_default_chmap,
|
||||
char *channel_map,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode)
|
||||
{
|
||||
struct asm_multi_channel_pcm_fmt_blk_param_v5 fmt;
|
||||
u8 *channel_mapping;
|
||||
int rc;
|
||||
|
||||
pr_debug("%s: session[%d]rate[%d]ch[%d]bps[%d]wordsize[%d]\n", __func__,
|
||||
ac->session, rate, channels,
|
||||
bits_per_sample, sample_word_size);
|
||||
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
q6asm_stream_add_hdr(ac, &fmt.hdr, sizeof(fmt), TRUE, stream_id);
|
||||
atomic_set(&ac->cmd_state, -1);
|
||||
/*
|
||||
* Updated the token field with stream/session for compressed playback
|
||||
* Platform driver must know the the stream with which the command is
|
||||
* associated
|
||||
*/
|
||||
if (ac->io_mode & COMPRESSED_STREAM_IO)
|
||||
fmt.hdr.token = ((ac->session << 8) & 0xFFFF00) |
|
||||
(stream_id & 0xFF);
|
||||
|
||||
pr_debug("%s: token = 0x%x, stream_id %d, session 0x%x\n",
|
||||
__func__, fmt.hdr.token, stream_id, ac->session);
|
||||
|
||||
fmt.hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
|
||||
fmt.fmt_blk.fmt_blk_size = sizeof(fmt) - sizeof(fmt.hdr) -
|
||||
sizeof(fmt.fmt_blk);
|
||||
fmt.param.num_channels = (uint16_t) channels & 0xFFFF;
|
||||
fmt.param.bits_per_sample = bits_per_sample;
|
||||
fmt.param.sample_rate = rate;
|
||||
fmt.param.is_signed = 1;
|
||||
fmt.param.sample_word_size = sample_word_size;
|
||||
fmt.param.endianness = endianness;
|
||||
fmt.param.mode = mode;
|
||||
channel_mapping = fmt.param.channel_mapping;
|
||||
|
||||
memset(channel_mapping, 0, PCM_FORMAT_MAX_NUM_CHANNEL_V8);
|
||||
|
||||
if (use_default_chmap) {
|
||||
if (q6asm_map_channels(channel_mapping, fmt.param.num_channels, false)) {
|
||||
pr_err("%s: map channels failed %d\n",
|
||||
__func__, channels);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
} else {
|
||||
memcpy(channel_mapping, channel_map,
|
||||
PCM_FORMAT_MAX_NUM_CHANNEL_V8);
|
||||
}
|
||||
|
||||
rc = apr_send_pkt(ac->apr, (uint32_t *) &fmt);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: Comamnd open failed %d\n", __func__, rc);
|
||||
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. 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* q6asm_media_format_block_pcm -
|
||||
* command to set mediafmt block for PCM on ASM stream
|
||||
|
|
@ -6084,6 +6407,47 @@ int q6asm_media_format_block_pcm_format_support_v4(struct audio_client *ac,
|
|||
EXPORT_SYMBOL(q6asm_media_format_block_pcm_format_support_v4);
|
||||
|
||||
|
||||
/*
|
||||
* q6asm_media_format_block_pcm_format_support_v5- sends pcm decoder
|
||||
* configuration parameters
|
||||
*
|
||||
* @ac: Client session handle
|
||||
* @rate: sample rate
|
||||
* @channels: number of channels
|
||||
* @bits_per_sample: bit width of encoder session
|
||||
* @stream_id: stream id of stream to be associated with this session
|
||||
* @use_default_chmap: true if default channel map to be used
|
||||
* @channel_map: input channel map
|
||||
* @sample_word_size: Size in bits of the word that holds a sample of a channel
|
||||
* @endianness: endianness of the pcm data
|
||||
* @mode: Mode to provide additional info about the pcm input data
|
||||
*/
|
||||
int q6asm_media_format_block_pcm_format_support_v5(struct audio_client *ac,
|
||||
uint32_t rate,
|
||||
uint32_t channels,
|
||||
uint16_t bits_per_sample,
|
||||
int stream_id,
|
||||
bool use_default_chmap,
|
||||
char *channel_map,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode)
|
||||
{
|
||||
if (!use_default_chmap && (channel_map == NULL)) {
|
||||
pr_err("%s: No valid chan map and can't use default\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
return __q6asm_media_format_block_pcm_v5(ac, rate,
|
||||
channels, bits_per_sample, stream_id,
|
||||
use_default_chmap, channel_map,
|
||||
sample_word_size, endianness,
|
||||
mode);
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(q6asm_media_format_block_pcm_format_support_v5);
|
||||
|
||||
|
||||
static int __q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
bool use_default_chmap, char *channel_map,
|
||||
|
|
@ -6290,6 +6654,79 @@ fail_cmd:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int __q6asm_media_format_block_multi_ch_pcm_v5(struct audio_client *ac,
|
||||
uint32_t rate,
|
||||
uint32_t channels,
|
||||
bool use_default_chmap,
|
||||
char *channel_map,
|
||||
uint16_t bits_per_sample,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode)
|
||||
{
|
||||
struct asm_multi_channel_pcm_fmt_blk_param_v5 fmt;
|
||||
u8 *channel_mapping;
|
||||
int rc;
|
||||
|
||||
pr_debug("%s: session[%d]rate[%d]ch[%d]bps[%d]wordsize[%d]\n", __func__,
|
||||
ac->session, rate, channels,
|
||||
bits_per_sample, sample_word_size);
|
||||
|
||||
memset(&fmt, 0, sizeof(fmt));
|
||||
q6asm_add_hdr(ac, &fmt.hdr, sizeof(fmt), TRUE);
|
||||
atomic_set(&ac->cmd_state, -1);
|
||||
|
||||
fmt.hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
|
||||
fmt.fmt_blk.fmt_blk_size = sizeof(fmt) - sizeof(fmt.hdr) -
|
||||
sizeof(fmt.fmt_blk);
|
||||
fmt.param.num_channels = channels;
|
||||
fmt.param.bits_per_sample = bits_per_sample;
|
||||
fmt.param.sample_rate = rate;
|
||||
fmt.param.is_signed = 1;
|
||||
fmt.param.sample_word_size = sample_word_size;
|
||||
fmt.param.endianness = endianness;
|
||||
fmt.param.mode = mode;
|
||||
channel_mapping = fmt.param.channel_mapping;
|
||||
|
||||
memset(channel_mapping, 0, PCM_FORMAT_MAX_NUM_CHANNEL_V8);
|
||||
|
||||
if (use_default_chmap) {
|
||||
if (q6asm_map_channels(channel_mapping, channels, false)) {
|
||||
pr_err("%s: map channels failed %d\n",
|
||||
__func__, channels);
|
||||
rc = -EINVAL;
|
||||
goto fail_cmd;
|
||||
}
|
||||
} else {
|
||||
memcpy(channel_mapping, channel_map,
|
||||
PCM_FORMAT_MAX_NUM_CHANNEL_V8);
|
||||
}
|
||||
|
||||
rc = apr_send_pkt(ac->apr, (uint32_t *) &fmt);
|
||||
if (rc < 0) {
|
||||
pr_err("%s: Comamnd open 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;
|
||||
}
|
||||
|
||||
int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
bool use_default_chmap, char *channel_map)
|
||||
|
|
@ -6369,6 +6806,41 @@ int q6asm_media_format_block_multi_ch_pcm_v4(struct audio_client *ac,
|
|||
}
|
||||
EXPORT_SYMBOL(q6asm_media_format_block_multi_ch_pcm_v4);
|
||||
|
||||
|
||||
/*
|
||||
* q6asm_media_format_block_multi_ch_pcm_v5 - sends pcm decoder configuration
|
||||
* parameters
|
||||
*
|
||||
* @ac: Client session handle
|
||||
* @rate: sample rate
|
||||
* @channels: number of channels
|
||||
* @bits_per_sample: bit width of encoder session
|
||||
* @use_default_chmap: true if default channel map to be used
|
||||
* @channel_map: input channel map
|
||||
* @sample_word_size: Size in bits of the word that holds a sample of a channel
|
||||
* @endianness: endianness of the pcm data
|
||||
* @mode: Mode to provide additional info about the pcm input data
|
||||
*/
|
||||
int q6asm_media_format_block_multi_ch_pcm_v5(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
bool use_default_chmap,
|
||||
char *channel_map,
|
||||
uint16_t bits_per_sample,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode)
|
||||
{
|
||||
return __q6asm_media_format_block_multi_ch_pcm_v5(ac, rate, channels,
|
||||
use_default_chmap,
|
||||
channel_map,
|
||||
bits_per_sample,
|
||||
sample_word_size,
|
||||
endianness,
|
||||
mode);
|
||||
}
|
||||
EXPORT_SYMBOL(q6asm_media_format_block_multi_ch_pcm_v5);
|
||||
|
||||
|
||||
/*
|
||||
* q6asm_media_format_block_gen_compr - set up generic compress format params
|
||||
*
|
||||
|
|
|
|||
|
|
@ -112,11 +112,14 @@
|
|||
#define ASM_LITTLE_ENDIAN 0
|
||||
#define ASM_BIG_ENDIAN 1
|
||||
|
||||
#define ADSP_ASM_API_VERSION_V2 2
|
||||
|
||||
/* PCM_MEDIA_FORMAT_Version */
|
||||
enum {
|
||||
PCM_MEDIA_FORMAT_V2 = 0,
|
||||
PCM_MEDIA_FORMAT_V3,
|
||||
PCM_MEDIA_FORMAT_V4,
|
||||
PCM_MEDIA_FORMAT_V5,
|
||||
};
|
||||
|
||||
/* PCM format modes in DSP */
|
||||
|
|
@ -296,6 +299,10 @@ int q6asm_open_read_v4(struct audio_client *ac, uint32_t format,
|
|||
uint16_t bits_per_sample, bool ts_mode,
|
||||
uint32_t enc_cfg_id);
|
||||
|
||||
int q6asm_open_read_v5(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample, bool ts_mode,
|
||||
uint32_t enc_cfg_id);
|
||||
|
||||
int q6asm_open_write(struct audio_client *ac, uint32_t format
|
||||
/*, uint16_t bits_per_sample*/);
|
||||
|
||||
|
|
@ -312,6 +319,9 @@ int q6asm_open_write_v3(struct audio_client *ac, uint32_t format,
|
|||
int q6asm_open_write_v4(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample);
|
||||
|
||||
int q6asm_open_write_v5(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample);
|
||||
|
||||
int q6asm_stream_open_write_v2(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample, int32_t stream_id,
|
||||
bool is_gapless_mode);
|
||||
|
|
@ -324,6 +334,10 @@ int q6asm_stream_open_write_v4(struct audio_client *ac, uint32_t format,
|
|||
uint16_t bits_per_sample, int32_t stream_id,
|
||||
bool is_gapless_mode);
|
||||
|
||||
int q6asm_stream_open_write_v5(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample, int32_t stream_id,
|
||||
bool is_gapless_mode);
|
||||
|
||||
int q6asm_open_read_compressed(struct audio_client *ac, uint32_t format,
|
||||
uint32_t passthrough_flag);
|
||||
|
||||
|
|
@ -462,6 +476,13 @@ int q6asm_enc_cfg_blk_pcm_format_support_v4(struct audio_client *ac,
|
|||
uint16_t endianness,
|
||||
uint16_t mode);
|
||||
|
||||
int q6asm_enc_cfg_blk_pcm_format_support_v5(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
uint16_t bits_per_sample,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode);
|
||||
|
||||
int q6asm_enc_cfg_blk_custom(struct audio_client *ac,
|
||||
uint32_t sample_rate, uint32_t channels,
|
||||
uint32_t format, void *cfg);
|
||||
|
|
@ -526,6 +547,17 @@ int q6asm_media_format_block_pcm_format_support_v4(struct audio_client *ac,
|
|||
uint16_t endianness,
|
||||
uint16_t mode);
|
||||
|
||||
int q6asm_media_format_block_pcm_format_support_v5(struct audio_client *ac,
|
||||
uint32_t rate,
|
||||
uint32_t channels,
|
||||
uint16_t bits_per_sample,
|
||||
int stream_id,
|
||||
bool use_default_chmap,
|
||||
char *channel_map,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode);
|
||||
|
||||
int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
bool use_default_chmap, char *channel_map);
|
||||
|
|
@ -561,6 +593,15 @@ int q6asm_media_format_block_multi_ch_pcm_v4(struct audio_client *ac,
|
|||
uint16_t endianness,
|
||||
uint16_t mode);
|
||||
|
||||
int q6asm_media_format_block_multi_ch_pcm_v5(struct audio_client *ac,
|
||||
uint32_t rate, uint32_t channels,
|
||||
bool use_default_chmap,
|
||||
char *channel_map,
|
||||
uint16_t bits_per_sample,
|
||||
uint16_t sample_word_size,
|
||||
uint16_t endianness,
|
||||
uint16_t mode);
|
||||
|
||||
int q6asm_media_format_block_aac(struct audio_client *ac,
|
||||
struct asm_aac_cfg *cfg);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue