From 11f2c8879565cd891881726d1f754072541ed28e Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Mon, 23 May 2022 04:29:06 +0000 Subject: [PATCH 1/3] Write the pullup value only if new value applied Bug: 226018845 Test: build, boot Signed-off-by: Jimmy Hu Change-Id: I64a964753fc89a29d278f1c426b2746abc2a2b12 --- usb/usb/Usb.cpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index b8ad7c5f..6cff2f26 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -83,23 +83,39 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, int64_t in_transactionId) { bool result = true; std::vector currentPortStatus; + string pullup; ALOGI("Userspace turn %s USB data signaling. opID:%ld", in_enable ? "on" : "off", in_transactionId); if (in_enable) { if (!mUsbDataEnabled) { + if (ReadFileToString(PULLUP_PATH, &pullup)) { + pullup = Trim(pullup); + if (pullup != kGadgetName) { + if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) { + ALOGE("Gadget cannot be pulled up"); + result = false; + } + } + } + if (!WriteStringToFile("1", USB_DATA_PATH)) { ALOGE("Not able to turn on usb connection notification"); result = false; } - - if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) { - ALOGE("Gadget cannot be pulled up"); - result = false; - } } } else { + if (ReadFileToString(PULLUP_PATH, &pullup)) { + pullup = Trim(pullup); + if (pullup == kGadgetName) { + if (!WriteStringToFile("none", PULLUP_PATH)) { + ALOGE("Gadget cannot be pulled down"); + result = false; + } + } + } + if (!WriteStringToFile("1", ID_PATH)) { ALOGE("Not able to turn off host mode"); result = false; @@ -114,11 +130,6 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, ALOGE("Not able to turn on usb connection notification"); result = false; } - - if (!WriteStringToFile("none", PULLUP_PATH)) { - ALOGE("Gadget cannot be pulled down"); - result = false; - } } if (result) { From 38d2997f6aac530fa8810d41d3094af65264bb10 Mon Sep 17 00:00:00 2001 From: David Chao Date: Thu, 26 May 2022 17:52:47 +0800 Subject: [PATCH 2/3] Revert "gs101: move charger thermal HAL setup into common code" This reverts commit 980650080a59cc85ea0165a276c7deb36bf21835. Reason for revert: Since the vendor.thermal.symlinks is init early than google-module init such as gpu cooling, the gpu cooling is not ready while creating thermal.symlinks. Thermal-hal GPU thermal throttling will fail because there is no thermal-gpufreq-0 in thermal.symlinks. Bug: 200615564 Test: thermal symlinks can be created in dev folder Change-Id: Ia3b0999c7a8038f7be5e2390926ff74473c0c339 --- conf/init.gs101.rc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/conf/init.gs101.rc b/conf/init.gs101.rc index 7b241f3f..bf63c26f 100644 --- a/conf/init.gs101.rc +++ b/conf/init.gs101.rc @@ -985,10 +985,19 @@ on property:vendor.thermal.link_ready=1 chown system system /dev/thermal/cdev-by-name/wlc_fcc/cur_state chown system system /dev/thermal/cdev-by-name/usbc-port/cur_state +# Create thermal symlink in off charging mode on charger + mkdir /dev/thermal 0750 system system + mkdir /dev/thermal/tz-by-name 0750 system system + mkdir /dev/thermal/cdev-by-name 0750 system system + start vendor.thermal.symlinks write /proc/vendor_sched/sys_uclamp_min 0 write /proc/vendor_sched/sys_prefer_idle 0 +# Launch thermal hal in off charging mode +on charger && property:vendor.thermal.link_ready=1 + start vendor.thermal-hal-2-0 + on property:vendor.disable.bcl.control=1 write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 0 From e6bbc89f541452238df132e366afa554b74e1c10 Mon Sep 17 00:00:00 2001 From: Daeho Jeong Date: Wed, 25 May 2022 08:34:46 -0700 Subject: [PATCH 3/3] disable powerhint for F2FS gc_urgent mode Disable the powerhint for F2FS gc_urgent mode, since we are going to replace this with the smart idle maintenance service. Test: turn on/off the screen & check /sys/fs/f2fs/dm-*/gc_urgent Bug: 214430685 Signed-off-by: Daeho Jeong Change-Id: I0798c082d668f904122c6a4af4634058dcbc777b --- powerhint_a0.json | 21 --------------------- powerhint_a1.json | 21 --------------------- 2 files changed, 42 deletions(-) diff --git a/powerhint_a0.json b/powerhint_a0.json index 47873678..76472db1 100644 --- a/powerhint_a0.json +++ b/powerhint_a0.json @@ -75,15 +75,6 @@ ], "ResetOnInit": true }, - { - "Name": "F2fsRecessModeEnable", - "Path": "/dev/sys/fs/by-name/userdata/gc_urgent", - "Values": [ - "2", - "0" - ], - "ResetOnInit": true - }, { "Name": "PowerHALRenderingState", "Path": "vendor.powerhal.rendering", @@ -184,12 +175,6 @@ "Duration": 200, "Value": "0" }, - { - "PowerHint": "DEVICE_IDLE", - "Node": "F2fsRecessModeEnable", - "Duration": 0, - "Value": "2" - }, { "PowerHint": "LAUNCH", "Type": "EndHint", @@ -231,12 +216,6 @@ "Duration": 5000, "Value": "0" }, - { - "PowerHint": "DISPLAY_INACTIVE", - "Node": "F2fsRecessModeEnable", - "Duration": 0, - "Value": "2" - }, { "PowerHint": "CAMERA_LAUNCH", "Node": "CPUBigClusterMaxFreq", diff --git a/powerhint_a1.json b/powerhint_a1.json index 81b4b659..7a980ba5 100644 --- a/powerhint_a1.json +++ b/powerhint_a1.json @@ -95,15 +95,6 @@ ], "ResetOnInit": true }, - { - "Name": "F2fsRecessModeEnable", - "Path": "/dev/sys/fs/by-name/userdata/gc_urgent", - "Values": [ - "2", - "0" - ], - "ResetOnInit": true - }, { "Name": "LimitFlashCurrent", "Path": "vendor.camera.max_flash_current", @@ -214,12 +205,6 @@ "Duration": 200, "Value": "0" }, - { - "PowerHint": "DEVICE_IDLE", - "Node": "F2fsRecessModeEnable", - "Duration": 0, - "Value": "2" - }, { "PowerHint": "LAUNCH", "Type": "EndHint", @@ -261,12 +246,6 @@ "Duration": 5000, "Value": "0" }, - { - "PowerHint": "DISPLAY_INACTIVE", - "Node": "F2fsRecessModeEnable", - "Duration": 0, - "Value": "2" - }, { "PowerHint": "CAMERA_LAUNCH", "Node": "CPUBigClusterMaxFreq",