static int aux_pcm_probe(struct platform_device *pdev) { int rc = 0; struct resource *mem_src; MM_INFO("aux_pcm_probe \n"); mem_src = platform_get_resource_byname(pdev, IORESOURCE_MEM, "aux_codec_reg_addr"); if (!mem_src) { rc = -ENODEV; goto done; } the_aux_pcm_state.aux_pcm_base = ioremap(mem_src->start, (mem_src->end - mem_src->start) + 1); if (!the_aux_pcm_state.aux_pcm_base) { rc = -ENOMEM; goto done; } rc = get_aux_pcm_gpios(pdev); if (rc) { MM_ERR("GPIO configuration failed\n"); rc = -ENODEV; } done: return rc; }
static void afe_dsp_event(void *data, unsigned id, size_t len, void (*getevent)(void *ptr, size_t len)) { struct msm_afe_state *afe = data; MM_DBG("msg_id %d \n", id); switch (id) { case AFE_APU_MSG_CODEC_CONFIG_ACK: { struct afe_msg_codec_config_ack afe_ack; getevent(&afe_ack, AFE_APU_MSG_CODEC_CONFIG_ACK_LEN); MM_DBG("%s: device_id: %d device activity: %d\n", __func__, afe_ack.device_id, afe_ack.device_activity); if (afe_ack.device_activity == AFE_MSG_CODEC_CONFIG_DISABLED) afe->codec_config[GETDEVICEID(afe_ack.device_id)] = 0; else afe->codec_config[GETDEVICEID(afe_ack.device_id)] = afe_ack.device_activity; wake_up(&afe->wait); break; } case AFE_APU_MSG_VOC_TIMING_SUCCESS: MM_INFO("Received VOC_TIMING_SUCCESS message from AFETASK\n"); break; case ADSP_MESSAGE_ID: MM_DBG("Received ADSP event: module enable/disable(audpptask)"); break; default: MM_ERR("unexpected message from afe \n"); } return; }
static ssize_t snddev_icodec_debug_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char *lb_str = filp->private_data; char cmd; if (get_user(cmd, ubuf)) return -EFAULT; MM_INFO("%s %c\n", lb_str, cmd); if (!strcmp(lb_str, "adie_loopback")) { switch (cmd) { case '1': debugfs_adie_loopback(1); break; case '0': debugfs_adie_loopback(0); break; } } else if (!strcmp(lb_str, "afe_loopback")) { switch (cmd) { case '1': debugfs_afe_loopback(1); break; case '0': debugfs_afe_loopback(0); break; } } return cnt; }
static int msm_device_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int rc = -EPERM; struct msm_snddev_info *dev_info; int dev_id = ucontrol->value.integer.value[0]; int volume = ucontrol->value.integer.value[1]; MM_DBG("dev_id = %d, volume = %d\n", dev_id, volume); dev_info = audio_dev_ctrl_find_dev(dev_id); if (IS_ERR(dev_info)) { rc = PTR_ERR(dev_info); MM_ERR("audio_dev_ctrl_find_dev failed. %ld\n", PTR_ERR(dev_info)); return rc; } MM_DBG("dev_name = %s dev_id = %d, volume = %d\n", dev_info->name, dev_id, volume); if (dev_info->dev_ops.set_device_volume) rc = dev_info->dev_ops.set_device_volume(dev_info, volume); else { MM_INFO("device %s does not support device volume " "control.", dev_info->name); return -EPERM; } return rc; }
static int __init snddev_ecodec_init(void) { int rc = 0; struct snddev_ecodec_drv_state *ecodec_drv = &snddev_ecodec_drv; MM_INFO("snddev_ecodec_init\n"); rc = platform_driver_register(&snddev_ecodec_driver); if (IS_ERR_VALUE(rc)) goto error_platform_driver; ecodec_drv->ecodec_clk = clk_get(NULL, "ecodec_clk"); if (IS_ERR(ecodec_drv->ecodec_clk)) goto error_ecodec_clk; ecodec_drv->lpa_core_clk = clk_get(NULL, "lpa_core_clk"); if (IS_ERR(ecodec_drv->lpa_core_clk)) goto error_lpa_core_clk; mutex_init(&ecodec_drv->dev_lock); ecodec_drv->rx_active = 0; ecodec_drv->tx_active = 0; return 0; error_lpa_core_clk: clk_put(ecodec_drv->ecodec_clk); error_ecodec_clk: platform_driver_unregister(&snddev_ecodec_driver); error_platform_driver: MM_ERR("encounter error\n"); return -ENODEV; }
int afe_config_fm_volume(uint16_t volume) { struct afe_cmd_fm_volume_config cmd; struct msm_afe_state *afe = &the_afe_state; int rc = 0; MM_INFO(" configure fm volume\n"); mutex_lock(&afe->lock); if (!afe->in_use) { /* enable afe */ rc = msm_adsp_get("AFETASK", &afe->mod, &afe->adsp_ops, afe); if (rc < 0) { MM_ERR("%s: failed to get AFETASK module\n", __func__); goto error_adsp_get; } rc = msm_adsp_enable(afe->mod); if (rc < 0) goto error_adsp_enable; } memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AFE_CMD_FM_PLAYBACK_VOLUME_CMD; cmd.volume = volume; afe_send_queue(afe, &cmd, sizeof(cmd)); mutex_unlock(&afe->lock); return rc; error_adsp_enable: msm_adsp_put(afe->mod); error_adsp_get: mutex_unlock(&afe->lock); return rc; }
/******************************************************************************* * Function Name : afe_config_loopback * Args : enable or disable DSP loopback. * dependencies : If QCOM changes ADSP firmware loopback command may not work. * ********************************************************************************/ int afe_config_loopback(uint16_t enable) { struct afe_cmd_loopback_config cmd; struct msm_afe_state *afe = &the_afe_state; int rc = 0; MM_INFO(" configure loopback %d\n",enable); mutex_lock(&afe->lock); if (!afe->in_use) { /* enable afe */ rc = msm_adsp_get("AFETASK", &afe->mod, &afe->adsp_ops, afe); if (rc < 0) { MM_ERR("%s: failed to get AFETASK module\n", __func__); goto error_adsp_get; } rc = msm_adsp_enable(afe->mod); if (rc < 0) goto error_adsp_enable; } memset(&cmd, 0, sizeof(cmd)); cmd.cmd_id = AFE_CMD_VOICE_LOOPBACK_CMD; cmd.enable = enable; afe_send_queue(afe, &cmd, sizeof(cmd)); mutex_unlock(&afe->lock); return rc; error_adsp_enable: msm_adsp_put(afe->mod); error_adsp_get: mutex_unlock(&afe->lock); return rc; }
static int lge_amp_ctl_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct amp_data *data; struct i2c_adapter *adapter = client->adapter; int err; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { err = -EOPNOTSUPP; return err; } MM_INFO("\n"); data = kzalloc(sizeof(struct amp_data), GFP_KERNEL); if (NULL == data) return -ENOMEM; _data = data; data->client = client; i2c_set_clientdata(client, data); if (lge_bd_rev >= LGE_REV_B) wm9093_amp_init(data); else tpa2055_amp_init(data); MM_ERR("%s chip found : bd rev : %d\n", client->name, lge_bd_rev); data->amp_off_all(); err = misc_register(&lge_amp_misc); return 0; }
static void audrec_dsp_event(void *data, unsigned id, size_t len, void (*getevent)(void *ptr, size_t len)) { struct audio_in *audio = data; uint16_t msg[3]; getevent(msg, sizeof(msg)); switch (id) { case AUDREC_MSG_CMD_CFG_DONE_MSG: if (msg[0] & AUDREC_MSG_CFG_DONE_TYPE_0_UPDATE) { if (msg[0] & AUDREC_MSG_CFG_DONE_TYPE_0_ENA) { MM_INFO("CFG ENABLED\n"); audio_in_encoder_config(audio); } else { MM_INFO("CFG SLEEP\n"); audio->running = 0; audio->tx_agc_enable = 0; audio->ns_enable = 0; audio->iir_enable = 0; } } else { MM_INFO("CMD_CFG_DONE %x\n", msg[0]); } break; case AUDREC_MSG_CMD_AREC_PARAM_CFG_DONE_MSG: { MM_INFO("PARAM CFG DONE\n"); audio->running = 1; audio_dsp_set_tx_agc(audio); audio_dsp_set_ns(audio); audio_dsp_set_iir(audio); break; } case AUDREC_MSG_FATAL_ERR_MSG: MM_ERR("ERROR %x\n", msg[0]); break; case AUDREC_MSG_PACKET_READY_MSG: /* REC_DBG("type %x, count %d", msg[0], (msg[1] | (msg[2] << 16))); */ audio_in_get_dsp_frames(audio); break; case ADSP_MESSAGE_ID: MM_DBG("Received ADSP event: module \ enable/disable(audrectask)\n"); break; default: MM_ERR("unknown event %d\n", id); } }
int msm_adsp_get(const char *name, struct msm_adsp_module **out, struct msm_adsp_ops *ops, void *driver_data) { struct msm_adsp_module *module; int rc = 0; static uint32_t init_info_cmd_sent; mutex_lock(&adsp_info.lock); if (!init_info_cmd_sent) { init_waitqueue_head(&adsp_info.init_info_wait); msm_get_init_info(); rc = wait_event_timeout(adsp_info.init_info_wait, adsp_info.init_info_state == ADSP_STATE_INIT_INFO, 5 * HZ); if (!rc) { MM_ERR("INIT_INFO failed\n"); mutex_unlock(&adsp_info.lock); return -ETIMEDOUT; } init_info_cmd_sent++; } mutex_unlock(&adsp_info.lock); module = find_adsp_module_by_name(&adsp_info, name); if (!module) return -ENODEV; mutex_lock(&module->lock); MM_INFO("opening module %s\n", module->name); if (module->ops) { rc = -EBUSY; goto done; } rc = adsp_rpc_init(module); if (rc) goto done; module->ops = ops; module->driver_data = driver_data; *out = module; rc = rpc_adsp_rtos_app_to_modem(RPC_ADSP_RTOS_CMD_REGISTER_APP, module->id, module); if (rc) { module->ops = NULL; module->driver_data = NULL; *out = NULL; MM_ERR("REGISTER_APP failed\n"); goto done; } MM_DBG("module %s has been registered\n", module->name); done: mutex_unlock(&module->lock); return rc; }
static void remote_cb_function(void *context, u32 param, void *evt_buf, u32 len) { struct voice_header *hdr; struct voice_data *v = context; hdr = (struct voice_header *)evt_buf; MM_INFO("len=%d id=%d\n", len, hdr->id); if (len <= 0) { MM_ERR("unexpected event with length %d \n", len); return; } switch (hdr->id) { case EVENT_ACQUIRE_START: atomic_inc(&v->acq_start_flag); wake_up(&v->dev_wait); mutex_lock(&voice.lock); v->voc_event = VOICE_ACQUIRE_START; v->network = ((struct voice_network *)evt_buf)->network_info; mutex_unlock(&voice.lock); complete(&v->complete); break; case EVENT_RELEASE_START: /* If ACQUIRED come in before the RELEASE, * will only services the RELEASE */ atomic_inc(&v->rel_start_flag); wake_up(&v->voc_wait); wake_up(&v->dev_wait); mutex_lock(&voice.lock); v->voc_event = VOICE_RELEASE_START; mutex_unlock(&voice.lock); complete(&v->complete); break; case EVENT_CHANGE_START: mutex_lock(&voice.lock); v->voc_event = VOICE_CHANGE_START; mutex_unlock(&voice.lock); complete(&v->complete); break; case EVENT_NETWORK_RECONFIG: /* send network change to audio_dev, if sample rate is less than 16k, otherwise, send acquire done */ mutex_lock(&voice.lock); v->voc_event = VOICE_NETWORK_RECONFIG; v->network = ((struct voice_network *)evt_buf)->network_info; mutex_unlock(&voice.lock); complete(&v->complete); break; default: MM_ERR("Undefined event %d \n", hdr->id); } }
static int lge_amp_ctl_remove(struct i2c_client *client) { struct amp_data *data = i2c_get_clientdata(client); kfree(data); MM_INFO("\n"); i2c_set_clientdata(client, NULL); return 0; }
void set_amp_speaker_stereo_audio(void) { int fail=0; fail |= WriteI2C(SUBSYSTEM_CONTROL, (~SWS & ~BYPASS & ~SSM_EN)); fail |= WriteI2C(INPUT_CONTROL, (amp_cal_data[SPEAKER_AUDIO_INPUT] | IN2_SE)); //Modify for desired IN gain fail |= WriteI2C(SPEAKER_VOLUME, (SPK_EN | amp_cal_data[SPEAKER_AUDIO_OUTPUT])); //Modify for desired SP gain fail |= WriteI2C(SPEAKER_OUTPUT, SPKOUT_IN2); MM_INFO("7 set_amp_speaker_stereo_voice() %d\n", fail); }
static int voice_cmd_device_info(struct voice_data *v) { struct voice_device cmd; int err, vol; MM_INFO("tx_dev=%d, rx_dev=%d, tx_sample=%d, tx_mute=%d\n", v->dev_tx.dev_acdb_id, v->dev_rx.dev_acdb_id, v->dev_tx.sample, v->dev_tx.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 = 0; cmd.tx_mute = v->dev_tx.mute; cmd.rx_sample = v->dev_rx.sample/1000; cmd.tx_sample = v->dev_tx.sample/1000; #if 1 // CPAUDIO : send more info to CP from AP if (v->network == NETWORK_WCDMA_WB) { cmd.rx_volume_min = v->min_rx_vol[VOC_WB_INDEX]; cmd.rx_volume_max = v->max_rx_vol[VOC_WB_INDEX]; } else { cmd.rx_volume_min = v->min_rx_vol[VOC_NB_INDEX]; cmd.rx_volume_max = v->max_rx_vol[VOC_NB_INDEX]; } cmd.rx_volume_percentage = v->dev_rx.volume; #endif 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; }
static void __exit afe_exit(void) { MM_INFO("AFE driver exit\n"); #ifdef CONFIG_DEBUG_FS if (debugfs_afelb) debugfs_remove(debugfs_afelb); #endif if (the_afe_state.mod) msm_adsp_put(the_afe_state.mod); return; }
/* ------------------- dsp --------------------- */ static void audpre_dsp_event(void *data, unsigned id, size_t len, void (*getevent)(void *ptr, size_t len)) { uint16_t msg[2]; getevent(msg, sizeof(msg)); switch (id) { case AUDPREPROC_MSG_CMD_CFG_DONE_MSG: MM_INFO("type %d, status_flag %d\n", msg[0], msg[1]); break; case AUDPREPROC_MSG_ERROR_MSG_ID: MM_INFO("err_index %d\n", msg[0]); break; case ADSP_MESSAGE_ID: MM_DBG("Received ADSP event: module enable(audpreproctask)\n"); break; default: MM_ERR("unknown event %d\n", id); } }
void set_amp_headset_mono_voice(void) { int fail=0; fail |= WriteI2C(SUBSYSTEM_CONTROL, (~SWS & ~BYPASS & ~SSM_EN)); fail |= WriteI2C(INPUT_CONTROL, (amp_cal_data[HEADSET_VOICE_INPUT] | IN1_DIFF)); //Modify for desired IN gain fail |= WriteI2C(HP_LEFT_VOLUME, (HPL_VOL_M60DB | HPL_EN | HP_TRACK)); fail |= WriteI2C(HP_RIGHT_VOLUME, (HPR_VOL_M60DB | HPR_EN)); fail |= WriteI2C(HEADPHONE_OUTPUT, HPOUT_IN1); fail |= WriteI2C(HP_LEFT_VOLUME, (amp_cal_data[HEADSET_VOICE_OUTPUT] | HPL_EN | HP_TRACK)); //Modify for desired HP gain fail |= WriteI2C(SPEAKER_OUTPUT, SPKOUT_MUTE); MM_INFO("2 set_amp_headset_mono_voice() %d\n", fail); }
/* must be called with audio->lock held */ static int audio_enable(struct audio *audio) { struct audmgr_config cfg; int rc; MM_INFO("\n"); /* Macro prints the file name and function */ if (audio->enabled) return 0; /* refuse to start if we're not ready */ if (!audio->out[0].used || !audio->out[1].used) return -EIO; /* we start buffers 0 and 1, so buffer 0 will be the * next one the dsp will want */ audio->out_tail = 0; audio->out_needed = 0; cfg.tx_rate = RPC_AUD_DEF_SAMPLE_RATE_NONE; cfg.rx_rate = RPC_AUD_DEF_SAMPLE_RATE_48000; cfg.def_method = RPC_AUD_DEF_METHOD_HOST_PCM; cfg.codec = RPC_AUD_DEF_CODEC_PCM; cfg.snd_method = RPC_SND_METHOD_MIDI; audio_prevent_sleep(audio); rc = audmgr_enable(&audio->audmgr, &cfg); if (rc < 0) { audio_allow_sleep(audio); return rc; } #ifdef CONFIG_AMP_MAX97000 if(!audio_enabled) { audio_enabled = 1; //max97000_resume(); } #endif if (audpp_enable(-1, audio_dsp_event, audio)) { MM_ERR("audpp_enable() failed\n"); audmgr_disable(&audio->audmgr); audio_allow_sleep(audio); return -ENODEV; } audio->enabled = 1; htc_pwrsink_set(PWRSINK_AUDIO, 100); return 0; }
int snddev_icodec_set_device_volume(struct msm_snddev_info *dev_info, u32 volume) { struct snddev_icodec_state *icodec; struct mutex *lock; struct snddev_icodec_drv_state *drv = &snddev_icodec_drv; int rc = -EPERM; if (!dev_info) { MM_INFO("device not intilized.\n"); return -EINVAL; } icodec = dev_info->private_data; if (!(icodec->data->dev_vol_type & (SNDDEV_DEV_VOL_DIGITAL | SNDDEV_DEV_VOL_ANALOG))) { MM_INFO("device %s does not support device volume " "control.", dev_info->name); return -EPERM; } dev_info->dev_volume = volume; if (icodec->data->capability & SNDDEV_CAP_RX) lock = &drv->rx_lock; else if (icodec->data->capability & SNDDEV_CAP_LB) lock = &drv->lb_lock; else lock = &drv->tx_lock; mutex_lock(lock); rc = snddev_icodec_set_device_volume_impl(dev_info, dev_info->dev_volume); mutex_unlock(lock); return rc; }
static int audio_open(struct inode *inode, struct file *file) { struct audio *audio = &the_audio; int rc, cnt; mutex_lock(&audio->lock); if (audio->opened) { MM_ERR("busy as driver already in open state\n"); rc = -EBUSY; goto done; } if (!audio->data) { audio->data = kmalloc(BUFSZ, GFP_KERNEL); if (!audio->data) { MM_ERR("could not allocate buffers\n"); rc = -ENOMEM; goto done; } } audio->client = msm_rpc_register_client("voice_pcm_interface_client", SND_VOC_PCM_INTERFACE_PROG, SND_VOC_PCM_INTERFACE_VERS, 1, pcm_interface_process_callback_routine); if (IS_ERR(audio->client)) { MM_ERR("Failed to register voice pcm interface client"\ "to 0x%8x\n", SND_VOC_PCM_INTERFACE_PROG); kfree(audio->data); audio->data = NULL; rc = -ENODEV; goto done; } MM_INFO("voice pcm client registred %p\n", audio->client); for (cnt = 0; cnt < MAX_VOC_FRAMES; cnt++) { audio->out[cnt].data = (audio->data +\ ((MAX_VOC_FRAME_SIZE * 2) * cnt)); audio->out[cnt].size = MAX_VOC_FRAME_SIZE * 2; MM_DBG("data ptr = %p\n", audio->out[cnt].data); } file->private_data = audio; audio_flush(audio); audio->opened = 1; rc = 0; done: mutex_unlock(&audio->lock); return rc; }
static ssize_t store_btlb_value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int lb = 0; sscanf(buf, "%d", &lb); MM_INFO("[BTUI] store_btlb_value : old(%d) new(%d) \n", lb_status,lb); /* skip when same status */ if (lb == lb_status) return count; /* set loopback */ bt_sco_set_loopback_mode(lb); return count; }
int msm_adsp_write(struct msm_adsp_module *module, unsigned dsp_queue_addr, void *cmd_buf, size_t cmd_size) { int rc, retries = 0; do { rc = __msm_adsp_write(module, dsp_queue_addr, cmd_buf, cmd_size); if (rc == -EAGAIN) udelay(50); } while (rc == -EAGAIN && retries++ < 300); if (retries > 20) MM_INFO("%s command took %d attempts: rc %d\n", module->name, retries, rc); return rc; }
/* must be called with audio->lock held */ static int audio_disable(struct audio *audio) { MM_INFO("[CLK]\n"); /* Macro prints the file name and function */ if (audio->enabled) { audio->enabled = 0; #ifdef CONFIG_CCI_SPEAKER MM_INFO("[CLK] speaker_audmgr_enable(false)\n"); /*cci.johnny_lee, for pop-noise issue */ if (speaker_audmgr_enable(false) < 0) { MM_ERR("[CLK] speaker_audmgr_enable return failed, we will retry after 600ms\n"); } #endif audio_dsp_out_enable(audio, 0); audpp_disable(-1, audio); wake_up(&audio->wait); audmgr_disable(&audio->audmgr); audio->out_needed = 0; audio_allow_sleep(audio); } return 0; }
void set_amp_headset_speaker_audio(void) { int fail=0; fail |= WriteI2C(INPUT_CONTROL, (amp_cal_data[HEADSET_SPEAKER_INPUT] | IN1_SE)); //Modify for desired IN gain fail |= WriteI2C(HP_LEFT_VOLUME, (HPL_VOL_M60DB | HPL_EN | HP_TRACK)); fail |= WriteI2C(HP_RIGHT_VOLUME, (HPR_VOL_M60DB | HPR_EN)); fail |= WriteI2C(SUBSYSTEM_CONTROL, 0xE3); fail |= WriteI2C(HP_LEFT_VOLUME, (amp_cal_data[HEADSET_SPEAKER_OUTPUT_HEADSET] | HPL_EN | HP_TRACK)); //Modify for desired HP gain fail |= WriteI2C(HEADPHONE_OUTPUT, HPOUT_IN1); fail |= WriteI2C(SPEAKER_VOLUME, (SPK_EN | amp_cal_data[HEADSET_SPEAKER_OUTPUT_SPEAKER])); //Modify for desired SP gain fail |= WriteI2C(SPEAKER_OUTPUT, SPKOUT_IN1); MM_INFO(" 6 set_amp_headset_speaker_audio() %d\n", fail); }
static int snddev_icodec_check_freq(u32 req_freq) { int rc = -EINVAL; if ((req_freq != 0) && (req_freq >= 8000) && (req_freq <= 48000)) { if ((req_freq == 8000) || (req_freq == 11025) || (req_freq == 12000) || (req_freq == 16000) || (req_freq == 22050) || (req_freq == 24000) || (req_freq == 32000) || (req_freq == 44100) || (req_freq == 48000)) { rc = 0; } else MM_INFO("Unsupported Frequency:%d\n", req_freq); } return rc; }
/* must be called with audio->lock held */ static int audio_disable(struct audio *audio) { MM_INFO("\n"); /* Macro prints the file name and function */ if (audio->enabled) { audio->enabled = 0; audio_dsp_out_enable(audio, 0); audpp_disable(-1, audio); wake_up(&audio->wait); audmgr_disable(&audio->audmgr); audio->out_needed = 0; audio_allow_sleep(audio); } return 0; }
static ssize_t snd_adie_debug_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { int rc = 0, op = 0; int id = 0, adie_block = 0, config = 1; sscanf(buf, "%d %d %d %d", &op, &id, &adie_block, &config); MM_INFO("\nUser input: op %d id %d block %d config %d\n", op, id, adie_block, config); switch (op) { case ADIE_SVC_REGISTER_CLIENT: MM_INFO("ADIE_SVC_REGISTER_CLIENT\n"); rc = adie_svc_get(); if (rc >= 0) MM_INFO("Client registered: %d\n", rc); else MM_ERR("Failed registering client\n"); break; case ADIE_SVC_DEREGISTER_CLIENT: MM_INFO("ADIE_SVC_DEREGISTER_CLIENT: %d\n", id); rc = adie_svc_put(id); if (!rc) MM_INFO("Client %d deregistered\n", id); else MM_ERR("Failed unregistering the client: %d\n", id); break; case ADIE_SVC_CONFIG_ADIE_BLOCK: MM_INFO("ADIE_SVC_CONFIG_ADIE_BLOCK: id %d adie_block %d \ config %d\n", id, adie_block, config); rc = adie_svc_config_adie_block(id, (enum adie_block_enum_type)adie_block, (bool)config); if (!rc) MM_INFO("ADIE block %d %s", adie_block, config ? "enabled\n" : "disabled\n"); else if (rc == 2) MM_INFO("ADIE block %d already in use\n", adie_block); else MM_ERR("ERROR configuring the ADIE block\n"); break; default: MM_INFO("Invalid operation\n"); } return count; }
static int32_t adsp_validate_queue(uint32_t mod_id, unsigned q_idx, uint32_t size) { int32_t i; struct adsp_rtos_mp_mtoa_init_info_type *sptr; sptr = adsp_info.init_info_ptr; for (i = 0; i < sptr->mod_to_q_entries; i++) if (mod_id == sptr->mod_to_q_tbl[i].module) if (q_idx == sptr->mod_to_q_tbl[i].q_type) { if (size <= sptr->mod_to_q_tbl[i].q_max_len) return 0; MM_INFO("q_idx: %d is not a valid queue \ for module %x\n", q_idx, mod_id); return -EINVAL; } MM_INFO("cmd_buf size is more than allowed size\n"); return -EINVAL; }
static int __init afe_init(void) { struct msm_afe_state *afe = &the_afe_state; MM_INFO("AFE driver init\n"); memset(afe, 0, sizeof(struct msm_afe_state)); afe->adsp_ops.event = afe_dsp_event; mutex_init(&afe->lock); init_waitqueue_head(&afe->wait); #ifdef CONFIG_DEBUG_FS debugfs_afelb = debugfs_create_file("afe_loopback", S_IFREG | S_IWUGO, NULL, (void *) "afe_loopback", &afe_debug_fops); #endif 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; }