From e182c63bd6b5a56cfdd27eae60a35743cca1bc08 Mon Sep 17 00:00:00 2001 From: Adam Shih Date: Tue, 15 Nov 2022 13:58:01 +0800 Subject: [PATCH] move thermal dump to gs-common Bug: 257880034 Test: adb shell dumpsys android.hardware.dumpstate.IDumpstateDevice/default dump_thermal.sh Change-Id: I6fa51c7662401a45defed776d69334fc42cee49e --- device.mk | 1 + dumpstate/Dumpstate.cpp | 33 --------------------------------- dumpstate/Dumpstate.h | 1 - 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/device.mk b/device.mk index ab3f35c9..e8efe715 100644 --- a/device.mk +++ b/device.mk @@ -20,6 +20,7 @@ include device/google/gs-common/ramdump/ramdump.mk include device/google/gs-common/soc/soc.mk include device/google/gs-common/modem/modem.mk include device/google/gs-common/aoc/aoc.mk +include device/google/gs-common/thermal/thermal.mk TARGET_BOARD_PLATFORM := gs101 DEVICE_IS_64BIT_ONLY ?= $(if $(filter %_64,$(TARGET_PRODUCT)),true,false) diff --git a/dumpstate/Dumpstate.cpp b/dumpstate/Dumpstate.cpp index a48f1e6c..85696f90 100644 --- a/dumpstate/Dumpstate.cpp +++ b/dumpstate/Dumpstate.cpp @@ -256,7 +256,6 @@ Dumpstate::Dumpstate() { "Devfreq", [this](int fd) { dumpDevfreqSection(fd); } }, { "cpu", [this](int fd) { dumpCpuSection(fd); } }, { "power", [this](int fd) { dumpPowerSection(fd); } }, - { "thermal", [this](int fd) { dumpThermalSection(fd); } }, { "touch", [this](int fd) { dumpTouchSection(fd); } }, { "display", [this](int fd) { dumpDisplaySection(fd); } }, { "misc", [this](int fd) { dumpMiscSection(fd); } }, @@ -508,38 +507,6 @@ void Dumpstate::dumpPowerSection(int fd) { } -// Dump items related to thermal -void Dumpstate::dumpThermalSection(int fd) { - RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/thermal* ; do " - "type=`cat $f/type` ; temp=`cat $f/temp` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device Current State", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "type=`cat $f/type` ; temp=`cat $f/cur_state` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device User Vote State", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "if [ ! -f $f/user_vote ]; then continue; fi; " - "type=`cat $f/type` ; temp=`cat $f/user_vote` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device Time in State", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; " - "do type=`cat $f/type` ; temp=`cat $f/stats/time_in_state_ms` ; echo \"$type:\n$temp\" ; done"}); - RunCommandToFd(fd, "Cooling Device Trans Table", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; " - "do type=`cat $f/type` ; temp=`cat $f/stats/trans_table` ; echo \"$type:\n$temp\" ; done"}); - RunCommandToFd(fd, "Cooling Device State2Power Table", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "if [ ! -f $f/state2power_table ]; then continue; fi; " - "type=`cat $f/type` ; state2power_table=`cat $f/state2power_table` ; echo \"$type: $state2power_table\" ; " - "done"}); - DumpFileToFd(fd, "TMU state:", "/sys/module/gs101_thermal/parameters/tmu_reg_dump_state"); - DumpFileToFd(fd, "TMU current temperature:", "/sys/module/gs101_thermal/parameters/tmu_reg_dump_current_temp"); - DumpFileToFd(fd, "TMU_TOP rise thresholds:", "/sys/module/gs101_thermal/parameters/tmu_top_reg_dump_rise_thres"); - DumpFileToFd(fd, "TMU_TOP fall thresholds:", "/sys/module/gs101_thermal/parameters/tmu_top_reg_dump_fall_thres"); - DumpFileToFd(fd, "TMU_SUB rise thresholds:", "/sys/module/gs101_thermal/parameters/tmu_sub_reg_dump_rise_thres"); - DumpFileToFd(fd, "TMU_SUB fall thresholds:", "/sys/module/gs101_thermal/parameters/tmu_sub_reg_dump_fall_thres"); -} - // Dump items related to touch void Dumpstate::dumpPreTouchSection(int fd) { const char nvt_spi_path[] = "/sys/class/spi_master/spi11/spi11.0/input/nvt_touch"; diff --git a/dumpstate/Dumpstate.h b/dumpstate/Dumpstate.h index 4c2d9cb6..7eb52f9b 100644 --- a/dumpstate/Dumpstate.h +++ b/dumpstate/Dumpstate.h @@ -48,7 +48,6 @@ class Dumpstate : public BnDumpstateDevice { // Text sections that can be dumped individually on the command line in // addition to being included in full dumps void dumpPowerSection(int fd); - void dumpThermalSection(int fd); void dumpPreTouchSection(int fd); void dumpTouchSection(int fd); void dumpCpuSection(int fd);