diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index 49fbe84f..f39a3299 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -158,15 +158,12 @@ PRODUCT_FS_COMPRESSION := 1 BOARD_FLASH_BLOCK_SIZE := 4096 BOARD_MOUNT_SDCARD_RW := true -# system.img -BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs - # product.img -BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs +BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4 TARGET_COPY_OUT_PRODUCT := product # system_ext.img -BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := erofs +BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4 TARGET_COPY_OUT_SYSTEM_EXT := system_ext # persist.img @@ -200,7 +197,7 @@ BOARD_SUPER_PARTITION_ERROR_LIMIT := 8006926336 # Build a separate system_dlkm partition BOARD_USES_SYSTEM_DLKMIMAGE := true -BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE := erofs +BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE := ext4 TARGET_COPY_OUT_SYSTEM_DLKM := system_dlkm # Testing related defines diff --git a/conf/fstab.gs201.in b/conf/fstab.gs201.in index 79f8cc82..83ba6889 100644 --- a/conf/fstab.gs201.in +++ b/conf/fstab.gs201.in @@ -4,12 +4,12 @@ # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK # # -system /system erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -system_dlkm /system_dlkm erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -system_ext /system_ext erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -product /product erofs ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 -vendor /vendor erofs ro wait,slotselect,avb=vbmeta_vendor,logical,first_stage_mount,readahead_size_kb=128 -vendor_dlkm /vendor_dlkm erofs ro wait,slotselect,avb=vbmeta,logical,first_stage_mount +system /system ext4 ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +system_dlkm /system_dlkm ext4 ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +system_ext /system_ext ext4 ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +product /product ext4 ro wait,slotselect,avb=vbmeta_system,logical,first_stage_mount,readahead_size_kb=128 +vendor /vendor ext4 ro wait,slotselect,avb=vbmeta_vendor,logical,first_stage_mount,readahead_size_kb=128 +vendor_dlkm /vendor_dlkm ext4 ro wait,slotselect,avb=vbmeta,logical,first_stage_mount /dev/block/platform/14700000.ufs/by-name/boot /boot emmc defaults slotselect,avb=boot,first_stage_mount /dev/block/platform/14700000.ufs/by-name/init_boot /init_boot emmc defaults slotselect,avb=init_boot,first_stage_mount /dev/block/platform/14700000.ufs/by-name/efs /mnt/vendor/efs f2fs noatime,sync wait,check,formattable diff --git a/conf/fstab.postinstall b/conf/fstab.postinstall index 16b167c2..955fba71 100644 --- a/conf/fstab.postinstall +++ b/conf/fstab.postinstall @@ -1,4 +1,4 @@ # Android fstab file. # # -system /postinstall erofs ro,nosuid,nodev,noexec slotselect_other,logical,avb_keys=/product/etc/security/avb/system_other.avbpubkey +system /postinstall ext4 ro,nosuid,nodev,noexec slotselect_other,logical,avb_keys=/product/etc/security/avb/system_other.avbpubkey diff --git a/conf/init.gs201.rc b/conf/init.gs201.rc index b83b409c..db36f369 100644 --- a/conf/init.gs201.rc +++ b/conf/init.gs201.rc @@ -959,6 +959,8 @@ on property:vendor.thermal.link_ready=1 # Thermal chown system system /dev/thermal/tz-by-name/quiet_therm/trip_point_0_temp chown system system /dev/thermal/tz-by-name/quiet_therm/trip_point_0_hyst + chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_temp + chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_hyst chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote diff --git a/device.mk b/device.mk index 017597d5..cdf5e31c 100644 --- a/device.mk +++ b/device.mk @@ -21,7 +21,7 @@ TARGET_BOARD_PLATFORM := gs201 AB_OTA_POSTINSTALL_CONFIG += \ RUN_POSTINSTALL_system=true \ POSTINSTALL_PATH_system=system/bin/otapreopt_script \ - FILESYSTEM_TYPE_system=erofs \ + FILESYSTEM_TYPE_system=ext4 \ POSTINSTALL_OPTIONAL_system=true # Set Vendor SPL to match platform diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml index 39dcfb47..f5fdf298 100644 --- a/device_framework_matrix_product.xml +++ b/device_framework_matrix_product.xml @@ -97,7 +97,7 @@ com.google.hardware.pixel.display - 4 + 5 IDisplay default diff --git a/radio/config/Pixel_Default.nprf b/radio/config/Pixel_Default.nprf index d2771019..c29975d3 100644 Binary files a/radio/config/Pixel_Default.nprf and b/radio/config/Pixel_Default.nprf differ diff --git a/usb/gadget/UsbGadget.cpp b/usb/gadget/UsbGadget.cpp index 8fe69929..e83b2fcb 100644 --- a/usb/gadget/UsbGadget.cpp +++ b/usb/gadget/UsbGadget.cpp @@ -33,6 +33,12 @@ namespace gadget { namespace V1_2 { namespace implementation { +string enabledPath; +constexpr char kHsi2cPath[] = "/sys/devices/platform/10d50000.hsi2c"; +constexpr char kI2CPath[] = "/sys/devices/platform/10d50000.hsi2c/i2c-"; +constexpr char kAccessoryLimitCurrent[] = "i2c-max77759tcpc/usb_limit_accessory_current"; +constexpr char kAccessoryLimitCurrentEnable[] = "i2c-max77759tcpc/usb_limit_accessory_enable"; + UsbGadget::UsbGadget() : mGadgetIrqPath("") { if (access(OS_DESC_PATH, R_OK) != 0) { ALOGE("configfs setup not done yet"); @@ -382,14 +388,45 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions, return Status::SUCCESS; } +Status getI2cBusHelper(string *name) { + DIR *dp; + + dp = opendir(kHsi2cPath); + if (dp != NULL) { + struct dirent *ep; + + while ((ep = readdir(dp))) { + if (ep->d_type == DT_DIR) { + if (string::npos != string(ep->d_name).find("i2c-")) { + std::strtok(ep->d_name, "-"); + *name = std::strtok(NULL, "-"); + } + } + } + closedir(dp); + return Status::SUCCESS; + } + + ALOGE("Failed to open %s", kHsi2cPath); + return Status::ERROR; +} + Return UsbGadget::setCurrentUsbFunctions(uint64_t functions, const sp &callback, uint64_t timeout) { std::unique_lock lk(mLockSetCurrentFunction); + std::string current_usb_power_operation_mode, current_usb_type; + std::string usb_limit_sink_enable; + + string accessoryCurrentLimitEnablePath, accessoryCurrentLimitPath, path; mCurrentUsbFunctions = functions; mCurrentUsbFunctionsApplied = false; + getI2cBusHelper(&path); + accessoryCurrentLimitPath = kI2CPath + path + "/" + kAccessoryLimitCurrent; + accessoryCurrentLimitEnablePath = kI2CPath + path + "/" + kAccessoryLimitCurrentEnable; + // Get the gadget IRQ number before tearDownGadget() if (mGadgetIrqPath.empty()) getUsbGadgetIrqPath(); @@ -437,6 +474,28 @@ Return UsbGadget::setCurrentUsbFunctions(uint64_t functions, } } + if (ReadFileToString(CURRENT_USB_TYPE_PATH, ¤t_usb_type)) + current_usb_type = Trim(current_usb_type); + + if (ReadFileToString(CURRENT_USB_POWER_OPERATION_MODE_PATH, ¤t_usb_power_operation_mode)) + current_usb_power_operation_mode = Trim(current_usb_power_operation_mode); + + if (functions & GadgetFunction::ACCESSORY && + current_usb_type == "Unknown SDP [CDP] DCP" && + (current_usb_power_operation_mode == "default" || + current_usb_power_operation_mode == "1.5A")) { + if (!WriteStringToFile("1300000", accessoryCurrentLimitPath)) { + ALOGI("Write 1.3A to limit current fail"); + } else { + if (!WriteStringToFile("1", accessoryCurrentLimitEnablePath)) { + ALOGI("Enable limit current fail"); + } + } + } else { + if (!WriteStringToFile("0", accessoryCurrentLimitEnablePath)) + ALOGI("unvote accessory limit current failed"); + } + ALOGI("Usb Gadget setcurrent functions called successfully"); return Void(); diff --git a/usb/gadget/UsbGadget.h b/usb/gadget/UsbGadget.h index 782fb021..61e6e798 100644 --- a/usb/gadget/UsbGadget.h +++ b/usb/gadget/UsbGadget.h @@ -86,6 +86,13 @@ static MonitorFfs monitorFfs(kGadgetName); #define BIG_CORE "6" #define MEDIUM_CORE "4" +#define POWER_SUPPLY_PATH "/sys/class/power_supply/usb/" +#define USB_PORT0_PATH "/sys/class/typec/port0/" + +#define CURRENT_MAX_PATH POWER_SUPPLY_PATH "current_max" +#define CURRENT_USB_TYPE_PATH POWER_SUPPLY_PATH "usb_type" +#define CURRENT_USB_POWER_OPERATION_MODE_PATH USB_PORT0_PATH "power_operation_mode" + struct UsbGadget : public IUsbGadget { UsbGadget(); diff --git a/usb/usb/android.hardware.usb-service.rc b/usb/usb/android.hardware.usb-service.rc index 0c60d249..127d9a23 100644 --- a/usb/usb/android.hardware.usb-service.rc +++ b/usb/usb/android.hardware.usb-service.rc @@ -10,6 +10,10 @@ on post-fs chown root system /sys/class/typec/port0/port_type chown root system /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/contaminant_detection chown root system /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_enable chown root system /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_current chown root system /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_sink_current chown root system /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_enable @@ -28,6 +32,10 @@ on post-fs chmod 664 /sys/devices/platform/11110000.usb/usb_data_enabled chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/contaminant_detection chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_enable chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_current chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_sink_current chmod 664 /sys/devices/platform/10d50000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_enable