[PATCH 2/4] input: ff-memless: Add trigger left/right in ml_combine_effects
From: Daniel Bomar
Date: Sun Apr 10 2022 - 18:06:59 EST
Signed-off-by: Daniel Bomar <dbdaniel42@xxxxxxxxx>
---
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