Revert "Fix CPU detection GPIO handling logic"
This reverts commit be73e6a4d11f6c9f6f6887918404901cd87386b8.
The new SGPIO driver has a critical bug so the driver will be replaced
with old version. This commit is for following up of the change.
Change-Id: Ia9cc430b6fd519e3565621c31e6905667d048945
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp
index 65f30e7..1c25655 100644
--- a/include/CPUSensor.hpp
+++ b/include/CPUSensor.hpp
@@ -59,9 +59,7 @@
return findIndex->second;
}
- // todo: need to change this number based setting to name based
constexpr size_t sgpioBase = 232;
- constexpr const char* labelSgpiochipIn = "1e780200.sgpio";
// check if sysfs has device
bool sysfs = std::filesystem::exists(gpioPath + std::string("gpio") +
@@ -82,8 +80,9 @@
}
}
- size_t index = gpioNum - sgpioBase;
- gpiod::chip chip(labelSgpiochipIn);
+ size_t chipNum = (gpioNum - sgpioBase) / 8;
+ size_t index = (gpioNum - sgpioBase) % 8;
+ gpiod::chip chip("gpiochip" + std::to_string(chipNum));
auto line = chip.get_line(index);
if (!line)