Exemplo n.º 1
0
/*
 * Timeout value can be changed from sysfs entry
 * created by timed_output_dev.
 * echo 100 > /sys/class/timed_output/vibrator/enable
 */
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	timeout = value;

	if (value) {
		vibrator_start();
		msleep(value);
		vibrator_stop();
	} else {
		vibrator_stop();
	}
}
Exemplo n.º 2
0
static void vib_work_feedback_func(struct work_struct *work)
{
	struct vibrator *vib = container_of(work, struct vibrator, work_feedback);
	D(" %s +++\n", __func__);
	vibrator_stop(vib);
	D(" %s ---\n", __func__);
}
Exemplo n.º 3
0
/*
 * Timeout value can be changed from sysfs entry
 * created by timed_output_dev.
 * echo 100 > /sys/class/timed_output/vibrator/enable
 */
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	hrtimer_cancel(&data->timer);
	if (value > 0) {
		vibrator_start();
		hrtimer_start(&data->timer,
			  ktime_set(value / 1000, (value % 1000) * 1000000),
			  HRTIMER_MODE_REL);
	} else
		vibrator_stop();
	return;
}
Exemplo n.º 4
0
static int vibrator_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct vibrator *vib = platform_get_drvdata(pdev);

	D("vibrator_suspend +++\n");
	vibrator_stop(vib);
	hrtimer_cancel(&vib->vib_timer);
	hrtimer_cancel(&vib->vib_timer_stop);
	hrtimer_cancel(&vib->vib_timer_feedback);
	cancel_work_sync(&vib->work);
	cancel_work_sync(&vib->work_feedback);
	if(vib->pdata->pwm_gpio >= 0) {
		gpio_direction_output(vib->pdata->pwm_gpio, 0);
		tegra_gpio_enable(vib->pdata->pwm_gpio);
	}
	D("vibrator_suspend ---\n");
	return 0;
}
Exemplo n.º 5
0
static void vib_work_func(struct work_struct *work)
{
	struct vibrator *vib = container_of(work, struct vibrator, work);
	int real_time = 0;

	D(" %s +++\n", __func__);
	
	real_time= gettimeMs()- enable_time;
	if( (delay_value-real_time) >= 3){
		hrtimer_start(&vib->vib_timer_feedback,
                              ktime_set((delay_value-real_time-1) / 1000, ((delay_value-real_time-1) % 1000) * 1000000),
                              HRTIMER_MODE_REL);
		D("vibator work short , real_time = %d ,add timer =%d\n",real_time,delay_value-real_time);
	} else {
    	vibrator_stop(vib);
        D("vibator work normal =%llu\n",gettimeMs()- enable_time );

	}
	D(" %s ---\n", __func__);
}
Exemplo n.º 6
0
/*
 * Timeout value can be changed from sysfs entry
 * created by timed_output_dev.
 * echo 100 > /sys/class/timed_output/vibrator/enable
 */
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	struct vibrator *vib = container_of(dev, struct vibrator, timed_dev);

	D(" %s +++\n", __func__);
	if (value < 0)
		return;
	if (value) {
		delay_value = value ;
		D("vibration enable and duration time %d ms:%s(parent:%s): tgid=%d\n", value,current->comm, current->parent->comm, current->tgid);

		disable_time = gettimeMs() + value + 4;
		D("vibrator hrtimer1 start\n");
		hrtimer_start(&vib->vib_timer,
			      ktime_set(value / 1000, (value % 1000) * 1000000),
			      HRTIMER_MODE_REL);
		vibrator_start(vib);
	} else {
		D("vibration disable.\n");
		vibrator_stop(vib);
	}
	D(" %s ---\n", __func__);
}
Exemplo n.º 7
0
static void vibrator_work_func(unsigned long data)
{
	vibrator_stop();
}