crossystem: replace 'chromeos_arm' device with new GPIO chardev API

Upstream Linux supports a new ioctl API for GPIO chips, via new
/dev/gpiochip* device nodes. This new API supports name lookups, which
is a much nicer way than the index-based stuff in /sys/class/gpio/. We
can finally use this instead of our custom, downstream "chromeos_arm"
driver.

GPIO line names are defined in a 'gpio-line-names' property in the
Device Tree. For now, we have exactly one board using this, and we're
calling it 'AP_FLASH_WP_L'. We will need to ensure future devices use
this same naming.

Per others' suggestions, I'm avoiding using libgpiod, because it's a
relatively new library (with breaking changes in v1.0 as recently as
this year), and vboot_reference is used by plenty of other projects. And
it wasn't that hard to hand-roll the ioctls.

Side note: the chromeos_arm device is not guaranteed to be found at
/sys/devices/platform/chromeos_arm any more (especially on kernel
>=4.14), so this is a handy excuse to just kill use of the driver
entirely.

BRANCH=none
BUG=chromium:897992
TEST=`crossystem wpsw_cur` on 4.14 kernels (with this API) and older
     kernels (without this API)

Change-Id: I7553801fb0e97c8a0aa6f4341d297ad0071c3dac
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1298274
Reviewed-by: Douglas Anderson <dianders@chromium.org>
1 file changed