/* * Send RPC_ADSP_RTOS_CMD_GET_INIT_INFO cmd to ARM9 and get * queue offsets and module entries (init info) as part of the event. */ static void msm_get_init_info(void) { struct adsp_rtos_atom_cmd cmd; int err; cmd.cmd = RPC_ADSP_RTOS_CMD_GET_INIT_INFO; cmd.proc_id = RPC_ADSP_RTOS_PROC_APPS; cmd.module = 0; cmd.cb_handle = adsp_info.cb_handle; err = dalrpc_fcn_5(DALDEVICE_ADSP_CMD_IDX | 0x80000000, adsp_info.handle, &cmd, sizeof(cmd)); if (err < 0) MM_ERR("INIT_INFO command send Failed\n"); }
/*===========================================================================*/ s32 cad_rpc_data(u32 stream_id, u32 group_id, void *data_buf, u32 data_buf_len, union adsp_audio_event *ret_evt) { s32 err = CAD_RES_SUCCESS; if (stream_id >= CAD_MAX_SESSION || group_id >= CAD_MAX_SESSION || !data_buf) return CAD_RES_FAILURE; ((union adsp_audio_command *)data_buf)->no_payload.dest.domain = ADSP_AUDIO_ADDRESS_DOMAIN_DSP; ((union adsp_audio_command *)data_buf)->no_payload.dest.service = ADSP_AUDIO_ADDRESS_SERVICE_AUDIO; ((union adsp_audio_command *)data_buf)->no_payload.dest.major = (u8)group_id; ((union adsp_audio_command *)data_buf)->no_payload.dest.minor = (u8)stream_id; ((union adsp_audio_command *)data_buf)->no_payload.source.domain = (u8)cad_rpc_data_type.processor_id; ((union adsp_audio_command *)data_buf)->no_payload.source.service = ADSP_AUDIO_ADDRESS_SERVICE_AUDIO; ((union adsp_audio_command *)data_buf)->no_payload.source.major = (u8)group_id; ((union adsp_audio_command *)data_buf)->no_payload.source.minor = (u8)stream_id; mutex_lock(&cad_rpc_data_type.remote_mutex_list[stream_id]); err = dalrpc_fcn_5(ADSP_RPC_DATA, cad_rpc_data_type.remote_handle, data_buf, data_buf_len); mutex_unlock(&cad_rpc_data_type.remote_mutex_list[stream_id]); if (err) pr_err("CAD:RPC Data rpc call returned err: %d\n", err); return err; }
static int voice_cmd_audio_loopback_end(struct voice_data *v) { struct voice_header hdr; int err; hdr.id = CMD_AUDIO_LP_END; hdr.data_len = 0; printk(KERN_ERR "[MyTag]voice_cmd_audio_loopback_end()"); err = dalrpc_fcn_5(VOICE_DALRPC_CMD, v->handle, &hdr, sizeof(struct voice_header)); if (err) MM_ERR("Voice acquire done command failed\n"); return err; }
static int voice_cmd_change(void) { struct voice_header hdr; struct voice_data *v = &voice; int err; hdr.id = CMD_DEVICE_CHANGE; hdr.data_len = 0; MM_DBG("\n"); /* Macro prints the file name and function */ err = dalrpc_fcn_5(VOICE_DALRPC_CMD, v->handle, &hdr, sizeof(struct voice_header)); if (err) MM_ERR("Voice change command failed\n"); return err; }
static int rpc_adsp_rtos_app_to_modem(uint32_t cmd, uint32_t module, struct msm_adsp_module *adsp_module) { struct adsp_rtos_atom_cmd adspsvc_cmd; int err; adspsvc_cmd.cmd = cmd; adspsvc_cmd.proc_id = RPC_ADSP_RTOS_PROC_APPS; adspsvc_cmd.module = module; adspsvc_cmd.cb_handle = adsp_info.cb_handle; err = dalrpc_fcn_5(DALDEVICE_ADSP_CMD_IDX | 0x80000000, adsp_info.handle, &adspsvc_cmd, sizeof(adspsvc_cmd)); if (err < 0) MM_AUD_ERR("ADSP command send Failed\n"); return 0; }
static int voice_cmd_acquire_done(struct voice_data *v) { struct voice_header hdr; int err; hdr.id = CMD_ACQUIRE_DONE; hdr.data_len = 0; MM_INFO("\n"); /* Macro prints the file name and function */ /* Enable HW sidetone if device supports it */ msm_snddev_enable_sidetone(v->dev_rx.dev_id, 1); err = dalrpc_fcn_5(VOICE_DALRPC_CMD, v->handle, &hdr, sizeof(struct voice_header)); if (err) MM_ERR("Voice acquire done command failed\n"); return err; }
static int voice_cmd_init(struct voice_data *v) { struct voice_init cmd; int err; MM_DBG("\n"); /* Macro prints the file name and function */ cmd.hdr.id = CMD_VOICE_INIT; cmd.hdr.data_len = sizeof(struct voice_init) - sizeof(struct voice_header); cmd.cb_handle = v->cb_handle; err = dalrpc_fcn_5(VOICE_DALRPC_CMD, v->handle, &cmd, sizeof(struct voice_init)); if (err) MM_ERR("Voice init command failed\n"); return err; }
static int voice_cmd_device_info(struct voice_data *v) { struct voice_device cmd; int err, vol; MM_ERR("tx_dev=%d, rx_dev=%d, tx_sample=%d, tx_mute=%d, rx_mute=%d\n", v->dev_tx.dev_acdb_id, v->dev_rx.dev_acdb_id, v->dev_tx.sample, v->dev_tx.mute, v->dev_rx.mute); mutex_lock(&voice.vol_lock); cmd.hdr.id = CMD_DEVICE_INFO; cmd.hdr.data_len = sizeof(struct voice_device) - sizeof(struct voice_header); cmd.tx_device = v->dev_tx.dev_acdb_id; cmd.rx_device = v->dev_rx.dev_acdb_id; if (v->network == NETWORK_WCDMA_WB) vol = v->min_rx_vol[VOC_WB_INDEX] + ((v->max_rx_vol[VOC_WB_INDEX] - v->min_rx_vol[VOC_WB_INDEX]) * v->dev_rx.volume)/100; else vol = v->min_rx_vol[VOC_NB_INDEX] + ((v->max_rx_vol[VOC_NB_INDEX] - v->min_rx_vol[VOC_NB_INDEX]) * v->dev_rx.volume)/100; cmd.rx_volume = (u32)vol; /* in mb */ cmd.rx_mute = v->dev_rx.mute; cmd.tx_mute = v->dev_tx.mute; cmd.rx_sample = v->dev_rx.sample/1000; cmd.tx_sample = v->dev_tx.sample/1000; MM_DBG("rx_vol=%d, rx_sample=%d\n", cmd.rx_volume, v->dev_rx.sample); err = dalrpc_fcn_5(VOICE_DALRPC_CMD, v->handle, &cmd, sizeof(struct voice_device)); mutex_unlock(&voice.vol_lock); if (err) MM_ERR("Voice device command failed\n"); return err; }
s32 cad_rpc_control(u32 stream_id, u32 group_id, void *cmd_buf, u32 cmd_buf_len, union adsp_audio_event *ret_evt) { s32 err = CAD_RES_SUCCESS; if (stream_id >= CAD_MAX_SESSION || group_id >= CAD_MAX_SESSION || !cmd_buf) return CAD_RES_FAILURE; ((union adsp_audio_command *)cmd_buf)->no_payload.dest.domain = ADSP_AUDIO_ADDRESS_DOMAIN_DSP; ((union adsp_audio_command *)cmd_buf)->no_payload.dest.service = ADSP_AUDIO_ADDRESS_SERVICE_AUDIO; ((union adsp_audio_command *)cmd_buf)->no_payload.dest.major = (u8)group_id; ((union adsp_audio_command *)cmd_buf)->no_payload.dest.minor = (u8)stream_id; ((union adsp_audio_command *)cmd_buf)->no_payload.source.domain = (u8)cad_rpc_data_type.processor_id; ((union adsp_audio_command *)cmd_buf)->no_payload.source.service = ADSP_AUDIO_ADDRESS_SERVICE_AUDIO; ((union adsp_audio_command *)cmd_buf)->no_payload.source.major = (u8)group_id; ((union adsp_audio_command *)cmd_buf)->no_payload.source.minor = (u8)stream_id; D("CAD:RPC Control stream (%d), Cmd(0x%x)\n", stream_id, ((union adsp_audio_command *)cmd_buf)->no_payload.cmd.op_code); mutex_lock(&cad_rpc_data_type.remote_mutex_list[stream_id]); init_completion(&cad_rpc_data_type.compl_list[stream_id]); err = dalrpc_fcn_5(ADSP_RPC_CONTROL, cad_rpc_data_type.remote_handle, cmd_buf, cmd_buf_len); if (err) pr_err("CAD:RPC Data rpc call returned err: %d\n", err); if (!err && ((union adsp_audio_command *)cmd_buf)->no_payload. cmd.response_type == ADSP_AUDIO_RESPONSE_COMMAND) { D("DALRPC Open function start wait!!!\n"); wait_for_completion(&cad_rpc_data_type.compl_list[stream_id]); if (ret_evt != NULL) { mutex_lock(&cad_rpc_data_type.resource_mutex); memcpy(ret_evt, &cad_rpc_data_type.sync_evt_queue[stream_id], sizeof(*ret_evt)); mutex_unlock(&cad_rpc_data_type.resource_mutex); } } mutex_unlock(&cad_rpc_data_type.remote_mutex_list[stream_id]); D("CAD:RPC Control stream (%d), Cmd(0x%x) DONE!\n", stream_id, ((union adsp_audio_command *)cmd_buf)->no_payload.cmd.op_code); return err; }