/* * 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(); } }
/* * 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; }
/* * 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__); }