summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2017-08-24 23:10:53 +0200
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-04-16 09:20:27 +0000
commitd5b068339e08b61864c4bd2ec1a89dad4e0da2de (patch)
treea456b45df9e2af1e4c89b4b452f41a02a88a6cba
parent3970502067f625f41f96ae9d155270b0f50bfaba (diff)
downloadchrome-ec-d5b068339e08b61864c4bd2ec1a89dad4e0da2de.tar.gz
ec_features / coral: Allow disabling keyboard backlight feature
Allow reporting that keyboard backlight doesn't exist even when the code is compiled in. Useful if there are multiple device models that should share firmware. BUG=b:64705535 BRANCH=none TEST=none Change-Id: I700f87ab098f69c38dc538b66b720d70e23b278d Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/633926 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 09136dea764dbe482392c29b3c8d1763149df3e6) Reviewed-on: https://chromium-review.googlesource.com/989863 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Trybot-Ready: Joel Kitching <kitching@chromium.org>
-rw-r--r--board/coral/board.c24
-rw-r--r--board/coral/board.h1
-rw-r--r--common/ec_features.c14
-rw-r--r--include/board_config.h6
-rw-r--r--include/config.h6
5 files changed, 49 insertions, 2 deletions
diff --git a/board/coral/board.c b/board/coral/board.c
index 2179f57809..c87c504859 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -1133,3 +1133,27 @@ struct keyboard_scan_config keyscan_config = {
0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
},
};
+
+uint32_t board_override_feature_flags0(uint32_t flags0)
+{
+ uint32_t sku = system_get_sku_id();
+
+ /*
+ * We always compile in backlight support for coral, but only some
+ * models come with the hardware. Therefore, check if the current
+ * device is one of them and return the default value - with backlight
+ * here.
+ */
+ if (sku == 8)
+ return flags0;
+
+ // Report that there is no keyboard backlight
+ flags0 &= ~EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB);
+
+ return flags0;
+}
+
+uint32_t board_override_feature_flags1(uint32_t flags1)
+{
+ return flags1;
+}
diff --git a/board/coral/board.h b/board/coral/board.h
index 7397bb20ca..ab135e7007 100644
--- a/board/coral/board.h
+++ b/board/coral/board.h
@@ -151,6 +151,7 @@
#define CONFIG_WLAN_POWER_ACTIVE_LOW
#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
#define CONFIG_PWR_STATE_DISCHARGE_FULL
+#define CONFIG_EC_FEATURE_BOARD_OVERRIDE
/*
* During shutdown sequence TPS65094x PMIC turns off the sensor rails
diff --git a/common/ec_features.c b/common/ec_features.c
index 9a630e6f17..01d666a9dc 100644
--- a/common/ec_features.c
+++ b/common/ec_features.c
@@ -6,11 +6,13 @@
/* Present Chrome EC device features to the outside world */
#include "common.h"
+#include "config.h"
#include "ec_commands.h"
+#include "board_config.h"
uint32_t get_feature_flags0(void)
{
- return 0
+ uint32_t result = 0
#ifdef CONFIG_FW_LIMITED_IMAGE
| EC_FEATURE_MASK_0(EC_FEATURE_LIMITED)
#endif
@@ -106,9 +108,17 @@ uint32_t get_feature_flags0(void)
| EC_FEATURE_MASK_0(EC_FEATURE_DEVICE_EVENT)
#endif
;
+#ifdef CONFIG_EC_FEATURE_BOARD_OVERRIDE
+ result = board_override_feature_flags0(result);
+#endif
+ return result;
}
uint32_t get_feature_flags1(void)
{
- return 0;
+ uint32_t result = 0;
+#ifdef CONFIG_EC_FEATURE_BOARD_OVERRIDE
+ result = board_override_feature_flags1(result);
+#endif
+ return result;
}
diff --git a/include/board_config.h b/include/board_config.h
index 6742573bc2..485cf4f353 100644
--- a/include/board_config.h
+++ b/include/board_config.h
@@ -48,4 +48,10 @@ void board_config_post_gpio_init(void);
void board_before_rsmrst(int rsmrst);
#endif
+#ifdef CONFIG_EC_FEATURE_BOARD_OVERRIDE
+/* function for board specific overrides to default feature flags */
+uint32_t board_override_feature_flags0(uint32_t flags0);
+uint32_t board_override_feature_flags1(uint32_t flags1);
+#endif
+
#endif /* __CROS_EC_BOARD_CONFIG_H */
diff --git a/include/config.h b/include/config.h
index ccf4f2c84b..0395eb3b34 100644
--- a/include/config.h
+++ b/include/config.h
@@ -943,6 +943,12 @@
/* EC capable of sensor speeds up to 200000 mHz */
#define CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ 200000
+/*
+ * Allow board to override the feature bitmap provided through host command
+ * and ACPI.
+ */
+#undef CONFIG_EC_FEATURE_BOARD_OVERRIDE
+
/* Support EC chip internal data EEPROM */
#undef CONFIG_EEPROM