Merge "usb: enable/disable displayport alt mode through enableUsbData" into main
This commit is contained in:
commit
5cc2bfebf4
4 changed files with 50 additions and 0 deletions
|
@ -239,3 +239,6 @@
|
||||||
/sys/bus/aoc/devices/control udfps_set_clock_source 0220 system system
|
/sys/bus/aoc/devices/control udfps_set_clock_source 0220 system system
|
||||||
/sys/bus/aoc/devices/control udfps_get_osc_freq 0440 system system
|
/sys/bus/aoc/devices/control udfps_get_osc_freq 0440 system system
|
||||||
/sys/bus/aoc/devices/control udfps_get_disp_freq 0440 system system
|
/sys/bus/aoc/devices/control udfps_get_disp_freq 0440 system system
|
||||||
|
|
||||||
|
# USB Alt Modes
|
||||||
|
/sys/devices/platform/10cb0000.hsi2c/i2c-*/*-0025/typec/port0/port0-partner/port0-partner.* mode1/active 0664 system system
|
|
@ -111,6 +111,7 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||||
int64_t in_transactionId) {
|
int64_t in_transactionId) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
std::vector<PortStatus> currentPortStatus;
|
std::vector<PortStatus> currentPortStatus;
|
||||||
|
string displayPortPartnerPath;
|
||||||
|
|
||||||
ALOGI("Userspace turn %s USB data signaling. opID:%ld", in_enable ? "on" : "off",
|
ALOGI("Userspace turn %s USB data signaling. opID:%ld", in_enable ? "on" : "off",
|
||||||
in_transactionId);
|
in_transactionId);
|
||||||
|
@ -126,6 +127,27 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||||
ALOGE("Gadget cannot be pulled up");
|
ALOGE("Gadget cannot be pulled up");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WriteStringToFile("1", DISPLAYPORT_ACTIVE_PATH)) {
|
||||||
|
ALOGE("Failed to enable DisplayPort Alt Mode on port");
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully enabled DisplayPort Alt Mode on port");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getDisplayPortUsbPathHelper(&displayPortPartnerPath) == Status::SUCCESS) {
|
||||||
|
size_t pos = displayPortPartnerPath.find("/displayport");
|
||||||
|
if (pos != string::npos) {
|
||||||
|
displayPortPartnerPath = displayPortPartnerPath.substr(0, pos) + "/mode1/active";
|
||||||
|
}
|
||||||
|
if (!WriteStringToFile("1", displayPortPartnerPath)) {
|
||||||
|
ALOGE("Failed to enable DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully enabled DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
setupDisplayPortPoll();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!WriteStringToFile("1", ID_PATH)) {
|
if (!WriteStringToFile("1", ID_PATH)) {
|
||||||
|
@ -147,6 +169,27 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||||
ALOGE("Gadget cannot be pulled down");
|
ALOGE("Gadget cannot be pulled down");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getDisplayPortUsbPathHelper(&displayPortPartnerPath) == Status::SUCCESS) {
|
||||||
|
size_t pos = displayPortPartnerPath.find("/displayport");
|
||||||
|
if (pos != string::npos) {
|
||||||
|
displayPortPartnerPath = displayPortPartnerPath.substr(0, pos) + "/mode1/active";
|
||||||
|
}
|
||||||
|
if (!WriteStringToFile("0", displayPortPartnerPath)) {
|
||||||
|
ALOGE("Failed to disable DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully disabled DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
shutdownDisplayPortPoll(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WriteStringToFile("0", DISPLAYPORT_ACTIVE_PATH)) {
|
||||||
|
ALOGE("Failed to disable DisplayPort Alt Mode on port");
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully disabled DisplayPort Alt Mode on port");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
|
@ -60,6 +60,8 @@ constexpr char kGadgetName[] = "11210000.dwc3";
|
||||||
#define VBUS_PATH NEW_UDC_PATH "dwc3_exynos_otg_b_sess"
|
#define VBUS_PATH NEW_UDC_PATH "dwc3_exynos_otg_b_sess"
|
||||||
#define USB_DATA_PATH NEW_UDC_PATH "usb_data_enabled"
|
#define USB_DATA_PATH NEW_UDC_PATH "usb_data_enabled"
|
||||||
|
|
||||||
|
#define DISPLAYPORT_ACTIVE_PATH "/sys/class/typec/port0/port0.0/mode1/active"
|
||||||
|
|
||||||
#define LINK_TRAINING_STATUS_UNKNOWN "0"
|
#define LINK_TRAINING_STATUS_UNKNOWN "0"
|
||||||
#define LINK_TRAINING_STATUS_SUCCESS "1"
|
#define LINK_TRAINING_STATUS_SUCCESS "1"
|
||||||
#define LINK_TRAINING_STATUS_FAILURE "2"
|
#define LINK_TRAINING_STATUS_FAILURE "2"
|
||||||
|
|
|
@ -8,6 +8,7 @@ on post-fs
|
||||||
chown root system /sys/class/typec/port0/power_role
|
chown root system /sys/class/typec/port0/power_role
|
||||||
chown root system /sys/class/typec/port0/data_role
|
chown root system /sys/class/typec/port0/data_role
|
||||||
chown root system /sys/class/typec/port0/port_type
|
chown root system /sys/class/typec/port0/port_type
|
||||||
|
chown root system /sys/class/typec/port0/port0.0/mode1/active
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/contaminant_detection
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/contaminant_detection
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/contaminant_detection
|
||||||
|
@ -90,6 +91,7 @@ on post-fs
|
||||||
chmod 664 /sys/class/typec/port0/power_role
|
chmod 664 /sys/class/typec/port0/power_role
|
||||||
chmod 664 /sys/class/typec/port0/data_role
|
chmod 664 /sys/class/typec/port0/data_role
|
||||||
chmod 664 /sys/class/typec/port0/port_type
|
chmod 664 /sys/class/typec/port0/port_type
|
||||||
|
chmod 664 /sys/class/typec/port0/port0.0/mode1/active
|
||||||
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
|
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
|
||||||
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
|
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
|
||||||
chmod 664 /sys/devices/platform/11110000.usb/usb_data_enabled
|
chmod 664 /sys/devices/platform/11110000.usb/usb_data_enabled
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue