mirror of https://github.com/zmkfirmware/zmk.git
fix: Fix wakeup from kscan wrapped in sideband.
* If using a sideband kscan device to wrap a native kscan device, ensure the inner kscan device is also wakeup enabled to it can be waken from a deep sleep state by key press.
This commit is contained in:
parent
92745903c9
commit
32d0a4bf41
|
|
@ -111,6 +111,9 @@ static int ksbb_enable(const struct device *dev) {
|
||||||
pm_device_runtime_get(config->kscan);
|
pm_device_runtime_get(config->kscan);
|
||||||
}
|
}
|
||||||
#elif IS_ENABLED(CONFIG_PM_DEVICE)
|
#elif IS_ENABLED(CONFIG_PM_DEVICE)
|
||||||
|
if (pm_device_wakeup_is_capable(config->kscan)) {
|
||||||
|
pm_device_wakeup_enable(config->kscan, true);
|
||||||
|
}
|
||||||
pm_device_action_run(config->kscan, PM_DEVICE_ACTION_RESUME);
|
pm_device_action_run(config->kscan, PM_DEVICE_ACTION_RESUME);
|
||||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
||||||
|
|
||||||
|
|
@ -132,6 +135,10 @@ static int ksbb_disable(const struct device *dev) {
|
||||||
pm_device_runtime_put(config->kscan);
|
pm_device_runtime_put(config->kscan);
|
||||||
}
|
}
|
||||||
#elif IS_ENABLED(CONFIG_PM_DEVICE)
|
#elif IS_ENABLED(CONFIG_PM_DEVICE)
|
||||||
|
if (pm_device_wakeup_is_capable(config->kscan) && !pm_device_wakeup_is_enabled(dev) &&
|
||||||
|
pm_device_wakeup_is_enabled(config->kscan)) {
|
||||||
|
pm_device_wakeup_enable(config->kscan, false);
|
||||||
|
}
|
||||||
pm_device_action_run(config->kscan, PM_DEVICE_ACTION_SUSPEND);
|
pm_device_action_run(config->kscan, PM_DEVICE_ACTION_SUSPEND);
|
||||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -393,10 +393,9 @@ static int zmk_physical_layouts_init(void) {
|
||||||
#if IS_ENABLED(CONFIG_PM_DEVICE)
|
#if IS_ENABLED(CONFIG_PM_DEVICE)
|
||||||
for (int l = 0; l < ARRAY_SIZE(layouts); l++) {
|
for (int l = 0; l < ARRAY_SIZE(layouts); l++) {
|
||||||
const struct zmk_physical_layout *pl = layouts[l];
|
const struct zmk_physical_layout *pl = layouts[l];
|
||||||
if (pl->kscan) {
|
if (pl->kscan && pm_device_wakeup_is_capable(pl->kscan) &&
|
||||||
if (pm_device_wakeup_is_capable(pl->kscan)) {
|
!pm_device_wakeup_enable(pl->kscan, true)) {
|
||||||
pm_device_wakeup_enable(pl->kscan, true);
|
LOG_WRN("Failed to wakeup enable %s", pl->kscan->name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
#endif // IS_ENABLED(CONFIG_PM_DEVICE)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue