sepolicy: thermal: reorganize the source to folder

Reorganize the dump thermal script source and sepolicy to its own
folder. This is done as a part of moving all thermal product
makefiles to gs-common.

Bug: 289146743
Test: Compilation and bootup test

Change-Id: Ie9162b401c9bed57c3d2e2648edc17457ad8883e
Signed-off-by: Ram Chandrasekar <rchandrasekar@google.com>
diff --git a/thermal/dump/Android.bp b/thermal/dump/Android.bp
new file mode 100644
index 0000000..70fef5c
--- /dev/null
+++ b/thermal/dump/Android.bp
@@ -0,0 +1,10 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+sh_binary {
+    name: "dump_thermal.sh",
+    src: "dump_thermal.sh",
+    vendor: true,
+    sub_dir: "dump",
+}
diff --git a/thermal/dump/dump_thermal.sh b/thermal/dump/dump_thermal.sh
new file mode 100644
index 0000000..288d34d
--- /dev/null
+++ b/thermal/dump/dump_thermal.sh
@@ -0,0 +1,46 @@
+#!/vendor/bin/sh
+
+echo 'Temperatures'
+for f in /sys/class/thermal/thermal* ; do
+  echo `cat $f/type`: `cat $f/temp`
+done
+
+echo 'Cooling Device Current State'
+for f in /sys/class/thermal/cooling* ; do
+  echo `cat $f/type`: `cat $f/cur_state`
+done
+
+echo 'Cooling Device User Vote State'
+for f in /sys/class/thermal/cooling* ; do
+  if ! [ -r $f/user_vote ]; then continue; fi;
+  echo `cat $f/type`: `cat $f/user_vote`
+done
+
+echo 'Cooling Device Time in State'
+for f in /sys/class/thermal/cooling* ; do
+  echo `cat $f/type`: `cat $f/stats/time_in_state_ms`
+done
+
+echo 'Cooling Device Trans Table'
+for f in /sys/class/thermal/cooling* ; do
+  echo `cat $f/type`: `cat $f/stats/trans_table`
+done
+
+echo 'Cooling Device State2Power Table'
+for f in /sys/class/thermal/cooling* ; do
+  if ! [ -r $f/state2power_table ]; then continue; fi;
+  echo `cat $f/type`: `cat $f/state2power_table`
+done
+
+echo 'TMU state:'
+cat /sys/module/gs_thermal/parameters/tmu_reg_dump_state
+echo 'TMU current temperature:'
+cat /sys/module/gs_thermal/parameters/tmu_reg_dump_current_temp
+echo 'TMU_TOP rise thresholds:'
+cat /sys/module/gs_thermal/parameters/tmu_top_reg_dump_rise_thres
+echo 'TMU_TOP fall thresholds:'
+cat /sys/module/gs_thermal/parameters/tmu_top_reg_dump_fall_thres
+echo 'TMU_SUB rise thresholds:'
+cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_rise_thres
+echo 'TMU_SUB fall thresholds:'
+cat /sys/module/gs_thermal/parameters/tmu_sub_reg_dump_fall_thres
diff --git a/thermal/dump/thermal.mk b/thermal/dump/thermal.mk
new file mode 100644
index 0000000..03b1dfa
--- /dev/null
+++ b/thermal/dump/thermal.mk
@@ -0,0 +1,3 @@
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/thermal/sepolicy/dump
+
+PRODUCT_PACKAGES += dump/dump_thermal.sh