diff mbox

[RFC] ff-memless instant starting

Message ID 1261575074.24604.31.camel@tema (mailing list archive)
State New, archived
Headers show

Commit Message

Jari Vanhala Dec. 23, 2009, 1:31 p.m. UTC
None
diff mbox

Patch

From d3b6fa1eaac42f878f7c9b89b22ddfa85d900f38 Mon Sep 17 00:00:00 2001
From: Jari Vanhala <ext-jari.vanhala@nokia.com>
Date: Tue, 22 Dec 2009 16:49:29 +0200
Subject: [PATCH] Input: Add instant option to ff-memless

Allows Force Feedback effect to be started immediately
and not to wait for timer. Useful in low HZ systems.

Signed-off-by: Jari Vanhala <ext-jari.vanhala@nokia.com>
---
 drivers/input/ff-memless.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index b483b29..dfd5830 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -67,6 +67,10 @@  struct ml_device {
 			   struct ff_effect *effect);
 };
 
+static int instant;
+module_param(instant, int, 0);
+MODULE_PARM_DESC(instant, "Start new effect instantly");
+
 static const struct ff_envelope *get_envelope(const struct ff_effect *effect)
 {
 	static const struct ff_envelope empty_envelope;
@@ -411,7 +415,10 @@  static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
 				 msecs_to_jiffies(state->effect->replay.length);
 		state->adj_at = state->play_at;
 
-		ml_schedule_timer(ml);
+		if (instant && !state->effect->replay.delay)
+			ml_play_effects(ml);
+		else
+			ml_schedule_timer(ml);
 
 	} else {
 		debug("initiated stop");
-- 
1.6.3.3