[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220410220649.5258-1-dbdaniel42@gmail.com>
Date: Sun, 10 Apr 2022 17:06:49 -0500
From: Daniel Bomar <dbdaniel42@...il.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
Daniel Bomar <dbdaniel42@...il.com>
Subject: [PATCH 2/4] input: ff-memless: Add trigger left/right in ml_combine_effects
Signed-off-by: Daniel Bomar <dbdaniel42@...il.com>
---
drivers/input/ff-memless.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index 8229a9006917..7f3a19970608 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -245,7 +245,7 @@ static void ml_combine_effects(struct ff_effect *effect,
int gain)
{
struct ff_effect *new = state->effect;
- unsigned int strong, weak, i;
+ unsigned int strong, weak, trigger_left, trigger_right, i;
int x, y;
s16 level;
@@ -271,6 +271,8 @@ static void ml_combine_effects(struct ff_effect *effect,
case FF_RUMBLE:
strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff;
weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff;
+ trigger_left = (u32)new->u.rumble.trigger_left * gain / 0xffff;
+ trigger_right = (u32)new->u.rumble.trigger_right * gain / 0xffff;
if (effect->u.rumble.strong_magnitude + strong)
effect->direction = ml_calculate_direction(
@@ -289,6 +291,10 @@ static void ml_combine_effects(struct ff_effect *effect,
0xffffU);
effect->u.rumble.weak_magnitude =
min(weak + effect->u.rumble.weak_magnitude, 0xffffU);
+ effect->u.rumble.trigger_left =
+ min(trigger_left + effect->u.rumble.trigger_left, 0xffffU);
+ effect->u.rumble.trigger_right =
+ min(trigger_right + effect->u.rumble.trigger_right, 0xffffU);
break;
case FF_PERIODIC:
--
2.35.1
Powered by blists - more mailing lists