static void vibrator_enable(struct timed_output_dev *dev, int value) { /* FUJITSU:2011-12-1 mod VIB start */ #if 0 hrtimer_cancel(&vibe_timer); if (value == 0) timed_vibrator_off(dev); else { value = (value > 15000 ? 15000 : value); timed_vibrator_on(dev); hrtimer_start(&vibe_timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); } #else int vibrator_time = 0; if (value == 0) { if (vibrator_timer_active()) { vibrator_time = vibrator_get_time(dev); printk("[VIB] vibrator Off(time[%d])\n", vibrator_time ); /* Put a delay of 10 ms, in case the vibrator is off immediately */ if (vibrator_time < 10 || vibrator_time > 50){ hrtimer_cancel(&vibe_timer); vibrator_time = 0; } vibrator_value = value; #if TIMED_VIBRATOR_FLAG if(timed_vibrator_flag == 1){ printk("timed_vibrator_enable off schedule cancel\n"); return; } #endif timed_vibrator_off(dev, vibrator_time + 10); } } else { printk("[VIB] vibrator On(time[%d])\n", value ); /* Provisional management */ /* Normal operation is not carried out in case of a small value. */ /* For this reason, 10 ms is used when smaller than 10 ms. */ if((0 < value )&&(value < 10)){ value = 10; } vibrator_value = (value > 15000 ? 15000 : value); hrtimer_cancel(&vibe_timer); timed_vibrator_on(dev); } #endif /* FUJITSU:2011-12-1 mod VIB end */ }
static void vibrator_enable(struct timed_output_dev *dev, int value) { pr_debug("[shvibrator] value=%d.\n", value); hrtimer_cancel(&vibe_timer); sh_vibrator_reqtime = value; cancel_work_sync(&work_hrtimer); cancel_work_sync(&work_vibrator_on); cancel_work_sync(&work_vibrator_off); if (value == 0) timed_vibrator_off(dev); else { sh_vibrator_reqtime = (value > 15000 ? 15000 : value); #if defined( SHVIB_PAUSE_PEDOMETER ) #if defined( CONFIG_SENSORS_AMI603 ) if (value >= 700) { pause_pedometer = 1; } else { pause_pedometer = 0; } #elif defined( CONFIG_SH_YAS530 ) pause_pedometer = 1; #endif #endif timed_vibrator_on(dev); } }
static void vibrator_enable(struct timed_output_dev *dev, int value) { hrtimer_cancel(&vibe_timer); if (value == 0) { printk("[VIB] OFF\n"); timed_vibrator_off(dev); } else { printk("[VIB] ON\n"); printk("[VIB] Duration : %d msec\n" , value); timed_vibrator_on(dev); if (value == 0x7fffffff){ printk("[VIB} No Use Timer %d \n", value); } else { value = (value > 15000 ? 15000 : value); hrtimer_start(&vibe_timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); } } }
static void vibrator_enable(struct timed_output_dev *dev, int value) { hrtimer_cancel(&vibe_timer); cancel_work_sync(&work_vibrator_on); cancel_work_sync(&work_vibrator_off); pr_info("vibrator_enable,%d ms,vibrator:%s now.\n",value,g_vibrator_status?"on":"off"); if (value == 0) { if(!timed_vibrator_off(dev))//if queue failed, delay 10ms try again by timer { pr_info("vibrator_enable, queue failed!\n"); value=10; hrtimer_start(&vibe_timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); value=0; } } else { //value = (value > 15000 ? 15000 : value); vibrator_on_delay = value; timed_vibrator_on(dev); //hrtimer_start(&vibe_timer, // ktime_set(value / 1000, (value % 1000 + VIB_OFF_DELAY) * 1000000), // HRTIMER_MODE_REL); } }
static void vibrator_enable(struct timed_output_dev *dev, int value) { hrtimer_cancel(&vibe_timer); if (value == 0) timed_vibrator_off(dev); else { value = (value > 15000 ? 15000 : value); timed_vibrator_on(dev); hrtimer_start(&vibe_timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); } }
static void vibrator_enable(struct timed_output_dev *dev, int value) { hrtimer_cancel(&vibe_timer); if (value == 0) timed_vibrator_off(dev); else { value = (value > 15000 ? 15000 : value); value = (value < 50 ? 50 : value); //20120704: anna add for strengthen the feeling of vibrator. timed_vibrator_on(dev); hrtimer_start(&vibe_timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); } }
static void vibrator_enable(struct timed_output_dev *dev, int value) { hrtimer_cancel(&vibe_timer); if (value == 0) { DEBUG_INFO( "vibrator_enable : value(%d) = vib off\n", value ); timed_vibrator_off(dev); } else { value = (value > 15000 ? 15000 : value); DEBUG_INFO( "vibrator_enable : value(%d) = vib on\n", value ); timed_vibrator_on( dev, value ); } }
static void vibrator_enable(struct timed_output_dev *dev, int value) { /* printk("vibrator duration value is %d \n", value); */ hrtimer_cancel(&vibe_timer); if (value == 0) { vibrator_duration_value = value; timed_vibrator_off(dev); } else { value = (value > 15000 ? 15000 : value); vibrator_duration_value = value; timed_vibrator_on(dev); hrtimer_start(&vibe_timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); } /*get the value from apps*/ }
static void vibrator_enable(struct timed_output_dev *dev, int value) { unsigned long flags; spin_lock_irqsave(&vibe_lock, flags); hrtimer_cancel(&vibe_timer); if (value == 0){ timed_vibrator_off(dev); } else { value = (value > 15000 ? 15000 : value); value = (value < 20) ? 20 : value; timed_vibrator_on(dev); hrtimer_start(&vibe_timer, ktime_set(value / 1000, (value % 1000) * 1000000), HRTIMER_MODE_REL); } spin_unlock_irqrestore(&vibe_lock, flags); }
static void vibrator_enable(struct timed_output_dev *dev, int value) { int vibrator_time = 0; if (value == 0) { if (vibrator_timer_active()) { vibrator_time = vibrator_get_time(dev); // hrtimer_cancel(&vibe_timer); /* Put a delay of 10 ms, in case the vibrator is off immediately */ if (vibrator_time < 10 || vibrator_time > 50) { hrtimer_cancel(&vibe_timer); vibrator_time = 0; } vibrator_value = value; timed_vibrator_off(dev, vibrator_time + 10); } } else { vibrator_value = (value > 15000 ? 15000 : value); hrtimer_cancel(&vibe_timer); timed_vibrator_on(dev); } }