summaryrefslogtreecommitdiff
path: root/src/mainboard/google/gru/chromeos.c
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-04-07 00:37:14 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-04-11 11:23:26 +0000
commitae0fb762a2b0592a9734120bd14e0b7a98af9d31 (patch)
tree48bff02725b52be3e38e4adb7584ab204c0d7020 /src/mainboard/google/gru/chromeos.c
parent482eec0e1bb43aee59cdbb4ec39068fecbcc012b (diff)
downloadcoreboot-ae0fb762a2b0592a9734120bd14e0b7a98af9d31.tar.xz
chromeos: clean up "recovery" and "write protect" GPIOs
The "write protect" GPIO's cached value is never actually read after entering depthcharge. Ensure the value from get_write_protect_state() is being transferred accurately, so that we may read this GPIO value in depthcharge without resampling. The cached value of the "recovery" GPIO is read only on certain boards which have a physical recovery switch. Correct some of the values sent to boards which presumably never read the previously incorrect value. Most of these inaccuracies are from non-inverted values on ACTIVE_LOW GPIOs. BUG=b:124141368, b:124192753, chromium:950273 TEST=make clean && make test-abuild BRANCH=none Change-Id: Ic17a98768703d7098480a9233b752fe5b201bd51 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32233 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/mainboard/google/gru/chromeos.c')
-rw-r--r--src/mainboard/google/gru/chromeos.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mainboard/google/gru/chromeos.c b/src/mainboard/google/gru/chromeos.c
index a856e45089..53d00fb188 100644
--- a/src/mainboard/google/gru/chromeos.c
+++ b/src/mainboard/google/gru/chromeos.c
@@ -26,15 +26,14 @@ static const uint32_t wp_polarity = CONFIG(GRU_BASEBOARD_SCARLET) ?
int get_write_protect_state(void)
{
- int raw = gpio_get(GPIO_WP);
- return wp_polarity == ACTIVE_HIGH ? raw : !raw;
+ return gpio_get(GPIO_WP) ^ !wp_polarity;
}
void fill_lb_gpios(struct lb_gpios *gpios)
{
struct lb_gpio chromeos_gpios[] = {
- {GPIO_WP.raw, wp_polarity, gpio_get(GPIO_WP),
- "write protect"},
+ {GPIO_WP.raw, wp_polarity,
+ get_write_protect_state() ^ !wp_polarity, "write protect"},
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
#if CONFIG(GRU_BASEBOARD_SCARLET)
{GPIO_BACKLIGHT.raw, ACTIVE_HIGH, -1, "backlight"},