diff options
-rw-r--r-- | common/mkbp_info.c | 16 | ||||
-rw-r--r-- | include/mkbp_info.h | 22 |
2 files changed, 35 insertions, 3 deletions
diff --git a/common/mkbp_info.c b/common/mkbp_info.c index b3835367cf..52d26f407b 100644 --- a/common/mkbp_info.c +++ b/common/mkbp_info.c @@ -12,16 +12,26 @@ #include "keyboard_config.h" #include "keyboard_mkbp.h" #include "keyboard_scan.h" +#include "mkbp_info.h" #include "mkbp_input_devices.h" #include "util.h" +__overridable int mkbp_support_volume_buttons(void) +{ +#ifdef CONFIG_VOLUME_BUTTONS + return 1; +#else + return 0; +#endif +} + static uint32_t get_supported_buttons(void) { uint32_t val = 0; -#ifdef CONFIG_VOLUME_BUTTONS - val |= BIT(EC_MKBP_VOL_UP) | BIT(EC_MKBP_VOL_DOWN); -#endif /* defined(CONFIG_VOLUME_BUTTONS) */ + if (mkbp_support_volume_buttons()) { + val |= BIT(EC_MKBP_VOL_UP) | BIT(EC_MKBP_VOL_DOWN); + } #ifdef CONFIG_DEDICATED_RECOVERY_BUTTON val |= BIT(EC_MKBP_RECOVERY); diff --git a/include/mkbp_info.h b/include/mkbp_info.h new file mode 100644 index 0000000000..64daa52dce --- /dev/null +++ b/include/mkbp_info.h @@ -0,0 +1,22 @@ +/* Copyright 2022 The ChromiumOS Authors. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* MKBP info host command for Chrome EC */ + +#ifndef __CROS_EC_MKBP_INFO_H +#define __CROS_EC_MKBP_INFO_H + +/** + * Board specific function to set support volume buttons. + * + * Although we're able to define CONFIG_VOLUME_BUTTONS for ec volume buttons, + * some boards might need to configure this settings at run time by several + * cases such as sharing the firmware with different designs. + * + * @return 1 if volume buttons supported else 0 + */ +__override_proto int mkbp_support_volume_buttons(void); + +#endif /* __CROS_EC_MKBP_INFO_H */ |