power: Add double tap to wake support

Change-Id: Icb0b6d442544b39576ec74e70e97751d6bc70590
tirimbino
Christopher N. Hesse 9 years ago
parent 66c10c2372
commit e480d89ce5
  1. 4
      power/Android.mk
  2. 19
      power/power.c

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

@ -503,6 +503,22 @@ static int samsung_get_feature(struct power_module *module __unused,
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 = {
.open = NULL,
};
@ -522,7 +538,8 @@ struct samsung_power_module HAL_MODULE_INFO_SYM = {
.init = samsung_power_init,
.setInteractive = samsung_power_set_interactive,
.powerHint = samsung_power_hint,
.getFeature = samsung_get_feature
.getFeature = samsung_get_feature,
.setFeature = samsung_set_feature
},
.lock = PTHREAD_MUTEX_INITIALIZER,

Loading…
Cancel
Save