usb: report displayport capable port partner disconnect to drm
On port-partner remove, write to drm's usbc_cable_disconnect node if setupDisplayPortPoll() had run previously in the connection, flagged by mPartnerSupportsDisplayPort. Test: manual test on device Bug: 303820069 Change-Id: I3478f2f027540972647044716a1a3e832ae1b152 Signed-off-by: RD Babiera <rdbabiera@google.com> (cherry picked from commit 3082aa7f4877e737f06f2fb170778dac56fb7d0a)
This commit is contained in:
parent
17b40f0246
commit
39c864b17b
3 changed files with 20 additions and 0 deletions
|
@ -1217,6 +1217,16 @@ static void uevent_event(uint32_t /*epevents*/, struct data *payload) {
|
|||
payload->usb->mPartnerUp = true;
|
||||
pthread_cond_signal(&payload->usb->mPartnerCV);
|
||||
pthread_mutex_unlock(&payload->usb->mPartnerLock);
|
||||
} else if (std::regex_match(cp, std::regex("(remove)(.*)(-partner)"))) {
|
||||
string drmDisconnectPath = string(kDisplayPortDrmPath) + "usbc_cable_disconnect";
|
||||
|
||||
if (payload->usb->mPartnerSupportsDisplayPort) {
|
||||
ALOGI("displayport partner removed");
|
||||
if (!WriteStringToFile("1", drmDisconnectPath)) {
|
||||
ALOGE("Failed to signal disconnect to drm");
|
||||
}
|
||||
payload->usb->mPartnerSupportsDisplayPort = false;
|
||||
}
|
||||
} else if (!strncmp(cp, "DEVTYPE=typec_", strlen("DEVTYPE=typec_")) ||
|
||||
!strncmp(cp, "DRIVER=max77759tcpc",
|
||||
strlen("DRIVER=max77759tcpc")) ||
|
||||
|
@ -1383,6 +1393,8 @@ ScopedAStatus Usb::setCallback(const shared_ptr<IUsbCallback>& in_callback) {
|
|||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
/***** DisplayPort Alt Mode Helpers *****/
|
||||
|
||||
Status Usb::getDisplayPortUsbPathHelper(string *path) {
|
||||
DIR *dp;
|
||||
Status result = Status::ERROR;
|
||||
|
@ -1799,6 +1811,7 @@ void Usb::setupDisplayPortPoll() {
|
|||
int ret;
|
||||
|
||||
ALOGI("usbdp: setup: beginning setup for displayport poll thread");
|
||||
mPartnerSupportsDisplayPort = true;
|
||||
|
||||
/*
|
||||
* If thread is currently starting, then it hasn't setup DisplayPort fd's, and we can abandon
|
||||
|
|
|
@ -156,6 +156,11 @@ struct Usb : public BnUsb {
|
|||
* eventfd to monitor whether a connection results in DisplayPort Alt Mode activating.
|
||||
*/
|
||||
int mDisplayPortActivateTimer;
|
||||
/*
|
||||
* Indicates whether or not port partner supports DisplayPort, and is used to
|
||||
* communicate to the drm when the port partner physically disconnects.
|
||||
*/
|
||||
bool mPartnerSupportsDisplayPort;
|
||||
|
||||
private:
|
||||
pthread_t mPoll;
|
||||
|
|
|
@ -74,6 +74,7 @@ on post-fs
|
|||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
|
||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/pin_assignment
|
||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/link_status
|
||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/usbc_cable_disconnect
|
||||
chown root system /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
|
||||
chown root system /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
|
||||
chown root system /sys/devices/platform/11110000.usb/usb_data_enabled
|
||||
|
@ -150,4 +151,5 @@ on post-fs
|
|||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
|
||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/pin_assignment
|
||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/link_status
|
||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/usbc_cable_disconnect
|
||||
chmod 664 /sys/devices/platform/google,pogo/enable_usb
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue