static void vibrator_enable(struct timed_output_dev *dev, int value)
{
#if defined (CONFIG_LCT_AW551_YL)
	int time = value / 100*2;
#else
	int time = value / 100;
#endif
	int vol = value % 100 * 100;

	hrtimer_cancel(&vibe_timer);
	cancel_work_sync(&work_vibrator_off);

	if (vol < VIB_VOL_MIN) vol = VIB_VOL_MIN;
	if (vol > VIB_VOL_MAX) vol = VIB_VOL_MAX;
	vib_level = vol;
	

	if (time <= 0)
		set_pmic_vibrator(0);
	else {
		//value = (value > 15000 ? 15000 : value);

		set_pmic_vibrator(1);
	//	timed_vibrator_on(dev);

		//hrtimer_start(&vibe_timer,
			      //ktime_set(value / 1000, (value % 1000) * 1000000),
			      //HRTIMER_MODE_REL);
		hrtimer_start(&vibe_timer,
			      ktime_set(time / 1000, (time % 1000) * 1000000),
			      HRTIMER_MODE_REL);
	}
}
示例#2
0
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	hrtimer_cancel(&vibe_timer);
/* LGE_CHANGE,
 * To prevent the vibrator being turned off automatically while it is vibrating
 * 2011-08-20, [email protected]
*/
	cancel_work_sync(&work_vibrator_off);
/* LGE_CHANGE End */

/* LGE_CHANGE,
 * No scheduling vibrator on and off, and convert max enable time 15sec to 20 sec
 * 2011-08-20, [email protected]
*/
	if (value == 0)
		/* timed_vibrator_off(dev); */ /* origin code  */
		set_pmic_vibrator(0);
	else {
		/* value = (value > 15000 ? 15000 : value); */ /* origin code */
		value = (value > 20000 ? 20000 : value);

		/* timed_vibrator_on(dev); */ /* origin code  */
		set_pmic_vibrator(1);
/* LGE_CHANGE End */

		hrtimer_start(&vibe_timer,
			      ktime_set(value / 1000, (value % 1000) * 1000000),
			      HRTIMER_MODE_REL);
	}
}
示例#3
0
static void pmic_vibrator_off(struct work_struct *work)
{
	set_pmic_vibrator(0);
	if (vibrator_timer_active()) {
		/* Make it on, timer will switch it off */
		set_pmic_vibrator(1);
	}
}
static void pmic_vibrator_off(struct work_struct *work)
{
	set_pmic_vibrator(0);
/* FUJITSU:2011-12-1 add VIB start	*/
	if (vibrator_timer_active()) {
		/* Make it on, timer will switch it off */
		set_pmic_vibrator(1);
	}
/* FUJITSU:2011-12-1 add VIB  end	*/
}
static void pmic_vibrator_on(struct work_struct *work)
{
/* FUJITSU:2011-12-1 mod VIB start	*/
#if 0
	set_pmic_vibrator(1);
#else
	hrtimer_start(&vibe_timer,ktime_set(vibrator_value / 1000, (vibrator_value % 1000) * 1000000),HRTIMER_MODE_REL);
	set_pmic_vibrator(1);
	if (!vibrator_timer_active()) {
		/* No timer active, there may in infinite vibration, so switch off */
		timed_vibrator_off(NULL, 0);
	}
#endif
/* FUJITSU:2011-12-1 mod VIB  end	*/
}
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	mutex_lock(&vibrator_mtx);
	hrtimer_cancel(&vibrator_timer);
	cancel_work_sync(&vibrator_work);

	if (value == 0) {
		set_pmic_vibrator(0);
	} else {
		value = (value > 15000 ? 15000 : value);
		set_pmic_vibrator(value);
		hrtimer_start(&vibrator_timer,
			      ktime_set(value / 1000, (value % 1000) * 1000000),
			      HRTIMER_MODE_REL);
	}
	mutex_unlock(&vibrator_mtx);
}
示例#7
0
static ssize_t shvib_write(struct file *filp, 
	const char __user *ubuf, size_t cnt, loff_t *ppos)
{
	char cmd;

	pr_debug("[shvib]shvib_write(%s) start\n", ubuf);
	
	if(get_user(cmd, ubuf)){
		return -EFAULT;
	}

	pr_debug("[shvib]shvib_write() cmd = %d\n", cmd);
	
	if(cmd == '0'){
		set_pmic_vibrator(0);
	}else{
		set_pmic_vibrator(1);
	}
	
	return cnt;
}
示例#8
0
static void pmic_vibrator_off(struct work_struct *work)
{
    if( g_vibrator_status==1)//if vibrator is on now
    {
        debug_print("Q:pmic_vibrator_off,start");
        set_pmic_vibrator(0);
        debug_print("Q:pmic_vibrator_off,done\n");
    }
    else
    {
        debug_print("Q:pmic_vibrator_off, already off, do nothing.\n");
    }
}
示例#9
0
static void pmic_vibrator_on(struct work_struct *work)
{
    if( g_vibrator_status==0)//if vibrator is on now
    {
        debug_print("Q:pmic_vibrator_on,start");
        set_pmic_vibrator(1);
        debug_print("Q:pmic_vibrator_on,done\n");
    }
    else
    {
        debug_print("Q:pmic_vibrator_on, already on, do nothing.\n");
    }
	vibrator_on_delay = (vibrator_on_delay > 15000 ? 15000 : vibrator_on_delay);	//moved from enable fun & modified chenchongbao.20111218
	hrtimer_start(&vibe_timer,
                      ktime_set(vibrator_on_delay / 1000, (vibrator_on_delay % 1000 ) * 1000000),
                      HRTIMER_MODE_REL);
}
示例#10
0
static void pmic_vibrator_on(struct work_struct *work)
{
#if defined( SHVIB_PAUSE_PEDOMETER )
	if (!paused_pedometer && pause_pedometer) {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Pause a pedometer.\n");
		AMI602Pedometer_Pause();
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Pause a acclerometer.\n");
		SHMDS_Acclerometer_Control( SHMDS_ACC_PAUSE );
#endif
		paused_pedometer = 1;
	} else {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Don't pause a pedometer.\n");
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Don't pause a acclerometer.\n");
#endif
	}
#endif

/* [BatteryTemperatureLog] [start] */
    if (sh_vibrator_shterm_flg == false) {
        pr_debug("%s() shterm_k_set_info( SHTERM_INFO_VIB, 1 ) \n", __func__);
        shterm_k_set_info( SHTERM_INFO_VIB, 1 );
        sh_vibrator_shterm_flg = true;
    }
/* [BatteryTemperatureLog] [end] */
/* [stop geiger when using speaker/vibration] -> */
#if defined( CONFIG_SENSORS_SHGEIGER )
	ShGeigerPause_Vib();
#endif
/* [stop geiger when using speaker/vibration] <- */

	set_pmic_vibrator(1);
	
	hrtimer_start(&vibe_timer,
		      ktime_set(sh_vibrator_reqtime / 1000, (sh_vibrator_reqtime % 1000) * 1000000),
		      HRTIMER_MODE_REL);
	pr_debug("[shvibrator] timer start. %d \n", sh_vibrator_reqtime);
}
示例#11
0
static void pmic_vibrator_off(struct work_struct *work)
{
	set_pmic_vibrator(0);

/* [stop geiger when using speaker/vibration] -> */
#if defined( CONFIG_SENSORS_SHGEIGER )
	ShGeigerReStart_Vib();
#endif
/* [stop geiger when using speaker/vibration] <- */
/* [BatteryTemperatureLog] [start] */
    if (sh_vibrator_shterm_flg == true) {
        pr_debug("%s() shterm_k_set_info( SHTERM_INFO_VIB, 0 ) \n", __func__);
        shterm_k_set_info( SHTERM_INFO_VIB, 0 );
        sh_vibrator_shterm_flg = false;
    }
/* [BatteryTemperatureLog] [end] */

#if defined( SHVIB_PAUSE_PEDOMETER )
	if (paused_pedometer) {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Restart a pedometer.\n");
		AMI602Pedometer_ReStart();
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Restart a acclerometer.\n");
		SHMDS_Acclerometer_Control( SHMDS_ACC_RESTART );
#endif
		paused_pedometer = 0;
	} else {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Don't restart a pedometer.\n");
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Don't restart a acclerometer.\n");
#endif
	}
#endif
}
示例#12
0
static void pmic_vibrator_off(struct work_struct *work)
{
	set_pmic_vibrator(0);
}
示例#13
0
static void pmic_vibrator_on(struct work_struct *work)
{
	set_pmic_vibrator(1);
}
示例#14
0
static void pmic_vibrator_off(struct work_struct *work)
{
	DEBUG_INFO( "[pmic_vibrator_off]vibrator off(0)\n" );
	set_pmic_vibrator( 0, NULL );

}
示例#15
0
static void pmic_vibrator_on(struct work_struct *work)
{
	DEBUG_INFO( "[pmic_vibrator_on]vibrator on(1)\n" );
	set_pmic_vibrator( 1, (struct vib_on_work_struct*)work );
}
static void update_vibrator(struct work_struct *work)
{
	pr_debug("%s\n", __func__);
	set_pmic_vibrator(0);
}
示例#17
0
static void pmic_vibrator_on(struct work_struct *work)
{
        hrtimer_start(&vibe_timer,ktime_set(vibrator_value / 1000, (vibrator_value % 1000) * 1000000),HRTIMER_MODE_REL);	     set_pmic_vibrator(1);
	if (!vibrator_timer_active()) {
		/* No timer active, there may in infinite vibration, so switch off */
		timed_vibrator_off(NULL, 0);
	}
}
示例#18
0
static void update_vibrator(struct work_struct *work)
{
	set_pmic_vibrator(vibe_state);
}