static void pm8xxx_vib_update(struct work_struct *work) { struct pm8xxx_vib *vib = container_of(work, struct pm8xxx_vib, work); pm8xxx_vib_set_off(vib); }
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); } }
static enum hrtimer_restart pm8xxx_vib_timer_func(struct hrtimer *timer) { struct pm8xxx_vib *vib = container_of(timer, struct pm8xxx_vib, vib_timer); VIB_INFO_LOG("%s \n",__func__); pm8xxx_vib_set_off(vib); return HRTIMER_NORESTART; }
static int pm8xxx_vib_suspend(struct device *dev) { struct pm8xxx_vib *vib = dev_get_drvdata(dev); hrtimer_cancel(&vib->vib_timer); pm8xxx_vib_set_off(vib); return 0; }
static int pm8xxx_vib_suspend(struct device *dev) { struct pm8xxx_vib *vib = dev_get_drvdata(dev); hrtimer_cancel(&vib->vib_timer); cancel_work_sync(&vib->work); /* turn-off vibrator */ pm8xxx_vib_set_off(vib); return 0; }
static int pm8xxx_vib_suspend(struct device *dev) { struct pm8xxx_vib_pwm *vib = dev_get_drvdata(dev); VIB_PWM_INFO("%s \n",__func__); hrtimer_cancel(&vib->vib_timer); cancel_work_sync(&vib->work); /* turn-off vibrator */ pm8xxx_vib_set_off(vib); gpio_direction_output(vib->vdd_gpio, DISABLE_VDD); return 0; }