static __inline void vibrator_onOff(char onOff) { unsigned int arg1, arg2=0; int ret; if(onOff) { arg1 = SMEM_PC_OEM_LED_CTL_VIB_ON; PM_LOG_EVENT(PM_LOG_ON, PM_LOG_VIBRATOR); jiff_vib_on_timeout = jiffies + 5*HZ; } else { arg1 = SMEM_PC_OEM_LED_CTL_VIB_OFF; PM_LOG_EVENT(PM_LOG_OFF, PM_LOG_VIBRATOR); } ret = cust_mproc_comm1(&arg1,&arg2); if(ret != 0) { MSG2("VIB %s: FAIL!", onOff?"ON":"OFF"); jiff_vib_on_timeout = jiffies + 30*24*60*60*HZ; } else { if(onOff == 0) { if(time_after(jiffies, jiff_vib_on_timeout)) MSG2("VIB OFF! Wait more than 5 sec after VIB ON"); jiff_vib_on_timeout = jiffies + 30*24*60*60*HZ; } } }
static ssize_t dsp_write(struct file *file, const char __user *buf, size_t count, loff_t *pos) { char cmd[32]; unsigned int arg1, arg2; int rc = 0; if (count >= sizeof(cmd)) return -EINVAL; if (copy_from_user(cmd, buf, count)) return -EFAULT; cmd[count] = 0; if ((count > 1) && (cmd[count-1] == '\n')) cmd[count-1] = 0; if (!strcmp(cmd, "wait-for-crash")) { while (!dsp_has_crashed) { int res; dsp_wait_count++; res = wait_event_interruptible(dsp_wait, dsp_has_crashed); if (res < 0) { dsp_wait_count--; return res; } } #if defined(CONFIG_MACH_MAHIMAHI) /* assert DSP NMI */ msm_proc_comm(PCOM_CUSTOMER_CMD1, 0, 0); msleep(250); #endif arg1 = SMEM_PC_OEM_FLUSH_ADSP6_CACHE; arg2 = 0; rc = cust_mproc_comm1(&arg1,&arg2); printk("Send SMEM_PC_OEM_FLUSH_ADSP6_CACHE done rc = %d", rc); msleep(250); } else if (!strcmp(cmd, "boom")) { q6audio_dsp_not_responding(); } else if (!strcmp(cmd, "continue-crash")) { dsp_has_crashed = 2; wake_up(&dsp_wait); } else { pr_err("[%s:%s] unknown dsp_debug command: %s\n", __MM_FILE__, __func__, cmd); } return count; }
static void pwrkey_work_func(struct work_struct *work) { unsigned int arg1, arg2; int ret; printk("[KEY]## %s+\n",__func__); arg1 = SMEM_PC_OEM_GET_PWK_RELEASE_STATUS; arg2 = 0; ret = cust_mproc_comm1(&arg1,&arg2); if(ret) { printk("[KEY]## %s Key = Unknown\n",__func__); } else { printk("[KEY]## %s Key = %s\n",__func__, arg2==1?"Released":"Pressed"); if(arg2 == 0) kernel_power_off("Power Key"); } printk("[KEY]## %s-\n",__func__); }
static int q6_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int rc; uint32_t n; uint32_t id[2]; uint32_t mute_status; switch (cmd) { case AUDIO_SWITCH_DEVICE: rc = copy_from_user(&id, (void *)arg, sizeof(id)); if (!rc) { D("AUDIO_SWITCH_DEVICE to 0x%x\n", id[0]); if (id[0] <= 0xff){ uint32_t arg1 = 0; uint32_t arg2 = 0; rc = q6_voice_stop(); printk("voice stop rc = %d\n", rc); if (QISDA_HANDSET_LOOKBACK == id[0]){ arg1 = SMEM_PC_OEM_AUD_LB_HANDSET; } else if (QISDA_HEADSET_LOOKBACK == id[0] ){ rc = q6_voice_start(); printk("voice start rc = %d\n", rc); arg1 = SMEM_PC_OEM_AUD_LB_HEADSET; } else if( QISDA_LOUDSPEAKER_LOOKBACK == id[0] ){ arg1 = SMEM_PC_OEM_AUD_LB_LOUDSPEAKER; } else if(QISDA_HANDSET_LOOKBACK_START == id[0] ){ arg1 = SMEM_PC_OEM_AUD_LB_HANDSET_START; } else if(QISDA_HANDSET_LOOKBACK_STOP == id[0] ){ arg1 = SMEM_PC_OEM_AUD_LB_HANDSET_STOP; } rc = cust_mproc_comm1(&arg1,&arg2); D("Start rout to loopback mode arg1 = %d, ret = %d\n", arg1, rc); } else{ rc = q6audio_do_routing(id[0], id[1]); } } break; case AUDIO_SET_VOLUME: rc = copy_from_user(&n, (void *)arg, sizeof(n)); if (!rc) { pr_info("[%s:%s] SET_VOLUME: vol = %d\n", __MM_FILE__, __func__, n); if ((atomic_read(&voice_started)) || ( n > 100 )) { pr_info("[%s:%s] SET_VOLUME: vol = %d\n", __MM_FILE__, __func__, n); rc = q6audio_set_rx_volume(n); } else { if( n == 0) #ifdef CONFIG_DSC_FORCE_SPEAKER_ENABLE //hPa //cm7 streak q6audio_pmic_speaker_enable(1); #else q6audio_pmic_speaker_enable(0); #endif else q6audio_pmic_speaker_enable(1); } }