예제 #1
0
static void vibetonz_start(void)
{
	int ret = 0;

	//printk("[VIBETONZ] %s : \n",__func__);
	spin_lock_init(&vib_lock);

	/* hrtimer settings */
	hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	timer.function = vibetonz_timer_func;

	if (gpio_is_valid(GPIO_VIB_EN)) {
		if (gpio_request(GPIO_VIB_EN, S3C_GPIO_LAVEL(GPIO_VIB_EN))) 
			printk(KERN_ERR "Failed to request GPIO_VIB_EN!\n");
		gpio_direction_output(GPIO_VIB_EN,0);
		mdelay(10);
		gpio_set_value(GPIO_VIB_EN, GPIO_LEVEL_LOW);
	}
	s3c_gpio_setpull(GPIO_VIB_EN, S3C_GPIO_PULL_NONE);

	/* pwm timer settings */
	s3c6410_timer_setup(1,10,VIBRATOR_ON_STRONG_PERIOD, VIBRATOR_OFF_STRONG_PERIOD);
	
	/* timed_output_device settings */
	ret = timed_output_dev_register(&timed_output_vt);
	if(ret)
		printk(KERN_ERR "[VIBETONZ] timed_output_dev_register is fail \n");	
}
예제 #2
0
void s3cfb_set_brightness(int val)
{
#if defined(CONFIG_S3C6410_PWM)
	int channel = 1;	/* must use channel-1 */
#elif defined(CONFIG_S5PC1XX_PWM)
	int channel = 0;	/* must use channel-0 */
#endif

	int usec = 0;		/* don't care value */
	unsigned long tcnt = 1000;
	unsigned long tcmp = 0;

	if (val < 0)
		val = 0;

	if (val > S3CFB_MAX_BRIGHTNESS)
		val = S3CFB_MAX_BRIGHTNESS;

	s3cfb_fimd.brightness = val;
	tcmp = val * 50;

#if defined(CONFIG_S3C6410_PWM)
        s3c6410_timer_setup(channel, usec, tcnt, tcmp);
#elif defined(CONFIG_S5PC1XX_PWM)
       s5pc100_timer_setup(channel, usec, tcnt, tcmp);
#endif
}
예제 #3
0
static int set_vibetonz(int timeout)
{
	
	if(!timeout) {

		printk("[VIBETONZ] reserved VIBRATOR_DISABLE\n");
		gpio_set_value(GPIO_VIBTONE_EN, GPIO_LEVEL_LOW);
		gpio_direction_input(GPIO_VIBTONE_EN);
		s3c_gpio_setpull(GPIO_VIBTONE_EN,S3C_GPIO_PULL_DOWN);

#if defined(CONFIG_MACH_SPICA) || defined(CONFIG_MACH_INSTINCTQ)
		//s3c_bat_set_compensation_for_drv(0,OFFSET_VIBRATOR_ON);
#endif
	}
	else {

		s3c6410_timer_setup(1,10,300,3);
		printk("[VIBETONZ] reserved VIBRATOR_ENABLE\n");
		gpio_direction_output(GPIO_VIBTONE_EN, GPIO_LEVEL_LOW);
		mdelay(1);
		gpio_set_value(GPIO_VIBTONE_EN, GPIO_LEVEL_HIGH);
#if defined(CONFIG_MACH_SPICA) || defined(CONFIG_MACH_INSTINCTQ)
		//s3c_bat_set_compensation_for_drv(1,OFFSET_VIBRATOR_ON);
#endif
	}

	vibrator_value = timeout;

	
	return 0;
}
static void vibetonz_start(void)
{
	int ret = 0;

	printk("[VIBETONZ] %s : \n",__func__);
	spin_lock_init(&vib_spin_lock);


	/* hrtimer settings */
	hrtimer_init(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	timer.function = vibetonz_timer_func;


	if (gpio_is_valid(GPIO_VIB_EN)) {
		if (gpio_request(GPIO_VIB_EN, S3C_GPIO_LAVEL(GPIO_VIB_EN))) 
			printk(KERN_ERR "Failed to request GPIO_VIB_EN!\n");
		gpio_direction_output(GPIO_VIB_EN,0);
		mdelay(10);
		gpio_set_value(GPIO_VIB_EN, GPIO_LEVEL_LOW);
	}
	s3c_gpio_setpull(GPIO_VIB_EN, S3C_GPIO_PULL_NONE);

	/*Initialising work-queue*/
	vib_wq = create_singlethread_workqueue("vib_wq");
	if(!vib_wq){
		printk(KERN_ERR "Not enough memory for vibrator workqueue\n");
	}	
	INIT_WORK(&work_vib,vib_work_func);
	
	/* pwm timer settings */
#ifdef CONFIG_MACH_VINSQ
	s3c6410_timer_setup(1,10,290,3);
#else
	s3c6410_timer_setup(1,10,300,3);
#endif
	
	/* timed_output_device settings */
	ret = timed_output_dev_register(&timed_output_vt);
	if(ret)
		printk(KERN_ERR "[VIBETONZ] timed_output_dev_register is fail \n");

	
}
예제 #5
0
static int set_vibetonz(int timeout)
{	
	int val = 0;
	
	if(!timeout) {	
		/* 2009.09.13(sunday) drkim - adjust vibratonz strength */
        s3c6410_timer_setup(1,10,VIBRATOR_ON_STRONG_PERIOD, VIBRATOR_OFF_STRONG_PERIOD);
		
		gpio_set_value(GPIO_VIB_EN, GPIO_LEVEL_LOW);

#if defined(CONFIG_MACH_SPICA) || defined(CONFIG_MACH_INSTINCTQ)
		s3c_bat_set_compensation_for_drv(0,OFFSET_VIBRATOR_ON);
#endif
	}
    else {
        /* 2009.09.13(sunday) drkim - adjust vibratonz strength */
        if(timeout == -1) {
            //printk("[VIBETONZ] HI TEST MODE\n");            
            s3c6410_timer_setup(1,10,VIBRATOR_ON_STRONG_PERIOD, VIBRATOR_OFF_STRONG_PERIOD);
        }
        else {
            if (timeout >= VIBRATOR_STRENGTH) {
               s3c6410_timer_setup(1,10,VIBRATOR_ON_WEEK_PERIOD, VIBRATOR_OFF_WEEK_PERIOD);
                timeout -= 0x40000000;
				//printk("[VIBETONZ] LOW, timeout= %x\n", timeout);
            }
            else {
                s3c6410_timer_setup(1,10,VIBRATOR_ON_STRONG_PERIOD,VIBRATOR_OFF_STRONG_PERIOD);                
            }
        }
		gpio_set_value(GPIO_VIB_EN, GPIO_LEVEL_HIGH);
        
#if defined(CONFIG_MACH_SPICA) || defined(CONFIG_MACH_INSTINCTQ)
		s3c_bat_set_compensation_for_drv(1,OFFSET_VIBRATOR_ON);
#endif
	}

	vibrator_value = timeout;
//    printk("[VIBETONZ] END, timeout = %x\n", vibrator_value);    
	
	return timeout;
}
예제 #6
0
void s3cfb_set_brightness(int val)
{
	int channel = 1;	
	int usec = 0;		
	unsigned long tcnt = 1000;
	unsigned long tcmp = 0;

	if (val < 0)
		val = 0;

	if (val > S3CFB_MAX_BRIGHTNESS)
		val = S3CFB_MAX_BRIGHTNESS;

	s3cfb_fimd.brightness = val;
	tcmp = val * 5;

	s3c6410_timer_setup (channel, usec, tcnt, tcmp);
}