static int qsd_pcm_playback_close(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct qsd_audio *prtd = runtime->private_data; int ret = 0; if (prtd->enabled) { mutex_lock(&the_locks.lock); cad_ioctl(prtd->cad_w_handle, CAD_IOCTL_CMD_STREAM_END_OF_STREAM, NULL, 0); mutex_unlock(&the_locks.lock); ret = wait_event_interruptible(the_locks.eos_wait, prtd->eos_ack); if (!prtd->eos_ack) pr_err("EOS Failed\n"); } prtd->eos_ack = 0; mutex_lock(&the_locks.lock); cad_close(prtd->cad_w_handle); mutex_unlock(&the_locks.lock); prtd->enabled = 0; /* * TODO: Deregister the async callback handler. * Currently cad provides no interface to do so. */ kfree(prtd); return ret; }
static int msm8k_pcm_in_release(struct inode *inode, struct file *f) { int rc = CAD_RES_SUCCESS; struct pcm *pcm = f->private_data; D("%s\n", __func__); cad_close(pcm->cad_w_handle); return rc; }
static int msm8k_dtmf_release(struct inode *inode, struct file *f) { int rc = CAD_RES_SUCCESS; struct dtmf *dtmf = f->private_data; D("%s\n", __func__); cad_close(dtmf->cad_w_handle); return rc; }
static int msm8k_aac_in_release(struct inode *inode, struct file *f) { int rc = CAD_RES_SUCCESS; struct aac *aac = f->private_data; D("%s\n", __func__); cad_close(aac->cad_w_handle); kfree(aac); return rc; }
static int msm8k_qcelp_in_release(struct inode *inode, struct file *f) { int rc = 0; struct qcelp *qcelp = f->private_data; D("%s\n", __func__); cad_close(qcelp->cad_w_handle); kfree(qcelp); return rc; }
static void __exit msm8k_audio_dev_ctrl_exit(void) { struct msm8k_audio_dev_ctrl *ctrl = &g_ctrl; D("%s()\n", __func__); cad_close(ctrl->cad_ctrl_handle); #ifdef CONFIG_PROC_FS remove_proc_entry(MSM8K_AUDIO_PROC_NAME, NULL); #endif }
static int msm8k_mp3_release(struct inode *inode, struct file *f) { int rc = CAD_RES_SUCCESS; struct mp3 *mp3 = f->private_data; D("%s\n", __func__); cad_close(mp3->cad_w_handle); kfree(mp3); return rc; }
static int msm8k_pcm_release(struct inode *inode, struct file *f) { int rc = CAD_RES_SUCCESS; struct pcm *pcm = f->private_data; D("%s\n", __func__); mutex_lock(&pcm_lock); cad_close(pcm->cad_w_handle); kfree(pcm); audio_allow_sleep(); pcm_opened = 0; mutex_unlock(&pcm_lock); return rc; }
static int qsd_pcm_capture_close(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct qsd_audio *prtd = runtime->private_data; mutex_lock(&the_locks.lock); cad_close(prtd->cad_w_handle); mutex_unlock(&the_locks.lock); /* * TODO: Deregister the async callback handler. * Currently cad provides no interface to do so. */ kfree(prtd); return 0; }
static int qsd_pcm_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct qsd_audio *prtd; struct cad_event_struct_type alsa_event; int ret = 0; prtd = kzalloc(sizeof(struct qsd_audio), GFP_KERNEL); if (prtd == NULL) { ret = -ENOMEM; return ret; } if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { printk(KERN_INFO "Stream = SNDRV_PCM_STREAM_PLAYBACK\n"); runtime->hw = qsd_pcm_playback_hardware; prtd->dir = SNDRV_PCM_STREAM_PLAYBACK; prtd->playback_substream = substream; prtd->cos.op_code = CAD_OPEN_OP_WRITE; } else { printk(KERN_INFO "Stream = SNDRV_PCM_STREAM_CAPTURE\n"); runtime->hw = qsd_pcm_capture_hardware; prtd->dir = SNDRV_PCM_STREAM_CAPTURE; prtd->capture_substream = substream; prtd->cos.op_code = CAD_OPEN_OP_READ; } /* Ensure that buffer size is a multiple of period size */ ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); if (ret < 0) { kfree(prtd); return ret; } runtime->private_data = prtd; prtd->cos.format = CAD_FORMAT_PCM; mutex_lock(&the_locks.lock); prtd->cad_w_handle = cad_open(&prtd->cos); mutex_unlock(&the_locks.lock); mutex_lock(&the_locks.lock); if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) alsa_event.callback = &alsa_event_cb_capture; else alsa_event.callback = &alsa_event_cb_playback; alsa_event.client_data = prtd; ret = cad_ioctl(prtd->cad_w_handle, CAD_IOCTL_CMD_SET_STREAM_EVENT_LSTR, &alsa_event, sizeof(struct cad_event_struct_type)); if (ret) { mutex_unlock(&the_locks.lock); cad_close(prtd->cad_w_handle); kfree(prtd); return ret; } mutex_unlock(&the_locks.lock); prtd->enabled = 0; return 0; }