1#!/vendor/bin/sh 2echo "------ Camera HAL Graph State Dump ------" 3for f in $(ls -t /data/vendor/camera/hal_graph_state*.txt |head -1); do 4 echo $f 5 cat $f 6done 7 8build_type="$(getprop ro.build.type)" 9 10echo "\n------ Power Stats Times ------" 11echo -n "Boot: " && /vendor/bin/uptime -s && echo -n "Now: " && date; 12 13echo "\n------ ACPM stats ------" 14for f in /sys/devices/platform/acpm_stats/*_stats ; do 15 echo "\n\n$f" 16 cat $f 17done 18 19echo "\n------ CPU PM stats ------" 20cat "/sys/devices/system/cpu/cpupm/cpupm/time_in_state" 21 22echo "\n------ GENPD summary ------" 23cat "/d/pm_genpd/pm_genpd_summary" 24 25echo "\n------ Power supply property battery ------" 26cat "/sys/class/power_supply/battery/uevent" 27echo "\n------ Power supply property dc ------" 28cat "/sys/class/power_supply/dc/uevent" 29echo "\n------ Power supply property gcpm ------" 30cat "/sys/class/power_supply/gcpm/uevent" 31echo "\n------ Power supply property gcpm_pps ------" 32cat "/sys/class/power_supply/gcpm_pps/uevent" 33echo "\n------ Power supply property main-charger ------" 34cat "/sys/class/power_supply/main-charger/uevent" 35echo "\n------ Power supply property pca9486-mains ------" 36cat "/sys/class/power_supply/pca9468-mains/uevent" 37echo "\n------ Power supply property tcpm ------" 38cat "/sys/class/power_supply/tcpm-source-psy-i2c-max77759tcpc/uevent" 39echo "\n------ Power supply property usb ------" 40cat "/sys/class/power_supply/usb/uevent" 41echo "\n------ Power supply property wireless ------" 42cat "/sys/class/power_supply/wireless/uevent" 43 44if [ -d "/sys/class/power_supply/maxfg" ] 45then 46 echo "\n------ Power supply property maxfg ------" 47 cat "/sys/class/power_supply/maxfg/uevent" 48 echo "\n------ m5_state ------" 49 cat "/sys/class/power_supply/maxfg/m5_model_state" 50 echo "\n------ maxfg ------" 51 cat "/dev/logbuffer_maxfg" 52 echo "\n------ maxfg ------" 53 cat "/dev/logbuffer_maxfg_monitor" 54else 55 echo "\n------ Power supply property maxfg_base ------" 56 cat "/sys/class/power_supply/maxfg_base/uevent" 57 echo "\n------ Power supply property maxfg_flip ------" 58 cat "/sys/class/power_supply/maxfg_flip/uevent" 59 echo "\n------ m5_state ------" 60 cat "/sys/class/power_supply/maxfg_base/m5_model_state" 61 echo "\n------ maxfg_base ------" 62 cat "/dev/logbuffer_maxfg_base" 63 echo "\n------ maxfg_flip ------" 64 cat "/dev/logbuffer_maxfg_flip" 65 echo "\n------ maxfg_base ------" 66 cat "/dev/logbuffer_maxfg_base_monitor" 67 echo "\n------ maxfg_flip ------" 68 cat "/dev/logbuffer_maxfg_flip_monitor" 69fi 70 71if [ -d "/sys/class/power_supply/dock" ] 72then 73 echo "\n------ Power supply property dock ------" 74 cat "/sys/class/power_supply/dock/uevent" 75fi 76 77if [ -e "/dev/logbuffer_tcpm" ] 78then 79 echo "\n------ Logbuffer TCPM ------" 80 cat "/dev/logbuffer_tcpm" 81 if [ -d "/sys/kernel/debug/tcpm" ] 82 then 83 echo "\n------ TCPM logs ------" 84 cat /sys/kernel/debug/tcpm/* 85 else 86 echo "\n------ TCPM logs ------" 87 cat /sys/kernel/debug/usb/tcpm* 88 fi 89fi 90 91echo "\n------ TCPC ------" 92for f in /sys/devices/platform/10d50000.hsi2c/i2c-*/i2c-max77759tcpc 93do 94 echo "registers:" 95 cat $f/registers 96 echo "frs:" 97 cat $f/frs 98 echo "auto_discharge:" 99 cat $f/auto_discharge 100 echo "bc12_enabled:" 101 cat $f/bc12_enabled 102 echo "cc_toggle_enable:" 103 cat $f/cc_toggle_enable 104 echo "contaminant_detection:" 105 cat $f/contaminant_detection 106 echo "contaminant_detection_status:" 107 cat $f/contaminant_detection_status 108done 109 110echo "\n------ PD Engine ------" 111cat "/dev/logbuffer_usbpd" 112echo "\n------ POGO Transport ------" 113cat "/dev/logbuffer_pogo_transport" 114echo "\n------ PPS-google_cpm ------" 115cat "/dev/logbuffer_cpm" 116echo "\n------ PPS-dc ------" 117cat "/dev/logbuffer_pca9468" 118 119echo "\n------ Battery Health ------" 120cat "/sys/class/power_supply/battery/health_index_stats" 121echo "\n------ BMS ------" 122cat "/dev/logbuffer_ssoc" 123echo "\n------ TTF ------" 124cat "/dev/logbuffer_ttf" 125echo "\n------ TTF details ------" 126cat "/sys/class/power_supply/battery/ttf_details" 127echo "\n------ TTF stats ------" 128cat "/sys/class/power_supply/battery/ttf_stats" 129echo "\n------ maxq ------" 130cat "/dev/logbuffer_maxq" 131echo "\n------ aacr_state ------" 132cat "/sys/class/power_supply/battery/aacr_state" 133echo "\n------ TEMP/DOCK-DEFEND ------" 134cat "/dev/logbuffer_bd" 135 136echo "\n------ TRICKLE-DEFEND Config ------" 137cd /sys/devices/platform/google,battery/power_supply/battery/ 138for f in `ls bd_*` 139do 140 echo $f: `cat $f` 141done 142 143echo "\n------ DWELL-DEFEND Config ------" 144cd /sys/devices/platform/google,charger/ 145for f in `ls charge_s*` 146do 147 echo "$f: `cat $f`" 148done 149 150echo "\n------ TEMP-DEFEND Config ------" 151cd /sys/devices/platform/google,charger/ 152for f in `ls bd_*` 153do 154 echo "$f: `cat $f`" 155done 156 157if [ $build_type = "userdebug" ] 158then 159 echo "\n------ DC_registers dump ------" 160 cat "/sys/class/power_supply/pca9468-mains/device/registers_dump" 161 echo "\n------ max77759_chg registers dump ------" 162 cat "/d/max77759_chg/registers" 163 echo "\n------ max77729_pmic registers dump ------" 164 cat "/d/max77729_pmic/registers" 165 echo "\n------ Charging table dump ------" 166 cat "/d/google_battery/chg_raw_profile" 167 168 echo "\n------ fg_model ------" 169 for f in /d/maxfg* 170 do 171 regs=`cat $f/fg_model` 172 echo $f: 173 echo "$regs" 174 done 175 176 echo "\n------ fg_alo_ver ------" 177 for f in /d/maxfg* 178 do 179 regs=`cat $f/algo_ver` 180 echo $f: 181 echo "$regs" 182 done 183 184 echo "\n------ fg_model_ok ------" 185 for f in /d/maxfg* 186 do 187 regs=`cat $f/model_ok` 188 echo $f: 189 echo "$regs" 190 done 191 192 echo "\n------ fg registers ------" 193 for f in /d/maxfg* 194 do 195 regs=`cat $f/registers` 196 echo $f: 197 echo "$regs" 198 done 199fi 200 201echo "\n------ Battery EEPROM ------" 202if [ -e "/sys/devices/platform/10970000.hsi2c/i2c-4/4-0050/eeprom" ] 203then 204 xxd /sys/devices/platform/10970000.hsi2c/i2c-4/4-0050/eeprom 205fi 206 207if [ -e "/sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom" ] 208then 209 xxd /sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom 210fi 211 212if [ -e "/sys/devices/platform/10970000.hsi2c/i2c-6/6-0050/eeprom" ] 213then 214 xxd /sys/devices/platform/10970000.hsi2c/i2c-6/6-0050/eeprom 215fi 216 217if [ -e "/sys/devices/platform/10970000.hsi2c/i2c-7/7-0050/eeprom" ] 218then 219 xxd /sys/devices/platform/10970000.hsi2c/i2c-7/7-0050/eeprom 220fi 221 222if [ -e "/sys/devices/platform/10970000.hsi2c/i2c-7/7-0050/eeprom" ] 223then 224 xxd /sys/devices/platform/10970000.hsi2c/i2c-7/7-0050/eeprom 225fi 226 227echo "\n------ Charger Stats ------" 228cat "/sys/class/power_supply/battery/charge_details" 229if [ $build_type = "userdebug" ] 230then 231 echo "\n------ Google Charger ------" 232 cd /sys/kernel/debug/google_charger/ 233 for f in `ls pps_*` 234 do 235 echo "$f: `cat $f`" 236 done 237 echo "\n------ Google Battery ------" 238 cd /sys/kernel/debug/google_battery/ 239 for f in `ls ssoc_*` 240 do 241 echo "$f: `cat $f`" 242 done 243fi 244 245echo "\n------ WLC logs ------" 246cat "/dev/logbuffer_wireless" 247echo "\n------ WLC VER ------" 248cat "/sys/class/power_supply/wireless/device/version" 249echo "\n------ WLC STATUS ------" 250cat "/sys/class/power_supply/wireless/device/status" 251echo "\n------ WLC FW Version ------" 252cat "/sys/class/power_supply/wireless/device/fw_rev" 253echo "\n------ RTX ------" 254cat "/dev/logbuffer_rtx" 255 256if [ $build_type = "userdebug" ] 257then 258 echo "\n------ gvotables ------" 259 cat /sys/kernel/debug/gvotables/*/status 260fi 261 262echo "\n------ Mitigation Stats ------" 263echo "Source\t\tCount\tSOC\tTime\tVoltage" 264for f in `ls /sys/devices/virtual/pmic/mitigation/last_triggered_count/*` 265do 266 count=`cat $f` 267 a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/last_triggered_count\//} 268 b=${f/last_triggered_count/last_triggered_capacity} 269 c=${f/last_triggered_count/last_triggered_timestamp/} 270 d=${f/last_triggered_count/last_triggered_voltage/} 271 cnt=`cat $f` 272 cap=`cat ${b/count/cap}` 273 ti=`cat ${c/count/time}` 274 volt=`cat ${d/count/volt}` 275 echo "${a/_count/} \t$cnt\t$cap\t$ti\t$volt" 276done 277 278echo "\n------ Clock Divider Ratio ------" 279echo \"Source\t\tRatio\" 280for f in `ls /sys/devices/virtual/pmic/mitigation/clock_ratio/*` 281do ratio=`cat $f` 282 a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/clock_ratio\//} 283 echo "${a/_ratio/} \t$ratio" 284done 285 286echo "\n------ Clock Stats ------" 287echo "Source\t\tStats" 288for f in `ls /sys/devices/virtual/pmic/mitigation/clock_stats/*` 289do 290 stats=`cat $f` 291 a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/clock_stats\//}; 292 echo "${a/_stats/} \t$stats" 293done 294 295echo "\n------ Triggered Level ------" 296echo "Source\t\tLevel" 297for f in `ls /sys/devices/virtual/pmic/mitigation/triggered_lvl/*` 298do 299 lvl=`cat $f` 300 a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/triggered_lvl\//} 301 echo "${a/_lvl/} \t$lvl" 302done 303 304echo "\n------ Instruction ------" 305for f in `ls /sys/devices/virtual/pmic/mitigation/instruction/*` 306do 307 val=`cat $f` 308 a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/instruction\//} 309 echo "$a=$val" 310done 311 312