Merge changes I1bc87291,Id3ae7e7a into main
* changes: usb: Modify sdp enumeration timeout value in charger mode UsbGadget: Update SDP enum timeout when gadget is pulled up
This commit is contained in:
commit
686df57c05
5 changed files with 33 additions and 0 deletions
|
@ -291,6 +291,7 @@ on property:sys.usb.config=charger && property:sys.usb.configfs=1
|
||||||
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "midi"
|
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "midi"
|
||||||
symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1
|
symlink /config/usb_gadget/g1/functions/midi.gs5 /config/usb_gadget/g1/configs/b.1/f1
|
||||||
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
|
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
|
||||||
|
write /sys/class/typec/port0/device/update_sdp_enum_timeout 0x1
|
||||||
setprop sys.usb.state ${sys.usb.config}
|
setprop sys.usb.state ${sys.usb.config}
|
||||||
|
|
||||||
on property:ro.bootmode=usbuwb
|
on property:ro.bootmode=usbuwb
|
||||||
|
|
|
@ -49,6 +49,7 @@ constexpr char kTcpcDevName[] = "i2c-max77759tcpc";
|
||||||
constexpr char kI2cClientId[] = "0025";
|
constexpr char kI2cClientId[] = "0025";
|
||||||
constexpr char kAccessoryLimitCurrent[] = "usb_limit_accessory_current";
|
constexpr char kAccessoryLimitCurrent[] = "usb_limit_accessory_current";
|
||||||
constexpr char kAccessoryLimitCurrentEnable[] = "usb_limit_accessory_enable";
|
constexpr char kAccessoryLimitCurrentEnable[] = "usb_limit_accessory_enable";
|
||||||
|
constexpr char kUpdateSdpEnumTimeout[] = "update_sdp_enum_timeout";
|
||||||
|
|
||||||
UsbGadget::UsbGadget() : mGadgetIrqPath(""),
|
UsbGadget::UsbGadget() : mGadgetIrqPath(""),
|
||||||
mI2cClientPath("") {
|
mI2cClientPath("") {
|
||||||
|
@ -103,6 +104,7 @@ Status UsbGadget::getUsbGadgetIrqPath() {
|
||||||
void currentFunctionsAppliedCallback(bool functionsApplied, void *payload) {
|
void currentFunctionsAppliedCallback(bool functionsApplied, void *payload) {
|
||||||
UsbGadget *gadget = (UsbGadget *)payload;
|
UsbGadget *gadget = (UsbGadget *)payload;
|
||||||
gadget->mCurrentUsbFunctionsApplied = functionsApplied;
|
gadget->mCurrentUsbFunctionsApplied = functionsApplied;
|
||||||
|
gadget->updateSdpEnumTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr<IUsbGadgetCallback> &callback,
|
ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr<IUsbGadgetCallback> &callback,
|
||||||
|
@ -369,6 +371,28 @@ ScopedAStatus UsbGadget::reset(const shared_ptr<IUsbGadgetCallback> &callback,
|
||||||
return ScopedAStatus::ok();
|
return ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UsbGadget::updateSdpEnumTimeout() {
|
||||||
|
string update_sdp_enum_timeout_path;
|
||||||
|
|
||||||
|
if (mI2cClientPath.empty()) {
|
||||||
|
for (int i = 0; i < NUM_HSI2C_PATHS; ++i) {
|
||||||
|
mI2cClientPath = getI2cClientPath(kHsi2cPaths[i], kTcpcDevName, kI2cClientId);
|
||||||
|
if (mI2cClientPath.empty()) {
|
||||||
|
ALOGE("%s: Unable to locate i2c bus node", __func__);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
update_sdp_enum_timeout_path = mI2cClientPath + kUpdateSdpEnumTimeout;
|
||||||
|
if (!WriteStringToFile("1", update_sdp_enum_timeout_path)) {
|
||||||
|
ALOGE("%s: Unable to write to %s.", __func__, update_sdp_enum_timeout_path.c_str());
|
||||||
|
} else {
|
||||||
|
ALOGI("%s: Updated SDP enumeration timeout value.", __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Status UsbGadget::setupFunctions(long functions,
|
Status UsbGadget::setupFunctions(long functions,
|
||||||
const shared_ptr<IUsbGadgetCallback> &callback, uint64_t timeout,
|
const shared_ptr<IUsbGadgetCallback> &callback, uint64_t timeout,
|
||||||
int64_t in_transactionId) {
|
int64_t in_transactionId) {
|
||||||
|
@ -427,6 +451,7 @@ Status UsbGadget::setupFunctions(long functions,
|
||||||
mCurrentUsbFunctionsApplied = true;
|
mCurrentUsbFunctionsApplied = true;
|
||||||
if (callback)
|
if (callback)
|
||||||
callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS, in_transactionId);
|
callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS, in_transactionId);
|
||||||
|
updateSdpEnumTimeout();
|
||||||
return Status::SUCCESS;
|
return Status::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,9 @@ struct UsbGadget : public BnUsbGadget {
|
||||||
|
|
||||||
ScopedAStatus setVidPid(const char *vid,const char *pid);
|
ScopedAStatus setVidPid(const char *vid,const char *pid);
|
||||||
|
|
||||||
|
// Indicates to the kernel that the gadget service is ready and the kernel can
|
||||||
|
// set SDP timeout to a lower value.
|
||||||
|
void updateSdpEnumTimeout();
|
||||||
std::string mI2cClientPath;
|
std::string mI2cClientPath;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -15,6 +15,7 @@ on post-fs
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_current
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_current
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_enable
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_enable
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_source_enable
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_source_enable
|
||||||
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/update_sdp_enum_timeout
|
||||||
chown root graphics /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
chown root graphics /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
||||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
||||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
||||||
|
@ -39,6 +40,7 @@ on post-fs
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_current
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_current
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_enable
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_enable
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_source_enable
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_source_enable
|
||||||
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/update_sdp_enum_timeout
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
||||||
|
|
|
@ -15,6 +15,7 @@ on post-fs
|
||||||
chown root system /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_current
|
chown root system /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_current
|
||||||
chown root system /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_enable
|
chown root system /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_enable
|
||||||
chown root system /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_source_enable
|
chown root system /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_source_enable
|
||||||
|
chown root system /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/update_sdp_enum_timeout
|
||||||
chown root graphics /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
chown root graphics /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
||||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
||||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
||||||
|
@ -39,6 +40,7 @@ on post-fs
|
||||||
chmod 664 /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_current
|
chmod 664 /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_current
|
||||||
chmod 664 /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_enable
|
chmod 664 /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_sink_enable
|
||||||
chmod 664 /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_source_enable
|
chmod 664 /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/usb_limit_source_enable
|
||||||
|
chmod 664 /sys/devices/platform/108d0000.hsi2c/i2c-6/6-0025/update_sdp_enum_timeout
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue