/* * 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) { int rc; struct rpc_adsp_rtos_app_to_modem_args_t rpc_req; struct rpc_reply_hdr rpc_rsp; adsp_info.init_info_rpc_client = msm_rpc_connect( rpc_adsp_rtos_atom_prog, rpc_adsp_rtos_atom_vers, MSM_RPC_UNINTERRUPTIBLE); if (IS_ERR(adsp_info.init_info_rpc_client)) { adsp_info.init_info_rpc_client = msm_rpc_connect_compatible( rpc_adsp_rtos_atom_prog, rpc_adsp_rtos_atom_vers_comp, MSM_RPC_UNINTERRUPTIBLE); if (IS_ERR(adsp_info.init_info_rpc_client)) { rc = PTR_ERR(adsp_info.init_info_rpc_client); adsp_info.init_info_rpc_client = 0; MM_ERR("could not open rpc client: %d\n", rc); return; } } rpc_req.gotit = cpu_to_be32(1); rpc_req.cmd = cpu_to_be32(RPC_ADSP_RTOS_CMD_GET_INIT_INFO); rpc_req.proc_id = cpu_to_be32(RPC_ADSP_RTOS_PROC_APPS); rpc_req.module = 0; rc = msm_rpc_call_reply(adsp_info.init_info_rpc_client, RPC_ADSP_RTOS_APP_TO_MODEM_PROC, &rpc_req, sizeof(rpc_req), &rpc_rsp, sizeof(rpc_rsp), 5 * HZ); if (rc < 0) MM_ERR("could not send RPC request: %d\n", rc); }
static int rpc_adsp_rtos_app_to_modem(uint32_t cmd, uint32_t module, struct msm_adsp_module *adsp_module) { int rc; struct rpc_adsp_rtos_app_to_modem_args_t rpc_req; struct rpc_reply_hdr rpc_rsp; rpc_req.gotit = cpu_to_be32(1); rpc_req.cmd = cpu_to_be32(cmd); rpc_req.proc_id = cpu_to_be32(RPC_ADSP_RTOS_PROC_APPS); rpc_req.module = cpu_to_be32(module); rc = msm_rpc_call_reply(adsp_module->rpc_client, RPC_ADSP_RTOS_APP_TO_MODEM_PROC, &rpc_req, sizeof(rpc_req), &rpc_rsp, sizeof(rpc_rsp), 5 * HZ); if (rc < 0) { MM_ERR("error receiving RPC reply: %d (%d)\n", rc, -ERESTARTSYS); return rc; } if (be32_to_cpu(rpc_rsp.reply_stat) != RPCMSG_REPLYSTAT_ACCEPTED) { MM_ERR("RPC call was denied!\n"); return -EPERM; } if (be32_to_cpu(rpc_rsp.data.acc_hdr.accept_stat) != RPC_ACCEPTSTAT_SUCCESS) { MM_ERR("RPC call was not successful (%d)\n", be32_to_cpu(rpc_rsp.data.acc_hdr.accept_stat)); return -EINVAL; } return 0; }
static int msmrtc_timeremote_read_ticks(struct device *dev, struct timespec *ticks) { int rc; int64_t get_ticks; struct timeremote_get_xtal_ticks_req { struct rpc_request_hdr hdr; uint32_t julian_time_not_null; } req; struct timeremote_get_xtal_ticks_rep { struct rpc_reply_hdr hdr; uint32_t sync_ticks; } rep; req.julian_time_not_null = cpu_to_be32(1); rc = msm_rpc_call_reply(ep, TIMEREMOTE_PROCEEDURE_GET_MILLISECOND_TICK, &req, sizeof(req), &rep, sizeof(rep), 5 * HZ); if (rc < 0) { pr_err("%s: msm_rpc_call_reply fail (%d)\n", __func__, rc); return rc; } get_ticks = be32_to_cpu(rep.sync_ticks); *ticks = ns_to_timespec(get_ticks*NSEC_PER_MSEC); #if RTC_DEBUG printk(KERN_DEBUG "%s ticks to ns: %lld\n", __func__, timespec_to_ns(ticks)); #endif return 0; }
int Fast_Domancy_Enable(void) { int rc = 0; static struct msm_rpc_endpoint *ipfilter_endpoint = NULL; dormancy_request req_packet; dormancy_reply rep_packet; if (!ipfilter_endpoint) { ipfilter_endpoint = msm_rpc_connect(CMPROG, CMVERS, 0); if (IS_ERR(ipfilter_endpoint)) { printk(KERN_INFO "ipfilter: cannot connect to rpc server!\n"); ACER_DBG("ipfilter: cannot connect to rpc server!\n"); ipfilter_endpoint = NULL; return -1; } } ACER_DBG("Enable Fast_Domancy!!\n"); memset(&req_packet, 0x00, sizeof(req_packet)); req_packet.cb_id = MSM_RPC_CLIENT_NULL_CB_ID; req_packet.handle = QCRIL_TOKEN_ID_INTERNAL; req_packet.client_id = REQ_PACKET_CLIENT_ID; rc = msm_rpc_call_reply(ipfilter_endpoint, ONCRPC_CM_MM_CALL_CMD_PS_SIG_RELEASE_PROC, &req_packet, sizeof(req_packet), &rep_packet, sizeof(rep_packet), -1); if (rc < 0) { pr_info("enable Fast_Domancy rpc call error! rc= %d, reply=%d\n", rc, rep_packet.reply); ACER_DBG("enable Fast_Domancy rpc call error! rc= %d, reply=%d\n", rc, rep_packet.reply); return -1; } ACER_DBG("ENABLED! reply = %d\n", rep_packet.reply); return 0; }
static long snd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_set_device_msg dmsg; struct snd_set_volume_msg vmsg; struct snd_avc_ctl_msg avc_msg; struct snd_agc_ctl_msg agc_msg; struct msm_snd_device_config dev; struct msm_snd_volume_config vol; struct snd_ctxt *snd = file->private_data; struct msm_snd_set_voccal_param voccal; struct snd_set_voccal_param_msg cmsg; struct msm_snd_set_voccal_iir_param voccaliir; struct snd_set_voccal_iir_param_msg cimsg; struct msm_snd_set_next_ec_param nextec; struct snd_set_next_ec_param_msg nmsg; struct msm_snd_set_rx_volume_param rxvol; struct snd_set_rx_volume_param_msg rmsg; struct msm_snd_set_dtmf_volume_param dtmfvol; struct snd_set_dtmf_volume_param_msg fmsg; struct msm_snd_set_pad_value_param padvalue; struct snd_set_pad_value_param_msg pmsg; struct msm_snd_set_loopback_mode_param loopback; struct snd_set_loopback_mode_msg lmsg; struct snd_write_efs_msg wmsg; struct msm_snd_set_micamp_gain_param micampgain; struct snd_set_micamp_gain_param_msg mamsg; struct msm_snd_set_amp_gain_param ampgain; struct snd_set_set_amp_gain_param_msg amsg; struct msm_snd_set_fm_radio_vol_param fmradiovol; struct snd_set_fm_radio_vol_msg fmrmsg; struct msm_snd_set_voice_clarity_param voiceclarity; struct snd_set_voice_clarity_msg vcmsg; //int fm_radio_vol; int wefs; struct snd_set_voccal_param_rep { struct rpc_reply_hdr hdr; uint32_t get_voccal; }crep; struct snd_set_voccal_iir_param_rep { struct rpc_reply_hdr hdr; uint32_t get_voccal_iir; }cirep; struct snd_set_nextec_param_rep { struct rpc_reply_hdr hdr; uint32_t get_nextec; }nrep; struct snd_set_rxvol_param_rep { struct rpc_reply_hdr hdr; uint32_t get_rxvol; }rrep; struct snd_set_dtmfvol_param_rep { struct rpc_reply_hdr hdr; uint32_t get_dtmfvol; }frep; struct snd_set_padvalue_param_rep { struct rpc_reply_hdr hdr; uint32_t get_padvalue; }prep; struct snd_set_loopback_param_rep { struct rpc_reply_hdr hdr; uint32_t get_mode; }lrep; struct snd_write_efs_rep { struct rpc_reply_hdr hdr; uint32_t result; }wrep; struct snd_set_amp_gain_param_rep { struct rpc_reply_hdr hdr; uint32_t get_gainvalue; }arep; struct snd_set_voice_clarity_param_rep { struct rpc_reply_hdr hdr; uint32_t get_mode; }vcrep; int rc = 0; uint32_t avc, agc; mutex_lock(&snd->lock); switch (cmd) { case SND_SET_DEVICE: if (copy_from_user(&dev, (void __user *) arg, sizeof(dev))) { MM_ERR("set device: invalid pointer\n"); rc = -EFAULT; break; } dmsg.args.device = cpu_to_be32(dev.device); dmsg.args.ear_mute = cpu_to_be32(dev.ear_mute); dmsg.args.mic_mute = cpu_to_be32(dev.mic_mute); if (check_mute(dev.ear_mute) < 0 || check_mute(dev.mic_mute) < 0) { MM_ERR("set device: invalid mute status\n"); rc = -EINVAL; break; } dmsg.args.cb_func = -1; dmsg.args.client_data = 0; MM_INFO("snd_set_device %d %d %d\n", dev.device, dev.ear_mute, dev.mic_mute); rc = msm_rpc_call(snd->ept, SND_SET_DEVICE_PROC, &dmsg, sizeof(dmsg), 5 * HZ); break; case SND_SET_VOLUME: if (copy_from_user(&vol, (void __user *) arg, sizeof(vol))) { MM_ERR("set volume: invalid pointer\n"); rc = -EFAULT; break; } vmsg.args.device = cpu_to_be32(vol.device); vmsg.args.method = cpu_to_be32(vol.method); if (vol.method != SND_METHOD_VOICE) { MM_ERR("set volume: invalid method\n"); rc = -EINVAL; break; } vmsg.args.volume = cpu_to_be32(vol.volume); vmsg.args.cb_func = -1; vmsg.args.client_data = 0; MM_INFO("snd_set_volume %d %d %d\n", vol.device, vol.method, vol.volume); rc = msm_rpc_call(snd->ept, SND_SET_VOLUME_PROC, &vmsg, sizeof(vmsg), 5 * HZ); break; case SND_AVC_CTL: if (get_user(avc, (uint32_t __user *) arg)) { rc = -EFAULT; break; } else if ((avc != 1) && (avc != 0)) { rc = -EINVAL; break; } avc_msg.args.avc_ctl = cpu_to_be32(avc); avc_msg.args.cb_func = -1; avc_msg.args.client_data = 0; MM_INFO("snd_avc_ctl %d\n", avc); rc = msm_rpc_call(snd->ept, SND_AVC_CTL_PROC, &avc_msg, sizeof(avc_msg), 5 * HZ); break; case SND_AGC_CTL: if (get_user(agc, (uint32_t __user *) arg)) { rc = -EFAULT; break; } else if ((agc != 1) && (agc != 0)) { rc = -EINVAL; break; } agc_msg.args.agc_ctl = cpu_to_be32(agc); agc_msg.args.cb_func = -1; agc_msg.args.client_data = 0; MM_INFO("snd_agc_ctl %d\n", agc); rc = msm_rpc_call(snd->ept, SND_AGC_CTL_PROC, &agc_msg, sizeof(agc_msg), 5 * HZ); break; case SND_GET_NUM_ENDPOINTS: if (copy_to_user((void __user *)arg, &snd->snd_epts->num, sizeof(unsigned))) { MM_ERR("get endpoint: invalid pointer\n"); rc = -EFAULT; } break; case SND_GET_ENDPOINT: rc = get_endpoint(snd, arg); break; #if defined (CONFIG_MACH_MSM7X27_SWIFT) case SND_SET_VOCCAL_PARAM: if (copy_from_user(&voccal, (void __user*) arg, sizeof(voccal))){ pr_err("snd_ioctl set vocal_param: invalid pointer.\n"); rc = -EFAULT; break; } cmsg.args.voc_codec = cpu_to_be32(voccal.voc_codec); cmsg.args.voccal_param_type = cpu_to_be32(voccal.voccal_param_type); cmsg.args.get_flag = cpu_to_be32(voccal.get_flag); cmsg.args.param_val = cpu_to_be32(voccal.param_val); cmsg.args.cb_func = -1; cmsg.args.client_data = 0; pr_info("snd_set_voccal_param %d %d %d %d\n", voccal.voc_codec, voccal.voccal_param_type, voccal.get_flag, voccal.param_val); rc = msm_rpc_call_reply(snd->ept, SND_SET_VOCCAL_PARAM_PROC, &cmsg, sizeof(cmsg), &crep, sizeof(crep), 5*HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { voccal.get_param = be32_to_cpu(crep.get_voccal); printk(KERN_INFO "%s:voccal ->%d\n", __func__, voccal.get_param); if (copy_to_user((void __user*)arg, &voccal, sizeof(voccal))){ pr_err("snd_ioctl get voccal: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_VOCCAL_IIR_PARAM: if (copy_from_user(&voccaliir, (void __user *) arg, sizeof(voccaliir))) { pr_err("snd_ioctl set_voccal_iir_param: invalid pointer.\n"); rc = -EFAULT; break; } cimsg.args.voc_codec = cpu_to_be32(voccaliir.voc_codec); cimsg.args.voccal_iir_param_type = cpu_to_be32(voccaliir.voccal_iir_param_type); cimsg.args.get_flag = cpu_to_be32(voccaliir.get_flag); cimsg.args.param_val = cpu_to_be32(voccaliir.param_val); cimsg.args.cb_func = -1; cimsg.args.client_data = 0; pr_info("set_voccal_iir_param %d %d %d\n", voccaliir.voc_codec, voccaliir.voccal_iir_param_type, voccaliir.param_val); rc = msm_rpc_call_reply(snd->ept, SND_SET_VOCCAL_IIR_PARAM_PROC, &cimsg, sizeof(cimsg),&cirep, sizeof(cirep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { voccaliir.get_param = be32_to_cpu(cirep.get_voccal_iir); printk(KERN_INFO "%s:voccal_iir ->%d\n", __func__, voccaliir.get_param); if (copy_to_user((void __user *)arg, &voccaliir, sizeof(voccaliir))) { pr_err("snd_ioctl get voccal iir: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_NEXT_EC_PARAM: if (copy_from_user(&nextec, (void __user *) arg, sizeof(nextec))) { pr_err("snd_ioctl set_next_ec_param: invalid pointer.\n"); rc = -EFAULT; break; } nmsg.args.ec_mode = cpu_to_be32(nextec.ec_mode); nmsg.args.ec_param_type = cpu_to_be32(nextec.ec_param_type); nmsg.args.get_flag = cpu_to_be32(nextec.get_flag); nmsg.args.param_val = cpu_to_be32(nextec.param_val); nmsg.args.cb_func = -1; nmsg.args.client_data = 0; pr_info("set_next_ec_param %d %d %d\n", nextec.ec_mode, nextec.ec_param_type, nextec.param_val); rc = msm_rpc_call_reply(snd->ept, SND_SET_NEXT_EC_PARAM_PROC, &nmsg, sizeof(nmsg),&nrep, sizeof(nrep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { nextec.get_param = be32_to_cpu(nrep.get_nextec); printk(KERN_INFO "%s:nextec ->%d\n", __func__, nextec.get_param); if (copy_to_user((void __user *)arg, &nextec, sizeof(nextec))) { pr_err("snd_ioctl get next ec: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_RX_VOLUME: if (copy_from_user(&rxvol, (void __user *) arg, sizeof(rxvol))) { pr_err("snd_ioctl set_rx_volume: invalid pointer.\n"); rc = -EFAULT; break; } rmsg.args.device = cpu_to_be32(rxvol.device); rmsg.args.method = cpu_to_be32(rxvol.method); rmsg.args.idx = cpu_to_be32(rxvol.idx); rmsg.args.get_flag = cpu_to_be32(rxvol.get_flag); rmsg.args.param_val = cpu_to_be32(rxvol.param_val); rmsg.args.cb_func = -1; rmsg.args.client_data = 0; pr_info("set_rx_volume %d %d %d %d\n", rxvol.device, rxvol.method, rxvol.idx, rxvol.param_val); rc = msm_rpc_call_reply(snd->ept, SND_SET_RX_VOLUME_PROC, &rmsg, sizeof(rmsg),&rrep, sizeof(rrep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { rxvol.get_param = be32_to_cpu(rrep.get_rxvol); printk(KERN_INFO "%s:rx vol ->%d\n", __func__, rxvol.get_param); if (copy_to_user((void __user *)arg, &rxvol, sizeof(rxvol))) { pr_err("snd_ioctl get rx vol: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_DTMF_VOLUME: if (copy_from_user(&dtmfvol, (void __user *) arg, sizeof(dtmfvol))) { pr_err("snd_ioctl set_dtmf_volume: invalid pointer.\n"); rc = -EFAULT; break; } fmsg.args.device = cpu_to_be32(dtmfvol.device); fmsg.args.method = cpu_to_be32(dtmfvol.method); fmsg.args.idx = cpu_to_be32(dtmfvol.idx); fmsg.args.get_flag = cpu_to_be32(dtmfvol.get_flag); fmsg.args.param_val = cpu_to_be32(dtmfvol.param_val); fmsg.args.cb_func = -1; fmsg.args.client_data = 0; pr_info("set_dtmf_volume %d %d %d %d\n", dtmfvol.device, dtmfvol.method, dtmfvol.idx, dtmfvol.param_val); rc = msm_rpc_call_reply(snd->ept, SND_SET_DTMF_VOLUME_PROC, &fmsg, sizeof(fmsg),&frep, sizeof(frep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { dtmfvol.get_param = be32_to_cpu(frep.get_dtmfvol); printk(KERN_INFO "%s:rx vol ->%d\n", __func__, dtmfvol.get_param); if (copy_to_user((void __user *)arg, &dtmfvol, sizeof(dtmfvol))) { pr_err("snd_ioctl get dtmf vol: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_PAD_VALUE: if (copy_from_user(&padvalue, (void __user *) arg, sizeof(padvalue))) { pr_err("snd_ioctl set_pad_value: invalid pointer.\n"); rc = -EFAULT; break; } pmsg.args.device = cpu_to_be32(padvalue.device); pmsg.args.method = cpu_to_be32(padvalue.method); pmsg.args.idx = cpu_to_be32(padvalue.idx); pmsg.args.get_flag = cpu_to_be32(padvalue.get_flag); pmsg.args.param_val = cpu_to_be32(padvalue.param_val); pmsg.args.cb_func = -1; pmsg.args.client_data = 0; pr_info("set_pad_value %d %d %d %d\n", padvalue.device, padvalue.method, padvalue.idx, padvalue.param_val); rc = msm_rpc_call_reply(snd->ept, SND_SET_PAD_VALUE_PROC, &pmsg, sizeof(pmsg),&prep, sizeof(prep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { padvalue.get_param = be32_to_cpu(prep.get_padvalue); printk(KERN_INFO "%s:rx vol ->%d\n", __func__, padvalue.get_param); if (copy_to_user((void __user *)arg, &padvalue, sizeof(padvalue))) { pr_err("snd_ioctl get pad value: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_LOOPBACK_MODE: if (copy_from_user(&loopback, (void __user *) arg, sizeof(loopback))) { pr_err("snd_ioctl set amp_gain: invalid pointer.\n"); rc = -EFAULT; break; } lmsg.args.mode = cpu_to_be32(loopback.mode); lmsg.args.cb_func = -1; lmsg.args.client_data = 0; pr_info("set_loopback_mode %d \n", loopback.mode); rc = msm_rpc_call(snd->ept, SND_SET_LOOPBACK_MODE_PROC, &lmsg, sizeof(lmsg), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { loopback.get_param = be32_to_cpu(lrep.get_mode); printk(KERN_INFO "%s:loopback mode ->%d\n", __func__, loopback.get_param); if (copy_to_user((void __user *)arg, &loopback, sizeof(loopback))) { pr_err("snd_ioctl get loopback mode: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_WRITE_EFS: wmsg.args.cb_func = -1; wmsg.args.client_data = 0; pr_info("set_write_efs \n"); rc = msm_rpc_call_reply(snd->ept, SND_WRITE_EFS_PROC, &wmsg, sizeof(wmsg),&wrep, sizeof(wrep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { wefs = be32_to_cpu(wrep.result); printk(KERN_INFO "%s:loopback mode ->%d\n", __func__, wefs); if (copy_to_user((void __user *)arg, &wefs, sizeof(wefs))) { pr_err("snd_ioctl write efs: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_MICAMP_GAIN: if (copy_from_user(&micampgain, (void __user *) arg, sizeof(micampgain))) { pr_err("snd_ioctl set_pad_value: invalid pointer.\n"); rc = -EFAULT; break; } mamsg.args.voc_codec = cpu_to_be32(micampgain.voc_codec); mamsg.args.mic_channel = cpu_to_be32(micampgain.mic_channel); mamsg.args.get_flag = cpu_to_be32(micampgain.get_flag); mamsg.args.get_param = cpu_to_be32(micampgain.value); mamsg.args.cb_func = -1; mamsg.args.client_data = 0; pr_info("SND_SET_MICAMP_GAIN %d %d %d %d\n", micampgain.voc_codec, micampgain.mic_channel, micampgain.get_flag, micampgain.get_param); rc = msm_rpc_call_reply(snd->ept, SND_SET_MICAMP_GAIN_PROC, &mamsg, sizeof(mamsg),&mrep, sizeof(mrep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { micampgain.get_param = be32_to_cpu(mrep.get_gainvalue); printk(KERN_INFO "%s:rx vol ->%d\n", __func__, micampgain.get_param); if (copy_to_user((void __user *)arg, &micampgain, sizeof(micampgain))) { pr_err("snd_ioctl get pad value: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_AMP_GAIN: if (copy_from_user(&gain, (void __user *) arg, sizeof(ampgain))) { pr_err("snd_ioctl set amp_gain: invalid pointer.\n"); rc = -EFAULT; break; } amsg.args.voc_codec = cpu_to_be32(ampgain.voc_codec); amsg.args.gain_type = cpu_to_be32(ampgain.gain_type); amsg.args.get_flag = cpu_to_be32(ampgain.get_flag); amsg.args.get_param = cpu_to_be32(ampgain.value); amsg.args.cb_func = -1; amsg.args.client_data = 0; rc = msm_rpc_call_reply(snd->ept, SND_SET_AMP_GAIN_PROC, &amsg, sizeof(amsg),&arep, sizeof(arep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { ampgain.get_param = be32_to_cpu(arep.get_gainvalue); printk(KERN_INFO "%s:rx vol ->%d\n", __func__, ampgain.get_param); if (copy_to_user((void __user *)arg, &gain, sizeof(ampgain))) { pr_err("snd_ioctl get pad value: invalid write pointer.\n"); rc = -EFAULT; } } if (copy_to_user((void __user *)arg, &gain, sizeof(ampgain))) { pr_err("snd_ioctl get amp gain: invalid write pointer.\n"); rc = -EFAULT; } break; case SND_WRITE_MEM: wmsg.args.cb_func = -1; wmsg.args.client_data = 0; pr_info("set_write_efs \n"); rc = msm_rpc_call_reply(snd->ept, SND_WRITE_MEM_PROC, &wmsg, sizeof(wmsg),&wrep, sizeof(wrep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { wefs = be32_to_cpu(wrep.result); printk(KERN_INFO "%s:loopback mode ->%d\n", __func__, wefs); if (copy_to_user((void __user *)arg, &wefs, sizeof(wefs))) { pr_err("snd_ioctl write efs: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_FM_RADIO_VOLUME: if (copy_from_user(&fmradiovol, (void __user *) arg, sizeof(fmradiovol))) { pr_err("snd_ioctl set amp_gain: invalid pointer.\n"); rc = -EFAULT; break; } fmrmsg.args.volume = cpu_to_be32(fmradiovol.volume); fmrmsg.args.cb_func = -1; fmrmsg.args.client_data = 0; pr_info("snd_set_fm_radio_volume %d\n", fmradiovol.volume); rc = msm_rpc_call(snd->ept, SND_SET_FM_RADIO_VOLUME_PROC, &fmrmsg, sizeof(fmrmsg), 5 * HZ); break; case SND_SET_VOICE_CLARITY: if (copy_from_user(&voiceclarity, (void __user *) arg, sizeof(voiceclarity))) { pr_err("snd_ioctl set amp_gain: invalid pointer.\n"); rc = -EFAULT; break; } vcmsg.args.mode = cpu_to_be32(voiceclarity.mode); vcmsg.args.cb_func = -1; vcmsg.args.client_data = 0; pr_info("set_loopback_mode %d \n", voiceclarity.mode); rc = msm_rpc_call(snd->ept, SND_SET_VOICE_CLARITY_PROC, &vcmsg, sizeof(vcmsg), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { voiceclarity.get_param = be32_to_cpu(vcrep.get_mode); printk(KERN_INFO "%s:voice clarity mode ->%d\n", __func__, voiceclarity.get_param); if (copy_to_user((void __user *)arg, &voiceclarity, sizeof(voiceclarity))) { pr_err("snd_ioctl get loopback mode: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_POWER_OFF: wmsg.args.cb_func = -1; wmsg.args.client_data = 0; pr_info("set_power_off \n"); rc = msm_rpc_call_reply(snd->ept, SND_SET_POWER_OFF_PROC, &wmsg, sizeof(wmsg),&wrep, sizeof(wrep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { wefs = be32_to_cpu(wrep.result); if (copy_to_user((void __user *)arg, &wefs, sizeof(wefs))) { pr_err("snd_ioctl write efs: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_SET_FM_RADIO_MULTI_SOUND: wmsg.args.cb_func = -1; wmsg.args.client_data = 0; pr_info("set_fm_radio_multi_sound \n"); rc = msm_rpc_call_reply(snd->ept, SND_SET_FM_RADIO_MULTI_SOUND_PROC, &wmsg, sizeof(wmsg),&wrep, sizeof(wrep), 5 * HZ); if (rc < 0){ printk(KERN_ERR "%s:rpc err because of %d\n", __func__, rc); } else { wefs = be32_to_cpu(wrep.result); if (copy_to_user((void __user *)arg, &wefs, sizeof(wefs))) { pr_err("snd_ioctl set_fm_radio_multi_sound: invalid write pointer.\n"); rc = -EFAULT; } } break; #endif default: MM_ERR("unknown command\n"); rc = -EINVAL; break; } mutex_unlock(&snd->lock); return rc; }
static int __devinit hs_probe(struct platform_device *pdev) { int rc = 0; struct input_dev *ipdev; #if 1 struct api_remote_req_t1 { struct rpc_request_hdr hdr; } send_p; #endif hs = kzalloc(sizeof(struct msm_handset), GFP_KERNEL); if (!hs) return -ENOMEM; hs->sdev.name = "h2w"; hs->sdev.print_name = msm_headset_print_name; rc = switch_dev_register(&hs->sdev); if (rc) goto err_switch_dev_register; #ifdef FLIP_USE /* FLIP */ hs->sdev_flip.name = "flip"; hs->sdev_flip.print_name = msm_flip_print_name; rc = switch_dev_register(&hs->sdev_flip); if (rc) goto err_switch_dev_register; hs->sdev_flip_chatt.name = "flip_chatt"; hs->sdev_flip_chatt.print_name = msm_flip_chatt_print_name; rc = switch_dev_register(&hs->sdev_flip_chatt); if (rc) goto err_switch_dev_register; #endif #if 0 hs->sdev_hssw.name = "headphone_switch"; hs->sdev_hssw.print_name = msm_hssw_print_name; rc = switch_dev_register(&hs->sdev_hssw); if (rc) goto err_switch_dev_register; #endif ipdev = input_allocate_device(); if (!ipdev) { rc = -ENOMEM; goto err_alloc_input_dev; } input_set_drvdata(ipdev, hs); hs->ipdev = ipdev; if (pdev->dev.platform_data) hs->hs_pdata = pdev->dev.platform_data; if (hs->hs_pdata->hs_name) ipdev->name = hs->hs_pdata->hs_name; else ipdev->name = DRIVER_NAME; ipdev->id.vendor = 0x0001; ipdev->id.product = 1; ipdev->id.version = 1; #if 0 input_set_capability(ipdev, EV_KEY, KEY_MEDIA); input_set_capability(ipdev, EV_KEY, KEY_VOLUMEUP); input_set_capability(ipdev, EV_KEY, KEY_VOLUMEDOWN); input_set_capability(ipdev, EV_SW, SW_HEADPHONE_INSERT); input_set_capability(ipdev, EV_SW, SW_MICROPHONE_INSERT); input_set_capability(ipdev, EV_KEY, KEY_POWER); input_set_capability(ipdev, EV_KEY, KEY_END); #else input_set_capability(ipdev, EV_SW, SW_HEADPHONE_INSERT); #endif #ifdef FLIP_USE /* FLIP */ input_set_capability(ipdev, EV_SW, SW_LID); #ifdef CONFIG_PERF_LOCK_ENABLE perf_lock_init(&flip_perf_lock, PERF_LOCK_HIGHEST, "Flip"); #endif #endif rc = input_register_device(ipdev); if (rc) { dev_err(&ipdev->dev, "hs_probe: input_register_device rc=%d\n", rc); goto err_reg_input_dev; } platform_set_drvdata(pdev, hs); rc = hs_rpc_init(); if (rc) { dev_err(&ipdev->dev, "rpc init failure\n"); goto err_hs_rpc_init; } #if 1 rc = msm_rpc_call_reply(rpc_svc_p, HS_SHEXTDET_API_INITIALIZE_REMOTE_PROC, &send_p,sizeof(send_p), NULL,0, 5 * HZ); if(rc) goto err_hs_rpc_init; #endif return 0; err_hs_rpc_init: input_unregister_device(ipdev); ipdev = NULL; err_reg_input_dev: input_free_device(ipdev); err_alloc_input_dev: switch_dev_unregister(&hs->sdev); #ifdef FLIP_USE /* FLIP */ switch_dev_unregister(&hs->sdev_flip); switch_dev_unregister(&hs->sdev_flip_chatt); #endif #if 0 switch_dev_unregister(&hs->sdev_hssw); #endif err_switch_dev_register: kfree(hs); return rc; }
/* * Front backlight (LCD_DRV_N) * front key * brightness (0~255) */ void pantech_button_bl_set(struct led_classdev *led_dev, enum led_brightness value) { #if 0 msm_pm_set_led_intensity_req req; msm_pm_set_led_intensity_rep rep; #else msm_pm_secure_mpp_config_i_sink_req req; msm_pm_secure_mpp_config_i_sink_rep rep; #endif int state; int rc = 0; printk(KERN_ERR "%s: button led set %d\n", __func__, value); if (value) { #if 0 //pm_mpp_config_i_sink(PM_MPP_7, PM_MPP__I_SINK__LEVEL_5mA, // PM_MPP__I_SINK__SWITCH_ENA); req.led = cpu_to_be32(PM_LCD_LED); // 0 req.val = cpu_to_be32(FRONT_LED_LEVEL); // 3 rc = msm_rpc_call_reply(pm_lib_ep, PM_SET_LED_INTENSITY_PROC, &req, sizeof(req), &rep, sizeof(rep), 5 * HZ); #else //pm_mpp_config_i_sink(PM_MPP_7, PM_MPP__I_SINK__LEVEL_5mA, // PM_MPP__I_SINK__SWITCH_ENA); req.mpp = cpu_to_be32(PM_MPP_7); req.level = cpu_to_be32(PM_MPP__I_SINK__LEVEL_5mA); req.onoff = cpu_to_be32(PM_MPP__I_SINK__SWITCH_ENA); rc = msm_rpc_call_reply(pm_lib_ep, PM_SECURE_MPP_CONFIG_I_SINK_PROC, &req, sizeof(req), &rep, sizeof(rep), 5 * HZ); #endif } else { #if 0 //pm_set_led_intensity(PM_KBD_LED, PM_LED_KBD_SETTING_LEVEL0); req.led = cpu_to_be32(PM_LCD_LED); // 0 req.val = cpu_to_be32(LED_OFF_LEVEL); // 0 rc = msm_rpc_call_reply(pm_lib_ep, PM_SET_LED_INTENSITY_PROC, &req, sizeof(req), &rep, sizeof(rep), 5 * HZ); #else //pm_mpp_config_i_sink(PM_MPP_7, PM_MPP__I_SINK__LEVEL_5mA, // PM_MPP__I_SINK__SWITCH_DIS); req.mpp = cpu_to_be32(PM_MPP_7); req.level = cpu_to_be32(PM_MPP__I_SINK__LEVEL_5mA); req.onoff = cpu_to_be32(PM_MPP__I_SINK__SWITCH_DIS); rc = msm_rpc_call_reply(pm_lib_ep, PM_SECURE_MPP_CONFIG_I_SINK_PROC, &req, sizeof(req), &rep, sizeof(rep), 5 * HZ); #endif } if (rc < 0) printk(KERN_ERR "%s: msm_rpc_call failed! rc = %d\n", __func__, rc); }
static int headset_sw_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int rc; struct headset_sw_rpc_start_t { struct rpc_request_hdr hdr; unsigned long sw_detect; } send_p; struct headset_sw_rpc_ret_t { struct rpc_reply_hdr hdr; long ret; } recv_p; long result = 0; if((!hssw) || (!hs)) { return -3; } switch (cmd) { case HEADPHONE_SW_IOCTL_DETECT_START: send_p.sw_detect = cpu_to_be32(HEADPHONE_SW_DETECT_ON); #if DEBUG printk(KERN_INFO "[msm-handset] [%s] sw_detect = 0x%02lx\n", __func__, send_p.sw_detect); #endif break; case HEADPHONE_SW_IOCTL_DETECT_STOP: send_p.sw_detect = cpu_to_be32(HEADPHONE_SW_DETECT_OFF); #if DEBUG printk(KERN_INFO "[msm-handset] [%s] sw_detect = 0x%02lx\n", __func__, send_p.sw_detect); #endif break; default: return -2; break; } rc = msm_rpc_call_reply(rpc_svc_p, HS_SHEXTDET_SW_DETECT_PROC, &send_p, sizeof(send_p), &recv_p, sizeof(recv_p), 5 * HZ); if (rc < 0) { #if DEBUG printk(KERN_ERR "%s: rpc call failed! error: (%d)", __func__, rc); #endif return -3; } else { result = cpu_to_be32(recv_p.ret); #if DEBUG printk(KERN_INFO "[msm-handset] [%s] result = %ld\n", __func__, result); #endif if(result != 0) { printk(KERN_ERR "[msm-handset] [%s] RPC_SW_DETECT_PROC NG\n", __func__); return -1; } } return 0; }
static int __devinit sh_mt_probe(struct platform_device *pdev) { int rc; struct input_dev *ipdev; struct api_remote_req_t1 { struct rpc_request_hdr hdr; } send_p; mt_key = kzalloc(sizeof(struct msm_handset), GFP_KERNEL); if (!mt_key) return -ENOMEM; ipdev = input_allocate_device(); if (!ipdev) { rc = -ENOMEM; goto err_alloc_input_dev; } input_set_drvdata(ipdev, mt_key); mt_key->ipdev = ipdev; if (pdev->dev.platform_data) mt_key->hs_pdata = pdev->dev.platform_data; if (mt_key->hs_pdata->hs_name) ipdev->name = mt_key->hs_pdata->hs_name; else ipdev->name = DRIVER_SH_MT_NAME; ipdev->id.vendor = 0x0001; ipdev->id.product = 1; ipdev->id.version = 1; input_set_capability(ipdev, EV_KEY, KEY_VOLUMEUP); input_set_capability(ipdev, EV_KEY, KEY_VOLUMEDOWN); input_set_capability(ipdev, EV_KEY, KEY_CAMERA); input_set_capability(ipdev, EV_KEY, KEY_FOCUS); #ifdef CONFIG_LYNCIS_KEYPAD input_set_capability(ipdev, EV_KEY, KEY_MENU); input_set_capability(ipdev, EV_KEY, KEY_HOME); input_set_capability(ipdev, EV_KEY, KEY_BACK); input_set_capability(ipdev, EV_KEY, KEY_SEARCH); #endif /* CONFIG_LYNCIS_KEYPAD */ rc = input_register_device(ipdev); if (rc) { dev_err(&ipdev->dev, "hs_probe: input_register_device rc=%d\n", rc); goto err_reg_input_dev; } platform_set_drvdata(pdev, mt_key); if(IS_ERR(rpc_svc_p)) { pr_err("%s: couldn't connect compatible rpc client err %ld\n", __func__, PTR_ERR(rpc_svc_p)); goto err_mt_rpc_init; } rc = msm_rpc_call_reply(rpc_svc_p, HS_SHKEYPAD_API_INITIALIZE_REMOTE_PROC, &send_p,sizeof(send_p), NULL,0, 5 * HZ); if(rc) goto err_mt_rpc_init; return 0; err_mt_rpc_init: input_unregister_device(ipdev); ipdev = NULL; err_reg_input_dev: input_free_device(ipdev); err_alloc_input_dev: kfree(mt_key); mt_key = NULL; return rc; }
int msm_nv_cmd_remote ( uint32_t cmd, uint32_t item, nv_cmd_item_type *data_ptr) { int rc = 0; int reqsz = 0, repsz = 0; int more_data; nv_cmd_generic_cmd *cmdptr; // validity check if (msm_nv_check_validity(item) < 0) { printk(KERN_ERR "%s : cmd(%d) is NOT supported!\n", __func__, item); return -EINVAL; } if (!nv_ep || IS_ERR(nv_ep)) { printk(KERN_ERR "%s: rpc connect failed: rc = %ld\n", __func__, PTR_ERR(nv_ep)); return -EAGAIN; } cmdptr = kmalloc(sizeof(nv_cmd_generic_cmd), GFP_KERNEL); if (!cmdptr) { printk(KERN_ERR "%s: malloc failed\n", __func__); return -EBUSY; } cmdptr->req.common.cmd = cpu_to_be32(cmd); cmdptr->req.common.item = cpu_to_be32(item); more_data = (data_ptr != NULL); cmdptr->req.common.more_data = cpu_to_be32(more_data); cmdptr->req.common.disc = cpu_to_be32(item); msm_nv_set_req_data(item, cmdptr, data_ptr, &reqsz, &repsz); #if RPC_NV_DEBUG printk(KERN_INFO "%s: reqhdr(%d), rephdr(%d)\n", __func__, sizeof(struct rpc_request_hdr), sizeof(struct rpc_reply_hdr)); printk(KERN_INFO "%s: reqsz(%d), repsz(%d)\n", __func__, reqsz, repsz); #endif rc = msm_rpc_call_reply(nv_ep, nv_rpc_ids.cmd_remote, &cmdptr->req, reqsz, &cmdptr->rep, repsz, 5 * HZ); if (rc < 0) { kfree(cmdptr); printk(KERN_ERR "%s: rpc call failed! error: %d\n", __func__, rc); return rc; } #if RPC_NV_DEBUG else { printk(KERN_INFO "%s: rpc call success\n" , __func__); } #endif rc = be32_to_cpu(cmdptr->rep.common.result); if (rc == NV_DONE_S) { msm_nv_set_rep_data(item, cmdptr, data_ptr); } kfree(cmdptr); return rc; }
int msm_hsusb_get_set_usb_conf_nv_value(uint32_t nv_item,uint32_t value,uint32_t is_write) { int rc = 0; struct hsusb_phy_start_req { struct rpc_request_hdr hdr; uint32_t nv_item; uint32_t value; uint32_t is_write; } req; struct nv23_value_rep { struct rpc_reply_hdr hdr; int value; char wifidata[24]; } rep; if (!usb_ep || IS_ERR(usb_ep)) { msm_hsusb_rpc_connect(); } if (!usb_rpc_ids.get_usb_conf_nv_value) { printk(KERN_ERR "%s: proc id not supported \n", __func__); return -ENODATA; } req.nv_item = cpu_to_be32(nv_item); req.value = cpu_to_be32(value); req.is_write =cpu_to_be32(is_write); rc = msm_rpc_call_reply(usb_ep, usb_rpc_ids.get_usb_conf_nv_value, &req, sizeof(req), &rep, sizeof(rep), 5 * HZ); printk("======return value=%d \n\n",be32_to_cpu(rep.value)); if (rc < 0) { printk(KERN_ERR "%s: rpc call failed! error: %d\n" , __func__, rc); return rc; } else { printk(KERN_ERR "%s: rpc call success\n" , __func__); } rc = be32_to_cpu(rep.value); if(rc == 0) { if(nv_item == _NV_WLAN_MAC_ADDRESS_) { char * p = (char *)value; memcpy(p,rep.wifidata,6); } else if(nv_item == _NV_WLAN_ATHEROS_SPECIFIC_CFG_) { char *p = (char *)value; memcpy(p,rep.wifidata,24); } else { } } return rc; }
static long snd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_set_device_msg dmsg; struct snd_set_volume_msg vmsg; struct snd_avc_ctl_msg avc_msg; struct snd_agc_ctl_msg agc_msg; //LGE_SND_UPDATE_S [ struct snd_72xx_rpc_extcmd_msg rpc_extcmd_msg; struct snd_audio_cal_msg cal_msg; //LGE_SND_UPDATE_E ] struct msm_snd_device_config dev; struct msm_snd_volume_config vol; //LGE_SND_UPDATE_S [ struct msm_snd_72xx_rpc_extcmd_config rpc_extcmd_conf; struct msm_snd_audio_cal_config snd_audio_cal_conf; //LGE_SND_UPDATE_E ] struct snd_ctxt *snd = file->private_data; int rc = 0; uint32_t avc, agc; mutex_lock(&snd->lock); switch (cmd) { case SND_SET_DEVICE: if (copy_from_user(&dev, (void __user *) arg, sizeof(dev))) { MM_ERR("set device: invalid pointer\n"); rc = -EFAULT; break; } dmsg.args.device = cpu_to_be32(dev.device); dmsg.args.ear_mute = cpu_to_be32(dev.ear_mute); dmsg.args.mic_mute = cpu_to_be32(dev.mic_mute); if (check_mute(dev.ear_mute) < 0 || check_mute(dev.mic_mute) < 0) { MM_ERR("set device: invalid mute status\n"); rc = -EINVAL; break; } dmsg.args.cb_func = -1; dmsg.args.client_data = 0; MM_INFO("snd_set_device %d %d %d\n", dev.device, dev.ear_mute, dev.mic_mute); rc = msm_rpc_call(snd->ept, SND_SET_DEVICE_PROC, &dmsg, sizeof(dmsg), 5 * HZ); break; case SND_SET_VOLUME: if (copy_from_user(&vol, (void __user *) arg, sizeof(vol))) { MM_ERR("set volume: invalid pointer\n"); rc = -EFAULT; break; } vmsg.args.device = cpu_to_be32(vol.device); vmsg.args.method = cpu_to_be32(vol.method); if (vol.method != SND_METHOD_VOICE) { MM_ERR("set volume: invalid method\n"); rc = -EINVAL; break; } vmsg.args.volume = cpu_to_be32(vol.volume); vmsg.args.cb_func = -1; vmsg.args.client_data = 0; MM_INFO("snd_set_volume %d %d %d\n", vol.device, vol.method, vol.volume); rc = msm_rpc_call(snd->ept, SND_SET_VOLUME_PROC, &vmsg, sizeof(vmsg), 5 * HZ); break; case SND_AVC_CTL: if (get_user(avc, (uint32_t __user *) arg)) { rc = -EFAULT; break; } else if ((avc != 1) && (avc != 0)) { rc = -EINVAL; break; } avc_msg.args.avc_ctl = cpu_to_be32(avc); avc_msg.args.cb_func = -1; avc_msg.args.client_data = 0; MM_INFO("snd_avc_ctl %d\n", avc); rc = msm_rpc_call(snd->ept, SND_AVC_CTL_PROC, &avc_msg, sizeof(avc_msg), 5 * HZ); break; case SND_AGC_CTL: if (get_user(agc, (uint32_t __user *) arg)) { rc = -EFAULT; break; } else if ((agc != 1) && (agc != 0)) { rc = -EINVAL; break; } agc_msg.args.agc_ctl = cpu_to_be32(agc); agc_msg.args.cb_func = -1; agc_msg.args.client_data = 0; MM_INFO("snd_agc_ctl %d\n", agc); rc = msm_rpc_call(snd->ept, SND_AGC_CTL_PROC, &agc_msg, sizeof(agc_msg), 5 * HZ); break; case SND_GET_NUM_ENDPOINTS: if (copy_to_user((void __user *)arg, &snd->snd_epts->num, sizeof(unsigned))) { MM_ERR("get endpoint: invalid pointer\n"); rc = -EFAULT; } break; case SND_GET_ENDPOINT: rc = get_endpoint(snd, arg); break; //LGE_SND_UPDATE_S [ case SND_72XX_RPC_EXTCMD: if (copy_from_user(&rpc_extcmd_conf, (void __user *) arg, sizeof(rpc_extcmd_conf))) { MM_ERR("SND_72XX_RPC_EXTCMD: invalid pointer\n"); rc = -EFAULT; break; } rpc_extcmd_msg.args.rpc_extcmd = cpu_to_be32(rpc_extcmd_conf.rpc_extcmd); rpc_extcmd_msg.args.option = cpu_to_be32(rpc_extcmd_conf.option); rpc_extcmd_msg.args.cb_func = -1; rpc_extcmd_msg.args.client_data = 0; MM_INFO("SND_72XX_RPC_EXTCMD %d %d \n", rpc_extcmd_conf.rpc_extcmd, rpc_extcmd_conf.option); rc = msm_rpc_call_reply(snd->ept, SND_72XX_RPC_EXTCMD_PROC, &rpc_extcmd_msg, sizeof(rpc_extcmd_msg), &(extcmd_msg_rep), sizeof (extcmd_msg_rep), 5 * HZ); if (rc < 0){ MM_ERR("rpc err because"); } else { rpc_extcmd_conf.result = be32_to_cpu(extcmd_msg_rep.result); MM_INFO("snd 72xx rpc extcmd result=[%d]\n", rpc_extcmd_conf.result); if (copy_to_user((void __user *)arg, &rpc_extcmd_conf, sizeof(rpc_extcmd_conf))) { MM_INFO("snd_ioctl get voccal: invalid write pointer.\n"); rc = -EFAULT; } } break; case SND_AUDIO_CAL: if (copy_from_user(&snd_audio_cal_conf, (void __user *) arg, sizeof(snd_audio_cal_conf))) { MM_ERR("SND_AUDIO_CAL: invalid pointer\n"); rc = -EFAULT; break; } cal_msg.args.nCalType = cpu_to_be32(snd_audio_cal_conf.nCalType); cal_msg.args.nCmd = cpu_to_be32(snd_audio_cal_conf.nCmd); cal_msg.args.nDevice = cpu_to_be32(snd_audio_cal_conf.nDevice); cal_msg.args.nIndex = cpu_to_be32(snd_audio_cal_conf.nIndex); cal_msg.args.nSubIndex = cpu_to_be32(snd_audio_cal_conf.nSubIndex); cal_msg.args.nItem = cpu_to_be32(snd_audio_cal_conf.nItem); cal_msg.args.cb_func = -1; cal_msg.args.client_data = 0; MM_INFO("SND_AUDIO_CAL %d %d %d %d %d %d\n", snd_audio_cal_conf.nCalType, snd_audio_cal_conf.nCmd, snd_audio_cal_conf.nDevice, snd_audio_cal_conf.nIndex, snd_audio_cal_conf.nSubIndex, snd_audio_cal_conf.nItem); rc = msm_rpc_call_reply(snd->ept, SND_AUDIO_CAL_PROC, &cal_msg, sizeof(cal_msg), &(cal_msg_rep), sizeof (cal_msg_rep), 5 * HZ); if (rc < 0){ MM_ERR("rpc err because"); } else { snd_audio_cal_conf.result = be32_to_cpu(cal_msg_rep.result); MM_INFO("snd audio cal result=[%d]\n", snd_audio_cal_conf.result); if (copy_to_user((void __user *)arg, &snd_audio_cal_conf, sizeof(snd_audio_cal_conf))) { MM_INFO("snd_ioctl get voccal: invalid write pointer.\n"); rc = -EFAULT; } } break; //LGE_SND_UPDATE_E ] default: MM_ERR("unknown command\n"); rc = -EINVAL; break; } mutex_unlock(&snd->lock); return rc; }