static int audio_in_encoder_config(struct audio_in *audio) { audrec_cmd_arec0param_cfg cmd; uint16_t *data = (void *) audio->data; unsigned n; memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AUDREC_CMD_AREC0PARAM_CFG; cmd.ptr_to_extpkt_buffer_msw = audio->phys >> 16; cmd.ptr_to_extpkt_buffer_lsw = audio->phys; cmd.buf_len = FRAME_NUM; /* Both WAV and AAC use 8 frames */ cmd.samp_rate_index = audio->samp_rate_index; cmd.stereo_mode = audio->channel_mode; /* 0 for mono, 1 for stereo */ /* cmd.rec_quality is based on user set bit rate / sample rate / * channel */ cmd.rec_quality = audio->record_quality; /* prepare buffer pointers: * Mono: 1024 samples + 4 halfword header * Stereo: 2048 samples + 4 halfword header * AAC * Mono/Stere: 768 + 4 halfword header */ for (n = 0; n < FRAME_NUM; n++) { audio->in[n].data = data + 4; if (audio->type == AUDREC_CMD_TYPE_0_INDEX_WAV) data += (4 + (audio->channel_mode ? 2048 : 1024)); else if (audio->type == AUDREC_CMD_TYPE_0_INDEX_AAC) data += (4 + 768); } return audio_send_queue_rec(audio, &cmd, sizeof(cmd)); }
static int audpcm_in_encmem_config(struct audio_in *audio) { struct audrec_cmd_arecmem_cfg cmd; uint16_t cnt = 0; uint16_t *data = (void *) audio->data; memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AUDREC_CMD_ARECMEM_CFG; cmd.audrec_obj_idx = audio->audrec_obj_idx; /* Rate at which packet complete message comes */ cmd.audrec_up_pkt_intm_cnt = 1; cmd.audrec_extpkt_buffer_msw = audio->phys >> 16; cmd.audrec_extpkt_buffer_lsw = audio->phys; /* Max Buffer no available for frames */ cmd.audrec_extpkt_buffer_num = FRAME_NUM; /* prepare buffer pointers: * Mono: 1024 samples + 4 halfword header * Stereo: 2048 samples + 4 halfword header */ for (cnt = 0; cnt < FRAME_NUM; cnt++) { audio->in[cnt].data = data + 4; data += (4 + (audio->channel_mode ? 2048 : 1024)); } return audio_send_queue_rec(audio, &cmd, sizeof(cmd)); }
int audrec_encoder_config(struct msm_audio *prtd) { audrec_cmd_arec0param_cfg cmd; uint16_t *data = (void *)prtd->data; unsigned n; memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AUDREC_CMD_AREC0PARAM_CFG; cmd.ptr_to_extpkt_buffer_msw = prtd->phys >> 16; cmd.ptr_to_extpkt_buffer_lsw = prtd->phys; cmd.buf_len = FRAME_NUM; /* Both WAV and AAC use 8 frames */ cmd.samp_rate_index = prtd->samp_rate_index; /* 0 for mono, 1 for stereo */ cmd.stereo_mode = prtd->channel_mode; cmd.rec_quality = 0x1C00; /* prepare buffer pointers: * Mono: 1024 samples + 4 halfword header * Stereo: 2048 samples + 4 halfword header */ for (n = 0; n < FRAME_NUM; n++) { prtd->in[n].data = data + 4; data += (4 + (prtd->channel_mode ? 2048 : 1024)); } return audio_send_queue_rec(prtd, &cmd, sizeof(cmd)); }
static int audio_in_dsp_enable(struct audio_in *audio, int enable) { audrec_cmd_cfg cmd; memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AUDREC_CMD_CFG; cmd.type_0 = enable ? AUDREC_CMD_TYPE_0_ENA : AUDREC_CMD_TYPE_0_DIS; cmd.type_0 |= (AUDREC_CMD_TYPE_0_UPDATE | audio->type); cmd.type_1 = 0; return audio_send_queue_rec(audio, &cmd, sizeof(cmd)); }
static int audpcm_in_encparam_config(struct audio_in *audio) { struct audrec_cmd_arecparam_wav_cfg cmd; memset(&cmd, 0, sizeof(cmd)); cmd.common.cmd_id = AUDREC_CMD_ARECPARAM_CFG; cmd.common.audrec_obj_idx = audio->audrec_obj_idx; cmd.samp_rate_idx = audio->samp_rate_index; cmd.stereo_mode = audio->channel_mode; /* 0 for mono, 1 for stereo */ return audio_send_queue_rec(audio, &cmd, sizeof(cmd)); }
int audrec_dsp_enable(struct msm_audio *prtd, int enable) { audrec_cmd_cfg cmd; memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AUDREC_CMD_CFG; cmd.type_0 = enable ? AUDREC_CMD_TYPE_0_ENA : AUDREC_CMD_TYPE_0_DIS; cmd.type_0 |= (AUDREC_CMD_TYPE_0_UPDATE | prtd->type); cmd.type_1 = 0; return audio_send_queue_rec(prtd, &cmd, sizeof(cmd)); }
static int audpcm_in_dsp_enable(struct audio_in *audio, int enable) { struct audrec_cmd_enc_cfg cmd; memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AUDREC_CMD_ENC_CFG; cmd.audrec_enc_type = (audio->enc_type & 0xFF) | (enable ? AUDREC_CMD_ENC_ENA : AUDREC_CMD_ENC_DIS); /* Don't care */ cmd.audrec_obj_idx = audio->audrec_obj_idx; return audio_send_queue_rec(audio, &cmd, sizeof(cmd)); }
static int audpcm_in_encmem_config(struct audio_in *audio) { struct audrec_cmd_arecmem_cfg cmd; uint16_t cnt = 0; uint16_t *data = (void *) audio->data; memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AUDREC_CMD_ARECMEM_CFG; cmd.audrec_obj_idx = audio->audrec_obj_idx; cmd.audrec_up_pkt_intm_cnt = 1; cmd.audrec_extpkt_buffer_msw = audio->phys >> 16; cmd.audrec_extpkt_buffer_lsw = audio->phys; cmd.audrec_extpkt_buffer_num = FRAME_NUM; for (cnt = 0; cnt < FRAME_NUM; cnt++) { audio->in[cnt].data = data + 4; data += (4 + (audio->channel_mode ? 2048 : 1024)); } return audio_send_queue_rec(audio, &cmd, sizeof(cmd)); }