mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-20 04:55:20 -05:00
fix: allow kscan-composite to wake up device. (#2682)
* include kscan.yaml so we can set kscan-composite as a wakeup source * modify enable and disable callback to check for wakeup capabilities of composite and children * disable children wakeup source The disable function is only called when the composite is not an enabled wakeup source. In that case the children should also not be an enabled wakeup source, so they can get suspended
This commit is contained in:
@@ -44,6 +44,13 @@ static int kscan_composite_enable_callback(const struct device *dev) {
|
||||
for (int i = 0; i < cfg->children_len; i++) {
|
||||
const struct kscan_composite_child_config *child_cfg = &cfg->children[i];
|
||||
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
if (pm_device_wakeup_is_enabled(dev) && pm_device_wakeup_is_capable(child_cfg->child) &&
|
||||
!pm_device_wakeup_enable(child_cfg->child, true)) {
|
||||
LOG_ERR("Failed to enable wakeup for %s", child_cfg->child->name);
|
||||
}
|
||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)
|
||||
if (!pm_device_runtime_is_enabled(dev) && pm_device_runtime_is_enabled(child_cfg->child)) {
|
||||
pm_device_runtime_get(child_cfg->child);
|
||||
@@ -62,6 +69,14 @@ static int kscan_composite_disable_callback(const struct device *dev) {
|
||||
for (int i = 0; i < cfg->children_len; i++) {
|
||||
const struct kscan_composite_child_config *child_cfg = &cfg->children[i];
|
||||
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
if (pm_device_wakeup_is_capable(child_cfg->child) &&
|
||||
pm_device_wakeup_is_enabled(child_cfg->child) &&
|
||||
!pm_device_wakeup_enable(child_cfg->child, false)) {
|
||||
LOG_ERR("Failed to disable wakeup for %s", child_cfg->child->name);
|
||||
}
|
||||
#endif // IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || IS_ENABLED(CONFIG_PM_DEVICE)
|
||||
|
||||
kscan_disable_callback(child_cfg->child);
|
||||
|
||||
#if IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)
|
||||
|
||||
Reference in New Issue
Block a user