diff options
author | Knox Chiou <knoxchiou@google.com> | 2022-05-30 13:36:27 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-07 17:28:21 +0000 |
commit | 9668a0f70a58be251d7741bcf7f589d9c88bf075 (patch) | |
tree | 11072b2ccc0da4533c6fcf53d2e3891d784f796d | |
parent | 61957c9a7309b651aa22d7a1ebbae3529a0a7f83 (diff) | |
download | chrome-ec-9668a0f70a58be251d7741bcf7f589d9c88bf075.tar.gz |
mkbp_info: Provide run time check volume buttons function
Define a volume button override function for board specific usage,
so the devices whom share the firmware could config volume buttons
by run time.
BUG=b:234175434
BRANCH=trogdor
TEST=emerge-trogdor chromeos-ec & ectool mkbpget buttons on lazor.
Signed-off-by: Knox Chiou <knoxchiou@google.com>
Change-Id: I18cd25c25183f8149650ed2302a476242b2680e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3674845
Commit-Queue: Wai-Hong Tam <waihong@google.com>
Tested-by: Knox Chiou <knoxchiou@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
-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 */ |