Add I2C runtime PM tunables
Daniel Leung
PATCH v2 1/1 Add I2C runtime PM tunables
Adds I2C adapters and devices into "Tunables" tab
for runtime PM.
v2: removed unused variables
Signed-off-by Daniel Leung <daniel.leung(a)linux.intel.com>
--- Android.mk | 1 + src/Makefile.am | 2 + src/devices/runtime_pm.cpp | 12 +++-- src/tuning/tuning.cpp | 2 + src/tuning/tuningi2c.cpp | 128 +++++++++++++++++++++++++++++++++++++++++++++ src/tuning/tuningi2c.h | 45 ++++++++++++++++ 6 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 src/tuning/tuningi2c.cpp create mode 100644 src/tuning/tuningi2c.h
Android.mk +1 -0
@@ -42,6 +42,7 @@ LOCAL_SRC_FILES += \ src/report.cpp \ src/main.cpp \ src/tuning/tuning.cpp \ + src/tuning/tuningi2c.cpp \ src/tuning/usb.cpp \ src/tuning/bluetooth.cpp \ src/tuning/ethernet.cpp \
src/Makefile.am +2 -0
@@ -118,6 +118,8 @@ powertop_SOURCES = \ tuning/tuningsysfs.h \ tuning/tuningusb.cpp \ tuning/tuningusb.h \ + tuning/tuningi2c.cpp \ + tuning/tuningi2c.h \ tuning/wifi.cpp \ tuning/wifi.h
src/devices/runtime_pm.cpp +9 -3
@@ -196,16 +196,22 @@ static void do_bus(const char *bus) dev = new class runtime_pmdevice(entry->d_name, filename); if (strcmp(bus, "i2c") == 0) { - char devname[4096]; + string devname; char dev_name[4096]; + bool is_adapter = false; + + sprintf(filename, "/sys/bus/%s/devices/%s/new_device", bus, entry->d_name); + if (access(filename, W_OK) == 0) + is_adapter = true; + sprintf(filename, "/sys/bus/%s/devices/%s/name", bus, entry->d_name); file.open(filename, ios::in); if (file) { - file >> devname; + getline(file, devname); file.close(); } - sprintf(dev_name, _("I2C Device: %s"), devname); + sprintf(dev_name, _("I2C %s (%s): %s"), (is_adapter ? _("Adapter") : _("Device")), entry->d_name, devname.c_str()); dev->set_human_name(dev_name); }
src/tuning/tuning.cpp +2 -0
@@ -31,6 +31,7 @@ #include "tuning.h" +#include "tuningi2c.h" #include "tuningsysfs.h" #include "tuningusb.h" #include "runtime.h"
@@ -68,6 +69,7 @@ static void init_tuning(void) add_ethernet_tunable(); add_bt_tunable(); add_wifi_tunables(); + add_i2c_tunables(); sort_tunables(); }
src/tuning/tuningi2c.cpp new file +128 -0
128 lines not on this page · raw message
src/tuning/tuningi2c.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.8.3.2