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>
This commit is contained in:
Patrick Georgi
2017-08-24 23:10:53 +02:00
committed by chrome-bot
parent f1dfc4cbac
commit 09136dea76
5 changed files with 49 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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