Repository navigation
HID: magicmouse: keep host click feedback across system sleep - #2026
DjDeveloperr merged 3 commits into
Conversation
The dockchannel transport keeps passing MTP reports on while it is suspended, but refuses requests with -EBUSY until it resumes. A press handled while the transport is suspended, such as one that wakes the system, queued its click, and the press worker failed to play the waveform. Its error path cleared haptic_press and tried to hand the actuator back to the firmware, which failed the same way, so the firmware stayed in host-controlled mode. Resume then assumed the actuator was device-controlled. With haptic_press off the host no longer clicked, and the firmware neither clicked nor reported the button: the pad had no click until the driver was rebound. Stop sending to the actuator in the driver's suspend callback, which the transport runs before it stops taking requests, until resume. On resume, assert the wanted actuator mode instead of assuming the firmware went back to device-controlled mode, which the J714s actuator does not do across suspend-to-idle. Nothing is sent when device-controlled mode is both wanted and already cached. Closes: aurora-silicon#2025 Signed-off-by: Isaac Duarte <[email protected]>
…asleep magicmouse_haptic_forget_mode() is gone: suspend now marks the trackpad suspended and resume asserts the actuator mode itself. Paste magicmouse_haptic_suspend(), magicmouse_haptic_resume() and magicmouse_haptic_effects_loaded() instead, and make the actuator stub assert that the transport is up, which is the -EBUSY failure seen on hardware. Check that resume asserts device mode, and host mode when haptic_press is set. Signed-off-by: Isaac Duarte <[email protected]>
273ad42 to
62d2045
Compare
A report can queue a click after suspend canceled its worker, then run it after resume clears the suspended flag. Serialize input and FF playback queueing with PM state changes under an IRQ-safe lock. Set the flag before draining both click and effect jobs, without holding either worker lock. Refuse FF uploads and defer the final erased-effect hand-back while asleep. Resume restores the wanted mode once the transport accepts requests again. Exercise the production producers, FF callbacks, default mode, loaded effects and restore failures. Keep the original head as a compiled runtime negative control in the host-test runner. Signed-off-by: Diljit Singh <[email protected]>
|
Pushed follow-up e12a699, preserving the original two commits. Found a remaining queue-after-cancel window: reports and FF playback could queue while suspended, then execute after resume cleared the flag. Input producers and PM transitions now share an IRQ-safe lock, all click/FF jobs drain after producers are stopped, uploads refuse asleep transport, and erase defers the firmware hand-back. The production callback checks pass, including loaded effects, restore failures, reset-resume and default zero-I/O behavior. The original PR head compiles and fails the new suspended-report assertion at runtime; the old transport negative control also fails as expected. Both controls are wired into CI. AArch64 W=1 driver object builds pass with haptics enabled and disabled, without warnings. Strict checkpatch and whitespace checks are clean. No new hardware boot or physical click test was performed; the author's previous hardware evidence applies to the earlier version. Default unchanged. Current-head CI is pending. |
|
Review against The fix covers both paths in #2025: no actuator request is sent while the transport is suspended, and resume asserts the mode that is wanted instead of trusting the cache. One interaction to settle before merge:
A second report on a J415 (M2, linux-aurora 7.3.0.aurora1-40) in #2025 shows the same |
|
The #2100 conflict is real on J714s, and the bad order is the one this machine has. Multi-touch is DockChannel interface 1, the actuator interface 4, and I'd keep the mode in the trackpad driver, the only one holding the cache. This PR covers #2100's case too: with effects loaded, resume asserts host mode and caches it, so the button is derived on the host instead of waiting for a firmware button that host mode never reports. That's from the code and the loaded-effects harness case; I have no J614c to test it on. If this lands, #2100's actuator-side switch can go; I've noted it there. Agreed on Hardware: the J714s now runs integration/aurora 0abc2f3 plus this PR's head (same patch as e12a699), |
|
Review (merge lane), head The suspend/resume handling holds up.
Local checks on the merge into integration/aurora
Follow-ups, none blocking:
#2100: with this in, its actuator-side switch to device mode on resume conflicts with this resume path. On J714s the trackpad (interface 1) resumes before the actuator (interface 4), so Merging. The J714s sleep row (default N and |
493b6dc
into
aurora-silicon:integration/aurora
Keep host-driven click feedback working across system sleep. Closes #2025.
Behavior
DockChannel HID still delivers input reports while suspended, but refuses feature requests with EBUSY. A click worker used to hit that refusal, disable
haptic_press, fail its firmware hand-back and leave the actuator in host mode while neither side produced a click.Suspend now marks the haptic state under the actuator mutex and an IRQ-safe producer lock. Raw click and FF playback producers cannot queue after that transition. It drains the four click jobs and all FF jobs without holding the locks their workers need. Workers and firmware hand-back skip actuator I/O while suspended; uploads return EBUSY, and erasing the final effect defers its hand-back until resume.
Resume/reset-resume clear input state and assert the wanted actuator mode after the transport accepts requests: host mode for
haptic_pressor loaded effects, otherwise device mode. Default N with device mode already cached sends nothing. Failed restoration leaves the cache value that makes the existing paths retry; unsupported host mode is not warned about.The producer lock closes a second race in the original fix: a report arriving after worker cancellation could queue work while suspended, then play after resume cleared the flag. The original two commits are preserved; the follow-up is
e12a69972e56fc8b804b38509fec3d8d0efce3ba.Follow-up validation
62d2045d8928compiles and fails the new suspended-report assertion at runtime. Legacy transport4db3a5a22c43also compiles and fails its expected runtime assertion. Both negative controls are in the host-test runner.CONFIG_HID_APPLE_MTP_HAPTIC=mand disabled, with no warnings. The enabled object references the actuator API; the disabled object does not. These are compile checks, not a new boot kit.Hardware evidence
The original version was tested by the author on J714s with integration c33c5fd plus this PR, in-tree haptics enabled and
haptic_press=Y. A devices-PM freeze while clicking reproduced the old EBUSY/silent-pad failure, while the original fix sent no suspended waveform and restored host mode. The author also reported 8-second and 4h42m lid s2idle sleeps with Y preserved and clicks/tracking working, plus device-mode hand-back after selecting N.The follow-up has since run on the J714s: integration/aurora 0abc2f3 plus this PR's head (same patch as e12a699),
haptic_press=Y. Across two s2idle wakes (1 h 24 min, ~1 s), the MTP logged the host-mode handoff from the resume path (Intercepted 0x21 click handoff: 01) after each, magicmouse logged no warnings, and a physical press gave exactly one click. A fresh devices-PM freeze while clicking has not been repeated on the follow-up.