From 575ccf4aac7a42d0b03b6d245705f25bb7f0523c Mon Sep 17 00:00:00 2001 From: mcc45tr Date: Tue, 1 Sep 2026 22:18:58 +0300 Subject: [PATCH 48/64] nabu: keep keyboard and legacy Iris from blocking suspend --- drivers/input/misc/xiaomi-nabu-keyboard.c | 16 ++++++--- drivers/media/platform/qcom/iris/iris_probe.c | 30 ++++++++++++++-- senemos/7.2.2-iris-audit.md | 35 +++++++++++++++++++ 3 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 senemos/7.2.2-iris-audit.md diff --git a/drivers/input/misc/xiaomi-nabu-keyboard.c b/drivers/input/misc/xiaomi-nabu-keyboard.c index 70e07728d364..24c6c1da6d9a 100644 --- a/drivers/input/misc/xiaomi-nabu-keyboard.c +++ b/drivers/input/misc/xiaomi-nabu-keyboard.c @@ -82,7 +82,15 @@ static irqreturn_t nabu_keyboard_detect_irq(int irq, void *data) { struct nabu_keyboard *keyboard = data; - pm_wakeup_event(keyboard->dev, 500); + /* + * Cover transitions while the system is awake are ordinary input + * changes, not wake events. Keeping a wakeup event pending during the + * desktop's pre-suspend blanking phase can make the freezer abort the + * following system suspend. Only hold the system awake after the PM + * callback has actually armed this IRQ as a wake source. + */ + if (READ_ONCE(keyboard->wake_enabled)) + pm_wakeup_event(keyboard->dev, 500); mod_delayed_work(system_wq, &keyboard->detect_work, msecs_to_jiffies(NABU_KEYBOARD_DEBOUNCE_MS)); return IRQ_HANDLED; @@ -249,7 +257,7 @@ static int nabu_keyboard_suspend(struct device *dev) ret = enable_irq_wake(keyboard->irq); if (!ret) - keyboard->wake_enabled = true; + WRITE_ONCE(keyboard->wake_enabled, true); return ret; } @@ -257,9 +265,9 @@ static int nabu_keyboard_resume(struct device *dev) { struct nabu_keyboard *keyboard = dev_get_drvdata(dev); - if (keyboard->wake_enabled) { + if (READ_ONCE(keyboard->wake_enabled)) { disable_irq_wake(keyboard->irq); - keyboard->wake_enabled = false; + WRITE_ONCE(keyboard->wake_enabled, false); } mod_delayed_work(system_wq, &keyboard->detect_work, msecs_to_jiffies(NABU_KEYBOARD_DEBOUNCE_MS)); diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c index 38946cad35ca..72a79092fa20 100644 --- a/drivers/media/platform/qcom/iris/iris_probe.c +++ b/drivers/media/platform/qcom/iris/iris_probe.c @@ -355,9 +355,35 @@ static int __maybe_unused iris_pm_resume(struct device *dev) return ret; } +static int __maybe_unused iris_system_suspend(struct device *dev) +{ + struct iris_core *core = dev_get_drvdata(dev); + + /* + * Runtime PM is forbidden on legacy VPU5 until its power-collapse + * handshake is implemented. pm_runtime_force_suspend() bypasses that + * prohibition and would still call iris_pm_suspend(), whose prepare-PC + * path intentionally returns -EAGAIN. Keep the controller powered + * across s2idle instead of rejecting every system suspend. + */ + if (core->iris_platform_data->legacy_vpu5) + return 0; + + return pm_runtime_force_suspend(dev); +} + +static int __maybe_unused iris_system_resume(struct device *dev) +{ + struct iris_core *core = dev_get_drvdata(dev); + + if (core->iris_platform_data->legacy_vpu5) + return 0; + + return pm_runtime_force_resume(dev); +} + static const struct dev_pm_ops iris_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) + SET_SYSTEM_SLEEP_PM_OPS(iris_system_suspend, iris_system_resume) SET_RUNTIME_PM_OPS(iris_pm_suspend, iris_pm_resume, NULL) }; diff --git a/senemos/7.2.2-iris-audit.md b/senemos/7.2.2-iris-audit.md new file mode 100644 index 000000000000..7d974f1804b3 --- /dev/null +++ b/senemos/7.2.2-iris-audit.md @@ -0,0 +1,35 @@ +# Linux 7.2.2 Nabu Iris audit + +## Decision + +Keep the current Linux 7.2.2 Iris overlay as the implementation base. It is +newer and broader than the Linux 6.17 port: the SM8150/VPU5 platform data, +Venus coordination, firmware boot gate, cached capture buffers and 10-bit P010 +decode are retained, while the 7.2.2 series also carries current V4L2 API +adaptation and additional VP9/P010 fixes. + +Do not replay the older Iris driver files wholesale. Doing so would replace +the current media API adaptation and lose fixes made after the original port. + +## Feature comparison + +| Capability | Linux 6.17 port | Linux 7.2.2-test result | +|---|---|---| +| SM8150 Iris/VPU5 platform data | Present | Retained and adapted to 7.2.2 | +| Venus/firmware coordination | Present | Retained | +| Firmware boot opt-in gate | Present | Retained (`allow_fw_boot`) | +| Cached capture buffers | Present | Retained | +| 10-bit decode/P010 | Present | Retained, with newer P010 hardening | +| VP9 decode | Initial support | Newer hidden-superframe and legacy-output fixes retained | +| Current V4L2/media API | Older kernel API | Adapted for Linux 7.2.2 | +| Runtime power collapse on VPU5 | Unsupported | Runtime PM remains forbidden | +| System suspend on VPU5 | Could call unsupported prepare-PC path | Guarded; Iris remains powered across s2idle | + +## Validation gates + +Source and compile validation are necessary but do not prove video hardware. +The physical gate is: firmware request succeeds, both video nodes enumerate, +V4L2 compliance does not regress, an 8-bit H.264/VP9 sample decodes, a P010 +sample decodes, repeated stream-on/off does not leak buffers, and a GNOME +suspend/resume cycle succeeds both idle and after decode. Failures must retain +pstore/ftrace evidence before rebooting to the known-good kernel.