static int qsd_pcm_capture_copy(struct snd_pcm_substream *substream, int a, snd_pcm_uframes_t hwoff, void __user *buf, snd_pcm_uframes_t frames) { int fbytes = 0; size_t xfer; int rc = 0; struct snd_pcm_runtime *runtime = substream->runtime; struct qsd_audio *prtd = runtime->private_data; fbytes = frames_to_bytes(runtime, frames); fbytes = fbytes; prtd->cbs.buffer = (void *)buf; prtd->cbs.phys_addr = 0; prtd->cbs.max_size = fbytes; prtd->cbs.actual_size = fbytes; mutex_lock(&the_locks.lock); xfer = cad_read(prtd->cad_w_handle, &prtd->cbs); mutex_unlock(&the_locks.lock); prtd->pcm_buf_pos += fbytes; if (xfer < fbytes) return -EIO; return rc; }
static ssize_t msm8k_pcm_in_read(struct file *f, char __user *buf, size_t cnt, loff_t *pos) { struct pcm *pcm = f->private_data; struct cad_buf_struct_type cbs; D("%s\n", __func__); memset(&cbs, 0, sizeof(struct cad_buf_struct_type)); cbs.buffer = (void *)buf; cbs.max_size = cnt; cbs.actual_size = cnt; cnt = cad_read(pcm->cad_w_handle, &cbs); return cnt; }