Repository navigation
drm/panel: samsung-s6e3fc3: local high brightness mode for the Pixel 7's fingerprint sensor - #263
angelrenefm wants to merge 6 commits into
Conversation
Mark a panel taken over from the bootloader as prepared and enabled, so drm_panel_disable() and drm_panel_unprepare() reach it, and track whether it is out of reset and sleep. While it is not, backlight updates only record the new state (drm_panel_enable() applies it through backlight_enable()). prepare() leaves the display off, which the reset does. Take the panel's lock in prepare/enable/disable/unprepare and in backlight updates, so their command sequences don't interleave. This follows the same change to the S6E3HC4 driver, for the Pixel 7 Pro, and lets gs-decon put the Pixel 7's panel to sleep with the screen off. Tested on a Pixel 7 from slot B (7.3.0-rc6), with gs-decon driving the screen: with gs_decon.screen_off=2, DPMS off put the panel to sleep and DPMS on woke it through the cold init (reset, the vendor init at 60 Hz, TE2 and DSC) with the picture correct; the power key's lock turned the screen off and a tap brought it back. No DSIM errors. Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia <skipper.pelygro@gmail.com>
Add the timers the Pixel 7's bootloader leaves on DSIM0 for its S6E3FC3 P10 panel at 60 Hz (UNDERRUN_CTRL 0x1cf8, CMD_TE_CTRL1 0x2a82306d, read on the phone), so gs-decon gets the link and the panel and can put the panel to sleep with the screen off. The set has no second rate: the panel's 90 Hz has no timers yet, so the link is never switched. Tested on a Pixel 7 from slot B (7.3.0-rc6): the driver logs "link timers for 60 Hz", and gs-decon takes the link and puts the panel to sleep and wakes it with the screen off. Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia <skipper.pelygro@gmail.com>
gs201 offered only the Pixel 7 Pro's 1440x3120 modes and refused to run when the bootloader scanned out any other size. Give each SoC a list of mode sets, one per panel, and pick the one whose first mode matches the size the bootloader left, which the probe already reads. Add the Pixel 7's S6E3FC3 P10 at 1080x2400 and 60 Hz, with the timings of Google's panel driver; its 90 Hz mode comes with the link timers for it. Tested on a Pixel 7 from slot B (7.3.0-rc6), with the padded-row change on top: gs-decon binds on the 1080x2400 set, counts frame starts at 60.02 Hz, and Hyprland runs on it at 1080x2400@60 with no flip timeouts. The Pixel 6 Pro's, 7 Pro's, 8 Pro's and 9a's sets are unchanged: one set each. Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia <skipper.pelygro@gmail.com>
gs-decon on gs201 took only framebuffers with the boot framebuffer's pitch. On the Pixel 7, whose DECON0 the next commit enables, Hyprland's buffers for the 1080x2400 panel have a 4352-byte pitch (1080 pixels padded to 64 bytes) where the boot framebuffer has 4320, so every modeset failed the plane check with -EINVAL and the screen froze on the boot console. The Pixel 7 Pro's 1440-pixel rows need no padding, which is why it never showed there. On gs201, DPP0 reads its source width as the row length in pixels, padding included, as G4 does; gs201 packs the source height into the upper half of the same register. This is measured on the Pixel 7, not taken from Google's driver, which programs the source width from fb->width and never scans out a padded stride: with 4352-byte rows and the stride written as the source width, the desktop shows unsheared, where an 8-pixel mismatch per row would shear every line. Set padded_pitch for gs201, write the height back with the width, and cap the width at the 16-bit field. With an unpadded buffer the register gets the same value the bootloader left. Tested on a Pixel 7 from slot B (7.3.0-rc6), with the next commit on top: before this change every Hyprland modeset failed and the screen froze on the boot console; with it the modesets pass, the desktop shows at 1080x2400@60 and stays smooth, with 2624 flips in ten minutes, no flip timeouts and no late flips (latency 8.9 ms on average, 16.8 ms at most). Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia <skipper.pelygro@gmail.com>
Enable DECON0 with a pool for gs-decon's scanout buffers and the boot framebuffer, as on the Pixel 7 Pro: gs-decon keeps the bootloader's DECON, DSIM and DSC setup, flips DPP0 between buffers, and takes the screen over from simpledrm. The pool has room for five 1080x2400 XRGB8888 buffers, below 4 GiB since DPP0 takes 32-bit addresses with the DPU SysMMU bypassed, and is reusable. Tested on a Pixel 7 from slot B (7.3.0-rc6): gs-decon allocates its scanout buffers from the pool, takes the screen over from simpledrm, and Hyprland flips on it at 60 Hz. Assisted-by: Claude Opus 5.5 Signed-off-by: Alejandro Garcia <skipper.pelygro@gmail.com>
|
Thank you, Ángel, for putting this up so quickly. I went through it against Google's Our gate passes on #181's head: one commit, signed off, checkpatch clean, and the W=1 build of the panel driver. On today's Two small things you could look at while it waits, neither a condition:
When this lands I'll update panther's FINGERPRINT-PLAN, which still says the driver on |
The Pixel 7's under-display optical fingerprint sensor needs local high
brightness mode (LHBM): a bright circle over the sensor while a finger
is on it. Add it with the interface the S6E3HC4 driver (Pixel 7 Pro)
already has, so the same fingerprint userspace drives both panels:
- local_hbm_mode on the backlight device (0/1), named as in Google's
driver; on is refused with EPERM unless the allow_lhbm module
parameter is set and the panel is lit;
- local_hbm_max_timeout (ms, 1-3000, default 3000): LHBM switches
itself off after that long;
- blanking, brightness 0, display off and sleep turn LHBM off first.
The commands are from Google's GPL driver (panel-samsung-s6e3fc3-p10.c,
android-gs-pantah-5.10-android15-qpr1):
- s6e3fc3_p10_lhbm_gamma_read(): the factory LHBM gamma at 0xd8 offset
0x22, read once, on the first LHBM on. Only the HS gamma is kept, the
one mode this driver runs; NS and AOD are left out. A failed read
leaves the panel's own gamma, as the vendor driver does;
- s6e3fc3_p10_lhbm_gamma_write(): the gamma written to 0x65 and the
DVT1+ fix for LHBM brightness with HBM, sent unconditionally since
this driver has no panel revision read and phone panels are past
DVT1;
- s6e3fc3_p10_send_lhbm_location_cmds(): the circle centred at x 0x21c,
y 0x6b1 with size 0x63, in 10-bit offset mode (0xf2 0xcc);
- WRCTRLD (0x53) with the LHBM bit 0x10 on top of BCTRL; off is BCTRL
alone.
The vendor driver sends the gamma and the location at each cold init.
Here they go with each LHBM on, which also covers a panel taken over
from the bootloader without a reset. Not reproduced from Google's
driver: switching to the peak refresh rate and aligning LHBM on to TE,
as for the S6E3HC4.
remove() turns LHBM off under the lock and marks the panel as going
away, so a write between devres cancelling the timeout and the backlight
going away can't light the circle with nothing left to turn it off. Each
on and re-enable sets the deadline it times out at, and the timeout work
turns LHBM off only once that deadline has passed, so a stale run can't
end a new session. Both from Derek Ross's review.
Tested on a Pixel 7, as a module on 7.3.0-rc6-omamobile-push1-g44048a9aa795
with allow_lhbm=1: writing 1 to local_hbm_mode read the gamma ("LHBM
gamma ..."), a bright circle lit over the fingerprint sensor, and it
went off by itself about 3.1 s later ("local HBM timed out"), three
times running. When the screen blanked during a session the circle went
off with it, and writing 1 with the screen off was refused with EPERM.
Not tested: its timing against the fingerprint HAL.
Assisted-by: LLM
Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com>
95788bb to
d7cca23
Compare
|
Thank you, Ángel. Both points are in, and done the way I'd hoped:
Nothing else in the commit changed; the sequences I compared with Google's driver last time are the same bytes. One thing moved underneath you: #181 was rebased on the 16th (new head So nothing is needed from you until #181 is merged; it is waiting on my Pixel 7 Pro run, not on you or its author. When it lands, please run (the old #181 head, since that is what your branch sits on), push, and once CI has run on the single commit I'll take it. If you'd like CI on it before then, |
As you suggested on omarchy-mobile#813: the local HBM commit from my fork's
panther-lhbm, so the next kernel pushkeeps it.
It adds
local_hbm_modeandlocal_hbm_max_timeoutto the S6E3FC3's backlight device, with the same interface asthe S6E3HC4 driver on the Pixel 7 Pro, so one fingerprint userspace drives both panels. Turning it on is refused
unless the
allow_lhbmmodule parameter is set. The commands are from Google's GPL driver; the commit messagenames each function.
It's stacked on #181. It needs that PR's "support sleep and a cold restart from KMS", so this branch carries
#181's five commits under the one commit for review. The diff that counts is the last commit only. Once #181
merges I'll rebase with
--ontoso it carries this commit alone.Your two review points are folded into the one commit: remove() turns LHBM off under the lock and refuses it
from then on, and the timeout only turns off the session whose deadline has passed.
On #181's head it passes
tools/kernel-pr-check --build OUT db288b74f: 1 commit signed off, checkpatch --strictwith 0 warnings, W=1 build of
panel-samsung-s6e3fc3.c. This commit touches only the panel driver.Tested on a Pixel 7 on 17 Nov with this commit's exact
panel-samsung-s6e3fc3.c, as a module withallow_lhbm=1: the circle lit over the sensor and went off by itself about 3.1 s later, three times running.When the screen blanked mid-session the circle went off with it, and turning it on with the screen off was
refused (EPERM). Not tested: its timing against the fingerprint HAL.
I used AI help (Claude) to work on this.