[Deepin-Kernel-SIG] [linux 6.6.y] [UOS] i8042: phytium-pio: support PS/2 controller over Phytium PIO#1947
Conversation
Reviewer's GuideBackport and minimal integration of a Phytium PIO-based PS/2 (i8042) path on ARM64 Phytium desktop CPUs (D2000/D3000/D3000M), including CPU model detection helpers, dynamic PIO register layout handling, and a platform-specific i8042 backend wired through logic PIO, while explicitly excluding older LPC-based and laptop-specific bits. Sequence diagram for Phytium PIO-backed i8042 interrupt handlingsequenceDiagram
participant PS2_Device
participant i8042 as i8042_interrupt
participant i8042_phy as i8042_write_lpc_interrupt_clear
participant PIO as phytium_pio
PS2_Device->>i8042: hardware IRQ
i8042->>i8042: spin_lock_irqsave
i8042->>i8042_phy: i8042_write_lpc_interrupt_clear()
i8042_phy->>PIO: phytium_pio_get_int_status()
PIO-->>i8042_phy: int_status
alt [int_status has I8042_KEY_BIT or I8042_TOUCH_BIT or EC_EVENT_BIT]
i8042_phy->>PIO: phytium_pio_clear_interrupt(mask)
PIO-->>i8042_phy: return
i8042_phy-->>i8042: 0 (handled)
i8042->>i8042: continue normal i8042_read_status()
else [no cared bits]
i8042_phy-->>i8042: 1 (no KBD|TP)
i8042->>i8042: spin_unlock_irqrestore
i8042-->>PS2_Device: IRQ not handled (ret = 0)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new classtypes.c helper is built unconditionally and includes <asm/dmi.h>, which may not exist or behave consistently on all architectures; consider either restricting its build to the same architectures that provide that header (e.g. CONFIG_ARM64) or adding appropriate ifdefs around the asm/dmi.h usage.
- The phytium_pio driver relies on global, non-static state (ppio, phytium_pio_int_state, phytium_pio_clr_int) and assumes a single instance; if multiple PIO devices or re-probe/remove scenarios are possible, it would be safer to tie this state to the device instance and avoid exporting driver-global mutable symbols.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new classtypes.c helper is built unconditionally and includes <asm/dmi.h>, which may not exist or behave consistently on all architectures; consider either restricting its build to the same architectures that provide that header (e.g. CONFIG_ARM64) or adding appropriate ifdefs around the asm/dmi.h usage.
- The phytium_pio driver relies on global, non-static state (ppio, phytium_pio_int_state, phytium_pio_clr_int) and assumes a single instance; if multiple PIO devices or re-probe/remove scenarios are possible, it would be safer to tie this state to the device instance and avoid exporting driver-global mutable symbols.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
eebce3e to
d3e1cfd
Compare
uos inclusion category: feature Squashed clean backport of Phytium PIO support for PS/2 keyboard/mouse on D2000/D3000/D3000M desktop platforms. Original commits: - uos: phyt: port phytium lpc & i8042 driver to V25 [T366853] - uos: add helper for detecting whether cpu is d3000 [T366853] - uos: phyt: delete Kconfig choice for i8042_phyt [T366853] - uos: phyt: port UOS_PHYTIUM_DESKTOP_SUPPORT to V25 [T366853] - uos: phytium: show cpuname for desktop processors [B305567] - arm64: cpuinfo: refactor cputype judge functions [T366853] - phytium/lpc: Support various lpc address/offset [T366853] - uos: phytium/lpc: Calc iobase and offsets in one function [T381729] - uos: i8042-phytio: rewrite i8042 for phytium use pio [T381729] - uos: Phytium/pio: Adapt D2000 platforms [T381729] - uos: Phytium/pio: Skip using logic_pio on FT2004 [B335177] - uos: phytium/pio: Support short addr length of PHYT0007 [B352065] Key content kept: - drivers/bus/phytium_pio.c: dynamic PIO register offsets per CPU model, skip PIO init on FT2004, support short PHYT0007 address length - drivers/input/serio/i8042-phytio.h: Logic PIO based i8042 I/O - drivers/input/serio/i8042.c: Phytium PIO interrupt clear hook - lib/cputypes.c, lib/classtypes.c: Phytium CPU model detection - arch/arm64/include/asm/cputype.h: MIDR_PHYTIUM_FT3000 alias - arch/arm64/Kconfig.platforms: select ARCH_MIGHT_HAVE_PC_SERIO for ARCH_PHYTIUM Removed in this minimal version: - LPC-based i8042 driver (i8042_phyt.c, SERIO_I8042_PHYT) - LPC/EC/laptop/S3/UART-init code under drivers/uos/phyt/ - Other CPU model detection helpers - UOS_PHYTIUM_DESKTOP_SUPPORT and related defconfig options Signed-off-by: huangbibo <huangbibo@uniontech.com> Signed-off-by: hmy <huanglin@uniontech.com> Signed-off-by: wenlunpeng <wenlunpeng@uniontech.com> Tested-by: Wentao Guan <guanwentao@uniontech.com> #GreatWall T321A D2000 Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
d3e1cfd to
60172a8
Compare
| once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \ | ||
| generic-radix-tree.o | ||
| generic-radix-tree.o classtypes.o | ||
| obj-$(CONFIG_ARM64) += cputypes.o |
There was a problem hiding this comment.
看起来针对飞腾特判的部分稍作改动可以放进arch/arm64/lib,而其它部分可以保留在这里
There was a problem hiding this comment.
看起来针对飞腾特判的部分稍作改动可以放进arch/arm64/lib,而其它部分可以保留在这里
把classtypes.o 也放到cputypes.o这边了
uos inclusion
category: feature
Squashed clean backport of Phytium PIO support for PS/2 keyboard/mouse on D2000/D3000/D3000M desktop platforms.
Original commits:
Key content kept:
Removed in this minimal version:
Tested-by: Wentao Guan guanwentao@uniontech.com #GreatWall T321A D2000
Summary by Sourcery
Add Phytium PIO-based PS/2 (i8042) support on Phytium desktop ARM64 platforms with CPU-model-specific handling.
New Features:
Enhancements:
Build: