static int uei_irrc_probe(struct platform_device *pdev) { struct uei_irrc_pdata_type *pdata = pdev->dev.platform_data; if(!pdata) return -EINVAL; pr_info("%s\n", __FUNCTION__); #if defined(CONFIG_MACH_APQ8064_AWIFI070U) irrc_power_set(1); #endif gpio_set_value(pdata->en_gpio,1); return 0; }
static long IRRC_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int rc = 0; int PWM_CLK; int duty; struct irrc_compr_params test; rc = copy_from_user(&test, (void __user *)arg, sizeof(test)); printk(KERN_INFO "IRRC_ioctl freqeuncy = %d, duty = %d\n",test.frequency,test.duty); PWM_CLK=(test.frequency)/1000; duty=test.duty; switch (cmd) { case IRRC_START: printk(KERN_INFO "IRRC_START\n"); irrc_pwmon(PWM_CLK,duty); // if (delayed_work_pending(&ts->input_PWM_off_work)) { cancel_delayed_work(&ts->input_PWM_off_work); } if (delayed_work_pending(&ts->irrc_power_off_work)) { cancel_delayed_work(&ts->irrc_power_off_work); } // break; case IRRC_STOP: printk(KERN_INFO "IRRC_STOP\n"); if(gpio_set==1){ printk(KERN_INFO "gpio_signal_off!\n"); cancel_delayed_work_sync(&ts->input_GPIO_off_work); queue_delayed_work(ts->workqueue,&ts->input_GPIO_off_work, msecs_to_jiffies(1500)); } else{ printk(KERN_INFO "pwm_signal_off!\n"); cancel_delayed_work_sync(&ts->input_PWM_off_work); queue_delayed_work(ts->workqueue,&ts->input_PWM_off_work, msecs_to_jiffies(1500)); } // #if defined(CONFIG_MACH_APQ8064_AWIFI) || defined(CONFIG_MACH_APQ8064_ALTEV) if (lge_get_board_revno() >= HW_REV_A) { printk(KERN_INFO "IRRC_power_off!\n"); cancel_delayed_work_sync(&ts->irrc_power_off_work); queue_delayed_work(ts->workqueue,&ts->irrc_power_off_work, msecs_to_jiffies(1500)); } #endif // break; // case IRRC_POWER: #if defined(CONFIG_MACH_APQ8064_AWIFI) || defined(CONFIG_MACH_APQ8064_ALTEV) if (lge_get_board_revno() >= HW_REV_A) { printk(KERN_INFO "IRRC_POWER\n"); irrc_power_set(1); rc = 1; } #else rc = -EPERM; #endif break; // default: rc = -EINVAL; } return rc; }
static void irrc_power_off_work_func(struct work_struct *work) { irrc_power_set(0); }