diff options
| author | GuEe-GUI <[email protected]> | 2026-05-25 14:57:45 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-05-28 16:09:55 +0800 |
| commit | cfda3b3d1a9935dd14dcb55e43065ca143d68fcf (patch) | |
| tree | 18a5f331c166a71dcc35b0b77ab71907bb404ba8 /documentation/6.components/device-driver/input/input.md | |
| parent | 633a963007d963ba8f709ce674d85ac9bea13f42 (diff) | |
[docs] device-driver: add DM subsystem docs and expand INDEX
Add Doxygen pages for RT-Thread device-model drivers: platform/OFW,
DM core (bus, dm, power), clk/regulator/reset/power-domain, PCI/PIC,
Phye, DMA/hwcache, block/SCSI/ATA/NVMe/UFS/SDIO, SCMI, RPMsg,
mailbox, NVMem, NUMA, syscon, thermal, input/LED/IIO/graphic, and
related power/charger/supply docs.
Expand device-driver INDEX.md with ~90 @subpage entries so all new
pages appear in the driver chapter navigation.
Update existing UART/SPI/RTC/pin/framework/dtc pages: UART docs moved
from serial/ to uart/ (uart + uart_dm + uart_earlycon); SPI and RTC
gain DM companion pages; pin links to pin_dm; framework points at DM
topics.
Focus on registration/probe flow and in-tree APIs; no standalone
VirtIO subsystem page (transport code still incomplete).
Test plan: build Doxygen for documentation/ and verify device-driver
INDEX links resolve without missing @ref/@subpage warnings.
Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'documentation/6.components/device-driver/input/input.md')
| -rwxr-xr-x | documentation/6.components/device-driver/input/input.md | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/documentation/6.components/device-driver/input/input.md b/documentation/6.components/device-driver/input/input.md new file mode 100755 index 0000000000..fa45817eab --- /dev/null +++ b/documentation/6.components/device-driver/input/input.md @@ -0,0 +1,59 @@ +@page page_device_input Input subsystem + +Device-tree binding and DM registration: @ref page_device_input_dm. + +| Topic | Page | +| --- | --- | +| Userspace API | @ref page_device_input_uapi | +| Touch class bridge | @ref page_device_input_touch | +| Power / restart keys | @ref page_device_input_power | + +# Input subsystem (API) + +Header: `drivers/input.h`. Typical stack: low-level driver → **`rt_input_event` / reporters** → handlers (GUI, shell) or **`/dev/inputN`** (@ref page_device_input_uapi). + +| Path | API | +| --- | --- | +| In-kernel listener | **`rt_input_add_handler`** | +| POSIX process (Smart) | **`open` / `read` / `ioctl` / `poll` on `/dev/inputN`** — @ref page_device_input_uapi | +| Legacy touch GUI | **`struct rt_touch_device`** — @ref page_device_input_touch | + +## When to use the input core + +| Use **`rt_input_*`** when… | Consider raw **`rt_device`** read when… | +| --- | --- | +| You want **Linux-like** `EV_KEY` / `EV_REL` / `EV_ABS` / multitouch slot semantics and multiple listeners. | You have a **single proprietary** app talking to a vendor IOCTL-only touch stack. | +| You need **polling** (`**rt_input_setup_polling**`) for GPIO keys without IRQ storms. | GPIO IRQ latency is fine and you do not need unified event routing. | + +## Event contract + +1. **`rt_input_set_capability`** before **`rt_input_device_register`** so users know which **`type`/`code`** pairs are valid. +2. For each hardware change, call **`rt_input_report_*`** then **`rt_input_sync`** to close the frame (**`SYN_REPORT`**). Missing **`sync`** merges events poorly for consumers. +3. **`rt_input_trigger`** routes through optional **`idev->trigger`**—use when you wrap another input device; otherwise **`rt_input_event`** is enough. + +## Callback / context rules + +- **`rt_input_add_handler` → `callback`**: invoked from **`rt_input_event`** path—assume **thread or workqueue** unless your driver documents IRQ delivery; keep **`callback` short**. +- **`poller->poll`**: runs on timer tick—**must not block** or take mutexes that can deadlock with the same thread calling **`rt_input_sync`**. +- **Touch helpers**: **`rt_input_setup_touch`** / **`rt_input_report_touch_*`** require **`RT_INPUT_TOUCHSCREEN`** — @ref page_device_input_touch. + +## Registration lifecycle + +- **`rt_input_device_register`**: registers underlying **`rt_device`**; failures leave partially init state—clean up partial setup in error paths. +- **`rt_input_remove_config`**: tears down polling/touch dynamic config before unregister if you toggled features at runtime. + +## Pitfalls + +- **ABS without `rt_input_set_absinfo`**: consumers cannot clamp—set min/max/resolution for axes you report. +- **Key autorepeat**: not automatic unless a layer implements it—do not assume Linux repeat behavior. +- **Re-entrancy**: posting events from inside a handler for the same device can recurse—prefer queueing. + +## See also + +- @ref page_device_input_dm +- @ref page_device_input_uapi +- @ref page_device_input_touch +- @ref page_device_input_power +- `components/drivers/include/drivers/input.h` +- `components/drivers/include/drivers/input_uapi.h` +- `dt-bindings/input/event-codes.h` |
