Beispiel #1
0
static long IRRC_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int rc = 0;
	int HD_size;
	int LD_size;
	
	struct irrc_compr_params test;
	
	rc = copy_from_user(&test, (void __user *)arg, sizeof(test));
	
	HD_size = test.HD_size;
	LD_size = test.LD_size;
	printk(KERN_INFO "IRRC_ioctl First %d %d",HD_size,LD_size);
	switch (cmd) {
	case IRRC_START:
		printk(KERN_INFO "IRRC_START\n");
	//	if(system_rev<2){
	//	}else if(system_rev==2){
	//		hwPowerOn(MT65XX_POWER_LDO_VCAMA, VOL_2800, "2V8_IrRC_LDO_S");
	//	}else{
			mt_set_gpio_mode(GPIO_IRRC_LDO_EN,GPIO_MODE_00);
			mt_set_gpio_pull_enable(GPIO_IRRC_LDO_EN, GPIO_PULL_ENABLE);
			mt_set_gpio_dir(GPIO_IRRC_LDO_EN,GPIO_DIR_OUT);
			mt_set_gpio_out(GPIO_IRRC_LDO_EN,GPIO_OUT_ONE);
	//	}
		irrc_pwmon(HD_size,LD_size);	
		cancel_delayed_work_sync(&ts->input_PWM_off_work); 
		cancel_delayed_work_sync(&ts->input_LDO_off_work);  
		break;
	case IRRC_STOP:
		printk(KERN_INFO "IRRC_STOP\n");
		cancel_delayed_work_sync(&ts->input_PWM_off_work);  
		queue_delayed_work(ts->workqueue,&ts->input_PWM_off_work, msecs_to_jiffies(1500));		
		cancel_delayed_work_sync(&ts->input_LDO_off_work);  
		queue_delayed_work(ts->workqueue,&ts->input_LDO_off_work, msecs_to_jiffies(1500));	
		break;
	default:
		rc = -EINVAL;
	}

	return rc;
}
Beispiel #2
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);
		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));
		}
		break;
	default:
		rc = -EINVAL;
	}

	return rc;
}
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;
}