summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2019-01-31 09:08:01 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-04 12:42:20 -0800
commit332b74e1818aa7811feb3534bdea2887c2f86aa4 (patch)
tree5b889b749295f8985d738fa9c0140e0ce8e29c7e
parenta22ce61eda75ec3a394e32f5c1eff27f1b2ff224 (diff)
downloadvboot-332b74e1818aa7811feb3534bdea2887c2f86aa4.tar.gz
crossystem: support recoverysw_cur with new gpiod API
We've dropped the chromeos_arm driver on recent kernels. Now, if you name the GPIO as RECOVERY_SW_L (e.g., in the Device Tree), crossystem can pick it up directly. BRANCH=none BUG=chromium:897992, b:116761006 TEST=crossystem recoverysw_cur on ARM with 4.14+ (without chromeos_arm driver) Change-Id: I20fb1aa310268a60070bd6c8914c4d58e5760cf8 Reviewed-on: https://chromium-review.googlesource.com/1448395 Commit-Ready: Brian Norris <briannorris@chromium.org> Tested-by: SANTHOSH JANARDHANA HASSAN <sahassan@google.com> Tested-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
-rw-r--r--host/arch/arm/lib/crossystem_arch.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c
index 2702f8ef..539d765b 100644
--- a/host/arch/arm/lib/crossystem_arch.c
+++ b/host/arch/arm/lib/crossystem_arch.c
@@ -34,7 +34,8 @@
#define FDT_COMPATIBLE_PATH "/proc/device-tree/compatible"
/* Path to the chromeos_arm platform device (deprecated) */
#define PLATFORM_DEV_PATH "/sys/devices/platform/chromeos_arm"
-/* This should match the Linux GPIO name (i.e., 'gpio-line-names'). */
+/* These should match the Linux GPIO name (i.e., 'gpio-line-names'). */
+#define GPIO_NAME_RECOVERY_SW_L "RECOVERY_SW_L"
#define GPIO_NAME_WP_L "AP_FLASH_WP_L"
/* Device for NVCTX write */
#define NVCTX_PATH "/dev/mmcblk%d"
@@ -547,6 +548,11 @@ int VbGetArchPropertyInt(const char* name)
return VbGetVarGpio("developer-switch");
} else if (!strcasecmp(name, "recoverysw_cur")) {
int value;
+ /* Try GPIO chardev API first. */
+ value = gpiod_read(GPIO_NAME_RECOVERY_SW_L, true);
+ if (value != -1)
+ return value;
+ /* Try the deprecated chromeos_arm platform device next. */
value = VbGetPlatformGpioStatus("recovery");
if (value != -1)
return value;