static ssize_t sky_direct_adsp_write(struct file *filp, const char __user *buffer, size_t length, loff_t *offset) { int ret = 0; #ifdef FEATURE_RV_VEGA_VOLTE_TICK_NOISE int nMax = 0; int index = 0; short* tmpVal = (short *)buffer; #endif//FEATURE_RV_VEGA_VOLTE_TICK_NOISE if(!bUseSKYDirectADSP) return -1; if(voip_info.state != VOIP_STARTED) return -2; if(voip_info.playback_start != 1) return -3; if(voip_info.mode == MODE_PCM) { #ifdef FEATURE_RV_VEGA_VOLTE_TICK_NOISE for(index = 0; index < length/2; index++) { nMax = (((nMax) > (tmpVal[index])) ? (nMax) : (tmpVal[index])); if (nMax > 256) break; } ret = msm_pcm_playback_copy(voip_info.playback_substream, ((nMax < 256) ? (-1):(0)), 0, (void __user *)buffer, length/2); #else //FEATURE_RV_VEGA_VOLTE_TICK_NOISE ret = msm_pcm_playback_copy(voip_info.playback_substream, 0, 0, (void __user *)buffer, length/2); #endif//FEATURE_RV_VEGA_VOLTE_TICK_NOISE } else if(voip_info.mode == MODE_AMR_WB) { ret = msm_pcm_playback_copy(voip_info.playback_substream, 0, 0, (void __user *)buffer, length); } else if(voip_info.mode == MODE_AMR) { ret = msm_pcm_playback_copy(voip_info.playback_substream, 0, 0, (void __user *)buffer, length); } else return -4; if(ret != 0) return -5; return length; }
static int msm_pcm_copy(struct snd_pcm_substream *substream, int a, snd_pcm_uframes_t hwoff, void __user *buf, snd_pcm_uframes_t frames) { int ret = 0; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ret = msm_pcm_playback_copy(substream, a, hwoff, buf, frames); else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) ret = msm_pcm_capture_copy(substream, a, hwoff, buf, frames); return ret; }