summaryrefslogtreecommitdiffstats
path: root/libpower/power.c
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 /libpower/power.c
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
Diffstat (limited to 'libpower/power.c')
-rw-r--r--libpower/power.c33
1 files changed, 33 insertions, 0 deletions
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,