Exemplo n.º 1
0
static void pm8xxx_vib_enable(struct timed_output_dev *dev, int value)
{
	struct pm8xxx_vib *vib = container_of(dev, struct pm8xxx_vib,
					 timed_dev);

	VIB_INFO_LOG("%s vibrate period: %d msec\n",__func__,value);
retry:

	if (hrtimer_try_to_cancel(&vib->vib_timer) < 0) {
		cpu_relax();
		goto retry;
	}

	if (value == 0)
		pm8xxx_vib_set_off(vib);
	else {

		value = (value > vib->pdata->max_timeout_ms ?
				 vib->pdata->max_timeout_ms : value);

    /* Sense 4 haptic feedback fix */	
    if ((value == 20) || (value == 21))
      value = 40;

		pm8xxx_vib_set_on(vib);
		hrtimer_start(&vib->vib_timer,
			      ktime_set(value / 1000, (value % 1000) * 1000000),
			      HRTIMER_MODE_REL);
	}
}
static void pm8xxx_vib_enable(struct timed_output_dev *dev, int value)
{
	struct pm8xxx_vib *vib = container_of(dev, struct pm8xxx_vib,
					 timed_dev);
	if (time_th >= 0 && value > time_th && vib->pdata->camera_cb) {
		vib->pdata->camera_cb();
		vib_notified = 1;
	}

	VIB_INFO_LOG("%s vibrate period: %d msec: %s(parent:%s), tgid=%d\n",__func__,value, current->comm, current->parent->comm, current->tgid);
retry:

	if (hrtimer_try_to_cancel(&vib->vib_timer) < 0) {
		cpu_relax();
		goto retry;
	}

	if (value == 0)
		pm8xxx_vib_set_off(vib);
	else {
		value = (value > vib->pdata->max_timeout_ms ?
				 vib->pdata->max_timeout_ms : value);
		pm8xxx_vib_set_on(vib);
		hrtimer_start(&vib->vib_timer,
			      ktime_set(value / 1000, (value % 1000) * 1000000),
			      HRTIMER_MODE_REL);
	}
}