gta4xl-common: build samsung-libperfmgr power hal

Change-Id: I86ffb3634654ce8a1cbf9a5231dd909cf18c2e62
diff --git a/config/power/README.md b/config/power/README.md
new file mode 100644
index 0000000..3b72a5f
--- /dev/null
+++ b/config/power/README.md
@@ -0,0 +1,55 @@
+# Scaling Available Frequencies (Exynos9611)
+
+See https://www.kernel.org/doc/Documentation/power/pm_qos_interface.txt
+
+> Alternatively the user mode program could write a hex
+> string for the value using 10 char long format e.g. "0x12345678".
+
+## CPU Little Cluster (CPU0)
+
+               0x12345678
+
+    1742000 -> 0x001a94b0
+    1586000 -> 0x00183350
+    1456000 -> 0x00163780
+    1300000 -> 0x0013d620
+    1157000 -> 0x0011a788
+    1053000 -> 0x00101148
+     949000 -> 0x000e7b08
+     806000 -> 0x000c4c70
+     650000 -> 0x0009eb10
+     546000 -> 0x000854d0
+     442000 -> 0x0006be90
+
+## CPU Big Cluster (CPU4)
+
+    2314000 -> 0x00234f10
+    2210000 -> 0x0021b8d0
+    2106000 -> 0x00202290
+    2002000 -> 0x001e8c50
+    1898000 -> 0x001cf610
+    1794000 -> 0x001b5fd0
+    1690000 -> 0x0019c990
+    1586000 -> 0x00183350
+    1508000 -> 0x001702a0
+    1404000 -> 0x00156c60
+    1222000 -> 0x0012a570
+    1066000 -> 0x00104410
+     962000 -> 0x000eadd0
+     845000 -> 0x000ce4c8
+     754000 -> 0x000b8150
+     650000 -> 0x0009eb10
+     507000 -> 0x0007bc78
+
+## GPU Scaling
+
+    1053000 -> 0x00101148
+     949000 -> 0x000e7b08
+     839000 -> 0x000ccd58
+     764000 -> 0x000ba860
+     683000 -> 0x000a6bf8
+     572000 -> 0x0008ba60
+     546000 -> 0x000854d0
+     455000 -> 0x0006f158
+     338000 -> 0x00052850
+     260000 -> 0x0003f7a0
diff --git a/config/power/powerhint.json b/config/power/powerhint.json
new file mode 100644
index 0000000..c5d0f4f
--- /dev/null
+++ b/config/power/powerhint.json
@@ -0,0 +1,358 @@
+{
+    "Nodes": [
+        {
+            "Name": "CPULittleClusterMaxFreq",
+            "Path": "/dev/cluster0_freq_max",
+            "Values": [
+                "0x001a94b0",
+                "0x00183350",
+                "0x00163780",
+                "0x0013d620"
+            ],
+            "HoldFd": true,
+            "DefaultIndex": 0,
+            "ResetOnInit": true
+        },
+        {
+            "Name": "CPULittleClusterMinFreq",
+            "Path": "/dev/cluster0_freq_min",
+            "Values": [
+                "0x001a94b0",
+                "0x00183350",
+                "0x0013d620",
+                "0x0011a788",
+                "0x000c4c70",
+                "0x00000000"
+            ],
+            "HoldFd": true,
+            "ResetOnInit": true
+        },
+        {
+            "Name": "CPUBigClusterMaxFreq",
+            "Path": "/dev/cluster1_freq_max",
+            "Values": [
+                "0x00234f10",
+                "0x001cf610",
+                "0x00183350",
+                "0x00156c60",
+                "0x0012a570"
+            ],
+            "HoldFd": true,
+            "DefaultIndex": 0,
+            "ResetOnInit": true
+        },
+        {
+            "Name": "CPUBigClusterMinFreq",
+            "Path": "/dev/cluster1_freq_min",
+            "Values": [
+                "0x00234f10",
+                "0x00183350",
+                "0x00156c60",
+                "0x0012a570",
+                "0x000ce4c8",
+                "0x00000000"
+            ],
+            "HoldFd": true,
+            "ResetOnInit": true
+        },
+        {
+            "Name": "TASchedtuneBoost",
+            "Path": "/dev/stune/top-app/schedtune.boost",
+            "Values": [
+                "70",
+                "5"
+            ],
+            "ResetOnInit": true
+        },
+        {
+            "Name": "PMQoSCpuDmaLatency",
+            "Path": "/dev/cpu_dma_latency",
+            "Values": [
+                "0x0000002c",
+                "0x00000064"
+            ],
+            "HoldFd": true
+        },
+        {
+            "Name": "TouchscreenEnable",
+            "Path": "/sys/class/sec/tsp/input/enabled",
+            "Values": [
+                "0",
+                "1"
+            ],
+            "ResetOnInit": true
+        },
+        {
+            "Name": "LCDEnable",
+            "Path": "/sys/class/power_supply/battery/lcd",
+            "Values": [
+                "0",
+                "1"
+            ],
+            "ResetOnInit": true
+        },
+        {
+            "Name": "DoubleTapToWakeEnable",
+            "Path": "/sys/class/sec/tsp/cmd",
+            "Values": [
+                "aot_enable,0",
+                "aot_enable,1"
+            ],
+            "DefaultIndex": 0,
+            "ResetOnInit": false
+        },
+        {
+            "Name": "PowerHALMainState",
+            "Path": "vendor.powerhal.state",
+            "Values": [
+                "CAMERA_STREAMING",
+                "SUSTAINED_PERFORMANCE",
+                "VR_MODE",
+                "VR_SUSTAINED_PERFORMANCE",
+                ""
+            ],
+            "Type": "Property"
+        },
+        {
+            "Name": "PowerHALAudioState",
+            "Path": "vendor.powerhal.audio",
+            "Values": [
+                "AUDIO_LOW_LATENCY",
+                ""
+            ],
+            "Type": "Property"
+        },
+        {
+            "Name": "PowerHALRenderingState",
+            "Path": "vendor.powerhal.rendering",
+            "Values": [
+                "EXPENSIVE_RENDERING",
+                ""
+            ],
+            "Type": "Property"
+        },
+        {
+            "Name": "PowerHALPerfProfileState",
+            "Path": "vendor.powerhal.perf_profile",
+            "Values": [
+                "POWER_SAVE",
+                "BIAS_POWER_SAVE",
+                "BIAS_PERFORMANCE",
+                "HIGH_PERFORMANCE"
+            ],
+            "Type": "Property"
+        }
+    ],
+    "Actions": [
+        {
+            "PowerHint": "INTERACTION",
+            "Node": "CPUBigClusterMinFreq",
+            "Duration": 0,
+            "Value": "0x000ce4c8"
+        },
+        {
+            "PowerHint": "INTERACTION",
+            "Node": "CPULittleClusterMinFreq",
+            "Duration": 0,
+            "Value": "0x000c4c70"
+        },
+        {
+            "PowerHint": "INTERACTION",
+            "Node": "TASchedtuneBoost",
+            "Duration": 0,
+            "Value": "70"
+        },
+        {
+            "PowerHint": "LAUNCH",
+            "Node": "CPUBigClusterMaxFreq",
+            "Duration": 5000,
+            "Value": "0x00234f10"
+        },
+        {
+            "PowerHint": "LAUNCH",
+            "Node": "CPUBigClusterMinFreq",
+            "Duration": 5000,
+            "Value": "0x00234f10"
+        },
+        {
+            "PowerHint": "LAUNCH",
+            "Node": "CPULittleClusterMinFreq",
+            "Duration": 5000,
+            "Value": "0x001a94b0"
+        },
+        {
+            "PowerHint": "LAUNCH",
+            "Node": "PMQoSCpuDmaLatency",
+            "Duration": 5000,
+            "Value": "0x0000002c"
+        },
+        {
+            "PowerHint": "CAMERA_LAUNCH",
+            "Node": "CPUBigClusterMaxFreq",
+            "Duration": 1000,
+            "Value": "0x00234f10"
+        },
+        {
+            "PowerHint": "CAMERA_LAUNCH",
+            "Node": "CPUBigClusterMinFreq",
+            "Duration": 1000,
+            "Value": "0x00234f10"
+        },
+        {
+            "PowerHint": "CAMERA_LAUNCH",
+            "Node": "CPULittleClusterMaxFreq",
+            "Duration": 1000,
+            "Value": "0x001a94b0"
+        },
+        {
+            "PowerHint": "CAMERA_LAUNCH",
+            "Node": "CPULittleClusterMinFreq",
+            "Duration": 1000,
+            "Value": "0x001a94b0"
+        },
+        {
+            "PowerHint": "CAMERA_LAUNCH",
+            "Node": "PMQoSCpuDmaLatency",
+            "Duration": 1000,
+            "Value": "0x0000002c"
+        },
+        {
+            "PowerHint": "CAMERA_STREAMING",
+            "Node": "PowerHALMainState",
+            "Duration": 0,
+            "Value": "CAMERA_STREAMING"
+        },
+        {
+            "PowerHint": "CAMERA_STREAMING",
+            "Node": "CPUBigClusterMaxFreq",
+            "Duration": 0,
+            "Value": "0x001cf610"
+        },
+        {
+            "PowerHint": "CAMERA_SHOT",
+            "Node": "CPUBigClusterMaxFreq",
+            "Duration": 1000,
+            "Value": "0x00234f10"
+        },
+        {
+            "PowerHint": "CAMERA_SHOT",
+            "Node": "CPUBigClusterMinFreq",
+            "Duration": 1000,
+            "Value": "0x00234f10"
+        },
+        {
+            "PowerHint": "CAMERA_SHOT",
+            "Node": "CPULittleClusterMaxFreq",
+            "Duration": 1000,
+            "Value": "0x001a94b0"
+        },
+        {
+            "PowerHint": "CAMERA_SHOT",
+            "Node": "CPULittleClusterMinFreq",
+            "Duration": 1000,
+            "Value": "0x001a94b0"
+        },
+        {
+            "PowerHint": "CAMERA_SHOT",
+            "Node": "PMQoSCpuDmaLatency",
+            "Duration": 1000,
+            "Value": "0x0000002c"
+        },
+        {
+            "PowerHint": "AUDIO_STREAMING",
+            "Node": "PMQoSCpuDmaLatency",
+            "Duration": 2000,
+            "Value": "0x0000002c"
+        },
+        {
+            "PowerHint": "AUDIO_LOW_LATENCY",
+            "Node": "PowerHALAudioState",
+            "Duration": 0,
+            "Value": "AUDIO_LOW_LATENCY"
+        },
+        {
+            "PowerHint": "AUDIO_LOW_LATENCY",
+            "Node": "PMQoSCpuDmaLatency",
+            "Duration": 0,
+            "Value": "0x0000002c"
+        },
+        {
+            "PowerHint": "SUSTAINED_PERFORMANCE",
+            "Node": "PowerHALMainState",
+            "Duration": 0,
+            "Value": "SUSTAINED_PERFORMANCE"
+        },
+        {
+            "PowerHint": "SUSTAINED_PERFORMANCE",
+            "Node": "CPUBigClusterMaxFreq",
+            "Duration": 0,
+            "Value": "0x00183350"
+        },
+        {
+            "PowerHint": "SUSTAINED_PERFORMANCE",
+            "Node": "CPULittleClusterMaxFreq",
+            "Duration": 0,
+            "Value": "0x0013d620"
+        },
+        {
+            "PowerHint": "VR_MODE",
+            "Node": "PowerHALMainState",
+            "Duration": 0,
+            "Value": "VR_MODE"
+        },
+        {
+            "PowerHint": "VR_SUSTAINED_PERFORMANCE",
+            "Node": "PowerHALMainState",
+            "Duration": 0,
+            "Value": "VR_SUSTAINED_PERFORMANCE"
+        },
+        {
+            "PowerHint": "EXPENSIVE_RENDERING",
+            "Node": "PowerHALRenderingState",
+            "Duration": 0,
+            "Value": "EXPENSIVE_RENDERING"
+        },
+        {
+            "PowerHint": "NOT_INTERACTIVE",
+            "Node": "TouchscreenEnable",
+            "Duration": 0,
+            "Value": "0"
+        },
+        {
+            "PowerHint": "NOT_INTERACTIVE",
+            "Node": "LCDEnable",
+            "Duration": 0,
+            "Value": "0"
+        },
+        {
+            "PowerHint": "DOUBLE_TAP_TO_WAKE",
+            "Node": "DoubleTapToWakeEnable",
+            "Duration": 0,
+            "Value": "aot_enable,1"
+        },
+        {
+            "PowerHint": "PROFILE_POWER_SAVE",
+            "Node": "PowerHALPerfProfileState",
+            "Duration": 0,
+            "Value": "POWER_SAVE"
+        },
+        {
+            "PowerHint": "PROFILE_BIAS_POWER_SAVE",
+            "Node": "PowerHALPerfProfileState",
+            "Duration": 0,
+            "Value": "BIAS_POWER_SAVE"
+        },
+        {
+            "PowerHint": "PROFILE_BIAS_PERFORMANCE",
+            "Node": "PowerHALPerfProfileState",
+            "Duration": 0,
+            "Value": "BIAS_PERFORMANCE"
+        },
+        {
+            "PowerHint": "PROFILE_HIGH_PERFORMANCE",
+            "Node": "PowerHALPerfProfileState",
+            "Duration": 0,
+            "Value": "HIGH_PERFORMANCE"
+        }
+    ]
+}
diff --git a/manifest.xml b/manifest.xml
index 0a35dd5..b6e201b 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -200,16 +200,6 @@
         </interface>
         <fqname>@1.2::IDevice/armnn</fqname>
     </hal>
-    <hal format="hidl">
-        <name>android.hardware.power</name>
-        <transport>hwbinder</transport>
-        <version>1.0</version>
-        <interface>
-            <name>IPower</name>
-            <instance>default</instance>
-        </interface>
-        <fqname>@1.0::IPower/default</fqname>
-    </hal>
     <hal format="hidl" override="true">
         <name>android.hardware.radio</name>
         <transport>hwbinder</transport>
@@ -387,16 +377,6 @@
         <fqname>@3.0::ISehLight/default</fqname>
     </hal>
     <hal format="hidl">
-        <name>vendor.samsung.hardware.miscpower</name>
-        <transport>hwbinder</transport>
-        <version>2.0</version>
-        <interface>
-            <name>ISehMiscPower</name>
-            <instance>default</instance>
-        </interface>
-        <fqname>@2.0::ISehMiscPower/default</fqname>
-    </hal>
-    <hal format="hidl">
         <name>vendor.samsung.hardware.sbtvdtuner</name>
         <transport>hwbinder</transport>
         <version>2.0</version>
diff --git a/platform/config.mk b/platform/config.mk
index f9a8a3a..9c457fb 100644
--- a/platform/config.mk
+++ b/platform/config.mk
@@ -16,3 +16,7 @@
 ### GPS
 PRODUCT_COPY_FILES += \
     $(PLATFORM_PATH)/config/gps/gps_psds.conf:$(TARGET_COPY_OUT_SYSTEM)/etc/gps/gps_psds.conf
+
+### POWER
+PRODUCT_COPY_FILES += \
+    $(PLATFORM_PATH)/config/power/powerhint.json:$(TARGET_COPY_OUT_VENDOR)/etc/powerhint.json
diff --git a/platform/product_packages.mk b/platform/product_packages.mk
index f3e3c90..67aa6f7 100644
--- a/platform/product_packages.mk
+++ b/platform/product_packages.mk
@@ -113,6 +113,10 @@
     libmm-omxcore \
     libstagefrighthw
 
+### POWER
+PRODUCT_PACKAGES += \
+    android.hardware.power@1.3-service.samsung-libperfmgr
+
 ### RENDERSCRIPT
 PRODUCT_PACKAGES += \
     android.hardware.renderscript@1.0-impl