summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-07-23 17:15:28 +0100
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-08-09 15:10:39 +0100
commite55671dae4539fc23a7f7cfdb93e2ed02efa2651 (patch)
tree7c399fba406ef2ebb3a3e33b98861a15a4e6522d
parent8902da1f3270ef4e56d58acb431e76aa94df4dff (diff)
Initial support for the hardware tunables framework
-rw-r--r--BoardConfig.mk2
-rw-r--r--cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java44
-rw-r--r--cmhw/org/cyanogenmod/hardware/VibratorHW.java47
-rw-r--r--init.geehrc.rc10
-rw-r--r--sepolicy/file_contexts4
5 files changed, 107 insertions, 0 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk
index ce7ce3d..a37f012 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -149,3 +149,5 @@ BOARD_SEPOLICY_UNION += \
thermald.te \
ueventd.te \
wpa_supplicant.te
+
+BOARD_HARDWARE_CLASS := device/lge/e975/cmhw/
diff --git a/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java b/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java
new file mode 100644
index 0000000..f933f3d
--- /dev/null
+++ b/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package org.cyanogenmod.hardware;
+
+import org.cyanogenmod.hardware.util.FileUtils;
+
+public class DisplayColorCalibration {
+ private static final String COLOR_FILE = "/sys/devices/platform/kcal_ctrl.0/kcal";
+ private static final String COLOR_FILE_CTRL = "/sys/devices/platform/kcal_ctrl.0/kcal_ctrl";
+
+ public static boolean isSupported() {
+ return true;
+ }
+
+ public static int getMaxValue() {
+ return 255;
+ }
+ public static int getMinValue() {
+ return 0;
+ }
+ public static String getCurColors() {
+ return FileUtils.readOneLine(COLOR_FILE);
+ }
+ public static boolean setColors(String colors) {
+ if (!FileUtils.writeLine(COLOR_FILE, colors)) {
+ return false;
+ }
+ return FileUtils.writeLine(COLOR_FILE_CTRL, "1");
+ }
+}
diff --git a/cmhw/org/cyanogenmod/hardware/VibratorHW.java b/cmhw/org/cyanogenmod/hardware/VibratorHW.java
new file mode 100644
index 0000000..bd605c8
--- /dev/null
+++ b/cmhw/org/cyanogenmod/hardware/VibratorHW.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package org.cyanogenmod.hardware;
+
+import org.cyanogenmod.hardware.util.FileUtils;
+
+public class VibratorHW {
+
+ private static String AMP_PATH = "/sys/class/timed_output/vibrator/amp";
+
+ public static boolean isSupported() {
+ return true;
+ }
+
+ public static int getMaxIntensity() {
+ return 100;
+ }
+ public static int getMinIntensity() {
+ return 50;
+ }
+ public static int getWarningThreshold() {
+ return -1;
+ }
+ public static int getCurIntensity() {
+ return Integer.parseInt(FileUtils.readOneLine(AMP_PATH));
+ }
+ public static int getDefaultIntensity() {
+ return 70;
+ }
+ public static boolean setIntensity(int intensity) {
+ return FileUtils.writeLine(AMP_PATH, String.valueOf(intensity));
+ }
+}
diff --git a/init.geehrc.rc b/init.geehrc.rc
index 5a089e6..46a939e 100644
--- a/init.geehrc.rc
+++ b/init.geehrc.rc
@@ -257,6 +257,16 @@ on post-fs-data
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 384000
write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 384000
+ chown root system /sys/class/timed_output/vibrator/amp
+ chown root system /sys/devices/platform/kcal_ctrl.0/kcal
+ chown root system /sys/devices/platform/kcal_ctrl.0/kcal_ctrl
+ chmod 0664 /sys/class/timed_output/vibrator/amp
+ chmod 0664 /sys/devices/platform/kcal_ctrl.0/kcal
+ chmod 0664 /sys/devices/platform/kcal_ctrl.0/kcal_ctrl
+ restorecon /sys/class/timed_output/vibrator/amp
+ restorecon /sys/devices/platform/kcal_ctrl.0/kcal
+ restorecon /sys/devices/platform/kcal_ctrl.0/kcal_ctrl
+
on charger
# Enable Power modes and set the CPU Freq Sampling rates
write /sys/module/rpm_resources/enable_low_power/L2_cache 1
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index e839206..c824e78 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -104,3 +104,7 @@
/sns(/.*)? u:object_r:persist_sensors_file:s0
/persist/playready(/.*)? u:object_r:persist_drm_file:s0
/persist/widevine(/.*)? u:object_r:persist_drm_file:s0
+
+# Hardware tunables
+/sys/class/timed_output/vibrator/amp u:object_r:sysfs_writable:s0
+/sys/devices/platform/kcal_ctrl.0(/.*)? -- u:object_r:sysfs_writable:s0