Skip to content

Input: cs40l25-vibra: add the Pixel 6 Pro's CS40L25A haptics - #114

Merged
derekross merged 3 commits into
derekross:omamobilefrom
robotosaith:omamobile-gs101-haptics-pr
Oct 29, 2026
Merged

derekross merged 3 commits into
derekross:omamobilefrom
robotosaith:omamobile-gs101-haptics-pr

Conversation

@robotosaith

Copy link
Copy Markdown
Contributor

The Pixel 6 Pro's haptics are a Cirrus Logic CS40L25A, an older part than the Pixel 7 Pro's CS40L26, with no mainline driver. This adds one, a binding and raven's node.

  • dt-bindings: the CS40L25A's address, reset line and (for later) its interrupt.
  • cs40l25-vibra:
    • Bring-up: resets the chip, hands it over from its ROM basic mode, applies the B0 errata and the board's boost (with its short test), and loads the RAM firmware and default wavetable through cs_dsp.
    • Force feedback: exposes FF_RUMBLE through ff-memless. The strength sets the firmware's trigger gain (−8 to −18 dB), a start plays the continuous effect through the trigger mailbox, and a stop writes ENDPLAYBACK. Themes ask for 7–12 ms clicks, shorter than the actuator needs to build up, so a stop is held back to 30 ms.
    • Source: the sequence follows Cirrus Logic's GPL cs40l2x driver in Google's Pixel 6 kernels. On raven the firmware idles at HALO_STATE 201, not the 203 cs40l2x expects, and plays from there.
  • raven DT: the chip on hsi2c_8 at 0x43, reset on gpp24-0, as stock's gs101-raviole-audio.dtsi.

The firmware is Google's (cs40l25a_clab.wmfw, cs40l20.bin), from the owner's factory image (tools/extract-vendor-firmware -d raven), not in linux-firmware.

Not yet: the IRQ, hibernation, braking, calibration, the codec path, and the boost from the DT.

Tested on raven (7.3.0-rc6): it probes at boot from the DT, and feedbackd drives it: key presses and notifications tick. tools/kernel-pr-check passes with --build (W=1 build clean); the binding passes dt-doc-validate, and dt-validate reports nothing new. Of the 8 checkpatch warnings, 6 are the Co-Authored-By: trailer, as in #8, and 2 ask about MAINTAINERS, which cs40l26-vibra doesn't have either.

🤖 Generated with Claude Code

@derekross

Copy link
Copy Markdown
Owner

Thanks for this. A CS40L25A driver from scratch is a big piece of work, and the plan's H0 to H5 trail made it easy to follow. I checked the boost against stock's gs101-raviole-audio.dtsi and cs40l2x_boost_config() with its tables: K1/K2 0x24, slope 0x75, peak 0x4a, 7.5 V 0x64, OVP 0x130. They match, and they're the same full values cs40l2x writes into its power-on sequence. Address, reset line and interrupt match stock too. The driver adds no shared code: the CS40L26 object for the Pixel 7 Pro is unchanged, and every commit builds on its own.

Two things before merging:

  1. Kconfig: select CS_DSP names a symbol that doesn't exist. It's FW_CS_DSP, as INPUT_CS40L26_VIBRA has it, and select INPUT_FF_MEMLESS is missing too. It builds in our config only because cs40l26-vibra and the CS35L41 codec select both. With arm64 defconfig, cs40l26-vibra off and INPUT_CS40L25_VIBRA=m, FW_CS_DSP isn't set at all, while the object needs cs_dsp_power_up, cs_dsp_run and the other cs_dsp_* calls, plus input_ff_create_memless.
  2. Reset polarity: the binding and raven's node describe the reset as GPIO_ACTIVE_HIGH, "high takes it out of reset", and the driver writes 1 to release it. The usual convention, and the one cirrus,cs40l26.yaml and cs40l26-vibra use in this tree, is to describe the line as GPIO_ACTIVE_LOW, with 1 meaning "held in reset". The wire levels stay exactly the same; only the logic flips. Since the binding becomes an interface once it lands, I'd like it fixed now.

Smaller ones, take them or leave them:

  • The boost values are built in for any cirrus,cs40l25a. The CS40L26 binding takes them from the DT (cirrus,boost-peak-microamp, cirrus,boost-ctl-microvolt). Oriole has the same values, so this only matters for a future board, but it's easiest while the binding is new.
  • The regmap makes everything up to 0x03807ffc readable, so a read of the debugfs registers file walks the DSP's memories over I2C while the firmware runs. On cheetah, reading a CS35L41's whole register file during playback stopped its DSP algorithm. A readable_reg limited to the control port avoids that (cs40l26-vibra has the same gap).
  • The errata, IRQ mask and boost tables come from Cirrus Logic's cs40l2x.c (Copyright (C) 2018-2020 Cirrus Logic, GPL-2.0). A "based on" line with that copyright in the header would be right.

As on the other PRs, a tools/phone-smoke report from your build would help. The order I have in mind is #111, #112 and #113 first, then this one, rebased (the DT node appends at the same place), and then device-raven's haptics (#113 there).

@robotosaith

Copy link
Copy Markdown
Contributor Author

Smoke report from the build that runs this: #112 (comment).

Kconfig now selects FW_CS_DSP and INPUT_FF_MEMLESS, and the header has cs40l2x's copyright. The reset-polarity change comes next, with a test boot, and I'll push the lot together.

@robotosaith
robotosaith force-pushed the omamobile-gs101-haptics-pr branch from 04a4e71 to 86fd0f1 Compare October 28, 2026 15:08
@robotosaith

Copy link
Copy Markdown
Contributor Author

Pushed. All five points are in:

  1. Kconfig: selects FW_CS_DSP and INPUT_FF_MEMLESS.
  2. Reset polarity: the binding and raven's node describe the reset as GPIO_ACTIVE_LOW. Probe takes it asserted and then releases it; remove asserts it again. The wire levels are unchanged.
  3. Boost from the DT: cirrus,boost-peak-microamp (1.6–4.5 A, default 4.5 A) and cirrus,boost-ctl-microvolt (2.55–11 V, default 11 V), as in the CS40L26 binding. Raven's node sets stock's 4.5 A and 7.5 V, which give the same 0x4a and 0x64 as before. The built-in sequence keeps only the coefficients, the slope and the OVP.
  4. Register reads: everything from the DSP's memories up is precious_reg, so the debugfs registers file no longer walks the DSP's memories over I2C.
  5. Copyright: the header credits cs40l2x.c, Copyright (C) 2018-2020 Cirrus Logic, Inc.

Gate (tools/kernel-pr-check --build) is clean, the binding passes dt_binding_check, and raven's DTB has no dt-validate findings. Booted on raven as 7.3.0-rc6-omamobile-push1-ge1e6adb69bbf: CS40L25A revision B1 probes with firmware 0x1400cb running.

tools/phone-smoke report

phone-smoke: unknown

Kernel 7.3.0-rc6-omamobile-push1-ge1e6adb69bbf, tools at 80e18e3, 2026-10-28T15:08Z.

Check Result Detail
boot (required) skip kernel 7.3.0-rc6-omamobile-push1-ge1e6adb69bbf, no slot on the command line
storage guard (required) ok 49 partitions; only userdata and slot B's boot images writable
root (required) ok ext4 on userdata, 97G free
kernel health (required) ok no oops or BUG; 0 WARN, 92 error lines in dmesg
systemd units not ok failed: omamobile-bt-addr@hci0.service
USB gadget (required) ok bound to 11110000.usb
display ok card2-DSI-1 connected, 1440x3120
GPU ok render node on panfrost
session (required) ok Hyprland and the Omarchy shell running
touch ok s6sy761
buttons ok gpio-keys
Wi-Fi ok wlp1s0 on brcmfmac, link up
Bluetooth ok hci0, powered true
battery ok 98% Charging, 22 °C
sound cards ok googleaocsndcar
sensors ok Accelerometer AmbientLight Proximity
cameras skip no libcamera tools
thermal ok hottest zone 46 °C

Packages: hyprland 0.56.2-7, libcamera 0.7.2-4, mesa 1:26.2.4-1.2, omacam 0.1.9-1, omamessages 0.2.0-1, omamobile-apps 0.2.0-1, omamobile-audio 0.4.4-1, omamobile-device-raven 0.1.23.6-1, omamobile-firstboot 0.1.0-1, omamobile-gnss 0.2.1-1, omamobile-keyring 20261013-1, omamobile-mirror 0.1.1-1, omamobile-mmd 0.1.2-1, omamobile-modem 0.1.9-1, omamobile-modem-sit 0.3.57-1, omamobile-omarchy 0.1.1-1, omamobile-owl-widgets 0.1.1-1, omamobile-sensors 0.2.0-1, omamobile-shell 0.2.21-1, omaphone 0.2.0-1, omarchy 4.0.4-2, omatel-agent 0.2.0-1, quickshell 0.3.2.r7.g2b4501a-1

@derekross

Copy link
Copy Markdown
Owner

Thanks for turning all five points around so quickly, and with a test boot. I checked each one against the new head:

  1. Kconfig: with arm64 defconfig, cs40l26-vibra and the CS35L41/CS35L56 codecs off and INPUT_CS40L25_VIBRA=m, FW_CS_DSP and INPUT_FF_MEMLESS now come in as m, and the driver builds.
  2. Reset: the binding, raven's node (GPIO_ACTIVE_LOW) and the driver (requested asserted, then released; asserted again in remove) agree, and the wire levels are the same as before.
  3. Boost from the DT: the encoding gives the same 0x4a and 0x64, the binding's ranges match the driver's checks, and the validator rejects an out-of-range value (I fed it 4.6 A as a test).
  4. Copyright: good.

One small gap in point 4 of my earlier list, the register reads: cs40l25_precious() starts at CS40L25_XMEM_UNPACKED24_0 (0x02800000), but the packed XM window at CS40L25_XMEM_PACKED_0 (0x02000000, with SYS_INFO at 0x025e0000) is the same DSP memory, and the debugfs registers file still walks it. return reg >= CS40L25_XMEM_PACKED_0; closes it. This will need a rebase anyway after #112 and #113 (all three add at the end of gs101-raven.dts; keep all three blocks in that order), so could you fold the one-liner into that push?

Also, the booted kernel (…-ge1e6adb69bbf) isn't in a public tree. If its cs40l25-vibra.c is the one on this head (blob ffc591452709), a line saying so would tie the boot to the code that lands.

After that I'll merge it, after the battery (#112) and torch (#113) PRs, with device-raven's haptics PR right after.

robotosaith added a commit to robotosaith/omarchy-mobile that referenced this pull request Oct 29, 2026
The kernel side is derekross/linux-omarchy-mobile#114 (cs40l25-vibra, its
binding and raven's node). This is the rest:

- device/raven/kernel.config builds cs40l25-vibra as a module.
- extract-vendor-firmware -d raven stages the CS40L25A's files from the
  owner's factory image: the CLAB RAM firmware and the default wavetable,
  which the driver loads, and the CLAB configuration (braking), not
  loaded yet.
- device-raven's 72-omamobile-feedbackd.rules makes the motor a feedbackd
  vibra, as cheetah's CS40L26. The motor's input device appears only once
  its firmware has loaded, about 5 s into the boot, and feedbackd (D-Bus
  activated) only looks for it when it starts, so on a boot where
  something asked for feedback first there were no haptics until
  feedbackd was restarted. The motor's arrival now starts
  omamobile-feedbackd-rescan.service, which stops a running feedbackd;
  the next request starts it again with the motor.

HAPTICS-TORCH-PLAN records H5 and the boot race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robotosaith and others added 3 commits October 29, 2026 06:11
The CS40L25A is the boosted haptic driver with a Halo Core DSP in the
Pixel 6 Pro, controlled over I2C. Describe what cs40l25-vibra uses: its
address, its active-low reset line, the boost converter's peak current
and voltage limits (as the CS40L26 binding names them, with cs40l2x's
ranges and defaults) and, for later, its interrupt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: saiththerobo <the.tom.sharp@gmail.com>
The CS40L25A in the Pixel 6 Pro boots into a ROM basic mode. This
driver resets it, hands it over from basic mode, applies the B0 errata
and the board's boost (with its short test), loads the RAM firmware and
the default wavetable through cs_dsp and exposes force feedback
(FF_RUMBLE) through ff-memless: the strength sets the firmware's trigger
gain, a start plays the continuous effect (index 0) through the trigger
mailbox and a stop writes ENDPLAYBACK. The sequence follows Cirrus
Logic's GPL cs40l2x driver in Google's Pixel 6 kernels.

On raven the firmware idles at HALO_STATE 201 with global enable
dropped, not the 203 cs40l2x expects, and plays from there. Themes ask
for 7-12 ms button clicks, shorter than the actuator takes to build up,
so a stop is held back to min_on_ms (30 ms); the strength maps onto -8
to -18 dB (atten_strongest tunes the top). Tested on raven: probes at
boot from the DT, feedbackd drives it, and key presses tick.

The boost's peak current and voltage come from the DT; the debugfs
registers file stays out of the DSP's memories and core registers
(precious), which cs_dsp and the driver still read directly.

Not yet: the IRQ, hibernation, the braking configuration, calibration
and the codec path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: saiththerobo <the.tom.sharp@gmail.com>
Raven's haptic driver sits on hsi2c_8 at 0x43 with its reset on gpp24-0
(active low) and stock's boost limits (4.5 A, 7.5 V), as Google's
gs101-raviole-audio.dtsi describes it; its interrupt (gpa6-5) isn't used
yet. Tested on raven (as an overlay): cs40l25-vibra probes at boot and
feedbackd drives it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: saiththerobo <the.tom.sharp@gmail.com>
@robotosaith
robotosaith force-pushed the omamobile-gs101-haptics-pr branch from 86fd0f1 to 5deed60 Compare October 29, 2026 06:12
@robotosaith

Copy link
Copy Markdown
Contributor Author

Rebased onto omamobile after #112 and #113. The three blocks at the end of gs101-raven.dts are now battery, torch and haptics, in that order. cs40l25_precious() now starts at CS40L25_XMEM_PACKED_0, so the debugfs registers file skips the packed XM window too. That's the only code change in this push.

The kernel booted for testing (7.3.0-rc6-omamobile-push1-ge1e6adb69bbf) has the previous head's cs40l25-vibra.c (blob ffc591452709). The driver on this head differs from it only by that line. The gate is clean, and dt-validate finds nothing in raven's DTB.

@derekross

Copy link
Copy Markdown
Owner

Thanks for the quick rebase and the one-liner. I checked the new head against my last comment:

  • Register reads: cs40l25_precious() now starts at CS40L25_XMEM_PACKED_0, so the debugfs registers file skips the packed window too. That's the only change to the driver, and the binding commit is unchanged.
  • Rebase: the end of gs101-raven.dts is battery, torch, haptics, in that order. It merges cleanly onto today's omamobile.
  • The boot: the booted kernel's cs40l25-vibra.c (ffc591452709) is the previous head's, and the new head differs from it only by that line and its comment. A precious-register change only affects what debugfs reads, so your boot still covers the driver that lands.

The gate passes here too, and CI ran dtbs_check and dt_binding_check on it. I'll merge it now, and device-raven's haptics PR right after.

One note for later, nothing to do now: if this goes upstream, the Co-Authored-By: trailers will need to become Assisted-by: (that's what checkpatch's warnings are about).

@derekross
derekross merged commit f18bc8c into derekross:omamobile Oct 29, 2026
1 check passed
@robotosaith
robotosaith deleted the omamobile-gs101-haptics-pr branch October 29, 2026 15:08
derekross added a commit to derekross/omarchy-mobile that referenced this pull request Oct 29, 2026
…#113)

* device-raven, tools: haptics through feedbackd on the CS40L25A

The kernel side is derekross/linux-omarchy-mobile#114 (cs40l25-vibra, its
binding and raven's node). This is the rest:

- device/raven/kernel.config builds cs40l25-vibra as a module.
- extract-vendor-firmware -d raven stages the CS40L25A's files from the
  owner's factory image: the CLAB RAM firmware and the default wavetable,
  which the driver loads, and the CLAB configuration (braking), not
  loaded yet.
- device-raven's 72-omamobile-feedbackd.rules makes the motor a feedbackd
  vibra, as cheetah's CS40L26. The motor's input device appears only once
  its firmware has loaded, about 5 s into the boot, and feedbackd (D-Bus
  activated) only looks for it when it starts, so on a boot where
  something asked for feedback first there were no haptics until
  feedbackd was restarted. The motor's arrival now starts
  omamobile-feedbackd-rescan.service, which stops a running feedbackd;
  the next request starts it again with the motor.

HAPTICS-TORCH-PLAN records H5 and the boot race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* device-raven 0.1.27: the haptics version bump

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Derek Ross <derekross@gmail.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…derekross#113)

* device-raven, tools: haptics through feedbackd on the CS40L25A

The kernel side is derekross/linux-omarchy-mobile#114 (cs40l25-vibra, its
binding and raven's node). This is the rest:

- device/raven/kernel.config builds cs40l25-vibra as a module.
- extract-vendor-firmware -d raven stages the CS40L25A's files from the
  owner's factory image: the CLAB RAM firmware and the default wavetable,
  which the driver loads, and the CLAB configuration (braking), not
  loaded yet.
- device-raven's 72-omamobile-feedbackd.rules makes the motor a feedbackd
  vibra, as cheetah's CS40L26. The motor's input device appears only once
  its firmware has loaded, about 5 s into the boot, and feedbackd (D-Bus
  activated) only looks for it when it starts, so on a boot where
  something asked for feedback first there were no haptics until
  feedbackd was restarted. The motor's arrival now starts
  omamobile-feedbackd-rescan.service, which stops a running feedbackd;
  the next request starts it again with the motor.

HAPTICS-TORCH-PLAN records H5 and the boot race.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* device-raven 0.1.27: the haptics version bump

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Derek Ross <derekross@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants