Read GPIO config from JSON instead of D-Bus

Read the GPIO information for the buttons from
/etc/default/obmc/gpio/gpio_defs.json instead of
from D-Bus, as the D-Bus location for these were a
legacy thing and are going away.

This requires that the GPIO pin name, like 'J1', is converted
to the GPIO number as used in /sys/class/gpio.

The libgpioplus utility will handle most of this for us, with the
exception of needing to look up the base offset in the
/sys/class/gpiochip*/base file, where the specific gpiochip*
directory is determined as following:

1) Find the 'label' file in a /sys/class/gpiochipX/ directory
   and check for it to match GPIO_BASE_LABEL_NAME, which is
   configurable at build time and defaults to the ASPEED BMC
   value.
2) Use the value in the 'base' file in that directory as the
   base offset.

If a platform doesn't need to use this base offset, it can be
turned off with the LOOKUP_GPIO_BASE dial.

Change-Id: I88d29529ffa8a6d13132ac9059b47f86344837ea
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
3 files changed
tree: 5f9e6549322b7955f868b28829924941b18f0eda
  1. inc/
  2. src/
  3. .clang-format
  4. CMakeLists.txt
  5. LICENSE
  6. MAINTAINERS
  7. settings.hpp.in