diff --git a/conf/Android.bp b/conf/Android.bp index 0185c98..4741102 100644 --- a/conf/Android.bp +++ b/conf/Android.bp @@ -25,6 +25,8 @@ package { filegroup { name: "fstab.zumapro.common", - srcs: ["fstab.zumapro.common"], + srcs: ["fstab.ro.system", + "fstab.zumapro.common" + ], } diff --git a/conf/fstab.modem b/conf/fstab.ro.modem similarity index 100% rename from conf/fstab.modem rename to conf/fstab.ro.modem diff --git a/conf/fstab.postinstall b/conf/fstab.ro.postinstall similarity index 100% rename from conf/fstab.postinstall rename to conf/fstab.ro.postinstall diff --git a/conf/fstab.ro.system b/conf/fstab.ro.system new file mode 100644 index 0000000..989604b --- /dev/null +++ b/conf/fstab.ro.system @@ -0,0 +1,14 @@ +# Android fstab file for system/vendor/product partitions +# +# The filesystem that contains the filesystem checker binary (typically /system) cannot +# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK +# +# +system /system ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +# During compliance testing, the previous line would fail (because GSI is ext4), and the next line would be used to mount GSI. +system /system ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +system_dlkm /system_dlkm ext4 noatime,ro wait,slotselect,avb=vbmeta_system,avb_keys=no_such_key,logical,first_stage_mount,readahead_size_kb=128 +system_ext /system_ext ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +product /product ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +vendor /vendor ext4 noatime,ro wait,slotselect,avb=vbmeta_vendor,logical,first_stage_mount,readahead_size_kb=128 +vendor_dlkm /vendor_dlkm ext4 noatime,ro wait,slotselect,avb=vbmeta,avb_keys=no_such_key,logical,first_stage_mount diff --git a/conf/fstab.zumapro.common b/conf/fstab.zumapro.common index a5521b7..961cac6 100644 --- a/conf/fstab.zumapro.common +++ b/conf/fstab.zumapro.common @@ -1,17 +1,6 @@ # Android fstab file. # -# The filesystem that contains the filesystem checker binary (typically /system) cannot -# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK -# # -system /system ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -# During compliance testing, the previous line would fail (because GSI is ext4), and the next line would be used to mount GSI. -system /system ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -system_dlkm /system_dlkm ext4 noatime,ro wait,slotselect,avb=vbmeta_system,avb_keys=no_such_key,logical,first_stage_mount,readahead_size_kb=128 -system_ext /system_ext ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -product /product ext4 noatime,ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -vendor /vendor ext4 noatime,ro wait,slotselect,avb=vbmeta_vendor,logical,first_stage_mount,readahead_size_kb=128 -vendor_dlkm /vendor_dlkm ext4 noatime,ro wait,slotselect,avb=vbmeta,avb_keys=no_such_key,logical,first_stage_mount /dev/block/platform/13200000.ufs/by-name/boot /boot emmc defaults slotselect,avb=boot,first_stage_mount /dev/block/platform/13200000.ufs/by-name/init_boot /init_boot emmc defaults slotselect,avb=init_boot,first_stage_mount /dev/block/platform/13200000.ufs/by-name/misc /misc emmc defaults wait diff --git a/device.mk b/device.mk index 8aae301..ee2b146 100644 --- a/device.mk +++ b/device.mk @@ -474,7 +474,7 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.persist:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.persist \ - device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.modem:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.modem \ + device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.ro.modem:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.modem \ device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.rw.efs:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.efs # Shell scripts @@ -1002,7 +1002,7 @@ PRODUCT_PRODUCT_PROPERTIES += \ ro.postinstall.fstab.prefix=/product PRODUCT_COPY_FILES += \ - device/google/zumapro/conf/fstab.postinstall:$(TARGET_COPY_OUT_PRODUCT)/etc/fstab.postinstall + device/google/zumapro/conf/fstab.ro.postinstall:$(TARGET_COPY_OUT_PRODUCT)/etc/fstab.postinstall # fastbootd PRODUCT_PACKAGES += \ @@ -1050,6 +1050,8 @@ SUPPORT_NR_DS := true USE_RADIO_HAL_2_1 := true # Using Early Send Device Info USE_EARLY_SEND_DEVICE_INFO := true +# Using New Radio Access Format to modem +USE_NEW_RADIO_ACCESS_SPECIFIER_FORMAT := true #$(call inherit-product, vendor/google_devices/telephony/common/device-vendor.mk) #$(call inherit-product, vendor/google_devices/zumapro/proprietary/device-vendor.mk) diff --git a/dumpstate/dump_power.cpp b/dumpstate/dump_power.cpp index 95d2b72..0c54118 100644 --- a/dumpstate/dump_power.cpp +++ b/dumpstate/dump_power.cpp @@ -268,48 +268,44 @@ void dumpLogBufferTcpm() { } void dumpTcpc() { - int ret; - const char* max77759TcpcHead = "TCPC"; - const char* i2cSubDirMatch = "i2c-"; - const char* directory = "/sys/devices/platform/10d60000.hsi2c/"; - const char* max77759Tcpc [][2] { - {"registers:", "/i2c-max77759tcpc/registers"}, - {"frs:", "/i2c-max77759tcpc/frs"}, - {"auto_discharge:", "/i2c-max77759tcpc/auto_discharge"}, - {"bcl2_enabled:", "/i2c-max77759tcpc/bcl2_enabled"}, - {"cc_toggle_enable:", "/i2c-max77759tcpc/cc_toggle_enable"}, - {"containment_detection:", "/i2c-max77759tcpc/containment_detection"}, - {"containment_detection_status:", "/i2c-max77759tcpc/containment_detection_status"}, + const char* max77759TcpcHead = "TCPC Device Attributes"; + const char* directory = "/sys/class/typec/port0/device"; + // alphabetic order + const char* max77759Tcpc [] { + "auto_discharge", + "bc12_enabled", + "cc_toggle_enable", + "contaminant_detection", + "contaminant_detection_status", + "frs", + "irq_hpd_count", + "manual_disable_vbus", + "non_compliant_reasons", + "sbu_pullup", + "update_sdp_enum_timeout", + "usb_limit_accessory_current", + "usb_limit_accessory_enable", + "usb_limit_sink_current", + "usb_limit_sink_enable", + "usb_limit_source_enable", }; - std::vector files; std::string content; + std::string tcpcRegistersPath(std::string(directory) + "/registers"); + + dumpFileContent("TCPC Registers", tcpcRegistersPath.c_str()); printTitle(max77759TcpcHead); - ret = getFilesInDir(directory, &files); - if (ret < 0) { - for (auto &tcpcVal : max77759Tcpc) - printf("%s\n", tcpcVal[0]); - return; - } - - for (auto &file : files) { - for (auto &tcpcVal : max77759Tcpc) { - printf("%s ", tcpcVal[0]); - if (std::string::npos == std::string(file).find(i2cSubDirMatch)) { - continue; - } - - std::string fileName = directory + file + "/" + std::string(tcpcVal[1]); - - if (!android::base::ReadFileToString(fileName, &content)) { - continue; - } - - printf("%s\n", content.c_str()); - } + for (auto& tcpcVal : max77759Tcpc) { + std::string filename = std::string(directory) + "/" + std::string(tcpcVal); + printf("%s: ", tcpcVal); + android::base::ReadFileToString(filename, &content); + if (!content.empty() && (content.back() == '\n' || content.back() == '\r')) + content.pop_back(); + printf("%s\n", content.c_str()); } + printf("\n"); } void dumpPdEngine() { diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index d8afb80..aedca4e 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -54,6 +54,7 @@ namespace usb_flags = android::hardware::usb::flags; using aidl::android::frameworks::stats::IStats; using android::base::GetProperty; using android::base::Join; +using android::base::ParseInt; using android::base::ParseUint; using android::base::Tokenize; using android::base::Trim; @@ -101,7 +102,9 @@ constexpr char kThermalZoneForTempReadPrimary[] = "usb_pwr_therm2"; constexpr char kThermalZoneForTempReadSecondary1[] = "usb_pwr_therm"; constexpr char kThermalZoneForTempReadSecondary2[] = "qi_therm"; constexpr char kPogoUsbActive[] = "/sys/devices/platform/google,pogo/pogo_usb_active"; +constexpr char kPogoEnableHub[] = "/sys/devices/platform/google,pogo/enable_hub"; constexpr char kPogoEnableUsb[] = "/sys/devices/platform/google,pogo/enable_usb"; +constexpr char kInternalHubDevnum[] = "/sys/bus/usb/devices/1-1/devnum"; constexpr char kPowerSupplyUsbType[] = "/sys/class/power_supply/usb/usb_type"; constexpr char kIrqHpdCount[] = "irq_hpd_count"; constexpr char kUdcUeventRegex[] = @@ -524,11 +527,16 @@ void updatePortStatus(android::hardware::usb::Usb *usb) { queryVersionHelper(usb, ¤tPortStatus); } -static int usbDeviceRemoved(const char *devname, void* client_data) { - return 0; +static int getInternalHubUniqueId() { + string internalHubDevnum; + int devnum = 0, internalHubUniqueId = -1; + if (ReadFileToString(kInternalHubDevnum, &internalHubDevnum) && + ParseInt(Trim(internalHubDevnum).c_str(), &devnum)) + internalHubUniqueId = 1000 + devnum; + return internalHubUniqueId; } -static int usbDeviceAdded(const char *devname, void* client_data) { +static Status tuneInternalHub(const char *devname, void* client_data) { uint16_t vendorId, productId; struct usb_device *device; ::aidl::android::hardware::usb::Usb *usb; @@ -537,7 +545,7 @@ static int usbDeviceAdded(const char *devname, void* client_data) { device = usb_device_open(devname); if (!device) { ALOGE("usb_device_open failed\n"); - return 0; + return Status::ERROR; } usb = (::aidl::android::hardware::usb::Usb *)client_data; @@ -559,6 +567,26 @@ static int usbDeviceAdded(const char *devname, void* client_data) { usb_device_close(device); + return Status::SUCCESS; +} + +static int usbDeviceRemoved(const char *devname, void* client_data) { + return 0; +} + +static int usbDeviceAdded(const char *devname, void* client_data) { + string pogoEnableHub; + int uniqueId = 0; + + // Enable hub tuning when the pogo dock is connected. + if (ReadFileToString(kPogoEnableHub, &pogoEnableHub) && Trim(pogoEnableHub) == "1") { + // If enable_hub is set to 1, the internal hub is the first enumearted device on bus 1 and + // port 1. + uniqueId = usb_device_get_unique_id_from_name(devname); + if (uniqueId == getInternalHubUniqueId()) + tuneInternalHub(devname, client_data); + } + return 0; }