]> git.baikalelectronics.ru Git - kernel.git/commit
Input: ff-core - correct magnitude setting for rumble compatibility
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 7 Dec 2021 07:23:00 +0000 (23:23 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 7 Dec 2021 07:24:03 +0000 (23:24 -0800)
commit1337027da6efd6ab7cd4105684b79cbbd08d1528
treec3c12a92f4e38d908563716c4ced9d713a8c81f1
parent543e6ec3d90481ac14d315b8f58d8fdaa4645207
Input: ff-core - correct magnitude setting for rumble compatibility

When converting a rumble into a periodic effect, for compatibility,
the magnitude is effectively calculated using:

magnitude = max(strong_rubble / 3 + weak_rubble / 6, 0x7fff);

The rumble magnitudes are both u16 and the resulting magnitude is
s16. The max is presumably an attempt to limit the result of the
calculation to the maximum possible magnitude for the s16 result,
and thus should be a min.

However in the case of strong = weak = 0xffff, the result of the first
part of the calculation is 0x7fff, meaning that the min would be
redundant anyway, so simply remove the current max.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211130135039.13726-1-ckeepax@opensource.cirrus.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/ff-core.c