diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-11-05 16:48:58 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-11-12 11:24:58 +0000 |
commit | 09a66ace7eef4a88d168b7edfb1cb0546e48c34d (patch) | |
tree | 2e08eef22f7c38de848629854dc110e9abc722e9 /src/mainboard/google/deltaur/chromeos.c | |
parent | 4bcc275d717c5c2ab926bc1ee2cb7122f58928e2 (diff) |
google/deltaur,drallion,sarien: Refactor ChromeOS GPIOs
Low-level GPIOs should not depend on late cros_gpios that
should be guarded with CHROMEOS and implemented for the
purpose of ACPI \OIPG package generation.
Change-Id: Ibe708330504bc819e312eddaf5dfe4016cda21a1
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59004
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/mainboard/google/deltaur/chromeos.c')
-rw-r--r-- | src/mainboard/google/deltaur/chromeos.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/mainboard/google/deltaur/chromeos.c b/src/mainboard/google/deltaur/chromeos.c index 3d17a6cfb2..7083c802fb 100644 --- a/src/mainboard/google/deltaur/chromeos.c +++ b/src/mainboard/google/deltaur/chromeos.c @@ -33,24 +33,14 @@ void fill_lb_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); } -static int cros_get_gpio_value(int type) +int get_write_protect_state(void) { - const struct cros_gpio *cros_gpios; - size_t i, num_gpios = 0; - - cros_gpios = variant_cros_gpios(&num_gpios); + return gpio_get(GPIO_PCH_WP); +} - for (i = 0; i < num_gpios; i++) { - const struct cros_gpio *gpio = &cros_gpios[i]; - if (gpio->type == type) { - int state = gpio_get(gpio->gpio_num); - if (gpio->polarity == CROS_GPIO_ACTIVE_LOW) - return !state; - else - return state; - } - } - return 0; +static bool raw_get_recovery_mode_switch(void) +{ + return !gpio_get(GPIO_REC_MODE); } void mainboard_chromeos_acpi_generate(void) @@ -63,11 +53,6 @@ void mainboard_chromeos_acpi_generate(void) chromeos_acpi_gpio_generate(cros_gpios, num_gpios); } -int get_write_protect_state(void) -{ - return cros_get_gpio_value(CROS_GPIO_WP); -} - int get_recovery_mode_switch(void) { static enum rec_mode_state saved_rec_mode = REC_MODE_UNINITIALIZED; @@ -93,7 +78,7 @@ int get_recovery_mode_switch(void) state = REC_MODE_REQUESTED; /* Read state from the GPIO controlled by servo. */ - if (cros_get_gpio_value(CROS_GPIO_REC)) + if (raw_get_recovery_mode_switch()) state = REC_MODE_REQUESTED; /* Store the state in case this is called again in verstage. */ |