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