summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Mok <kmok@cyngn.com>2015-11-13 09:46:14 -0800
committerRashed Abdel-Tawab <rashed@linux.com>2017-11-03 14:19:32 -0700
commit72201a0b49f2577dec5fa31954b73ac7a2bc24f1 (patch)
treed8c0f44089a088cf8fab0c1e6df0dd3abe842d4d
parentcd8bfdcdb0aa2dbc96dd08e2c7adb882a1ca34ce (diff)
downloadandroid_hardware_qcom_power-staging/lineage-15.0.tar.gz
android_hardware_qcom_power-staging/lineage-15.0.tar.bz2
android_hardware_qcom_power-staging/lineage-15.0.zip
Refactor TARGET_TAP_TO_WAKE_NODEstaging/lineage-15.0
Add TARGET_POWER_SET_FEATURE_LIB, since other devices are not simply writing a 0/1 to a device node. TARGET_TAP_TO_WAKE_NODE is still valid and both TARGET_TAP_TO_WAKE_NODE and TARGET_POWER_SET_FEATURE_LIB are allowed to coexist. (Currently set_feature only has double tap to wake, but it may be extended in future) Change-Id: I5c6204fd38a6fbe48e8aac49843bfa047c4b6436
-rw-r--r--Android.mk4
-rw-r--r--power-feature.h24
-rw-r--r--power.c7
3 files changed, 35 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index 068c880..d78fb85 100644
--- a/Android.mk
+++ b/Android.mk
@@ -69,6 +69,10 @@ ifeq ($(call is-board-platform-in-list,msm8916), true)
LOCAL_SRC_FILES += power-8916.c
endif
+ifneq ($(TARGET_POWER_SET_FEATURE_LIB),)
+ LOCAL_STATIC_LIBRARIES += $(TARGET_POWER_SET_FEATURE_LIB)
+endif
+
ifeq ($(TARGET_USES_INTERACTION_BOOST),true)
LOCAL_CFLAGS += -DINTERACTION_BOOST
endif
diff --git a/power-feature.h b/power-feature.h
new file mode 100644
index 0000000..595e3dd
--- /dev/null
+++ b/power-feature.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _QCOM_POWER_FEATURE_H
+#define _QCOM_POWER_FEATURE_H
+
+#include <hardware/power.h>
+
+void set_device_specific_feature(struct power_module *module, feature_t feature, int state);
+
+#endif
diff --git a/power.c b/power.c
index 5bc29a0..6568ca5 100644
--- a/power.c
+++ b/power.c
@@ -47,6 +47,7 @@
#include "hint-data.h"
#include "performance.h"
#include "power-common.h"
+#include "power-feature.h"
static int saved_dcvs_cpu0_slack_max = -1;
static int saved_dcvs_cpu0_slack_min = -1;
@@ -453,6 +454,11 @@ void set_interactive(struct power_module *module, int on)
saved_interactive_mode = !!on;
}
+void __attribute__((weak)) set_device_specific_feature(struct power_module *module __unused,
+ feature_t feature __unused, int state __unused)
+{
+}
+
static void set_feature(struct power_module *module, feature_t feature, int state)
{
switch (feature) {
@@ -464,6 +470,7 @@ static void set_feature(struct power_module *module, feature_t feature, int stat
default:
break;
}
+ set_device_specific_feature(module, feature, state);
}
static int power_device_open(const hw_module_t* module, const char* name,