From cac4fc37494c4459fbcdc77afe7440debecd7753 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 19:32:14 -0647 Subject: [PATCH] drm/panel: google-tg4c: Add local high brightness mode The Pixel 9a's under-display fingerprint sensor needs the panel to light the finger: local high brightness mode (LHBM), a bright circle over the sensor. Add it as Google's panel-gs-tg4c.c does it, and expose it as their panels do, through local_hbm_mode and local_hbm_max_timeout on the backlight device, which the fingerprint HAL uses. Turning it on selects CMD2 page 2, sets the LHBM gamma for the current brightness (0x6F 0x07, then 0x87 0x01-0x04 by Google's thresholds) and writes 0x87 0x05; 0x87 0x00 turns it off. The circle keeps the panel's own per-band LHBM brightness. Google raises those by an overdrive offset for the first frames and then writes the panel's values back; with the overdrive kept on, the sensor's captures were too poor to match, and with the panel's values they match. LHBM needs the panel on and at 120 Hz, as on stock, so it is refused otherwise, turned off before a switch away from 120 Hz or the panel turning off, and turned off by a timer after 3 s. The timer belongs to the current circle: turning LHBM on restarts it and turning it off cancels it, so an earlier circle's timer can't cut a new one short. On remove the attributes go first, then the circle is turned off and the timer stopped, so nothing can queue it afterwards. It is off unless the allow_lhbm module parameter is set. Tested on the Pixel 9a: with the fingerprint stack running, the enrolled finger matches and a different finger is refused, and the lock screen unlocks by fingerprint. The tested panel-google-tg4c.c is this commit's file (blob d591bc3d1bf1). Link: https://android.googlesource.com/kernel/google-modules/display/panels/tegu/+/e3a801fb038fdd1bbaec36d387f27bd99f10757a/panel-gs-tg4c.c Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../testing/sysfs-class-backlight-google-tg4c | 23 +++ MAINTAINERS | 1 + drivers/gpu/drm/panel/panel-google-tg4c.c | 150 +++++++++++++++++- 3 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-class-backlight-google-tg4c diff --git a/Documentation/ABI/testing/sysfs-class-backlight-google-tg4c b/Documentation/ABI/testing/sysfs-class-backlight-google-tg4c new file mode 100644 index 0000000000..2d37b0a0ba --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-backlight-google-tg4c @@ -0,0 +1,23 @@ +What: /sys/class/backlight//local_hbm_mode +Date: October 2026 +KernelVersion: 7.3 +Contact: W4HO <87742609+W4HO-ham@users.noreply.github.com> +Description: + (RW) Local high brightness mode of the Google TG4C panel + (Pixel 9a): a bright circle over the under-display + fingerprint sensor, which lights the finger for the sensor. + Write 1 to light it and 0 to turn it off; read gives the + current state. Writing 1 fails with EPERM if the + panel_google_tg4c module parameter allow_lhbm is off or the + brightness is 0, and with EBUSY unless the panel is on and + running at 120 Hz. The circle turns itself off + after local_hbm_max_timeout milliseconds, and when the panel + turns off or leaves 120 Hz. + +What: /sys/class/backlight//local_hbm_max_timeout +Date: October 2026 +KernelVersion: 7.3 +Contact: W4HO <87742609+W4HO-ham@users.noreply.github.com> +Description: + (RO) How long, in milliseconds, local high brightness mode + stays on before the panel driver turns it off by itself. diff --git a/MAINTAINERS b/MAINTAINERS index 00e06c4795..58ac0fdde9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8151,6 +8151,7 @@ F: include/drm/gud.h DRM DRIVER FOR GOOGLE TG4C PANELS M: W4HO <87742609+W4HO-ham@users.noreply.github.com> S: Maintained +F: Documentation/ABI/testing/sysfs-class-backlight-google-tg4c F: Documentation/devicetree/bindings/display/panel/google,tg4c.yaml F: drivers/gpu/drm/panel/panel-google-tg4c.c diff --git a/drivers/gpu/drm/panel/panel-google-tg4c.c b/drivers/gpu/drm/panel/panel-google-tg4c.c index f956318402..d591bc3d1b 100644 --- a/drivers/gpu/drm/panel/panel-google-tg4c.c +++ b/drivers/gpu/drm/panel/panel-google-tg4c.c @@ -17,6 +17,7 @@ #include #include #include +#include #include