diff --git a/include/sound/q6asm-v2.h b/include/sound/q6asm-v2.h index 2ee5ff72e4a..182da1c88be 100644 --- a/include/sound/q6asm-v2.h +++ b/include/sound/q6asm-v2.h @@ -66,6 +66,7 @@ #define SYNC_IO_MODE 0x0001 #define ASYNC_IO_MODE 0x0002 +#define COMPRESSED_IO 0x0040 #define NT_MODE 0x0400 diff --git a/sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c index 01a9538750a..d85bbbcac48 100644 --- a/sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-compr-q6-v2.c @@ -148,17 +148,14 @@ static void compr_event_handler(uint32_t opcode, ((unsigned int)buf[0].phys + (prtd->out_head * prtd->pcm_count))); - if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) time_stamp_flag = SET_TIMESTAMP; - memcpy(&output_meta_data, (char *)(buf->data + + else + time_stamp_flag = NO_TIMESTAMP; + memcpy(&output_meta_data, (char *)(buf->data + prtd->out_head * prtd->pcm_count), COMPRE_OUTPUT_METADATA_SIZE); - } else { - time_stamp_flag = NO_TIMESTAMP; - memset(&output_meta_data, 0, - COMPRE_OUTPUT_METADATA_SIZE); - output_meta_data.frame_size = prtd->pcm_count; - } + buffer_length = output_meta_data.frame_size; pr_debug("meta_data_length: %d, frame_length: %d\n", output_meta_data.meta_data_length, @@ -257,17 +254,13 @@ static void compr_event_handler(uint32_t opcode, __func__, prtd->out_head, ((unsigned int)buf[0].phys + (prtd->out_head * prtd->pcm_count))); - if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) time_stamp_flag = SET_TIMESTAMP; - memcpy(&output_meta_data, (char *)(buf->data + + else + time_stamp_flag = NO_TIMESTAMP; + memcpy(&output_meta_data, (char *)(buf->data + prtd->out_head * prtd->pcm_count), COMPRE_OUTPUT_METADATA_SIZE); - } else { - time_stamp_flag = NO_TIMESTAMP; - memset(&output_meta_data, 0, - COMPRE_OUTPUT_METADATA_SIZE); - output_meta_data.frame_size = prtd->pcm_count; - } buffer_length = output_meta_data.frame_size; pr_debug("meta_data_length: %d, frame_length: %d\n", output_meta_data.meta_data_length, @@ -774,7 +767,8 @@ static int msm_compr_hw_params(struct snd_pcm_substream *substream, } } - ret = q6asm_set_io_mode(prtd->audio_client, ASYNC_IO_MODE); + ret = q6asm_set_io_mode(prtd->audio_client, + (COMPRESSED_IO | ASYNC_IO_MODE)); if (ret < 0) { pr_err("%s: Set IO mode failed\n", __func__); return -ENOMEM; diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c index 072e293e6bf..875bf47537c 100644 --- a/sound/soc/msm/qdsp6v2/q6asm.c +++ b/sound/soc/msm/qdsp6v2/q6asm.c @@ -476,9 +476,13 @@ void q6asm_audio_client_free(struct audio_client *ac) return; } -int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode) +int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode1) { + uint32_t mode; + ac->io_mode &= 0xFF00; + mode = (mode1 & 0xF); + pr_debug("%s ac->mode after anding with FF00:0x[%x],\n", __func__, ac->io_mode); if (ac == NULL) { @@ -486,7 +490,7 @@ int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode) return -EINVAL; } if ((mode == ASYNC_IO_MODE) || (mode == SYNC_IO_MODE)) { - ac->io_mode |= mode; + ac->io_mode |= mode1; pr_debug("%s:Set Mode to 0x[%x]\n", __func__, ac->io_mode); return 0; } else { @@ -2961,6 +2965,7 @@ int q6asm_async_write(struct audio_client *ac, struct audio_port_data *port; u32 lbuf_addr_lsw; u32 liomode; + u32 io_compressed; if (!ac || ac->apr == NULL) { pr_err("%s: APR handle NULL\n", __func__); @@ -2981,9 +2986,12 @@ int q6asm_async_write(struct audio_client *ac, write.timestamp_msw = param->msw_ts; write.timestamp_lsw = param->lsw_ts; liomode = (ASYNC_IO_MODE | NT_MODE); + io_compressed = (ASYNC_IO_MODE | COMPRESSED_IO); if (ac->io_mode == liomode) lbuf_addr_lsw = (write.buf_addr_lsw - 32); + else if (ac->io_mode == io_compressed) + lbuf_addr_lsw = (write.buf_addr_lsw - 0x40); else lbuf_addr_lsw = write.buf_addr_lsw;