summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2017-08-24 23:10:53 +0200
committerchrome-bot <chrome-bot@chromium.org>2017-08-30 03:58:28 -0700
commit09136dea764dbe482392c29b3c8d1763149df3e6 (patch)
treeb6cff30ac999c763082c285f6bd3ef7ef0016c5d
parentf1dfc4cbac2140f51f4a40fec790755ca7d4fafe (diff)
downloadchrome-ec-09136dea764dbe482392c29b3c8d1763149df3e6.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: I9c1fc370aedf66ef856a571f73831095d27e3d39 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>
-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 6c1768ce6e..a1ebd18e7b 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -1170,3 +1170,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 f0f0f47801..6dccddb61b 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 f408db8cd6..f3f42ea795 100644
--- a/include/board_config.h
+++ b/include/board_config.h
@@ -61,4 +61,10 @@ void board_before_rsmrst(int rsmrst);
*/
void chip_pre_init(void);
+#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 6d7c8439d3..270783ef48 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1010,6 +1010,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