Merge series "ALSA: compress: Add wma, alac and ape support" from Vinod Koul <vkoul@kernel.org>:
This series adds more WMA profiles and WMA decoder parameters to UAPI and then support for these in qcom driver. It also adds FLAC and APE IDs and decoder parameters to UAPI and then support in qcom driver This was tested on Dragon board RB3. Last, bump up the compressed version so that userspace can check for the support. Since the series touches compress uapi and asoc, it would make sense to go thru asoc tree with acks. Changes in v3: - add r-b from Srini - use macros for FLAC channel layout tags Changes in v2: - use bitflags for wma profiles Vinod Koul (9): ALSA: compress: add wma codec profiles ALSA: compress: Add wma decoder params ASoC: qcom: q6asm: pass codec profile to q6asm_open_write ASoC: qcom: q6asm: add support to wma config ASoC: qcom: q6asm-dai: add support to wma decoder ALSA: compress: add alac & ape decoder params ASoC: qcom: q6asm: add support for alac and ape configs ASoC: qcom: q6asm-dai: add support for ALAC and APE decoders ALSA: compress: bump the version include/uapi/sound/compress_offload.h | 2 +- include/uapi/sound/compress_params.h | 37 +++- sound/soc/qcom/qdsp6/q6asm-dai.c | 139 ++++++++++++++- sound/soc/qcom/qdsp6/q6asm.c | 243 +++++++++++++++++++++++++- sound/soc/qcom/qdsp6/q6asm.h | 51 +++++- 5 files changed, 465 insertions(+), 7 deletions(-) -- 2.24.1
This commit is contained in:
commit
eff4d9ecd0
|
@ -31,7 +31,7 @@
|
|||
#include <sound/compress_params.h>
|
||||
|
||||
|
||||
#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
|
||||
#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 2, 0)
|
||||
/**
|
||||
* struct snd_compressed_buffer - compressed buffer
|
||||
* @fragment_size: size of buffer fragment in bytes
|
||||
|
|
|
@ -75,7 +75,9 @@
|
|||
#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
|
||||
#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
|
||||
#define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E)
|
||||
#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_BESPOKE
|
||||
#define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F)
|
||||
#define SND_AUDIOCODEC_APE ((__u32) 0x00000010)
|
||||
#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE
|
||||
|
||||
/*
|
||||
* Profile and modes are listed with bit masks. This allows for a
|
||||
|
@ -142,6 +144,9 @@
|
|||
#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
|
||||
#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
|
||||
#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
|
||||
#define SND_AUDIOPROFILE_WMA9_PRO ((__u32) 0x00000010)
|
||||
#define SND_AUDIOPROFILE_WMA9_LOSSLESS ((__u32) 0x00000020)
|
||||
#define SND_AUDIOPROFILE_WMA10_LOSSLESS ((__u32) 0x00000040)
|
||||
|
||||
#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
|
||||
#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
|
||||
|
@ -326,6 +331,33 @@ struct snd_dec_flac {
|
|||
__u16 reserved;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
struct snd_dec_wma {
|
||||
__u32 encoder_option;
|
||||
__u32 adv_encoder_option;
|
||||
__u32 adv_encoder_option2;
|
||||
__u32 reserved;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
struct snd_dec_alac {
|
||||
__u32 frame_length;
|
||||
__u8 compatible_version;
|
||||
__u8 pb;
|
||||
__u8 mb;
|
||||
__u8 kb;
|
||||
__u32 max_run;
|
||||
__u32 max_frame_bytes;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
struct snd_dec_ape {
|
||||
__u16 compatible_version;
|
||||
__u16 compression_level;
|
||||
__u32 format_flags;
|
||||
__u32 blocks_per_frame;
|
||||
__u32 final_frame_blocks;
|
||||
__u32 total_frames;
|
||||
__u32 seek_table_present;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
union snd_codec_options {
|
||||
struct snd_enc_wma wma;
|
||||
struct snd_enc_vorbis vorbis;
|
||||
|
@ -333,6 +365,9 @@ union snd_codec_options {
|
|||
struct snd_enc_flac flac;
|
||||
struct snd_enc_generic generic;
|
||||
struct snd_dec_flac flac_d;
|
||||
struct snd_dec_wma wma_d;
|
||||
struct snd_dec_alac alac_d;
|
||||
struct snd_dec_ape ape_d;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
/** struct snd_codec_desc - description of codec capabilities
|
||||
|
|
|
@ -41,6 +41,9 @@
|
|||
#define Q6ASM_DAI_TX 1
|
||||
#define Q6ASM_DAI_RX 2
|
||||
|
||||
#define ALAC_CH_LAYOUT_MONO ((101 << 16) | 1)
|
||||
#define ALAC_CH_LAYOUT_STEREO ((101 << 16) | 2)
|
||||
|
||||
enum stream_state {
|
||||
Q6ASM_STREAM_IDLE = 0,
|
||||
Q6ASM_STREAM_STOPPED,
|
||||
|
@ -252,7 +255,7 @@ static int q6asm_dai_prepare(struct snd_soc_component *component,
|
|||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
ret = q6asm_open_write(prtd->audio_client, FORMAT_LINEAR_PCM,
|
||||
prtd->bits_per_sample);
|
||||
0, prtd->bits_per_sample);
|
||||
} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
|
||||
ret = q6asm_open_read(prtd->audio_client, FORMAT_LINEAR_PCM,
|
||||
prtd->bits_per_sample);
|
||||
|
@ -629,10 +632,17 @@ static int q6asm_dai_compr_set_params(struct snd_compr_stream *stream,
|
|||
int dir = stream->direction;
|
||||
struct q6asm_dai_data *pdata;
|
||||
struct q6asm_flac_cfg flac_cfg;
|
||||
struct q6asm_wma_cfg wma_cfg;
|
||||
struct q6asm_alac_cfg alac_cfg;
|
||||
struct q6asm_ape_cfg ape_cfg;
|
||||
unsigned int wma_v9 = 0;
|
||||
struct device *dev = c->dev;
|
||||
int ret;
|
||||
union snd_codec_options *codec_options;
|
||||
struct snd_dec_flac *flac;
|
||||
struct snd_dec_wma *wma;
|
||||
struct snd_dec_alac *alac;
|
||||
struct snd_dec_ape *ape;
|
||||
|
||||
codec_options = &(prtd->codec_param.codec.options);
|
||||
|
||||
|
@ -654,7 +664,7 @@ static int q6asm_dai_compr_set_params(struct snd_compr_stream *stream,
|
|||
prtd->bits_per_sample = 16;
|
||||
if (dir == SND_COMPRESS_PLAYBACK) {
|
||||
ret = q6asm_open_write(prtd->audio_client, params->codec.id,
|
||||
prtd->bits_per_sample);
|
||||
params->codec.profile, prtd->bits_per_sample);
|
||||
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "q6asm_open_write failed\n");
|
||||
|
@ -694,6 +704,126 @@ static int q6asm_dai_compr_set_params(struct snd_compr_stream *stream,
|
|||
return -EIO;
|
||||
}
|
||||
break;
|
||||
|
||||
case SND_AUDIOCODEC_WMA:
|
||||
wma = &codec_options->wma_d;
|
||||
|
||||
memset(&wma_cfg, 0x0, sizeof(struct q6asm_wma_cfg));
|
||||
|
||||
wma_cfg.sample_rate = params->codec.sample_rate;
|
||||
wma_cfg.num_channels = params->codec.ch_in;
|
||||
wma_cfg.bytes_per_sec = params->codec.bit_rate / 8;
|
||||
wma_cfg.block_align = params->codec.align;
|
||||
wma_cfg.bits_per_sample = prtd->bits_per_sample;
|
||||
wma_cfg.enc_options = wma->encoder_option;
|
||||
wma_cfg.adv_enc_options = wma->adv_encoder_option;
|
||||
wma_cfg.adv_enc_options2 = wma->adv_encoder_option2;
|
||||
|
||||
if (wma_cfg.num_channels == 1)
|
||||
wma_cfg.channel_mask = 4; /* Mono Center */
|
||||
else if (wma_cfg.num_channels == 2)
|
||||
wma_cfg.channel_mask = 3; /* Stereo FL/FR */
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
/* check the codec profile */
|
||||
switch (params->codec.profile) {
|
||||
case SND_AUDIOPROFILE_WMA9:
|
||||
wma_cfg.fmtag = 0x161;
|
||||
wma_v9 = 1;
|
||||
break;
|
||||
|
||||
case SND_AUDIOPROFILE_WMA10:
|
||||
wma_cfg.fmtag = 0x166;
|
||||
break;
|
||||
|
||||
case SND_AUDIOPROFILE_WMA9_PRO:
|
||||
wma_cfg.fmtag = 0x162;
|
||||
break;
|
||||
|
||||
case SND_AUDIOPROFILE_WMA9_LOSSLESS:
|
||||
wma_cfg.fmtag = 0x163;
|
||||
break;
|
||||
|
||||
case SND_AUDIOPROFILE_WMA10_LOSSLESS:
|
||||
wma_cfg.fmtag = 0x167;
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(dev, "Unknown WMA profile:%x\n",
|
||||
params->codec.profile);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (wma_v9)
|
||||
ret = q6asm_stream_media_format_block_wma_v9(
|
||||
prtd->audio_client, &wma_cfg);
|
||||
else
|
||||
ret = q6asm_stream_media_format_block_wma_v10(
|
||||
prtd->audio_client, &wma_cfg);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "WMA9 CMD failed:%d\n", ret);
|
||||
return -EIO;
|
||||
}
|
||||
break;
|
||||
|
||||
case SND_AUDIOCODEC_ALAC:
|
||||
memset(&alac_cfg, 0x0, sizeof(alac_cfg));
|
||||
alac = &codec_options->alac_d;
|
||||
|
||||
alac_cfg.sample_rate = params->codec.sample_rate;
|
||||
alac_cfg.avg_bit_rate = params->codec.bit_rate;
|
||||
alac_cfg.bit_depth = prtd->bits_per_sample;
|
||||
alac_cfg.num_channels = params->codec.ch_in;
|
||||
|
||||
alac_cfg.frame_length = alac->frame_length;
|
||||
alac_cfg.pb = alac->pb;
|
||||
alac_cfg.mb = alac->mb;
|
||||
alac_cfg.kb = alac->kb;
|
||||
alac_cfg.max_run = alac->max_run;
|
||||
alac_cfg.compatible_version = alac->compatible_version;
|
||||
alac_cfg.max_frame_bytes = alac->max_frame_bytes;
|
||||
|
||||
switch (params->codec.ch_in) {
|
||||
case 1:
|
||||
alac_cfg.channel_layout_tag = ALAC_CH_LAYOUT_MONO;
|
||||
break;
|
||||
case 2:
|
||||
alac_cfg.channel_layout_tag = ALAC_CH_LAYOUT_STEREO;
|
||||
break;
|
||||
}
|
||||
ret = q6asm_stream_media_format_block_alac(prtd->audio_client,
|
||||
&alac_cfg);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "ALAC CMD Format block failed:%d\n", ret);
|
||||
return -EIO;
|
||||
}
|
||||
break;
|
||||
|
||||
case SND_AUDIOCODEC_APE:
|
||||
memset(&ape_cfg, 0x0, sizeof(ape_cfg));
|
||||
ape = &codec_options->ape_d;
|
||||
|
||||
ape_cfg.sample_rate = params->codec.sample_rate;
|
||||
ape_cfg.num_channels = params->codec.ch_in;
|
||||
ape_cfg.bits_per_sample = prtd->bits_per_sample;
|
||||
|
||||
ape_cfg.compatible_version = ape->compatible_version;
|
||||
ape_cfg.compression_level = ape->compression_level;
|
||||
ape_cfg.format_flags = ape->format_flags;
|
||||
ape_cfg.blocks_per_frame = ape->blocks_per_frame;
|
||||
ape_cfg.final_frame_blocks = ape->final_frame_blocks;
|
||||
ape_cfg.total_frames = ape->total_frames;
|
||||
ape_cfg.seek_table_present = ape->seek_table_present;
|
||||
|
||||
ret = q6asm_stream_media_format_block_ape(prtd->audio_client,
|
||||
&ape_cfg);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "APE CMD Format block failed:%d\n", ret);
|
||||
return -EIO;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -793,9 +923,12 @@ static int q6asm_dai_compr_get_caps(struct snd_compr_stream *stream,
|
|||
caps->max_fragment_size = COMPR_PLAYBACK_MAX_FRAGMENT_SIZE;
|
||||
caps->min_fragments = COMPR_PLAYBACK_MIN_NUM_FRAGMENTS;
|
||||
caps->max_fragments = COMPR_PLAYBACK_MAX_NUM_FRAGMENTS;
|
||||
caps->num_codecs = 2;
|
||||
caps->num_codecs = 5;
|
||||
caps->codecs[0] = SND_AUDIOCODEC_MP3;
|
||||
caps->codecs[1] = SND_AUDIOCODEC_FLAC;
|
||||
caps->codecs[2] = SND_AUDIOCODEC_WMA;
|
||||
caps->codecs[3] = SND_AUDIOCODEC_ALAC;
|
||||
caps->codecs[4] = SND_AUDIOCODEC_APE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2 0x00010DA5
|
||||
#define ASM_MEDIA_FMT_MP3 0x00010BE9
|
||||
#define ASM_MEDIA_FMT_FLAC 0x00010C16
|
||||
#define ASM_MEDIA_FMT_WMA_V9 0x00010DA8
|
||||
#define ASM_MEDIA_FMT_WMA_V10 0x00010DA7
|
||||
#define ASM_DATA_CMD_WRITE_V2 0x00010DAB
|
||||
#define ASM_DATA_CMD_READ_V2 0x00010DAC
|
||||
#define ASM_SESSION_CMD_SUSPEND 0x00010DEC
|
||||
|
@ -46,6 +48,8 @@
|
|||
#define ASM_STREAM_CMD_OPEN_READ_V3 0x00010DB4
|
||||
#define ASM_DATA_EVENT_READ_DONE_V2 0x00010D9A
|
||||
#define ASM_STREAM_CMD_OPEN_READWRITE_V2 0x00010D8D
|
||||
#define ASM_MEDIA_FMT_ALAC 0x00012f31
|
||||
#define ASM_MEDIA_FMT_APE 0x00012f32
|
||||
|
||||
|
||||
#define ASM_LEGACY_STREAM_SESSION 0
|
||||
|
@ -104,6 +108,63 @@ struct asm_flac_fmt_blk_v2 {
|
|||
u16 reserved;
|
||||
} __packed;
|
||||
|
||||
struct asm_wmastdv9_fmt_blk_v2 {
|
||||
struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
|
||||
u16 fmtag;
|
||||
u16 num_channels;
|
||||
u32 sample_rate;
|
||||
u32 bytes_per_sec;
|
||||
u16 blk_align;
|
||||
u16 bits_per_sample;
|
||||
u32 channel_mask;
|
||||
u16 enc_options;
|
||||
u16 reserved;
|
||||
} __packed;
|
||||
|
||||
struct asm_wmaprov10_fmt_blk_v2 {
|
||||
struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
|
||||
u16 fmtag;
|
||||
u16 num_channels;
|
||||
u32 sample_rate;
|
||||
u32 bytes_per_sec;
|
||||
u16 blk_align;
|
||||
u16 bits_per_sample;
|
||||
u32 channel_mask;
|
||||
u16 enc_options;
|
||||
u16 advanced_enc_options1;
|
||||
u32 advanced_enc_options2;
|
||||
} __packed;
|
||||
|
||||
struct asm_alac_fmt_blk_v2 {
|
||||
struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
|
||||
u32 frame_length;
|
||||
u8 compatible_version;
|
||||
u8 bit_depth;
|
||||
u8 pb;
|
||||
u8 mb;
|
||||
u8 kb;
|
||||
u8 num_channels;
|
||||
u16 max_run;
|
||||
u32 max_frame_bytes;
|
||||
u32 avg_bit_rate;
|
||||
u32 sample_rate;
|
||||
u32 channel_layout_tag;
|
||||
} __packed;
|
||||
|
||||
struct asm_ape_fmt_blk_v2 {
|
||||
struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
|
||||
u16 compatible_version;
|
||||
u16 compression_level;
|
||||
u32 format_flags;
|
||||
u32 blocks_per_frame;
|
||||
u32 final_frame_blocks;
|
||||
u32 total_frames;
|
||||
u16 bits_per_sample;
|
||||
u16 num_channels;
|
||||
u32 sample_rate;
|
||||
u32 seek_table_present;
|
||||
} __packed;
|
||||
|
||||
struct asm_stream_cmd_set_encdec_param {
|
||||
u32 param_id;
|
||||
u32 param_size;
|
||||
|
@ -858,7 +919,7 @@ err:
|
|||
* Return: Will be an negative value on error or zero on success
|
||||
*/
|
||||
int q6asm_open_write(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample)
|
||||
u32 codec_profile, uint16_t bits_per_sample)
|
||||
{
|
||||
struct asm_stream_cmd_open_write_v3 *open;
|
||||
struct apr_pkt *pkt;
|
||||
|
@ -894,6 +955,30 @@ int q6asm_open_write(struct audio_client *ac, uint32_t format,
|
|||
case SND_AUDIOCODEC_FLAC:
|
||||
open->dec_fmt_id = ASM_MEDIA_FMT_FLAC;
|
||||
break;
|
||||
case SND_AUDIOCODEC_WMA:
|
||||
switch (codec_profile) {
|
||||
case SND_AUDIOPROFILE_WMA9:
|
||||
open->dec_fmt_id = ASM_MEDIA_FMT_WMA_V9;
|
||||
break;
|
||||
case SND_AUDIOPROFILE_WMA10:
|
||||
case SND_AUDIOPROFILE_WMA9_PRO:
|
||||
case SND_AUDIOPROFILE_WMA9_LOSSLESS:
|
||||
case SND_AUDIOPROFILE_WMA10_LOSSLESS:
|
||||
open->dec_fmt_id = ASM_MEDIA_FMT_WMA_V10;
|
||||
break;
|
||||
default:
|
||||
dev_err(ac->dev, "Invalid codec profile 0x%x\n",
|
||||
codec_profile);
|
||||
rc = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
case SND_AUDIOCODEC_ALAC:
|
||||
open->dec_fmt_id = ASM_MEDIA_FMT_ALAC;
|
||||
break;
|
||||
case SND_AUDIOCODEC_APE:
|
||||
open->dec_fmt_id = ASM_MEDIA_FMT_APE;
|
||||
break;
|
||||
default:
|
||||
dev_err(ac->dev, "Invalid format 0x%x\n", format);
|
||||
rc = -EINVAL;
|
||||
|
@ -1075,6 +1160,162 @@ int q6asm_stream_media_format_block_flac(struct audio_client *ac,
|
|||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6asm_stream_media_format_block_flac);
|
||||
|
||||
int q6asm_stream_media_format_block_wma_v9(struct audio_client *ac,
|
||||
struct q6asm_wma_cfg *cfg)
|
||||
{
|
||||
struct asm_wmastdv9_fmt_blk_v2 *fmt;
|
||||
struct apr_pkt *pkt;
|
||||
void *p;
|
||||
int rc, pkt_size;
|
||||
|
||||
pkt_size = APR_HDR_SIZE + sizeof(*fmt);
|
||||
p = kzalloc(pkt_size, GFP_KERNEL);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
pkt = p;
|
||||
fmt = p + APR_HDR_SIZE;
|
||||
|
||||
q6asm_add_hdr(ac, &pkt->hdr, pkt_size, true, ac->stream_id);
|
||||
|
||||
pkt->hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
|
||||
fmt->fmt_blk.fmt_blk_size = sizeof(*fmt) - sizeof(fmt->fmt_blk);
|
||||
fmt->fmtag = cfg->fmtag;
|
||||
fmt->num_channels = cfg->num_channels;
|
||||
fmt->sample_rate = cfg->sample_rate;
|
||||
fmt->bytes_per_sec = cfg->bytes_per_sec;
|
||||
fmt->blk_align = cfg->block_align;
|
||||
fmt->bits_per_sample = cfg->bits_per_sample;
|
||||
fmt->channel_mask = cfg->channel_mask;
|
||||
fmt->enc_options = cfg->enc_options;
|
||||
fmt->reserved = 0;
|
||||
|
||||
rc = q6asm_ac_send_cmd_sync(ac, pkt);
|
||||
kfree(pkt);
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6asm_stream_media_format_block_wma_v9);
|
||||
|
||||
int q6asm_stream_media_format_block_wma_v10(struct audio_client *ac,
|
||||
struct q6asm_wma_cfg *cfg)
|
||||
{
|
||||
struct asm_wmaprov10_fmt_blk_v2 *fmt;
|
||||
struct apr_pkt *pkt;
|
||||
void *p;
|
||||
int rc, pkt_size;
|
||||
|
||||
pkt_size = APR_HDR_SIZE + sizeof(*fmt);
|
||||
p = kzalloc(pkt_size, GFP_KERNEL);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
pkt = p;
|
||||
fmt = p + APR_HDR_SIZE;
|
||||
|
||||
q6asm_add_hdr(ac, &pkt->hdr, pkt_size, true, ac->stream_id);
|
||||
|
||||
pkt->hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
|
||||
fmt->fmt_blk.fmt_blk_size = sizeof(*fmt) - sizeof(fmt->fmt_blk);
|
||||
fmt->fmtag = cfg->fmtag;
|
||||
fmt->num_channels = cfg->num_channels;
|
||||
fmt->sample_rate = cfg->sample_rate;
|
||||
fmt->bytes_per_sec = cfg->bytes_per_sec;
|
||||
fmt->blk_align = cfg->block_align;
|
||||
fmt->bits_per_sample = cfg->bits_per_sample;
|
||||
fmt->channel_mask = cfg->channel_mask;
|
||||
fmt->enc_options = cfg->enc_options;
|
||||
fmt->advanced_enc_options1 = cfg->adv_enc_options;
|
||||
fmt->advanced_enc_options2 = cfg->adv_enc_options2;
|
||||
|
||||
rc = q6asm_ac_send_cmd_sync(ac, pkt);
|
||||
kfree(pkt);
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6asm_stream_media_format_block_wma_v10);
|
||||
|
||||
int q6asm_stream_media_format_block_alac(struct audio_client *ac,
|
||||
struct q6asm_alac_cfg *cfg)
|
||||
{
|
||||
struct asm_alac_fmt_blk_v2 *fmt;
|
||||
struct apr_pkt *pkt;
|
||||
void *p;
|
||||
int rc, pkt_size;
|
||||
|
||||
pkt_size = APR_HDR_SIZE + sizeof(*fmt);
|
||||
p = kzalloc(pkt_size, GFP_KERNEL);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
pkt = p;
|
||||
fmt = p + APR_HDR_SIZE;
|
||||
|
||||
q6asm_add_hdr(ac, &pkt->hdr, pkt_size, true, ac->stream_id);
|
||||
|
||||
pkt->hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
|
||||
fmt->fmt_blk.fmt_blk_size = sizeof(*fmt) - sizeof(fmt->fmt_blk);
|
||||
|
||||
fmt->frame_length = cfg->frame_length;
|
||||
fmt->compatible_version = cfg->compatible_version;
|
||||
fmt->bit_depth = cfg->bit_depth;
|
||||
fmt->num_channels = cfg->num_channels;
|
||||
fmt->max_run = cfg->max_run;
|
||||
fmt->max_frame_bytes = cfg->max_frame_bytes;
|
||||
fmt->avg_bit_rate = cfg->avg_bit_rate;
|
||||
fmt->sample_rate = cfg->sample_rate;
|
||||
fmt->channel_layout_tag = cfg->channel_layout_tag;
|
||||
fmt->pb = cfg->pb;
|
||||
fmt->mb = cfg->mb;
|
||||
fmt->kb = cfg->kb;
|
||||
|
||||
rc = q6asm_ac_send_cmd_sync(ac, pkt);
|
||||
kfree(pkt);
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6asm_stream_media_format_block_alac);
|
||||
|
||||
int q6asm_stream_media_format_block_ape(struct audio_client *ac,
|
||||
struct q6asm_ape_cfg *cfg)
|
||||
{
|
||||
struct asm_ape_fmt_blk_v2 *fmt;
|
||||
struct apr_pkt *pkt;
|
||||
void *p;
|
||||
int rc, pkt_size;
|
||||
|
||||
pkt_size = APR_HDR_SIZE + sizeof(*fmt);
|
||||
p = kzalloc(pkt_size, GFP_KERNEL);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
pkt = p;
|
||||
fmt = p + APR_HDR_SIZE;
|
||||
|
||||
q6asm_add_hdr(ac, &pkt->hdr, pkt_size, true, ac->stream_id);
|
||||
|
||||
pkt->hdr.opcode = ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2;
|
||||
fmt->fmt_blk.fmt_blk_size = sizeof(*fmt) - sizeof(fmt->fmt_blk);
|
||||
|
||||
fmt->compatible_version = cfg->compatible_version;
|
||||
fmt->compression_level = cfg->compression_level;
|
||||
fmt->format_flags = cfg->format_flags;
|
||||
fmt->blocks_per_frame = cfg->blocks_per_frame;
|
||||
fmt->final_frame_blocks = cfg->final_frame_blocks;
|
||||
fmt->total_frames = cfg->total_frames;
|
||||
fmt->bits_per_sample = cfg->bits_per_sample;
|
||||
fmt->num_channels = cfg->num_channels;
|
||||
fmt->sample_rate = cfg->sample_rate;
|
||||
fmt->seek_table_present = cfg->seek_table_present;
|
||||
|
||||
rc = q6asm_ac_send_cmd_sync(ac, pkt);
|
||||
kfree(pkt);
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6asm_stream_media_format_block_ape);
|
||||
|
||||
/**
|
||||
* q6asm_enc_cfg_blk_pcm_format_support() - setup pcm configuration for capture
|
||||
*
|
||||
|
|
|
@ -45,6 +45,47 @@ struct q6asm_flac_cfg {
|
|||
u16 md5_sum;
|
||||
};
|
||||
|
||||
struct q6asm_wma_cfg {
|
||||
u32 fmtag;
|
||||
u32 num_channels;
|
||||
u32 sample_rate;
|
||||
u32 bytes_per_sec;
|
||||
u32 block_align;
|
||||
u32 bits_per_sample;
|
||||
u32 channel_mask;
|
||||
u32 enc_options;
|
||||
u32 adv_enc_options;
|
||||
u32 adv_enc_options2;
|
||||
};
|
||||
|
||||
struct q6asm_alac_cfg {
|
||||
u32 frame_length;
|
||||
u8 compatible_version;
|
||||
u8 bit_depth;
|
||||
u8 pb;
|
||||
u8 mb;
|
||||
u8 kb;
|
||||
u8 num_channels;
|
||||
u16 max_run;
|
||||
u32 max_frame_bytes;
|
||||
u32 avg_bit_rate;
|
||||
u32 sample_rate;
|
||||
u32 channel_layout_tag;
|
||||
};
|
||||
|
||||
struct q6asm_ape_cfg {
|
||||
u16 compatible_version;
|
||||
u16 compression_level;
|
||||
u32 format_flags;
|
||||
u32 blocks_per_frame;
|
||||
u32 final_frame_blocks;
|
||||
u32 total_frames;
|
||||
u16 bits_per_sample;
|
||||
u16 num_channels;
|
||||
u32 sample_rate;
|
||||
u32 seek_table_present;
|
||||
};
|
||||
|
||||
typedef void (*q6asm_cb) (uint32_t opcode, uint32_t token,
|
||||
void *payload, void *priv);
|
||||
struct audio_client;
|
||||
|
@ -55,7 +96,7 @@ void q6asm_audio_client_free(struct audio_client *ac);
|
|||
int q6asm_write_async(struct audio_client *ac, uint32_t len, uint32_t msw_ts,
|
||||
uint32_t lsw_ts, uint32_t flags);
|
||||
int q6asm_open_write(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample);
|
||||
u32 codec_profile, uint16_t bits_per_sample);
|
||||
|
||||
int q6asm_open_read(struct audio_client *ac, uint32_t format,
|
||||
uint16_t bits_per_sample);
|
||||
|
@ -69,6 +110,14 @@ int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
|
|||
uint16_t bits_per_sample);
|
||||
int q6asm_stream_media_format_block_flac(struct audio_client *ac,
|
||||
struct q6asm_flac_cfg *cfg);
|
||||
int q6asm_stream_media_format_block_wma_v9(struct audio_client *ac,
|
||||
struct q6asm_wma_cfg *cfg);
|
||||
int q6asm_stream_media_format_block_wma_v10(struct audio_client *ac,
|
||||
struct q6asm_wma_cfg *cfg);
|
||||
int q6asm_stream_media_format_block_alac(struct audio_client *ac,
|
||||
struct q6asm_alac_cfg *cfg);
|
||||
int q6asm_stream_media_format_block_ape(struct audio_client *ac,
|
||||
struct q6asm_ape_cfg *cfg);
|
||||
int q6asm_run(struct audio_client *ac, uint32_t flags, uint32_t msw_ts,
|
||||
uint32_t lsw_ts);
|
||||
int q6asm_run_nowait(struct audio_client *ac, uint32_t flags, uint32_t msw_ts,
|
||||
|
|
Loading…
Reference in New Issue