input: kbd: add power management support to all keyboard scan drivers
Add power management support to various drivers: - gpio-kbd-matrix - ite,it8xxx2-kbd - nuvoton,npcx-kbd - microchip,xec-kbd Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
committed by
Anas Nashif
parent
eff584bf2d
commit
947ff45e7a
@@ -330,7 +330,9 @@ static const struct input_kbd_matrix_api gpio_kbd_matrix_api = {
|
||||
\
|
||||
static struct gpio_kbd_matrix_data gpio_kbd_matrix_data_##n; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, gpio_kbd_matrix_init, NULL, \
|
||||
PM_DEVICE_DT_INST_DEFINE(n, input_kbd_matrix_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, gpio_kbd_matrix_init, PM_DEVICE_DT_INST_GET(n), \
|
||||
&gpio_kbd_matrix_data_##n, &gpio_kbd_matrix_cfg_##n, \
|
||||
POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \
|
||||
NULL);
|
||||
|
||||
@@ -252,10 +252,16 @@ static const struct it8xxx2_kbd_config it8xxx2_kbd_cfg_0 = {
|
||||
|
||||
static struct it8xxx2_kbd_data it8xxx2_kbd_data_0;
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, &it8xxx2_kbd_init, NULL,
|
||||
PM_DEVICE_DT_INST_DEFINE(0, input_kbd_matrix_pm_action);
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, &it8xxx2_kbd_init, PM_DEVICE_DT_INST_GET(0),
|
||||
&it8xxx2_kbd_data_0, &it8xxx2_kbd_cfg_0,
|
||||
POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL);
|
||||
|
||||
BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED) ||
|
||||
IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME),
|
||||
"CONFIG_PM_DEVICE_RUNTIME must be enabled when using CONFIG_PM_DEVICE_SYSTEM_MANAGED");
|
||||
|
||||
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
|
||||
"only one ite,it8xxx2-kbd compatible node can be supported");
|
||||
BUILD_ASSERT(IN_RANGE(DT_INST_PROP(0, row_size), 1, 8), "invalid row-size");
|
||||
|
||||
@@ -226,10 +226,16 @@ static const struct npcx_kbd_config npcx_kbd_cfg_0 = {
|
||||
|
||||
static struct npcx_kbd_data npcx_kbd_data_0;
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, npcx_kbd_init, NULL,
|
||||
PM_DEVICE_DT_INST_DEFINE(0, input_kbd_matrix_pm_action);
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, npcx_kbd_init, PM_DEVICE_DT_INST_GET(0),
|
||||
&npcx_kbd_data_0, &npcx_kbd_cfg_0,
|
||||
POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL);
|
||||
|
||||
BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED) ||
|
||||
IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME),
|
||||
"CONFIG_PM_DEVICE_RUNTIME must be enabled when using CONFIG_PM_DEVICE_SYSTEM_MANAGED");
|
||||
|
||||
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
|
||||
"only one nuvoton,npcx-kbd compatible node can be supported");
|
||||
BUILD_ASSERT(IN_RANGE(DT_INST_PROP(0, row_size), 1, 8), "invalid row-size");
|
||||
|
||||
@@ -143,6 +143,11 @@ static int xec_kbd_pm_action(const struct device *dev, enum pm_device_action act
|
||||
struct kscan_regs *regs = cfg->regs;
|
||||
int ret;
|
||||
|
||||
ret = input_kbd_matrix_pm_action(dev, action);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (cfg->wakeup_source) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user