drivers/misc: add Goodix GXFP5130 eSPI fingerprint sensor driver
Subsystems (4)
cover drivers/misc: add Goodix GXFP5130 eSPI fingerprint sensor driver
This series adds a kernel driver for the Goodix GXFP5130 fingerprint sensor found in Huawei MateBook laptops (D16 2024, X Pro 2024, 14 2024).
The sensor is enumerated through ACPI (HID: GXFP5130) and communicates with the host via an eSPI-based memory-mapped mailbox window plus three GPIOs. It does not use SPI or I2C bus drivers.
A misc character device /dev/gxfp is exposed to userspace. The libfprint library (with a corresponding GXFP5130 plugin) uses this device to perform biometric enrollment and verification via fprintd.
The four patches are:
[1/4] UAPI header (include/uapi/linux/gxfp_ioctl.h) [2/4] Driver source tree (drivers/misc/gxfp5130/) [3/4] Documentation (Documentation/misc-devices/gxfp5130.rst) [4/4] MAINTAINERS entry
Metehan Günen (4):
include/uapi/linux: add gxfp_ioctl.h for GXFP5130 fingerprint sensor drivers/misc: add Goodix GXFP5130 eSPI fingerprint sensor driver Documentation/misc-devices: add gxfp5130.rst
MAINTAINERS: add entry for GXFP5130 fingerprint sensor driver
Documentation/misc-devices/gxfp5130.rst | 90 +++++++ Documentation/misc-devices/index.rst | 1 + MAINTAINERS | 7 + drivers/misc/Kconfig | 2 + drivers/misc/Makefile | 2 + drivers/misc/gxfp5130/Kconfig | 18 ++ drivers/misc/gxfp5130/Makefile | 28 ++ drivers/misc/gxfp5130/cmd/gxfp_cmd.c | 177 ++++++++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd.h | 54 ++++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_config.c | 28 ++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_config.h | 12 + .../misc/gxfp5130/cmd/gxfp_cmd_mcu_state.c | 89 +++++++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_state.h | 30 +++ drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.c | 185 +++++++++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.h | 27 ++ drivers/misc/gxfp5130/cmd/gxfp_cmd_version.c | 100 +++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd_version.h | 22 ++ drivers/misc/gxfp5130/driver/gxfp_irq.c | 57 ++++ drivers/misc/gxfp5130/driver/gxfp_irq.h | 9 + drivers/misc/gxfp5130/driver/gxfp_platform.c | 251 ++++++++++++++++++ drivers/misc/gxfp5130/driver/gxfp_platform.h | 12 + drivers/misc/gxfp5130/driver/gxfp_trace.c | 179 +++++++++++++ drivers/misc/gxfp5130/driver/gxfp_trace.h | 15 ++ drivers/misc/gxfp5130/driver/gxfp_uapi.h | 25 ++ drivers/misc/gxfp5130/driver/gxfp_uapi_ctrl.c | 136 ++++++++++ drivers/misc/gxfp5130/driver/gxfp_uapi_fifo.c | 245 +++++++++++++++++ drivers/misc/gxfp5130/driver/gxfp_uapi_misc.c | 123 +++++++++ drivers/misc/gxfp5130/gxfp_main.c | 127 +++++++++ drivers/misc/gxfp5130/hw/gxfp_acpi.c | 130 +++++++++ drivers/misc/gxfp5130/hw/gxfp_acpi.h | 15 ++ drivers/misc/gxfp5130/hw/gxfp_delay.c | 15 ++ drivers/misc/gxfp5130/hw/gxfp_delay.h | 7 + drivers/misc/gxfp5130/hw/gxfp_gpio.c | 64 +++++ drivers/misc/gxfp5130/hw/gxfp_gpio.h | 17 ++ drivers/misc/gxfp5130/hw/gxfp_mmio.c | 45 ++++ drivers/misc/gxfp5130/hw/gxfp_mmio.h | 10 + .../misc/gxfp5130/include/gxfp_constants.h | 38 +++ drivers/misc/gxfp5130/include/gxfp_priv.h | 55 ++++ .../misc/gxfp5130/proto/gxfp_goodix_proto.c | 84 ++++++ .../misc/gxfp5130/proto/gxfp_goodix_proto.h | 31 +++ drivers/misc/gxfp5130/proto/gxfp_mp_proto.c | 96 +++++++ drivers/misc/gxfp5130/proto/gxfp_mp_proto.h | 27 ++ .../gxfp5130/transport/gxfp_espi_common.c | 80 ++++++ .../gxfp5130/transport/gxfp_espi_common.h | 27 ++ .../gxfp5130/transport/gxfp_espi_rx_irq.c | 120 +++++++++ .../gxfp5130/transport/gxfp_espi_rx_irq.h | 15 ++ .../gxfp5130/transport/gxfp_espi_rx_sync.c | 96 +++++++ .../gxfp5130/transport/gxfp_espi_rx_sync.h | 14 + .../misc/gxfp5130/transport/gxfp_espi_tx.c | 88 ++++++ .../misc/gxfp5130/transport/gxfp_espi_tx.h | 20 ++ include/uapi/linux/gxfp_ioctl.h | 43 +++ 51 files changed, 3188 insertions(+)
--
2.55.0
PATCH 1/4 include/uapi/linux: add gxfp_ioctl.h for GXFP5130 fingerprint sensor
Define the userspace ABI for the Goodix GXFP5130 eSPI fingerprint sensor driver:
- struct gxfp_tap_hdr: header prepended to every read(2) record, carries payload length, MP protocol type and a ktime_get_ns() timestamp.
- struct gxfp_tx_pkt_hdr: header that userspace prepends to write(2) payloads so the driver can wrap them in the eSPI frame format.
- GXFP_IOCTL_FLUSH_RXQ: flush the kernel-side RX record queue.
--- include/uapi/linux/gxfp_ioctl.h | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/uapi/linux/gxfp_ioctl.h
include/uapi/linux/gxfp_ioctl.h new file +43 -0
@@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __UAPI_GXFP_IOCTL_H +#define __UAPI_GXFP_IOCTL_H + +#include <linux/types.h> +#include <linux/ioctl.h> + +#define GXFP_IOCTL_MAGIC 'G' + +/* +* 4-byte MP header + payload must fit GXFP_TX_BUFFER_SIZE(512). +*/ +#define GXFP_IOCTL_TX_PAYLOAD_MAX 508u + +/* Maximum protocol payload bytes exported via read(2) records. */ +#define GXFP_IOCTL_TAP_PAYLOAD_MAX (128u * 1024u) + +/* +* Stream tap (read/poll) record header. +* Followed by `len` bytes of protocol payload. +*/ +struct gxfp_tap_hdr { +__u32 len;/* protocol payload bytes */ +__u32 type;/* MP type */ +__u32 _rsvd0; +__u64 ts_ns;/* ktime_get_ns() */ +__u8 head16[16 ];/* first 16 bytes of payload */ +}; + +/* +* write(2) packet header. +* Userspace writes: [gxfp_tx_pkt_hdr][payload bytes] +*/ +struct gxfp_tx_pkt_hdr { +__u8 mp_flags; +__u8 _pad0; +__u16 payload_len; +__u32 flags; +}; + +#define GXFP_IOCTL_FLUSH_RXQ _IO(GXFP_IOCTL_MAGIC, 0x11) + +#endif /* __UAPI_GXFP_IOCTL_H */
Signature · 1 line
2.55.0
Greg KH
maintainerRe: [PATCH 1/4] include/uapi/linux: add gxfp_ioctl.h for GXFP5130 fingerprint sensor
Quoted 36 lines · Metehan Günen
Define the userspace ABI for the Goodix GXFP5130 eSPI fingerprint sensor driver:
- struct
gxfp_tap_hdr: header prepended to every read(2) record, carries payload length, MP protocol type and aktime_get_ns()timestamp.
- structgxfp_tx_pkt_hdr: header that userspace prepends to write(2) payloads so the driver can wrap them in the eSPI frame format.
-GXFP_IOCTL_FLUSH_RXQ: flush the kernel-side RX record queue.Signed-off-by Metehan Günen <[email protected]>--- include/uapi/linux/gxfp_ioctl.h | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/uapi/linux/gxfp_ioctl.hinclude/uapi/linux/gxfp_ioctl.h new file +15
-0@@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __UAPI_GXFP_IOCTL_H +#define __UAPI_GXFP_IOCTL_H + +#include <linux/types.h> +#include <linux/ioctl.h> + +#define GXFP_IOCTL_MAGIC 'G' + +/* +* 4-byte MP header + payload must fit GXFP_TX_BUFFER_SIZE(512). +*/ +#define GXFP_IOCTL_TX_PAYLOAD_MAX 508u + +/* Maximum protocol payload bytes exported via read(2) records. */
include/uapi/linux/gxfp_ioctl.h line 25
Quoted 10 lines
include/uapi/linux/gxfp_ioctl.h new file +10
-0+#define GXFP_IOCTL_TAP_PAYLOAD_MAX (128u * 1024u) + +/* +* Stream tap (read/poll) record header. +* Followed by `len` bytes of protocol payload. +*/ +struct gxfp_tap_hdr { +__u32 len;/* protocol payload bytes */ +__u32 type;/* MP type */ +__u32 _rsvd0;
C variables do not start with _, this isn't rust :)
And are you checking this for 0?
include/uapi/linux/gxfp_ioctl.h line 36
Quoted 11 lines
include/uapi/linux/gxfp_ioctl.h new file +11
-0+__u64 ts_ns;/* ktime_get_ns() */ +__u8 head16[16 ];/* first 16 bytes of payload */ +}; + +/* +* write(2) packet header. +* Userspace writes: [gxfp_tx_pkt_hdr][payload bytes] +*/ +struct gxfp_tx_pkt_hdr { +__u8 mp_flags; +__u8 _pad0;
Are you checking this for 0?
include/uapi/linux/gxfp_ioctl.h line 38
Quoted 2 lines
include/uapi/linux/gxfp_ioctl.h new file +2
-0+__u16 payload_len; +__u32 flags;
No definition of what these flags are?
thanks,
greg k-h
Re: [PATCH 1/4] include/uapi/linux: add gxfp_ioctl.h for GXFP5130 fingerprint sensor
Quoted 3 lines · Greg KH
C variables do not start with _, this isn't rust :)
And are you checking this for 0?
Will rename _rsvd0 to reserved and add a zero-check in v2:
if (hdr.reserved != 0)
return -EINVAL;
Quoted 1 line
Are you checking this for 0?
Same for _pad0: will rename to pad and add zero validation.
Quoted 1 line
No definition of what these flags are?
The flags field was placeholder code that was never wired up — there are no flag values defined or used anywhere. I will remove the field entirely in v2 to keep the ABI clean.
Thanks,
Metehan Günen
Greg KH
maintainerRe: [PATCH 1/4] include/uapi/linux: add gxfp_ioctl.h for GXFP5130 fingerprint sensor
In reply to Metehan GünenQuoted 21 lines · Metehan Günen
Define the userspace ABI for the Goodix GXFP5130 eSPI fingerprint sensor driver:
- struct
gxfp_tap_hdr: header prepended to every read(2) record, carries payload length, MP protocol type and aktime_get_ns()timestamp.
- structgxfp_tx_pkt_hdr: header that userspace prepends to write(2) payloads so the driver can wrap them in the eSPI frame format.
-GXFP_IOCTL_FLUSH_RXQ: flush the kernel-side RX record queue.Signed-off-by Metehan Günen <[email protected]>--- include/uapi/linux/gxfp_ioctl.h | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/uapi/linux/gxfp_ioctl.hinclude/uapi/linux/gxfp_ioctl.h new file +0
-0
include/uapi/linux/gxfp_ioctl.h line 8
Quoted 8 lines
include/uapi/linux/gxfp_ioctl.h new file +8
-0@@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __UAPI_GXFP_IOCTL_H +#define __UAPI_GXFP_IOCTL_H + +#include <linux/types.h> +#include <linux/ioctl.h> + +#define GXFP_IOCTL_MAGIC 'G'
Why do you get to use "G" here?
Re: [PATCH 1/4] include/uapi/linux: add gxfp_ioctl.h for GXFP5130 fingerprint sensor
Quoted 1 line · Greg KH
Why do you get to use "G" here?
I don't. I checked Documentation/userspace-api/ioctl/ioctl-number.rst and 'G' is already allocated to multiple subsystems. I will pick a free magic number from the unallocated ranges and register it in that file in v2.
Thanks,
Metehan Günen
PATCH 2/4 drivers/misc: add Goodix GXFP5130 eSPI fingerprint sensor driver
In reply to Metehan GünenThe GXFP5130 is a press-type fingerprint sensor by Goodix Technology. It is found in Huawei MateBook laptops (D16 2024, X Pro 2024, 14 2024) and is enumerated through ACPI with HID GXFP5130.
Hardware interface: The sensor does not sit on SPI or I2C. The ACPI firmware maps a memory window (eSPI flash-channel mailbox) and three
GPIOs: write-done (host pulses after writing a command), read-done (host pulses after reading each response chunk), and irq (sensor asserts to signal a response is ready). All frames use a 4-byte eSPI wrapper header followed by a Goodix MP protocol frame carrying the command body.
Driver structure:
transport/ eSPI framing layer (TX, synchronous RX, IRQ-driven RX) hw/ ACPI resource parsing, MMIO helpers, GPIO helpers, delay proto/ MP and Goodix command protocol encode/decode cmd/ individual command helpers (version, MCU state, reset ...) driver/ platform probe/remove, IRQ thread, UAPI misc device,
debugfs trace ring buffer
include/ private driver headers (gxfp_priv.h, gxfp_constants.h)
Userspace interface: A misc character device /dev/gxfp is created. Only one reader at a time is allowed (CAP_SYS_ADMIN required). write(2) sends command frames; read(2)/poll(2) return response records prefixed with gxfp_tap_hdr. GXFP_IOCTL_FLUSH_RXQ discards the kernel-side queue. The libfprint library communicates with the sensor through this device.
Startup: On probe the driver executes a firmware-version handshake (up to 3 retries) and falls back to a session-recovery sequence if the sensor does not acknowledge the first attempt. The IRQ line is kept masked until the handshake succeeds.
--- drivers/misc/Kconfig | 2 + drivers/misc/Makefile | 2 + drivers/misc/gxfp5130/Kconfig | 18 ++ drivers/misc/gxfp5130/Makefile | 28 ++ drivers/misc/gxfp5130/cmd/gxfp_cmd.c | 177 ++++++++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd.h | 54 ++++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_config.c | 28 ++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_config.h | 12 + .../misc/gxfp5130/cmd/gxfp_cmd_mcu_state.c | 89 +++++++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_state.h | 30 +++ drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.c | 185 +++++++++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.h | 27 ++ drivers/misc/gxfp5130/cmd/gxfp_cmd_version.c | 100 +++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd_version.h | 22 ++ drivers/misc/gxfp5130/driver/gxfp_irq.c | 57 ++++ drivers/misc/gxfp5130/driver/gxfp_irq.h | 9 + drivers/misc/gxfp5130/driver/gxfp_platform.c | 251 ++++++++++++++++++ drivers/misc/gxfp5130/driver/gxfp_platform.h | 12 + drivers/misc/gxfp5130/driver/gxfp_trace.c | 179 +++++++++++++ drivers/misc/gxfp5130/driver/gxfp_trace.h | 15 ++ drivers/misc/gxfp5130/driver/gxfp_uapi.h | 25 ++ drivers/misc/gxfp5130/driver/gxfp_uapi_ctrl.c | 136 ++++++++++ drivers/misc/gxfp5130/driver/gxfp_uapi_fifo.c | 245 +++++++++++++++++ drivers/misc/gxfp5130/driver/gxfp_uapi_misc.c | 123 +++++++++ drivers/misc/gxfp5130/gxfp_main.c | 127 +++++++++ drivers/misc/gxfp5130/hw/gxfp_acpi.c | 130 +++++++++ drivers/misc/gxfp5130/hw/gxfp_acpi.h | 15 ++ drivers/misc/gxfp5130/hw/gxfp_delay.c | 15 ++ drivers/misc/gxfp5130/hw/gxfp_delay.h | 7 + drivers/misc/gxfp5130/hw/gxfp_gpio.c | 64 +++++ drivers/misc/gxfp5130/hw/gxfp_gpio.h | 17 ++ drivers/misc/gxfp5130/hw/gxfp_mmio.c | 45 ++++ drivers/misc/gxfp5130/hw/gxfp_mmio.h | 10 + .../misc/gxfp5130/include/gxfp_constants.h | 38 +++ drivers/misc/gxfp5130/include/gxfp_priv.h | 55 ++++ .../misc/gxfp5130/proto/gxfp_goodix_proto.c | 84 ++++++ .../misc/gxfp5130/proto/gxfp_goodix_proto.h | 31 +++ drivers/misc/gxfp5130/proto/gxfp_mp_proto.c | 96 +++++++ drivers/misc/gxfp5130/proto/gxfp_mp_proto.h | 27 ++ .../gxfp5130/transport/gxfp_espi_common.c | 80 ++++++ .../gxfp5130/transport/gxfp_espi_common.h | 27 ++ .../gxfp5130/transport/gxfp_espi_rx_irq.c | 120 +++++++++ .../gxfp5130/transport/gxfp_espi_rx_irq.h | 15 ++ .../gxfp5130/transport/gxfp_espi_rx_sync.c | 96 +++++++ .../gxfp5130/transport/gxfp_espi_rx_sync.h | 14 + .../misc/gxfp5130/transport/gxfp_espi_tx.c | 88 ++++++ .../misc/gxfp5130/transport/gxfp_espi_tx.h | 20 ++ 47 files changed, 3047 insertions(+) create mode 100644 drivers/misc/gxfp5130/Kconfig create mode 100644 drivers/misc/gxfp5130/Makefile create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd.c create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd.h create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_config.c create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_config.h create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_state.c create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_state.h create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.c create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.h create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_version.c create mode 100644 drivers/misc/gxfp5130/cmd/gxfp_cmd_version.h create mode 100644 drivers/misc/gxfp5130/driver/gxfp_irq.c create mode 100644 drivers/misc/gxfp5130/driver/gxfp_irq.h create mode 100644 drivers/misc/gxfp5130/driver/gxfp_platform.c create mode 100644 drivers/misc/gxfp5130/driver/gxfp_platform.h create mode 100644 drivers/misc/gxfp5130/driver/gxfp_trace.c create mode 100644 drivers/misc/gxfp5130/driver/gxfp_trace.h create mode 100644 drivers/misc/gxfp5130/driver/gxfp_uapi.h create mode 100644 drivers/misc/gxfp5130/driver/gxfp_uapi_ctrl.c create mode 100644 drivers/misc/gxfp5130/driver/gxfp_uapi_fifo.c create mode 100644 drivers/misc/gxfp5130/driver/gxfp_uapi_misc.c create mode 100644 drivers/misc/gxfp5130/gxfp_main.c create mode 100644 drivers/misc/gxfp5130/hw/gxfp_acpi.c create mode 100644 drivers/misc/gxfp5130/hw/gxfp_acpi.h create mode 100644 drivers/misc/gxfp5130/hw/gxfp_delay.c create mode 100644 drivers/misc/gxfp5130/hw/gxfp_delay.h create mode 100644 drivers/misc/gxfp5130/hw/gxfp_gpio.c create mode 100644 drivers/misc/gxfp5130/hw/gxfp_gpio.h create mode 100644 drivers/misc/gxfp5130/hw/gxfp_mmio.c create mode 100644 drivers/misc/gxfp5130/hw/gxfp_mmio.h create mode 100644 drivers/misc/gxfp5130/include/gxfp_constants.h create mode 100644 drivers/misc/gxfp5130/include/gxfp_priv.h create mode 100644 drivers/misc/gxfp5130/proto/gxfp_goodix_proto.c create mode 100644 drivers/misc/gxfp5130/proto/gxfp_goodix_proto.h create mode 100644 drivers/misc/gxfp5130/proto/gxfp_mp_proto.c create mode 100644 drivers/misc/gxfp5130/proto/gxfp_mp_proto.h create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_common.c create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_common.h create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_rx_irq.c create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_rx_irq.h create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_rx_sync.c create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_rx_sync.h create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_tx.c create mode 100644 drivers/misc/gxfp5130/transport/gxfp_espi_tx.h
drivers/misc/Kconfig +2 -0
@@ -651,4 +651,6 @@ source "drivers/misc/mchp_pci1xxxx/Kconfig" source "drivers/misc/keba/Kconfig" source "drivers/misc/amd-sbi/Kconfig" source "drivers/misc/rp1/Kconfig" +source "drivers/misc/gxfp5130/Kconfig" + endmenu
drivers/misc/Makefile +2 -0
@@ -74,3 +74,5 @@ obj-$(CONFIG_MCHP_LAN966X_PCI) += lan966x-pci.o obj-y += keba/ obj-y += amd-sbi/ obj-$(CONFIG_MISC_RP1) += rp1/ + +obj-$(CONFIG_GXFP5130) += gxfp5130/
drivers/misc/gxfp5130/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0 +config GXFP5130 + tristate "Goodix GXFP5130 eSPI fingerprint sensor" + depends on ACPI && HAS_IOMEM && GPIOLIB + help + Driver for the Goodix GXFP5130 fingerprint sensor found in + Huawei MateBook laptops (MateBook D16 2024, MateBook X Pro 2024, + MateBook 14 2024). + + The sensor connects to the host via an eSPI-based MMIO mailbox + and is enumerated through ACPI (ACPI HID: GXFP5130). + + A character device (/dev/gxfp) is created for userspace access. + The libfprint library uses this interface for biometric enrollment + and verification via fprintd. + + If unsure, say N. To compile as a module, say M; the module + will be called gxfp.
drivers/misc/gxfp5130/Makefile new file +28 -0
@@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_GXFP5130) += gxfp.o + +ccflags-y += -I$(src)/include + +gxfp-y := \ + gxfp_main.o \ + transport/gxfp_espi_common.o \ + transport/gxfp_espi_tx.o \ + transport/gxfp_espi_rx_sync.o \ + transport/gxfp_espi_rx_irq.o \ + hw/gxfp_acpi.o \ + hw/gxfp_delay.o \ + hw/gxfp_mmio.o \ + hw/gxfp_gpio.o \ + proto/gxfp_mp_proto.o \ + proto/gxfp_goodix_proto.o \ + cmd/gxfp_cmd.o \ + cmd/gxfp_cmd_version.o \ + cmd/gxfp_cmd_mcu_state.o \ + cmd/gxfp_cmd_mcu_config.o \ + cmd/gxfp_cmd_reset.o \ + driver/gxfp_platform.o \ + driver/gxfp_irq.o \ + driver/gxfp_trace.o \ + driver/gxfp_uapi_fifo.o \ + driver/gxfp_uapi_ctrl.o \ + driver/gxfp_uapi_misc.o
drivers/misc/gxfp5130/cmd/gxfp_cmd.c new file +177 -0
177 lines not on this page · raw message
drivers/misc/gxfp5130/cmd/gxfp_cmd.h new file +54 -0
54 lines not on this page · raw message
drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_config.c new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/kernel.h> +#include <linux/errno.h> + +#include "gxfp_priv.h" +#include "gxfp_cmd.h" +#include "gxfp_constants.h" +#include "gxfp_cmd_mcu_config.h" + +int gxfp_cmd_upload_config_mcu (struct gxfp_dev *gdev,const __u8 *cfg,size_t cfg_len) +{ +__u8 ack_payload[32 ]; +size_t ack_len =0 ; + +if (!gdev) +return -EINVAL ; +if (!cfg || cfg_len ==0 ) +return -EINVAL ; + +return gxfp_cmd_xfer (gdev, +GXFP_CMD_UPLOAD_CONFIG_MCU , + cfg, cfg_len, +GXFP_CMD_ACK , + ack_payload,sizeof (ack_payload), + &ack_len, +GXFP_DEFAULT_RETRY_COUNT , +GXFP_DEFAULT_TIMEOUT_US ); +}
drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_config.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_CMD_MCU_CONFIG_H +#define __GXFP_CMD_MCU_CONFIG_H + +#include <linux/types.h> + +struct gxfp_dev ; + +/* Not used or tested */ +int gxfp_cmd_upload_config_mcu (struct gxfp_dev *gdev,const __u8 *cfg,size_t cfg_len); + +#endif /* __GXFP_CMD_MCU_CONFIG_H */
drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_state.c new file +89 -0
89 lines not on this page · raw message
drivers/misc/gxfp5130/cmd/gxfp_cmd_mcu_state.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_CMD_MCU_STATE_H +#define __GXFP_CMD_MCU_STATE_H + +#include <linux/types.h> +#include "gxfp_constants.h" + +struct gxfp_dev ; + +#define GXFP_MCU_STATE_LEN 20 + +struct gxfp_mcu_state { +/* byte 0 */ +__u8 version; + +/* byte 1 */ +__u8 b1_raw; +__u8 is_pov_image_valid; +__u8 is_tls_connected; +__u8 is_tls_used; +__u8 is_locked; + +/* byte 2 - 19 */ +__u8 reserved[18 ]; +}; + +int gxfp_cmd_query_mcu_state (struct gxfp_dev *gdev,struct gxfp_mcu_state *out); +int gxfp_cmd_parse_mcu_state_payload (const __u8 *buf,size_t len,struct gxfp_mcu_state *out); + +#endif /* __GXFP_CMD_MCU_STATE_H */
drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.c new file +185 -0
185 lines not on this page · raw message
drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_CMD_RESET_H +#define __GXFP_CMD_RESET_H + +#include <linux/types.h> + +struct gxfp_dev ; + +#define GXFP_RESET_FLAG_SENSOR 0x01u +#define GXFP_RESET_FLAG_MCU 0x02u +#define GXFP_RESET_FLAG_MCU_SENSOR (GXFP_RESET_FLAG_MCU | GXFP_RESET_FLAG_SENSOR) + +int gxfp_cmd_sleep_cleanup (struct gxfp_dev *gdev,unsigned int post_delay_ms); + +int gxfp_cmd_notify_power_state (struct gxfp_dev *gdev, +__u8 state); + +int gxfp_cmd_reset_device (struct gxfp_dev *gdev, +__u8 reset_flags); + +int gxfp_cmd_tls_unlock (struct gxfp_dev *gdev); + +int gxfp_cmd_protocol_init (struct gxfp_dev *gdev); + +int gxfp_cmd_recover_session (struct gxfp_dev *gdev,bool unstick_tls); + +#endif /* __GXFP_CMD_RESET_H */
drivers/misc/gxfp5130/cmd/gxfp_cmd_version.c new file +100 -0
100 lines not on this page · raw message
drivers/misc/gxfp5130/cmd/gxfp_cmd_version.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_CMD_VERSION_H +#define __GXFP_CMD_VERSION_H + +#include <linux/types.h> +#include "gxfp_constants.h" + +struct gxfp_dev ; + +struct gxfp_get_version_result { +__u32 status; +__u32 gpio_status; +__u32 tx_status; +__u32 rx_status; +__u32 bytes_read; +char version_ascii[GXFP_MAX_VERSION_ASCII ]; +__u8 raw[GXFP_MAX_VERSION_RAW ]; +}; + +int gxfp_cmd_get_version (struct gxfp_dev *gdev,struct gxfp_get_version_result *out); + +#endif /* __GXFP_CMD_VERSION_H */
drivers/misc/gxfp5130/driver/gxfp_irq.c new file +57 -0
57 lines not on this page · raw message
drivers/misc/gxfp5130/driver/gxfp_irq.h new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_IRQ_H +#define __GXFP_IRQ_H + +#include <linux/interrupt.h> + +irqreturn_t gxfp_irq_thread (int irq,void *data); + +#endif /* __GXFP_IRQ_H */
drivers/misc/gxfp5130/driver/gxfp_platform.c new file +251 -0
251 lines not on this page · raw message
drivers/misc/gxfp5130/driver/gxfp_platform.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_PLATFORM_H +#define __GXFP_PLATFORM_H + +#include <linux/platform_device.h> + +int gxfp_platform_probe (struct platform_device *pdev); +void gxfp_platform_remove (struct platform_device *pdev); + +int gxfp_platform_init_gpios (struct platform_device *pdev); + +#endif /* __GXFP_PLATFORM_H */
drivers/misc/gxfp5130/driver/gxfp_trace.c new file +179 -0
179 lines not on this page · raw message
drivers/misc/gxfp5130/driver/gxfp_trace.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_TRACE_H +#define __GXFP_TRACE_H + +#include <linux/types.h> + +struct device ; + +int gxfp_trace_init (struct device *dev); +void gxfp_trace_exit (void ); +void gxfp_trace_clear (void ); + +void gxfp_trace_logf(const char *fmt, ...) __printf(1, 2); + +#endif /* __GXFP_TRACE_H */
drivers/misc/gxfp5130/driver/gxfp_uapi.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_UAPI_DRV_H +#define __GXFP_UAPI_DRV_H + +#include <linux/types.h> +#include <linux/fs.h> +#include <linux/poll.h> + +struct gxfp_dev ; + +void gxfp_uapi_rxq_push_packet (struct gxfp_dev *gdev,const __u8 *buf,size_t len); + +void gxfp_uapi_rxq_flush_locked (struct gxfp_dev *gdev); +ssize_t gxfp_uapi_read (struct file *file,char __user *ubuf,size_t count,loff_t *ppos); +__poll_t gxfp_uapi_poll (struct file *file,poll_table *wait); + +int gxfp_uapi_open (struct inode *inode,struct file *file); +int gxfp_uapi_release (struct inode *inode,struct file *file); +ssize_t gxfp_uapi_write (struct file *file,const char __user *ubuf,size_t count,loff_t *ppos); +long gxfp_uapi_unlocked_ioctl (struct file *file,unsigned int cmd,unsigned long arg); + +int gxfp_uapi_register (struct gxfp_dev *gdev); +void gxfp_uapi_unregister (struct gxfp_dev *gdev); + +#endif /* __GXFP_UAPI_DRV_H */
drivers/misc/gxfp5130/driver/gxfp_uapi_ctrl.c new file +136 -0
136 lines not on this page · raw message
drivers/misc/gxfp5130/driver/gxfp_uapi_fifo.c new file +245 -0
245 lines not on this page · raw message
drivers/misc/gxfp5130/driver/gxfp_uapi_misc.c new file +123 -0
123 lines not on this page · raw message
drivers/misc/gxfp5130/gxfp_main.c new file +127 -0
127 lines not on this page · raw message
drivers/misc/gxfp5130/hw/gxfp_acpi.c new file +130 -0
130 lines not on this page · raw message
drivers/misc/gxfp5130/hw/gxfp_acpi.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_ACPI_H +#define __GXFP_ACPI_H + +#include <linux/device.h> +#include <linux/acpi.h> + +int gxfp_acpi_get_gpio_crs_indexes (struct device *dev, +int *irq_gpio_crs_index, +int done_gpio_crs_index[2 ], +bool *done_active_low); + +int gxfp_acpi_get_hid (struct device *dev,char *buf,size_t bufsz); + +#endif /* __GXFP_ACPI_H */
drivers/misc/gxfp5130/hw/gxfp_delay.c new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <linux/delay.h> + +#include "gxfp_delay.h" + +void gxfp_busy_wait_us (unsigned int us) +{ +if (!us) +return ; +if (us <=2000 ) { +udelay (us); +return ; + } +usleep_range (us, us +200 ); +}
drivers/misc/gxfp5130/hw/gxfp_delay.h new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_DELAY_H +#define __GXFP_DELAY_H + +void gxfp_busy_wait_us (unsigned int us); + +#endif /* __GXFP_DELAY_H */
drivers/misc/gxfp5130/hw/gxfp_gpio.c new file +64 -0
64 lines not on this page · raw message
drivers/misc/gxfp5130/hw/gxfp_gpio.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_GPIO_H +#define __GXFP_GPIO_H + +#include <linux/device.h> + +struct gxfp_dev ; + +void gxfp_gpio_pulse_write_done (struct gxfp_dev *gdev); + +void gxfp_gpio_set_read_done (struct gxfp_dev *gdev,int value); + +void gxfp_gpio_pulse_read_done (struct gxfp_dev *gdev); + +void gxfp_gpio_force_done_deassert (struct device *dev,struct gxfp_dev *gdev); + +#endif /* __GXFP_GPIO_H */
drivers/misc/gxfp5130/hw/gxfp_mmio.c new file +45 -0
45 lines not on this page · raw message
drivers/misc/gxfp5130/hw/gxfp_mmio.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_MMIO_H +#define __GXFP_MMIO_H + +#include <linux/types.h> + +int gxfp_mmio_write_qword_aligned (void __iomem *mmio,const __u8 *buf,size_t len); +int gxfp_mmio_read_qword_aligned (__u8 *buf,void __iomem *mmio,size_t len); + +#endif /* __GXFP_MMIO_H */
drivers/misc/gxfp5130/include/gxfp_constants.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_CONSTANTS_H +#define __GXFP_CONSTANTS_H + +#define GXFP_MAILBOX_MIN_SIZE 0x1000 + +#define GXFP_READ_CHUNK_MAX 0xe00 +#define GXFP_TX_BUFFER_SIZE 0x200 + +#define GXFP_CMD_FIRMWARE_VERSION 0xA8 +#define GXFP_CMD_TRIGGER_MCU_STATE 0xAF +#define GXFP_CMD_QUERY_MCU_STATE 0xAE +#define GXFP_CMD_ACK 0xB0 +#define GXFP_CMD_UPLOAD_CONFIG_MCU 0x90 +#define GXFP_CMD_NOTIFY_POWER_STATE 0x0E +#define GXFP_CMD_PROTOCOL_INIT 0x01 +#define GXFP_CMD_SLEEP_CLEANUP 0xD2 +#define GXFP_CMD_RESET_DEVICE 0xA1 +#define GXFP_CMD_TLS_UNLOCK 0xD4 + +#define GXFP_MAX_VERSION_RAW 512 +#define GXFP_MAX_VERSION_ASCII 32 +#define GXFP_MAX_MCU_STATE_PAYLOAD 256 + +#define GXFP_DEFAULT_RETRY_COUNT 8 +#define GXFP_DEFAULT_TIMEOUT_US 15000 +#define GXFP_RESET_DELAY_US 200000 + +#define GXFP_FRAME_ALIGNMENT 8 + +#define GXFP_MP_TYPE_A 0xAu +#define GXFP_MP_TYPE_B 0xBu +#define GXFP_MP_TYPE_C 0xCu + +#define GXFP_ESPI_WRAPPER_MAGIC 0xF0 +#define GXFP_ESPI_SEQ16_INIT 0x8881 + +#endif /* __GXFP_CONSTANTS_H */
drivers/misc/gxfp5130/include/gxfp_priv.h new file +55 -0
55 lines not on this page · raw message
drivers/misc/gxfp5130/proto/gxfp_goodix_proto.c new file +84 -0
84 lines not on this page · raw message
drivers/misc/gxfp5130/proto/gxfp_goodix_proto.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_GOODIX_PROTO_H +#define __GXFP_GOODIX_PROTO_H + +#include <linux/types.h> + +#define GXFP_GOODIX_PAYLOAD_U16_MAX 0xFF00u + +struct gxfp_frame_parsed { +bool valid; +bool proto_checksum_ok; +__u8 cmd; +__u16 decl_len; +const __u8 *payload; +__u16 payload_len; +__u8 proto_checksum; +}; + +bool gxfp_parse_goodix_body (const __u8 *buf,size_t buf_len, +struct gxfp_frame_parsed *out); + +__u8 gxfp_goodix_proto_checksum (__u8 cmd,__u16 decl_len, +const __u8 *payload,size_t payload_len); + +int gxfp_goodix_build_frame (__u8 cmd, +const __u8 *payload, +size_t payload_len, +__u8 *out, +size_t out_cap); + +#endif /* __GXFP_GOODIX_PROTO_H */
drivers/misc/gxfp5130/proto/gxfp_mp_proto.c new file +96 -0
96 lines not on this page · raw message
drivers/misc/gxfp5130/proto/gxfp_mp_proto.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_MP_PROTO_H +#define __GXFP_MP_PROTO_H + +#include <linux/types.h> + +#define GXFP_GOODIX_MP_LEN_MAX 0x6c00u + +struct gxfp_mp_frame_parsed { +bool valid; +__u8 flags; +__u16 payload_len; +const __u8 *payload; +}; + +bool gxfp_parse_mp_frame (const __u8 *buf,size_t buf_len, +struct gxfp_mp_frame_parsed *out); + +bool gxfp_check_mp_head (const __u8 *buf,size_t buf_len,__u16 *out_mp_len); + +int gxfp_mp_build_frame (__u8 mp_type, +const __u8 *payload, +size_t payload_len, +__u8 *out, +size_t out_cap); + +#endif /* __GXFP_MP_PROTO_H */
drivers/misc/gxfp5130/transport/gxfp_espi_common.c new file +80 -0
80 lines not on this page · raw message
drivers/misc/gxfp5130/transport/gxfp_espi_common.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_ESPI_COMMON_H +#define __GXFP_ESPI_COMMON_H + +#include <linux/types.h> +#include "../include/gxfp_constants.h" + +struct gxfp_dev ; + +#define GXFP_ESPI_RX_OFF 0x200 +#define GXFP_ESPI_CHUNK_MAX GXFP_READ_CHUNK_MAX +#define GXFP_ESPI_ALIGN GXFP_FRAME_ALIGNMENT + +void gxfp_espi_irq_assem_reset (struct gxfp_dev *gdev); +int gxfp_espi_rx_read_window (struct gxfp_dev *gdev,__u8 *dst); +void gxfp_espi_rx_chunk_calc (size_t remain, +size_t *chunk, +size_t *pad, +size_t *do_read); +int gxfp_espi_rx_start_packet (struct gxfp_dev *gdev, +__u8 *rx_buf, +size_t rx_cap, +bool validate_head, +size_t *out_total, +size_t *out_first_chunk); + +#endif /* __GXFP_ESPI_COMMON_H */
drivers/misc/gxfp5130/transport/gxfp_espi_rx_irq.c new file +120 -0
120 lines not on this page · raw message
drivers/misc/gxfp5130/transport/gxfp_espi_rx_irq.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_ESPI_RX_IRQ_H +#define __GXFP_ESPI_RX_IRQ_H + +#include <linux/types.h> + +struct gxfp_dev ; + +int gxfp_espi_irq_read_step (struct gxfp_dev *gdev, +__u8 *rx_buf, +size_t rx_cap, +size_t *out_rx_len, +bool *complete); + +#endif /* __GXFP_ESPI_RX_IRQ_H */
drivers/misc/gxfp5130/transport/gxfp_espi_rx_sync.c new file +96 -0
96 lines not on this page · raw message
drivers/misc/gxfp5130/transport/gxfp_espi_rx_sync.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __GXFP_ESPI_RX_SYNC_H +#define __GXFP_ESPI_RX_SYNC_H + +#include <linux/types.h> + +struct gxfp_dev ; + +int gxfp_espi_read (struct gxfp_dev *gdev, +__u8 *rx_buf, +size_t rx_cap, +size_t *out_rx_len); + +#endif /* __GXFP_ESPI_RX_SYNC_H */
drivers/misc/gxfp5130/transport/gxfp_espi_tx.c new file +88 -0
54 lines not on this page · raw message
drivers/misc/gxfp5130/transport/gxfp_espi_tx.h new file +20 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.55.0
Part of the diff is not shown here. View the raw message.
Greg KH
maintainerdrivers/misc/Kconfig source "drivers/misc/mchp_pci1xxxx/Kconfig" · line 655
Quoted 8 lines · Metehan Günen
drivers/misc/Kconfig +2
-0@@ -651,4 +651,6 @@ source "drivers/misc/mchp_pci1xxxx/Kconfig" source "drivers/misc/keba/Kconfig" source "drivers/misc/amd-sbi/Kconfig" source "drivers/misc/rp1/Kconfig" +source "drivers/misc/gxfp5130/Kconfig" +
Why add this extra line?
drivers/misc/Makefile obj-$(CONFIG_MCHP_LAN966X_PCI) += lan966x-pci.o · line 78
Quoted 11 lines
drivers/misc/Kconfig +0
-0endmenudrivers/misc/Makefile +2
-0@@ -74,3 +74,5 @@ obj-$(CONFIG_MCHP_LAN966X_PCI) += lan966x-pci.o obj-y += keba/ obj-y += amd-sbi/ obj-$(CONFIG_MISC_RP1) += rp1/ + +obj-$(CONFIG_GXFP5130) += gxfp5130/
Same here, why the extra line?
drivers/misc/Makefile
Quoted 2 lines
drivers/misc/Makefile +2
-0+ gxfp_trace_logf("cmd_timeout req=0x%02x expect=0x%02x tries=%u", + req->req_cmd, req->expect_cmd, req->tries ? req->tries : 1);
Please do not roll your own tracing functions, use the in-kernel ones instead.
thanks,
greg k-h
Quoted 2 lines · Greg KH
Why add this extra line?
Same here, why the extra line?
Script artifact — the patch generation script added a spurious blank line before both the source and obj entries. Will fix in v2.
Quoted 2 lines
Please do not roll your own tracing functions, use the in-kernel ones instead.
Agreed. The entire gxfp_trace module will be removed in v2 and replaced with dev_dbg() calls throughout, which integrate with the kernel's dynamic debug infrastructure.
Thanks,
Metehan Günen
Greg KH
maintainerQuoted 7 lines · Metehan Günen
Quoted 2 lines · Greg KH
Why add this extra line?
Same here, why the extra line?Script artifact — the patch generation script added a spurious blank line before both the source and obj entries. Will fix in v2.
Quoted 6 lines
Quoted 2 lines
Please do not roll your own tracing functions, use the in-kernel ones instead.
Agreed. The entire
gxfp_tracemodule will be removed in v2 and replaced withdev_dbg()calls throughout, which integrate with the kernel's dynamic debug infrastructure.
Or you can use the normal traceing infrastructure if you really want trace log messages instead of dev_dbg() ones. Your call.
Greg KH
maintainerdrivers/misc/gxfp5130/driver/gxfp_trace.c line 159
Quoted 2 lines · Metehan Günen
drivers/misc/gxfp5130/driver/gxfp_trace.c new file +2
-0+ gxfp_trace.dir =debugfs_create_dir ("gxfp" ,NULL ); +if (!IS_ERR_OR_NULL (gxfp_trace.dir)) {
This is not how you use debugfs.
Also, this implements a custom trace function, again, use the built-in kernel functions for this.
This implies that the driver came from an external company that does not have much kernel development experience, or a LLM wrote this. As there is no copyright information on the code, which is it?
drivers/misc/gxfp5130/driver/gxfp_trace.c line 173
Quoted 3 lines
drivers/misc/gxfp5130/driver/gxfp_trace.c new file +3
-0+void gxfp_trace_exit (void ) +{ +if (!READ_ONCE (gxfp_trace.inited))
That's an abuse of READ_ONCE() :(
thanks,
greg k-h
Quoted 4 lines · Greg KH
This is not how you use debugfs.
Also, this implements a custom trace function, again, use the built-in kernel functions for this.
Understood on both counts. The IS_ERR_OR_NULL() guard around the debugfs_create_dir() return value is wrong — debugfs functions handle a NULL or error dir silently in subsequent calls, so the check is unnecessary. The gxfp_trace module will be removed entirely in v2 and replaced with dev_dbg() throughout.
Quoted 3 lines
This implies that the driver came from an external company that does not have much kernel development experience, or a LLM wrote this. As there is no copyright information on the code, which is it?
The original code was written by Void755 (github.com/Void755) for out-of-tree use under GPL-2.0 on hardware not supported by any existing driver. I ported it to mainline kernel style with assistance from an AI tool, which is responsible for the debugfs misuse, the custom trace system, and the other style issues you found — it applied patterns that compile but do not follow kernel conventions. I should have caught these before sending.
v2 will carry proper copyright headers:
Copyright (C) 2024 Void755 <github.com/Void755> Copyright (C) 2026 Metehan Günen <[email protected]>
Quoted 1 line
That's an abuse of
READ_ONCE():(
Agreed — READ_ONCE() is for lockless concurrent access paths, not a plain init flag. Will be replaced with a regular boolean check in v2.
Thanks,
Metehan Günen
PATCH 3/4 Documentation/misc-devices: add gxfp5130.rst
In reply to Metehan GünenDocument the Goodix GXFP5130 eSPI fingerprint sensor driver:
hardware interface (MMIO mailbox + 3 GPIOs), userspace ABI (open/write/read/poll/ioctl), sysfs attribute, debugfs trace interface, and the table of supported laptop models.
--- Documentation/misc-devices/gxfp5130.rst | 90 +++++++++++++++++++++++++ Documentation/misc-devices/index.rst | 1 + 2 files changed, 91 insertions(+) create mode 100644 Documentation/misc-devices/gxfp5130.rst
Documentation/misc-devices/gxfp5130.rst new file +90 -0
@@ -0,0 +1,90 @@ +.. SPDX-License-Identifier: GPL-2.0 + +===================================== +Goodix GXFP5130 Fingerprint Sensor +===================================== + +Overview +-------- + +The GXFP5130 is a press-type fingerprint sensor by Goodix Technology used in +several Huawei MateBook laptops. It connects to the host via an eSPI-based +MMIO mailbox interface and is enumerated through ACPI (HID: ``GXFP5130``). + +This driver exposes a character device (``/dev/gxfp``) that userspace +libraries such as libfprint use to perform fingerprint enrollment and +verification through fprintd. + +Hardware interface +------------------ + +The sensor communicates through a memory-mapped mailbox window provided by +the ACPI ``_CRS`` resource. Signalling uses three GPIOs: + +- **write-done**: host pulses high after writing a command frame +- **read-done**: host pulses high after reading each chunk of a response +- **irq**: sensor asserts to indicate a response is available + +All frames use a 4-byte eSPI wrapper header followed by a Goodix MP protocol +frame, which in turn wraps a Goodix command/response body. + +UAPI +---- + +The character device supports the following operations: + +``open(2)`` + Requires ``CAP_SYS_ADMIN``. Only one reader is allowed at a time. + +``write(2)`` + Write a ``struct gxfp_tx_pkt_hdr`` followed by the payload bytes. + The driver wraps this in an eSPI frame and sends it to the sensor. + +``read(2)`` + Returns one response record at a time. Each record begins with a + ``struct gxfp_tap_hdr`` header followed by the response payload. + Blocks until a response is available (unless ``O_NONBLOCK``). + +``poll(2)`` + Returns ``EPOLLIN`` when a response record is available. + +``ioctl(2)`` + ``GXFP_IOCTL_FLUSH_RXQ`` — discard all queued response records. + +Kernel parameters +----------------- + +None. All configuration is automatic from ACPI. + +sysfs attributes +---------------- + +``/sys/class/misc/gxfp/acpi_id`` (read-only) + ACPI HID of the enumerated device (e.g. ``GXFP5130``). + +debugfs +------- + +When ``CONFIG_DEBUG_FS`` is enabled, the driver creates +``/sys/kernel/debug/gxfp/``: + +``trace_dump`` (read-only) + Ring buffer of recent driver trace events, one per line. + Format: ``<seq> <ts_ns> <message>`` + +``trace_clear`` (write-only) + Writing anything clears the trace ring buffer. + +``trace_enable`` (read-write) + ``0`` to disable tracing (default), ``1`` to enable. + +Supported hardware +------------------ + +=============================== ======= ============================ +Device ACPI ID Firmware seen +=============================== ======= ============================ +Huawei MateBook D16 2024 GXFP5130 GF_GCC_EC_20067 +Huawei MateBook X Pro 2024 GXFP5130 GF_GCC_EC_20068 +Huawei MateBook 14 2024 GXFP5130 (under investigation) +=============================== ======= ============================
Documentation/misc-devices/index.rst +1 -0
@@ -10,6 +10,7 @@ fit into other categories. .. toctree:: :caption: Table of contents :maxdepth: 2 + gxfp5130 ad525x_dpot amd-sbi
Signature · 1 line
2.55.0
Greg KH
maintainerRe: [PATCH 3/4] Documentation/misc-devices: add gxfp5130.rst
Quoted 4 lines · Metehan Günen
Document the Goodix GXFP5130 eSPI fingerprint sensor driver:
hardware interface (MMIO mailbox + 3 GPIOs), userspace ABI (open/write/read/poll/ioctl), sysfs attribute, debugfs trace interface, and the table of supported laptop models.
sysfs documentation goes in Documentation/ABI please.
Re: [PATCH 3/4] Documentation/misc-devices: add gxfp5130.rst
Quoted 1 line · Greg KH
sysfs documentation goes in
Documentation/ABIplease.
Understood. v2 will move the sysfs attribute entry to Documentation/ABI/testing/sysfs-class-misc-gxfp and keep only the hardware description and char-device ABI in the rst file.
Thanks,
Metehan Günen
PATCH 4/4 MAINTAINERS: add entry for GXFP5130 fingerprint sensor driver
In reply to Metehan GünenAdd maintainer entry for the new Goodix GXFP5130 driver covering the driver source tree, UAPI header, and documentation.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -11048,6 +11048,13 @@ S: Maintained F: Documentation/devicetree/bindings/connector/gocontroll,moduline-module-slot.yaml GOODIX TOUCHSCREEN +GOODIX GXFP5130 FINGERPRINT SENSOR DRIVER +M: Metehan Günen <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/misc-devices/gxfp5130.rst +F: drivers/misc/gxfp5130/ +F: include/uapi/linux/gxfp_ioctl.h M: Hans de Goede <[email protected]> L: [email protected] S: Maintained
Signature · 1 line
2.55.0
Greg KH
maintainerRe: [PATCH 4/4] MAINTAINERS: add entry for GXFP5130 fingerprint sensor driver
Quoted 16 lines · Metehan Günen
Add maintainer entry for the new Goodix GXFP5130 driver covering the driver source tree, UAPI header, and documentation.
Signed-off-by Metehan Günen <[email protected]>--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)MAINTAINERS +0
-0@@ -11048,6 +11048,13 @@ S: Maintained F: Documentation/devicetree/bindings/connector/gocontroll,moduline-module-slot.yaml GOODIX TOUCHSCREEN
MAINTAINERS S: Maintained · line 11060
Quoted 10 lines
MAINTAINERS +7
-0+GOODIX GXFP5130 FINGERPRINT SENSOR DRIVER +M: Metehan Günen <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/misc-devices/gxfp5130.rst +F: drivers/misc/gxfp5130/ +F: include/uapi/linux/gxfp_ioctl.h M: Hans de Goede <[email protected]> L: [email protected] S: Maintained
I don't think this entry is doing what you think it is doing.
Was it created by a LLM?
thanks,
greg k-h
Re: [PATCH 4/4] MAINTAINERS: add entry for GXFP5130 fingerprint sensor driver
Quoted 3 lines · Greg KH
I don't think this entry is doing what you think it is doing.
Was it created by a LLM?
You are right — the patch script inserted the new block between the GOODIX TOUCHSCREEN header line and its own M: line, breaking that entry. The new GOODIX GXFP5130 block needs to appear as a standalone section, not mid-block. Will fix in v2.
As noted in my reply to the cover letter, the reformatting work was done with AI assistance, which caused this and the other style issues you found. The original driver logic is from Void755's out-of-tree driver; I am responsible for the mainline port and the mistakes in it.
Thanks,
Metehan Günen
Greg KH
maintainerRe: [PATCH 4/4] MAINTAINERS: add entry for GXFP5130 fingerprint sensor driver
Quoted 9 lines · Metehan Günen
Quoted 3 lines · Greg KH
I don't think this entry is doing what you think it is doing.
Was it created by a LLM?
You are right — the patch script inserted the new block between the GOODIX TOUCHSCREEN header line and its own M: line, breaking that entry. The new GOODIX GXFP5130 block needs to appear as a standalone section, not mid-block. Will fix in v2.
As per our documentation you must document that you use an LLM, please do so for your next submissions.
thanks,
greg k-h
Greg KH
maintainerQuoted 10 lines · Metehan Günen
This series adds a kernel driver for the Goodix GXFP5130 fingerprint sensor found in Huawei MateBook laptops (D16 2024, X Pro 2024, 14 2024).
The sensor is enumerated through ACPI (HID: GXFP5130) and communicates with the host via an eSPI-based memory-mapped mailbox window plus three GPIOs. It does not use SPI or I2C bus drivers.
A misc character device
/dev/gxfpis exposed to userspace. The libfprint library (with a corresponding GXFP5130 plugin) uses this device to perform biometric enrollment and verification via fprintd.
Is that the "normal" user/kernel api for these types of sensors? I thought we had a real api these days, and a vendor one was not generally a good idea as you are just exposing raw hardware design to userspace.
Quoted 56 lines
The four patches are:
[1/4] UAPI header (include/uapi/linux/gxfp_ioctl.h) [2/4] Driver source tree (drivers/misc/gxfp5130/) [3/4] Documentation (Documentation/misc-devices/gxfp5130.rst) [4/4]MAINTAINERSentryMetehan Günen (4):
include/uapi/linux: addgxfp_ioctl.hfor GXFP5130 fingerprint sensordrivers/misc: add Goodix GXFP5130 eSPI fingerprint sensor driverDocumentation/misc-devices: addgxfp5130.rst
MAINTAINERS: add entry for GXFP5130 fingerprint sensor driverDocumentation/misc-devices/gxfp5130.rst | 90 +++++++ Documentation/misc-devices/index.rst | 1 + MAINTAINERS | 7 + drivers/misc/Kconfig | 2 + drivers/misc/Makefile | 2 + drivers/misc/gxfp5130/Kconfig | 18 ++ drivers/misc/gxfp5130/Makefile | 28 ++ drivers/misc/gxfp5130/cmd/gxfp_cmd.c | 177 ++++++++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd.h | 54 ++++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_config.c | 28 ++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_config.h | 12 + .../misc/gxfp5130/cmd/gxfp_cmd_mcu_state.c | 89 +++++++ .../misc/gxfp5130/cmd/gxfp_cmd_mcu_state.h | 30 +++ drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.c | 185 +++++++++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd_reset.h | 27 ++ drivers/misc/gxfp5130/cmd/gxfp_cmd_version.c | 100 +++++++ drivers/misc/gxfp5130/cmd/gxfp_cmd_version.h | 22 ++ drivers/misc/gxfp5130/driver/gxfp_irq.c | 57 ++++ drivers/misc/gxfp5130/driver/gxfp_irq.h | 9 + drivers/misc/gxfp5130/driver/gxfp_platform.c | 251 ++++++++++++++++++ drivers/misc/gxfp5130/driver/gxfp_platform.h | 12 + drivers/misc/gxfp5130/driver/gxfp_trace.c | 179 +++++++++++++ drivers/misc/gxfp5130/driver/gxfp_trace.h | 15 ++ drivers/misc/gxfp5130/driver/gxfp_uapi.h | 25 ++ drivers/misc/gxfp5130/driver/gxfp_uapi_ctrl.c | 136 ++++++++++ drivers/misc/gxfp5130/driver/gxfp_uapi_fifo.c | 245 +++++++++++++++++ drivers/misc/gxfp5130/driver/gxfp_uapi_misc.c | 123 +++++++++ drivers/misc/gxfp5130/gxfp_main.c | 127 +++++++++ drivers/misc/gxfp5130/hw/gxfp_acpi.c | 130 +++++++++ drivers/misc/gxfp5130/hw/gxfp_acpi.h | 15 ++ drivers/misc/gxfp5130/hw/gxfp_delay.c | 15 ++ drivers/misc/gxfp5130/hw/gxfp_delay.h | 7 + drivers/misc/gxfp5130/hw/gxfp_gpio.c | 64 +++++ drivers/misc/gxfp5130/hw/gxfp_gpio.h | 17 ++ drivers/misc/gxfp5130/hw/gxfp_mmio.c | 45 ++++ drivers/misc/gxfp5130/hw/gxfp_mmio.h | 10 + .../misc/gxfp5130/include/gxfp_constants.h | 38 +++ drivers/misc/gxfp5130/include/gxfp_priv.h | 55 ++++ .../misc/gxfp5130/proto/gxfp_goodix_proto.c | 84 ++++++ .../misc/gxfp5130/proto/gxfp_goodix_proto.h | 31 +++ drivers/misc/gxfp5130/proto/gxfp_mp_proto.c | 96 +++++++ drivers/misc/gxfp5130/proto/gxfp_mp_proto.h | 27 ++ .../gxfp5130/transport/gxfp_espi_common.c | 80 ++++++ .../gxfp5130/transport/gxfp_espi_common.h | 27 ++
Quoted 8 lines
.../gxfp5130/transport/gxfp_espi_rx_irq.c | 120 +++++++++ .../gxfp5130/transport/gxfp_espi_rx_irq.h | 15 ++ .../gxfp5130/transport/gxfp_espi_rx_sync.c | 96 +++++++ .../gxfp5130/transport/gxfp_espi_rx_sync.h | 14 + .../misc/gxfp5130/transport/gxfp_espi_tx.c | 88 ++++++ .../misc/gxfp5130/transport/gxfp_espi_tx.h | 20 ++ include/uapi/linux/gxfp_ioctl.h | 43 +++ 51 files changed, 3188 insertions(+)
Why isn't this just one single .c file? 3k for a driver is nothing, this is a mess of stuff that odds are, can be much much smaller if its all in one single file, and one .h file for the uapi.
What caused this to be split up so crazily?
And no copyright notices at all? Are you sure about that?
thanks,
greg k-h
Quoted 3 lines · Greg KH
Is that the "normal" user/kernel api for these types of sensors? I thought we had a real api these days, and a vendor one was not generally a good idea as you are just exposing raw hardware design to userspace.
The GXFP5130 communicates using a vendor-specific MP protocol over the eSPI mailbox — it is not USB HID-compliant and does not expose a standard fingerprint command set. The libfprint plugin that consumes this device speaks the protocol directly and handles enrollment and matching entirely in userspace, the same model used by other libfprint char-device backends (e.g. goodix-55x4, elan-i2c).
I am open to alternative approaches. If there is a preferred kernel-side abstraction for this class of device I should be targeting instead, please point me to it and I will rework the driver accordingly.
The large file count (51 files) reflects the upstream tree layout of the out-of-tree driver I ported. v2 will consolidate the driver into a single .c file as is standard for misc drivers of this size.
The original driver code was written by Void755 (github.com/Void755), who developed it for out-of-tree use. I ported it to mainline kernel conventions with assistance from an AI tool for the reformatting work. That AI assistance introduced several of the style issues you have pointed out across the patches. I will fix all of them in v2 and add proper copyright attribution for both Void755 and myself.
Thanks,
Metehan Günen
Greg KH
maintainerQuoted 12 lines · Metehan Günen
Quoted 3 lines · Greg KH
Is that the "normal" user/kernel api for these types of sensors? I thought we had a real api these days, and a vendor one was not generally a good idea as you are just exposing raw hardware design to userspace.
The GXFP5130 communicates using a vendor-specific MP protocol over the eSPI mailbox — it is not USB HID-compliant and does not expose a standard fingerprint command set. The libfprint plugin that consumes this device speaks the protocol directly and handles enrollment and matching entirely in userspace, the same model used by other libfprint char-device backends (e.g. goodix-55x4, elan-i2c).
Quoted 3 lines
I am open to alternative approaches. If there is a preferred kernel-side abstraction for this class of device I should be targeting instead, please point me to it and I will rework the driver accordingly.
Why does it have to be a kernel driver at all? Can't you just talk to the device directly from userspace through the spi userspace api instead?
thanks,
greg k-h
I am withdrawing this patch series (v1).
After consulting with Void755, who wrote the original out-of-tree driver this submission was based on, it became clear that the driver is not ready for mainline inclusion yet. Specifically:
- The kernel module currently handles sensor-specific protocol logic (MP protocol, Goodix command structures) that belongs in userspace. This is consistent with the concern you raised about why a kernel driver is needed at all.
- A sibling sensor (SIL6250) shares the same eSPI mailbox transport mechanism. A properly refactored, transport-only kernel driver could support both sensors, which would make a stronger case for mainline.
- The original author prefers out-of-tree maintenance for now while the architecture is reworked.
I will resubmit once the kernel/userspace boundary is properly designed and the driver is in a state the original author considers ready.
Thank you for the detailed review of v1.
Metehan Günen