summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Repinski <repinski23@gmail.com>2016-09-25 14:45:00 -0500
committerAndreas Blaesius <skate4life@gmx.de>2017-02-06 21:32:51 +0000
commit398b4a0150ce4e183f2f7d4234fcc1847f7529f6 (patch)
treed2f197927c4302b0ef821f360683cc9f8ec57f39
parent8d973f30c67070cab51ccb7387e71d6e6dddfaac (diff)
downloadhardware_ti_omap4-398b4a0150ce4e183f2f7d4234fcc1847f7529f6.zip
hardware_ti_omap4-398b4a0150ce4e183f2f7d4234fcc1847f7529f6.tar.gz
hardware_ti_omap4-398b4a0150ce4e183f2f7d4234fcc1847f7529f6.tar.bz2
libpower: Add optional support for API 0.3
Change-Id: I3b401e237ceb0dde1ff038fdd58a020aec1b3134
-rw-r--r--libpower/Android.mk6
-rw-r--r--libpower/power.c33
2 files changed, 38 insertions, 1 deletions
diff --git a/libpower/Android.mk b/libpower/Android.mk
index c6fb0f7..8f5955c 100644
--- a/libpower/Android.mk
+++ b/libpower/Android.mk
@@ -24,6 +24,10 @@ LOCAL_SRC_FILES := power.c
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Wall -Werror
+LOCAL_CFLAGS := -Wall -Werror $(ANDROID_API_CFLAGS)
+
+ifneq ($(BOARD_DOUBLE_TAP_TO_WAKE_PATH),)
+LOCAL_CFLAGS += -DDOUBLE_TAP_TO_WAKE_PATH=$(BOARD_DOUBLE_TAP_TO_WAKE_PATH)
+endif
include $(BUILD_SHARED_LIBRARY)
diff --git a/libpower/power.c b/libpower/power.c
index bb481e7..6aa2cc2 100644
--- a/libpower/power.c
+++ b/libpower/power.c
@@ -213,6 +213,32 @@ static void omap_power_hint(struct power_module *module,
}
}
+#ifdef ANDROID_API_LP_MR1_OR_LATER
+static void omap_set_feature(struct power_module *module,
+ feature_t feature, int state)
+{
+ struct omap_power_module *omap_device =
+ (struct omap_power_module *) module;
+
+ if (!omap_device->inited)
+ return;
+
+ switch (feature) {
+ case POWER_FEATURE_DOUBLE_TAP_TO_WAKE:
+#ifdef DOUBLE_TAP_TO_WAKE_PATH
+ sysfs_write(DOUBLE_TAP_TO_WAKE_PATH, (state ? "1" : "0"));
+#else
+ /* Silly code to avoid issue of "state" being otherwised unused */
+ if (state)
+ return;
+#endif
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
static struct hw_module_methods_t power_module_methods = {
.open = NULL,
};
@@ -221,7 +247,11 @@ struct omap_power_module HAL_MODULE_INFO_SYM = {
.base = {
.common = {
.tag = HARDWARE_MODULE_TAG,
+#ifdef ANDROID_API_LP_MR1_OR_LATER
+ .module_api_version = POWER_MODULE_API_VERSION_0_3,
+#else
.module_api_version = POWER_MODULE_API_VERSION_0_2,
+#endif
.hal_api_version = HARDWARE_HAL_API_VERSION,
.id = POWER_HARDWARE_MODULE_ID,
.name = "OMAP Power HAL",
@@ -232,6 +262,9 @@ struct omap_power_module HAL_MODULE_INFO_SYM = {
.init = omap_power_init,
.setInteractive = omap_power_set_interactive,
.powerHint = omap_power_hint,
+#ifdef ANDROID_API_LP_MR1_OR_LATER
+ .setFeature = omap_set_feature,
+#endif
},
.lock = PTHREAD_MUTEX_INITIALIZER,