From 3a4737b6a00fe2993ba78b9745ab00a4ff781d71 Mon Sep 17 00:00:00 2001 From: Andrew Chant Date: Tue, 17 Dec 2019 19:47:55 +0800 Subject: [PATCH] dumpstate: dump display PMIC registers Dump PMIC registers for display power supplies. Bug: 146400230 Test: took a bugreport in userdebug build, saw display register dumps: ------ ELVDD Register Dump (/sys/kernel/debug/regmap/spmi0-05/data) ------ de00: 00 de01: 01 de02: 01 ... Change-Id: I9d9e0c74af9e10d4bdaf0151b97ed382d269021e --- device.mk | 2 ++ dumpstate/DumpstateDevice.cpp | 25 +++++++++++++++++++++++++ init.hardware.userdebug.rc.userdebug | 21 +++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 init.hardware.userdebug.rc.userdebug diff --git a/device.mk b/device.mk index 08e3748b..2f5cc4dd 100644 --- a/device.mk +++ b/device.mk @@ -124,6 +124,8 @@ ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) $(LOCAL_PATH)/init.hardware.ipa.rc.userdebug:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.$(PRODUCT_PLATFORM).ipa.rc PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/init.hardware.power_debug.rc.userdebug:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.$(PRODUCT_PLATFORM).power_debug.rc + PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/init.hardware.userdebug.rc.userdebug:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.$(PRODUCT_PLATFORM).userdebug.rc else PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/init.hardware.diag.rc.user:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.$(PRODUCT_PLATFORM).diag.rc diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 2d52ae21..e98bb56c 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -18,6 +18,7 @@ #include "DumpstateDevice.h" +#include #include #include #include @@ -309,6 +310,30 @@ static void DumpDisplay(int fd) { DumpFileToFd(fd, "PANEL VENDOR NAME", "/sys/class/panel_info/panel0/panel_vendor_name"); DumpFileToFd(fd, "PANEL SN", "/sys/class/panel_info/panel0/serial_number"); DumpFileToFd(fd, "PANEL EXTRA INFO", "/sys/class/panel_info/panel0/panel_extinfo"); + + const std::string pmic_regmap_path = "/sys/kernel/debug/regmap/spmi0-05"; + using android::base::WriteStringToFile; + + if (WriteStringToFile("0x80", pmic_regmap_path + "/count", true) && + WriteStringToFile("0xE000", pmic_regmap_path + "/address", true)) { + DumpFileToFd(fd, "OLEDB Register Dump", pmic_regmap_path + "/data"); + } else { + dprintf(fd, "Unable to print OLEDB Register Dump\n"); + } + + if (WriteStringToFile("0x80", pmic_regmap_path + "/count", true) && + WriteStringToFile("0xDE00", pmic_regmap_path + "/address", true)) { + DumpFileToFd(fd, "ELVDD Register Dump", pmic_regmap_path + "/data"); + } else { + dprintf(fd, "Unable to print ELVDD Register Dump\n"); + } + + if (WriteStringToFile("0x60", pmic_regmap_path + "/count", true) && + WriteStringToFile("0xDC00", pmic_regmap_path + "/address", true)) { + DumpFileToFd(fd, "ELVSS Register Dump", pmic_regmap_path + "/data"); + } else { + dprintf(fd, "Unable to print ELVSS Register Dump\n"); + } } static void DumpSensorLog(int fd) { diff --git a/init.hardware.userdebug.rc.userdebug b/init.hardware.userdebug.rc.userdebug new file mode 100644 index 00000000..869d2bed --- /dev/null +++ b/init.hardware.userdebug.rc.userdebug @@ -0,0 +1,21 @@ +# +# Copyright (C) 2019 The Android Open-Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +on property:sys.boot_completed=1 + chown system system /sys/kernel/debug/regmap/spmi0-05/address + chown system system /sys/kernel/debug/regmap/spmi0-05/count + chown system system /sys/kernel/debug/regmap/spmi0-05/data +