Use gpioplus for specifying gpio gating

A GPIO can control whether a hwmon sensor is readable.  This module
allows one to specify whether a sensor is gated and by what GPIO.  This
is often the case for battery voltages, such that the battery isn't
drained constantly by being left open.

For each sensor where you need GPIO locking:
GPIOCHIP_in1=0
GPIO_in1=53

such that GPIOCHIP is the gpiochip: /sys/bus/gpio/devices/gpiochip{id}
such that GPIO is the line offset.
the value used to unlock the sensor via gpio is 1
after 1 is written to the gpio, it pauses for 500ms

Tested: Verified the failure case for invalid gpio fields.  Verified
correct behavior on two platforms.
Change-Id: I2fa12848972075cad0e0f69c0bfa6382e15d4f50
Signed-off-by: Patrick Venture <venture@google.com>
7 files changed
tree: 7c3619d61d1f662bd29389fe34d3e3ba984af0e6
  1. msl/
  2. test/
  3. tools/
  4. .clang-format
  5. .gitignore
  6. argument.cpp
  7. argument.hpp
  8. bootstrap.sh
  9. configure.ac
  10. env.cpp
  11. env.hpp
  12. fan_pwm.cpp
  13. fan_pwm.hpp
  14. fan_speed.cpp
  15. fan_speed.hpp
  16. gpio_handle.cpp
  17. gpio_handle.hpp
  18. hwmon.cpp
  19. hwmon.hpp
  20. hwmonio.cpp
  21. hwmonio.hpp
  22. interface.hpp
  23. LICENSE
  24. mainloop.cpp
  25. mainloop.hpp
  26. MAINTAINERS
  27. Makefile.am
  28. readd.cpp
  29. README.iio.md
  30. README.md
  31. sensor.cpp
  32. sensor.hpp
  33. sensorset.cpp
  34. sensorset.hpp
  35. sysfs.cpp
  36. sysfs.hpp
  37. targets.hpp
  38. thresholds.hpp
  39. timer.cpp
  40. timer.hpp
  41. types.hpp
  42. util.hpp
README.md

Exposes generic hwmon entries as DBus objects. More information can be found at Sensor Architecture

To Build

To build this package, do the following steps:

    1. ./bootstrap.sh
    2. ./configure ${CONFIGURE_FLAGS}
    3. make

To clean the repository run `./bootstrap.sh clean`.

D-Bus bus names

To enable the use of Linux features like cgroups prioritization and
udev/systemd control, one instance of phosphor-hwmon is intended to
be run per hwmon sysfs class instance.

This requires an algorithm for selecting a stable, well-known D-Bus busname.

The algorithm is <PREFIX>-<ID>.Hwmon<N> where PREFIX is an autoconf
configurable prefix (BUSNAME_PREFIX, xyz.openbmc_project by default),
ID is a std::hash of the /sys/devices path backing the hwmon class
instance, and N is the implemented phosphor-hwmon D-Bus API version.