dptx: MST: Added check for MST capabilities before enabling.

Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2014-08-10 16:10:18 -07:00 committed by Jagannadha Sutradharudu Teki
parent abd449945c
commit 71f96698d0
4 changed files with 82 additions and 1 deletions

View file

@ -170,6 +170,19 @@ u32 Dptx_MstExample(XDptx *InstancePtr, u16 DeviceId)
return XST_FAILURE;
}
Status = XDptx_MstCapable(InstancePtr);
if (Status != XST_SUCCESS) {
xil_printf("The immediate downstream DisplayPort device does "
"not have MST capabilities.\n");
/* If the immediate downstream RX device is an MST monitor and
* the DisplayPort Configuration Data (DPCD) does not indicate
* MST capability, it is likely that the MST or DisplayPort v1.2
* option must be selected from the monitor's option menu. */
xil_printf("Check that the RX device is operating with a "
"DisplayPort version greater or equal to 1.2.\n");
return XST_FAILURE;
}
/* A DisplayPort connection must exist at this point. See the interrupt
* and polling examples for waiting for connection events. */
Status = Dptx_StartLink(InstancePtr);

View file

@ -760,6 +760,7 @@ XDptx_Config *XDptx_LookupConfig(u16 DeviceId);
* MST mode. */
void XDptx_MstCfgModeEnable(XDptx *InstancePtr);
void XDptx_MstCfgModeDisable(XDptx *InstancePtr);
u32 XDptx_MstCapable(XDptx *InstancePtr);
u32 XDptx_MstEnable(XDptx *InstancePtr);
u32 XDptx_MstDisable(XDptx *InstancePtr);

View file

@ -854,7 +854,7 @@
#define XDPTX_DPCD_FAUX_FORWARD_CH_STATUS 0x00280
#define XDPTX_DPCD_FAUX_BACK_CH_DRIVE_SET 0x00281
#define XDPTX_DPCD_FAUX_BACK_CH_SYM_ERR_COUNT_CTRL 0x00282
#define XDPTX_DPCD_PAYLOAD_TABLE_UPDATE_STATUS 0x002C0
#define XDPTX_DPCD_PAYLOAD_TABLE_UPDATE_STATUS 0x002C0
#define XDPTX_DPCD_VC_PAYLOAD_ID_SLOT(SlotNum) \
(XDPTX_DPCD_PAYLOAD_TABLE_UPDATE_STATUS + SlotNum)
/* @} */

View file

@ -226,6 +226,60 @@ void XDptx_MstCfgModeDisable(XDptx *InstancePtr)
InstancePtr->MstEnable = 0;
}
/******************************************************************************/
/**
* This function will check if the immediate downstream RX device is capable of
* multi-stream transport (MST) mode. A DisplayPort Configuration Data (DPCD)
* version of 1.2 or higher is required and the MST capability bit in the DPCD
* must be set for this function to return XST_SUCCESS.
*
* @param InstancePtr is a pointer to the XDptx instance.
*
* @return
* - XST_SUCCESS if the RX device is MST capable.
* - XST_NO_FEATURE if the RX device does not support MST.
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
* - XST_ERROR_COUNT_MAX if an AUX read request timed out.
* - XST_FAILURE otherwise - if an AUX read transaction failed.
*
* @note None.
*
*******************************************************************************/
u32 XDptx_MstCapable(XDptx *InstancePtr)
{
u32 Status;
u8 AuxData;
/* Verify arguments. */
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
/* Check that the RX device has a DisplayPort Configuration Data (DPCD)
* version greater than or equal to 1.2 to be able to support MST
* functionality. */
Status = XDptx_AuxRead(InstancePtr, XDPTX_DPCD_REV, 1, &AuxData);
if (Status != XST_SUCCESS) {
/* The AUX read transaction failed. */
return Status;
}
else if (AuxData < 0x12) {
return XST_NO_FEATURE;
}
/* Check if the RX device has MST capabilities.. */
Status = XDptx_AuxRead(InstancePtr, XDPTX_DPCD_MSTM_CAP, 1, &AuxData);
if (Status != XST_SUCCESS) {
/* The AUX read transaction failed. */
return Status;
}
else if ((AuxData & XDPTX_DPCD_MST_CAP_MASK) !=
XDPTX_DPCD_MST_CAP_MASK) {
return XST_NO_FEATURE;
}
return XST_SUCCESS;
}
/******************************************************************************/
/**
* This function will enable multi-stream transport (MST) mode in both the
@ -236,6 +290,10 @@ void XDptx_MstCfgModeDisable(XDptx *InstancePtr)
* @return
* - XST_SUCCESS if MST mode has been successful enabled in
* hardware.
* - XST_NO_FEATURE if the immediate downstream RX device does not
* support MST - that is, if its DisplayPort Configuration Data
* (DPCD) version is less than 1.2, or if the DPCD indicates that
* it has no DPCD capabilities.
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
* - XST_ERROR_COUNT_MAX if an AUX request timed out.
* - XST_FAILURE otherwise - if an AUX read or write transaction
@ -253,6 +311,13 @@ u32 XDptx_MstEnable(XDptx *InstancePtr)
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
/* Check if the immediate downstream RX device has MST capabilities. */
Status = XDptx_MstCapable(InstancePtr);
if (Status != XST_SUCCESS) {
/* The RX device is not downstream capable. */
return Status;
}
/* HPD long pulse used for upstream notification. */
AuxData = 0;
Status = XDptx_AuxWrite(InstancePtr, XDPTX_DPCD_BRANCH_DEVICE_CTRL, 1,
@ -276,6 +341,7 @@ u32 XDptx_MstEnable(XDptx *InstancePtr)
XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_TX_MST_CONFIG,
XDPTX_TX_MST_CONFIG_MST_EN_MASK);
XDptx_MstCfgModeEnable(InstancePtr);
return XST_SUCCESS;
}
@ -316,6 +382,7 @@ u32 XDptx_MstDisable(XDptx *InstancePtr)
/* Disable MST mode in the DisplayPort TX. */
XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_TX_MST_CONFIG, 0x0);
XDptx_MstCfgModeDisable(InstancePtr);
return XST_SUCCESS;
}