Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14cc011b authored by RD Babiera's avatar RD Babiera Committed by Android (Google) Code Review
Browse files

Merge "Add hpd and link training status to AltModeData"

parents 6a787d5c 07ce7599
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -40,5 +40,7 @@ union AltModeData {
    android.hardware.usb.DisplayPortAltModeStatus partnerSinkStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN;
    android.hardware.usb.DisplayPortAltModeStatus cableStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN;
    android.hardware.usb.DisplayPortAltModePinAssignment pinAssignment = android.hardware.usb.DisplayPortAltModePinAssignment.NONE;
    boolean hpd = false;
    android.hardware.usb.LinkTrainingStatus linkTrainingStatus = android.hardware.usb.LinkTrainingStatus.UNKNOWN;
  }
}
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.usb;
@Backing(type="int") @VintfStability
enum LinkTrainingStatus {
  UNKNOWN = 0,
  SUCCESS = 1,
  FAILURE = 2,
}
+13 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.hardware.usb;

import android.hardware.usb.DisplayPortAltModePinAssignment;
import android.hardware.usb.DisplayPortAltModeStatus;
import android.hardware.usb.LinkTrainingStatus;

@VintfStability
union AltModeData {
@@ -42,6 +43,18 @@ union AltModeData {
         * negotiated between the device, port partner, and cable.
         */
        DisplayPortAltModePinAssignment pinAssignment = DisplayPortAltModePinAssignment.NONE;
        /**
         * Indicates DisplayPort Hot Plug Detection (HPD) status for a partner
         * sink device. If true, then a DisplayPort Alt Mode partner sink is
         * connected and powered on, and if false, the partner sink is not
         * powered or no partner sink is connected.
         */
        boolean hpd = false;
        /**
         * Indicates the current status of DisplayPort link training over USB-C
         * for the attached DisplayPort Alt Mode partner sink.
         */
        LinkTrainingStatus linkTrainingStatus = LinkTrainingStatus.UNKNOWN;
    }
    DisplayPortAltModeData displayPortAltModeData;
}
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.usb;

@VintfStability
@Backing(type="int")
/**
 * Indicates the current status of DisplayPort link training over USB-C for the
 * attached DisplayPort Alt Mode partner sink as described in DisplayPort
 * v1.4/2.1.
 */
enum LinkTrainingStatus {
    /*
     * Indicates the link training result is not available because link training
     * has not completed or initiated yet.
     */
    UNKNOWN = 0,
    /*
     * Indicates that link training has completed and optimal settings for data
     * transmission between the sink and source device have successfully been
     * negotiated.
     */
    SUCCESS = 1,
    /*
     * Indicates that link training has failed and the link initialization has
     * terminated.
     */
    FAILURE = 2,
}
+5 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ using ::aidl::android::hardware::usb::DisplayPortAltModePinAssignment;
using ::aidl::android::hardware::usb::DisplayPortAltModeStatus;
using ::aidl::android::hardware::usb::IUsb;
using ::aidl::android::hardware::usb::IUsbCallback;
using ::aidl::android::hardware::usb::LinkTrainingStatus;
using ::aidl::android::hardware::usb::PlugOrientation;
using ::aidl::android::hardware::usb::PortDataRole;
using ::aidl::android::hardware::usb::PortMode;
@@ -724,6 +725,10 @@ TEST_P(UsbAidlTest, dpAltModeValues) {
                  (int)DisplayPortAltModePinAssignment::NONE);
      EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <=
                  (int)DisplayPortAltModePinAssignment::F);

      EXPECT_TRUE((int)displayPortAltModeData.linkTrainingStatus >=
                  (int)LinkTrainingStatus::UNKNOWN);
      EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <= (int)LinkTrainingStatus::FAILURE);
    }
  }