Exemple #1
0
/* add work queue for hrtimer -> */
static void hrtimer_work_func(struct work_struct *work)
{
#if 0
	timed_vibrator_off(NULL);
#else
	pmic_vibrator_off(NULL);
#endif
}
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	/* detele */
	if (value == 0)
	{
		/* detele */
		//timed_vibrator_off(dev);
		pmic_vibrator_off(NULL);
	}
	else {
		value = (value > 600000 ? 600000 : value);
		value = (value < VIBRATOR_MIN ? VIBRATOR_MIN : value);
		time_value = value;
		//timed_vibrator_on(dev);
		pmic_vibrator_on(NULL);//use this function instead of timed_vibrator_on.
	/* detele */
	}
}
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	time_value = value;//save this value as vibratting time
	hrtimer_cancel(&vibe_timer);

	if (value == 0)
	{
		mdelay(VIBRATOR_DELAY);
		//timed_vibrator_off(dev);
		pmic_vibrator_off(NULL);
	}
	else {
		value = (value > 15000 ? 15000 : value);
		value = (value < VIBRATOR_MIN ? VIBRATOR_MIN : value);

		//timed_vibrator_on(dev);
		pmic_vibrator_on(NULL);//use this function instead of timed_vibrator_on.
		hrtimer_start(&vibe_timer,
			      ktime_set(value / 1000, (value % 1000) * 1000000),
			      HRTIMER_MODE_REL);
	}
}
static void vibrator_enable(struct timed_output_dev *dev, int value)
{
	time_value = value;//save this value as vibratting time
    /* < DTS2012041806002 houming 20120504 begin*/
    /* detele */
    /*  DTS2012041806002 houming 20120504 end > */
	if (value == 0)
	{
		mdelay(VIBRATOR_DELAY);
		//timed_vibrator_off(dev);
		pmic_vibrator_off(NULL);
	}
	else {
		value = (value > 15000 ? 15000 : value);
		value = (value < VIBRATOR_MIN ? VIBRATOR_MIN : value);

		//timed_vibrator_on(dev);
		pmic_vibrator_on(NULL);//use this function instead of timed_vibrator_on.
    /* < DTS2012041806002 houming 20120504 begin*/
    /* detele */
    /*  DTS2012041806002 houming 20120504 end > */
	}
}