power: Add double tap to wake support

Change-Id: Icb0b6d442544b39576ec74e70e97751d6bc70590
This commit is contained in:
Christopher N. Hesse 2016-06-22 23:04:39 +02:00
parent 66c10c2372
commit e480d89ce5
2 changed files with 22 additions and 1 deletions

View File

@ -24,6 +24,10 @@ LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_SRC_FILES := power.c LOCAL_SRC_FILES := power.c
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
ifneq ($(TARGET_TAP_TO_WAKE_NODE),)
LOCAL_CFLAGS := -DDT2W_PATH=\"$(TARGET_DT2W_PATH)\"
endif
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
endif endif

View File

@ -503,6 +503,22 @@ static int samsung_get_feature(struct power_module *module __unused,
return -1; return -1;
} }
static void samsung_set_feature(struct power_module *module, feature_t feature, int state)
{
struct samsung_power_module *samsung_pwr = (struct samsung_power_module *) module;
switch (feature) {
#ifdef DT2W_PATH
case POWER_FEATURE_DOUBLE_TAP_TO_WAKE:
ALOGV("%s: %s double tap to wake", __func__, state ? "enabling" : "disabling");
sysfs_write(DT2W_PATH, state > 0 ? "1" : "0");
break;
#endif
default:
break;
}
}
static struct hw_module_methods_t power_module_methods = { static struct hw_module_methods_t power_module_methods = {
.open = NULL, .open = NULL,
}; };
@ -522,7 +538,8 @@ struct samsung_power_module HAL_MODULE_INFO_SYM = {
.init = samsung_power_init, .init = samsung_power_init,
.setInteractive = samsung_power_set_interactive, .setInteractive = samsung_power_set_interactive,
.powerHint = samsung_power_hint, .powerHint = samsung_power_hint,
.getFeature = samsung_get_feature .getFeature = samsung_get_feature,
.setFeature = samsung_set_feature
}, },
.lock = PTHREAD_MUTEX_INITIALIZER, .lock = PTHREAD_MUTEX_INITIALIZER,