static int vibrator_get_time(struct timed_output_dev *dev) { int ret; unsigned long flags; spin_lock_irqsave(&vibe_lock, flags); switch (vibe_state) { case TASK_KICK_START: ret = long_vibe_time; break; case TASK_START: case TASK_STOP: ret = long_vibe_time; if (hrtimer_active(&vibe_timer)) { ktime_t r = hrtimer_get_remaining(&vibe_timer); ret += r.tv.sec * 1000 + r.tv.nsec / 1000000; } break; case TASK_FORCE_STOP: case TASK_NONE: default: ret = 0; break; } spin_unlock_irqrestore(&vibe_lock, flags); return ret; }
static int vibrator_get_time(struct timed_output_dev *dev) { if (hrtimer_active(&vibe_timer)) { ktime_t r = hrtimer_get_remaining(&vibe_timer); return ktime_to_ms(r); } else return 0; }
static int vibrator_get_time(struct timed_output_dev *dev) { if (hrtimer_active(&vibe_timer)) { ktime_t r = hrtimer_get_remaining(&vibe_timer); return r.tv.sec * 1000 + r.tv.nsec / 1000000; } else return 0; }
static int herring_vibrator_get_time(struct timed_output_dev *dev) { if (hrtimer_active(&vibdata.timer)) { ktime_t r = hrtimer_get_remaining(&vibdata.timer); return ktime_to_ms(r); } return 0; }
/* * Timeout value can be read from sysfs entry * created by timed_output_dev. * cat /sys/class/timed_output/vibrator/enable */ static int vibrator_get_time(struct timed_output_dev *dev) { struct vibrator *vib = container_of(dev, struct vibrator, timed_dev); if (hrtimer_active(&vib->vib_timer)) { ktime_t r = hrtimer_get_remaining(&vib->vib_timer); return (int)ktime_to_us(r); } else return 0; }
static int drv2667_get_time(struct timed_output_dev *dev) { struct drv2667_data *data = container_of(dev, struct drv2667_data, dev); if (hrtimer_active(&data->timer)) return data->runtime_left + ktime_to_ms(hrtimer_get_remaining(&data->timer)); return 0; }
static int vibrator_get_time(struct timed_output_dev *dev) { if (hrtimer_active(&vibe_timer)) { ktime_t r = hrtimer_get_remaining(&vibe_timer); struct timeval t = ktime_to_timeval(r); return t.tv_sec * 1000 + t.tv_usec / 1000; } return 0; }
static int get_time_for_vibetonz(struct timed_output_dev *dev) { int remaining; if (hrtimer_active(&timer)) { ktime_t r = hrtimer_get_remaining(&timer); remaining = r.tv.sec * 1000 + r.tv.nsec / 1000000; } else remaining = 0; return remaining; }
static void msm_otg_del_timer(struct msm_otg *dev) { int bit = dev->active_tmout; pr_debug("deleting %s timer. remaining %lld msec \n", timer_string(bit), div_s64(ktime_to_us(hrtimer_get_remaining(&dev->timer)), 1000)); hrtimer_cancel(&dev->timer); clear_bit(bit, &dev->tmouts); }
static int vibrator_get_time(struct timed_output_dev *dev) { struct timed_vibrator_data *data = container_of(dev, struct timed_vibrator_data, dev); if (hrtimer_active(&data->timer)) { ktime_t r = hrtimer_get_remaining(&data->timer); return r.tv.sec * 1000 + r.tv.nsec / 1000000; } else return 0; }
static int vibrator_get_time(struct timed_output_dev *dev) { struct timed_vibrator_data *vib = container_of(dev, struct timed_vibrator_data, dev); if (hrtimer_active(&vib->timer)) { ktime_t r = hrtimer_get_remaining(&vib->timer); return ktime_to_ms(r); } else return 0; }
int mx6_get_time(structtimed_output_dev *sdev) { if(hrtimer_active(&vibdata.timer)) { ktime_tr = hrtimer_get_remaining(&vibdata.timer); //读取剩余时间按并返回 returnktime_to_ms(r); } return 0; }
static int vibrator_get_time(struct timed_output_dev *dev) { //struct Haptics *pvibdata = container_of(dev, struct Haptics, to_dev); if (hrtimer_active(&vibdata.timer)) { ktime_t r = hrtimer_get_remaining(&vibdata.timer); return ktime_to_ms(r); } return 0; }
static int vibrator_get_time(struct timed_output_dev *dev) { struct timespec time_tmp; if (hrtimer_active(&vibe_timer)) { ktime_t r = hrtimer_get_remaining(&vibe_timer); time_tmp = ktime_to_timespec(r); //return r.tv.sec * 1000 + r.tv.nsec/1000000; return time_tmp.tv_sec* 1000 + time_tmp.tv_nsec/1000000; } else return 0; }
static int k3_vibrator_get_time(struct timed_output_dev *dev) { struct k3_vibrator_data *pdata = container_of(dev, struct k3_vibrator_data, dev); if (hrtimer_active(&pdata->timer)) { ktime_t r = hrtimer_get_remaining(&pdata->timer); struct timeval t = ktime_to_timeval(r); return t.tv_sec * 1000 + t.tv_usec / 1000; } else return 0; }
static int vibrator_get_time(struct timed_output_dev *dev) { printk("[tspdrv] %s\n", __func__); if (hrtimer_active(&vibe_timer)) { ktime_t r = hrtimer_get_remaining(&vibe_timer); return ktime_to_ms(r); } return 0; }
static int pmic8058_vib_get_time(struct timed_output_dev *dev) { struct pmic8058_vib *vib = container_of(dev, struct pmic8058_vib, timed_dev); if (hrtimer_active(&vib->vib_timer)) { ktime_t r = hrtimer_get_remaining(&vib->vib_timer); return r.tv.sec * 1000 + r.tv.nsec / 1000000; } else return 0; }
static int haptic_get_time(struct timed_output_dev *tdev) { struct haptic_data *chip = container_of(tdev, struct haptic_data, tdev); if (hrtimer_active(&chip->timer)) { ktime_t r = hrtimer_get_remaining(&chip->timer); struct timeval t = ktime_to_timeval(r); return t.tv_sec * 1000 + t.tv_usec / 1000; } return 0; }
/* get time api to know the remaining time */ static int qpnp_hap_get_time(struct timed_output_dev *dev) { struct qpnp_hap *hap = container_of(dev, struct qpnp_hap, timed_dev); if (hrtimer_active(&hap->hap_timer)) { ktime_t r = hrtimer_get_remaining(&hap->hap_timer); return (int)ktime_to_us(r); } else { return 0; } }
static int lge_isa1200_vibrator_get_time(struct timed_output_dev *dev) { struct lge_isa1200_context *context = container_of(dev, struct lge_isa1200_context, dev); dev_info(dev->dev, "%s()\n", __func__); if (hrtimer_active(&context->timer)) { ktime_t r = hrtimer_get_remaining(&context->timer); return ktime_to_ms(r); } else return 0; }
static int vibrator_get_time(struct timed_output_dev *dev) { struct drv2605_data *data; data = container_of(dev, struct drv2605_data, dev); if (hrtimer_active(&(data->timer))) { ktime_t r = hrtimer_get_remaining(&data->timer); return ktime_to_ms(r); } return 0; }
int qsd_timed_vibrator_get_time(struct timed_output_dev *sdev) { ktime_t remain; int value = 0; MSG("%s", __func__); if(hrtimer_active(&qsd_timed_vibrator_timer)) { remain = hrtimer_get_remaining(&qsd_timed_vibrator_timer); value = remain.tv.sec * 1000 + remain.tv.nsec / 1000000; } MSG("timeout = %d",value); return value; }
static ssize_t aat1271_flash_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { struct timed_gpio_data *gpio_data = dev_get_drvdata(dev); int remaining; if (hrtimer_active(&gpio_data->timer)) { ktime_t r = hrtimer_get_remaining(&gpio_data->timer); remaining = r.tv.sec * 1000 + r.tv.nsec / 1000000; } else remaining = 0; return sprintf(buf, "%d\n", remaining); }
static int lc898300_vib_get_time(struct timed_output_dev *dev) { struct lc898300_data *data = container_of(dev, struct lc898300_data, timed_dev); int remain; if (hrtimer_active(&data->vib_timer)) { ktime_t r = hrtimer_get_remaining(&data->vib_timer); remain = (int)ktime_to_ms(r); return remain > 0 ? remain : 0; } else { return 0; } }
static int ldo_vibrator_vib_get_time(struct timed_output_dev *dev) { struct ldo_vibrator_data *data = container_of(dev, struct ldo_vibrator_data, timed_dev); int ret = 0; if (hrtimer_active(&data->vib_timer)) { ktime_t r = hrtimer_get_remaining(&data->vib_timer); ret = (int)ktime_to_us(r); } return ret; }
static int haptic_get_time(struct timed_output_dev *tout_dev) { struct max77833_haptic_data *hap_data = container_of(tout_dev, struct max77833_haptic_data, tout_dev); struct hrtimer *timer = &hap_data->timer; if (hrtimer_active(timer)) { ktime_t remain = hrtimer_get_remaining(timer); struct timeval t = ktime_to_timeval(remain); return t.tv_sec * 1000 + t.tv_usec / 1000; } return 0; }
static int pm8xxx_vib_get_time(struct timed_output_dev *dev) { struct pm8xxx_vib *vib = container_of(dev, struct pm8xxx_vib, timed_dev); VIB_DEBUG_LOG(KERN_INFO, "called.\n"); if (hrtimer_active(&vib->vib_timer)) { ktime_t r = hrtimer_get_remaining(&vib->vib_timer); VIB_DEBUG_LOG(KERN_INFO, "remaining=%d.\n", (int)ktime_to_us(r)); return (int)ktime_to_ms(r); } else { VIB_DEBUG_LOG(KERN_INFO, "hrtimer not active.\n"); return 0; } }
static int pm8xxx_vib_get_time(struct timed_output_dev *dev) { struct pm8xxx_vib *vib = container_of(dev, struct pm8xxx_vib, timed_dev); if (hrtimer_active(&vib->vib_timer)) { ktime_t r = hrtimer_get_remaining(&vib->vib_timer); VIBRATOR_PRINTK(1, "%s: time=%d \n", __func__, (int)ktime_to_us(r)); return (int)ktime_to_us(r); } else { VIBRATOR_PRINTK(1, "%s: no timer device atcived--\n", __func__); return 0; } }
/* * Get the time remaining on a POSIX.1b interval timer. This function * is ALWAYS called with spin_lock_irq on the timer, thus it must not * mess with irq. * * We have a couple of messes to clean up here. First there is the case * of a timer that has a requeue pending. These timers should appear to * be in the timer list with an expiry as if we were to requeue them * now. * * The second issue is the SIGEV_NONE timer which may be active but is * not really ever put in the timer list (to save system resources). * This timer may be expired, and if so, we will do it here. Otherwise * it is the same as a requeue pending timer WRT to what we should * report. */ static void common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) { ktime_t remaining; struct hrtimer *timer = &timr->it.real.timer; memset(cur_setting, 0, sizeof(struct itimerspec)); remaining = hrtimer_get_remaining(timer); /* Time left ? or timer pending */ if (remaining.tv64 > 0 || hrtimer_active(timer)) goto calci; /* interval timer ? */ if (timr->it.real.interval.tv64 == 0) return; /* * When a requeue is pending or this is a SIGEV_NONE timer * move the expiry time forward by intervals, so expiry is > * now. */ if (timr->it_requeue_pending & REQUEUE_PENDING || (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) { timr->it_overrun += hrtimer_forward(timer, timr->it.real.interval); remaining = hrtimer_get_remaining(timer); } calci: /* interval timer ? */ if (timr->it.real.interval.tv64 != 0) cur_setting->it_interval = ktime_to_timespec(timr->it.real.interval); /* Return 0 only, when the timer is expired and not pending */ if (remaining.tv64 <= 0) cur_setting->it_value.tv_nsec = 1; else cur_setting->it_value = ktime_to_timespec(remaining); }
static int isa1200_chip_get_time(struct timed_output_dev *dev) { struct isa1200_chip *haptic = container_of(dev, struct isa1200_chip, dev); if (hrtimer_active(&haptic->timer)) { ktime_t r = hrtimer_get_remaining(&haptic->timer); #ifdef CONFIG_MACH_MEHMET return ktime_to_ms(r); #else return r.tv.sec * 1000 + r.tv.nsec / 1000000; #endif //CONFIG_MACH_T10S } else return 0; }