From: Daniel Bomar <dbdaniel42@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Daniel Bomar <dbdaniel42@gmail.com>
Subject: [PATCH 2/4] input: ff-memless: Add trigger left/right in ml_combine_effects
Date: Sun, 10 Apr 2022 17:06:49 -0500 [thread overview]
Message-ID: <20220410220649.5258-1-dbdaniel42@gmail.com> (raw)
Signed-off-by: Daniel Bomar <dbdaniel42@gmail.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
reply other threads:[~2022-04-10 22:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220410220649.5258-1-dbdaniel42@gmail.com \
--to=dbdaniel42@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.