fix: Defer auto enabling of kscan sideband.
* Now that device init of kscan sideband is in POST_KERNEL stage, use a separate SYS_INIT for auto enabling the device so processing of early/initial presses from referenced toggle mode kscan devices occurs at the proper time during init.
This commit is contained in:
parent
cd25c12ce9
commit
fce1c38e62
1 changed files with 13 additions and 8 deletions
|
@ -161,16 +161,11 @@ static int ksbb_init(const struct device *dev) {
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config->auto_enable) {
|
#if IS_ENABLED(CONFIG_PM_DEVICE)
|
||||||
#if !IS_ENABLED(CONFIG_PM_DEVICE)
|
if (!config->auto_enable) {
|
||||||
kscan_config(config->kscan, &ksbb_inner_kscan_callback);
|
|
||||||
kscan_enable_callback(config->kscan);
|
|
||||||
#else
|
|
||||||
ksbb_pm_action(dev, PM_DEVICE_ACTION_RESUME);
|
|
||||||
} else {
|
|
||||||
pm_device_init_suspended(dev);
|
pm_device_init_suspended(dev);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -188,6 +183,16 @@ static const struct kscan_driver_api ksbb_api = {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KSBB_INST(n) \
|
#define KSBB_INST(n) \
|
||||||
|
COND_CODE_1(DT_INST_PROP_OR(n, auto_enable, false), (static int ksbb_auto_enable_##n(void) { \
|
||||||
|
const struct device *dev = DEVICE_DT_GET(DT_DRV_INST(n)); \
|
||||||
|
COND_CODE_1(IS_ENABLED(CONFIG_PM_DEVICE), \
|
||||||
|
(ksbb_pm_action(dev, PM_DEVICE_ACTION_RESUME);), \
|
||||||
|
(const struct ksbb_config *config = dev->config; \
|
||||||
|
kscan_config(config->kscan, &ksbb_inner_kscan_callback); \
|
||||||
|
kscan_enable_callback(config->kscan);)) \
|
||||||
|
return 0; \
|
||||||
|
} SYS_INIT(ksbb_auto_enable_##n, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);), \
|
||||||
|
()) \
|
||||||
static struct ksbb_entry entries_##n[] = { \
|
static struct ksbb_entry entries_##n[] = { \
|
||||||
DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP(n, ENTRY, (, ))}; \
|
DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP(n, ENTRY, (, ))}; \
|
||||||
const struct ksbb_config ksbb_config_##n = { \
|
const struct ksbb_config ksbb_config_##n = { \
|
||||||
|
|
Loading…
Add table
Reference in a new issue