Re: [PATCH v8 3/9] Input: qcom-pmi8998-haptics - Add Qualcomm PMI8998 haptics driver

From: David Heidelberg

Date: Tue Dec 01 2026 - 04:57:56 EST


On 01/12/2026 05:48, Dmitry Torokhov wrote:
Hi David,

On Mon, Nov 30, 2026 at 01:13:50AM +0100, David Heidelberg wrote:
Add a driver for the haptics module in the Qualcomm PMI8998 PMIC, based
on the downstream qpnp-haptics driver and using the input force-feedback
framework.

Both linear resonant actuators (LRA) and eccentric rotating mass (ERM)
motors are supported in direct and 8-sample buffer play modes.
FF_RUMBLE, FF_CONSTANT, FF_PERIODIC (FF_SINE and FF_CUSTOM) effects and
FF_GAIN master gain are supported, with requested strength scaled
linearly between 116 mV and the board's qcom,vmax-microvolt and timed
effects stopped automatically after replay.length ms. For LRA actuators,
the module's auto-resonance measurement is polled while driving to track
resonance drift within the configured variation bounds; ERM actuators
disable auto-resonance and use the configured sample play rate. Active
braking and short-circuit fault handling (which shuts down the module if
shorts persist) are supported. Audio and PWM waveform sources, overdrive
and multi-set waveforms are not implemented.

PMI8941, PMI8994 and PMI8996 carry a similar block; they can be added
once tested.

Based on work of Casey Connolly.

Signed-off-by: David Heidelberg <david@xxxxxxx>

Thank you for the driver. Please also mention PM660 in the commit
description since the driver adds support for qcom,pm660-haptics.

The biggest issue here is that the driver grew to over 2000 lines mostly
because it uses input_ff_create() and implements its own asynchronous FF
scheduler (effect array, request queue, spinlock, and multiple work
items). Since this hardware has no autonomous effect memory or replay
timer, please switch to input_ff_create_memless() like the other
vibrator drivers in drivers/input/misc/. That gives proper handling of
replay.delay, repeat counts, FF_GAIN, envelopes, and effect combining,
avoids hand-rolling partial FF_SINE and FF_CONSTANT support, and drops
the custom queue and work races (including the work()/erase() race
Sashiko pointed out).

Hi Dmitry.

What about our waveform buffer the HW has, I wouldn't be able to utilize it with ff-memless, if I'm correct. While I currently dislike the extra complexity, the problem why I went with this approach was mostly because ff-memless couldn't do much.


As a heads up, I am looking into reworking the FF core and ff-memless to
better handle suspend, resume, and "slow" (sleepable) memoryless
devices. There is no need to wait on that work, though: a slim driver
built on the existing input_ff_create_memless() with a single
work_struct will be straightforward to adapt once those changes land.

If I go for the memless, are there planned at least some changes to, f.e. use the waveform buffers, e.g. opposite of memless?

Thank you
David

P.S. I won't mind if you use your own wording instead of LLM replies, as I remember these were historically just fine.

[...]