dptx: MST: Clean-up, documentation, and general organization.

Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2014-08-07 22:00:50 -07:00 committed by Jagannadha Sutradharudu Teki
parent 79093491e1
commit 3d6faf54b3
5 changed files with 1386 additions and 486 deletions

View file

@ -609,7 +609,7 @@ u32 XDptx_AuxRead(XDptx *InstancePtr, u32 Address, u32 NumBytes, void *Data)
* to be written to the RX device.
*
* @return
* - XST_SUCCESS if AUX write request was successfully
* - XST_SUCCESS if the AUX write request was successfully
* acknowledged.
* - XST_DEVICE_NOT_FOUND if no RX device is connected.
* - XST_ERROR_COUNT_MAX if the AUX request timed out.

View file

@ -155,7 +155,6 @@
*
* <b>Limitations</b>
*
* - The driver currently supports single-stream transport (SST) functionality.
* - The driver does not handle audio. See the audio example in the driver
* examples directory for the required sequence for enabling audio.
*
@ -182,32 +181,6 @@
#include "xil_assert.h"
#include "xil_types.h"
/* Need to reorganize this... */
/* To add to xstatus.h. */
#define XST_CRC_ERROR 30L
#define XDPTX_SBMSG_LINK_ADDRESS 0x01
#define XDPTX_SBMSG_ENUM_PATH_RESOURCES 0x10
#define XDPTX_SBMSG_ALLOCATE_PAYLOAD 0x11
#define XDPTX_SBMSG_CLEAR_PAYLOAD_ID_TABLE 0x14
#define XDPTX_SBMSG_REMOTE_DPCD_READ 0x20
#define XDPTX_SBMSG_REMOTE_DPCD_WRITE 0x21
#define XDPTX_SBMSG_REMOTE_I2C_READ 0x22
/* When returning the reason for NACK reply, XST_SBREPLY_NACK is added in order
* to differentiate between the return codes in xstatus.h. */
#define XST_SBREPLY_NACK 1452L
#define XDPTX_SBREPLY_NACK_WRITE_FAILURE 0x01
#define XDPTX_SBREPLY_NACK_INVALID_RAD 0x02
#define XDPTX_SBREPLY_NACK_CRC_FAILURE 0x03
#define XDPTX_SBREPLY_NACK_BAD_PARAM 0x04
#define XDPTX_SBREPLY_NACK_DEFER 0x05
#define XDPTX_SBREPLY_NACK_LINK_FAILURE 0x06
#define XDPTX_SBREPLY_NACK_NO_RESOURCES 0x07
#define XDPTX_SBREPLY_NACK_DPCD_FAIL 0x08
#define XDPTX_SBREPLY_NACK_I2C_NAK 0x09
#define XDPTX_SBREPLY_NACK_ALLOCATE_FAIL 0x0A
/******************* Macros (Inline Functions) Definitions ********************/
/******************************************************************************/
@ -490,10 +463,14 @@ typedef struct {
in use by the video stream. */
} XDptx_MainStreamAttributes;
/**
* This typedef describes a stream when the driver is running in multi-stream
* transport (MST) mode.
*/
typedef struct {
u8 LinkCountTotal; /** The total number of DisplayPort
links from the DisplayPort TX
to the sink device that this MST
links from the DisplayPort TX to
the sink device that this MST
stream is targeting.*/
u8 RelativeAddress[15]; /** The relative address from the
DisplayPort TX to the sink
@ -507,6 +484,49 @@ typedef struct {
MSA configuration. */
} XDptx_MstStream;
/**
* This typedef describes a downstream DisplayPort device when the driver is
* running in multi-stream transport (MST) mode.
*/
typedef struct {
u32 Guid[4]; /**< The global unique identifier (GUID)
of the device. */
u8 RelativeAddress[15]; /**< The relative address from the
DisplayPort TX to this
device. */
u8 DeviceType; /**< The type of DisplayPort device.
Either a branch or sink. */
u8 LinkCountTotal; /**< The total number of DisplayPort
links connecting this device to
the DisplayPort TX. */
u8 DpcdRev; /**< The revision of the device's
DisplayPort Configuration Data
(DPCD). For this device to
support MST features, this value
must represent a protocl version
greater or equal to 1.2. */
u8 MsgCapStatus; /**< This device is capable of sending
and receiving sideband
messages. */
} XDptx_TopologyNode;
/**
* This typedef describes a the entire topology of connected downstream
* DisplayPort devices (from the DisplayPort TX) when the driver is operating
* in multi-stream transport (MST) mode.
*/
typedef struct {
u8 NodeTotal;
XDptx_TopologyNode NodeTable[63];
u8 SinkTotal;
XDptx_TopologyNode *SinkList[63];
} XDptx_Topology;
/**
* This typedef describes a port that is connected to a DisplayPort branch
* device. This structure is used when the driver is operating in multi-stream
* transport (MST) mode.
*/
typedef struct {
u8 InputPort;
u8 PeerDeviceType;
@ -521,6 +541,10 @@ typedef struct {
u8 NumSdpStreamSinks;
} XDptx_SbMsgLinkAddressReplyPortDetail;
/**
* This typedef describes a DisplayPort branch device. This structure is used
* when the driver is operating in multi-stream transport (MST) mode.
*/
typedef struct {
u8 ReplyType;
u8 RequestId;
@ -571,22 +595,6 @@ typedef void (*XDptx_HpdEventHandler)(void *InstancePtr);
*******************************************************************************/
typedef void (*XDptx_HpdPulseHandler)(void *InstancePtr);
typedef struct {
u32 Guid[4];
u8 RelativeAddress[15];
u8 DeviceType;
u8 LinkCountTotal;
u8 DpcdRev;
u8 MsgCapStatus;
} XDptx_TopologyNode;
typedef struct {
u8 NodeTotal;
XDptx_TopologyNode NodeTable[63];
u8 SinkTotal;
XDptx_TopologyNode *SinkList[63];
} XDptx_Topology;
/**
* The XDptx driver instance data. The user is required to allocate a variable
* of this type for every XDptx device in the system. A pointer to a variable of
@ -625,7 +633,11 @@ typedef struct {
for a multi-stream
transport (MST)
stream. */
XDptx_Topology Topology;
XDptx_Topology Topology; /**< The topology of connected
downstream DisplayPort
devices when the driver
is running in MST
mode. */
XDptx_TimerHandler UserTimerWaitUs; /**< Custom user function for
delay/sleep. */
void *UserTimerPtr; /**< Pointer to a timer instance
@ -714,30 +726,53 @@ u32 XDptx_SelfTest(XDptx *InstancePtr);
/* xdptx_sinit.c: Configuration extraction function.*/
XDptx_Config *XDptx_LookupConfig(u16 DeviceId);
/* xdptx_mst.c: Multi-stream transport (MST) functions. */
/* xdptx_mst.c: Multi-stream transport (MST) functions for enabling or disabling
* MST mode. */
void XDptx_MstCfgModeEnable(XDptx *InstancePtr);
void XDptx_MstCfgModeDisable(XDptx *InstancePtr);
u32 XDptx_MstEnable(XDptx *InstancePtr);
u32 XDptx_MstDisable(XDptx *InstancePtr);
/* xdptx_mst.c: Multi-stream transport (MST) functions for enabling or disabling
* MST streams and selecting their associated target sinks. */
void XDptx_MstCfgStreamEnable(XDptx *InstancePtr, u8 Stream);
void XDptx_MstCfgStreamDisable(XDptx *InstancePtr, u8 Stream);
u8 XDptx_MstStreamIsEnabled(XDptx *InstancePtr, u8 Stream);
void XDptx_SetStreamSelectFromSinkList(XDptx *InstancePtr, u8 Stream, u8
SinkNum);
void XDptx_SetStreamSinkRad(XDptx *InstancePtr, u8 Stream, u8 LinkCountTotal,
u8 *RelativeAddress);
u32 XDptx_MstEnable(XDptx *InstancePtr);
u32 XDptx_MstDisable(XDptx *InstancePtr);
/* xdptx_mst.c: Multi-stream transport (MST) functions related to MST topology
* discovery. */
void XDptx_FindAccessibleDpDevices(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress);
void XDptx_WriteGuid(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress,
u32 Guid[4]);
void XDptx_GetGuid(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress,
u32 *Guid);
/* xdptx_mst.c: Multi-stream transport (MST) functions related to MST stream
* allocation. */
u32 XDptx_AllocatePayloadStreams(XDptx *InstancePtr);
void XDptx_SetStreamSelectFromSinkList(XDptx *InstancePtr, u8 Stream, u8 SinkNum);
void XDptx_SetStreamSinkRad(XDptx *InstancePtr, u8 Stream, u8 LinkCountTotal, u8 *RelativeAddress);
u32 XDptx_AllocatePayloadVcIdTable(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress, u8 VcId, u16 Pbn, u8 Ts);
u32 XDptx_ClearPayloadVcIdTable(XDptx *InstancePtr);
void XDptx_FindAccessibleDpDevices(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress);
void XDptx_WriteGuid(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, u32 Guid[4]);
void XDptx_GetGuid(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, u32 *Guid);
/* Sideband messages. */
u32 XDptx_SendSbMsgRemoteDpcdWrite(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, u32 DpcdAddress, u8 BytesToWrite, u8 *WriteData);
u32 XDptx_SendSbMsgRemoteDpcdRead(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, u32 DpcdAddress, u8 BytesToRead, u8 *ReadData);
u32 XDptx_SendSbMsgRemoteIicRead(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, u32 IicDeviceId, u8 BytesToRead, u8 *ReadData);
u32 XDptx_SendSbMsgLinkAddress(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, XDptx_SbMsgLinkAddressReplyDeviceInfo *FormatReply);
u32 XDptx_SendSbMsgEnumPathResources(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, u16 *AvailPbn, u16 *FullPbn);
u32 XDptx_SendSbMsgAllocatePayload(XDptx *InstancePtr, u8 LinkCountTotal, u8 *RelativeAddress, u8 VcId, u16 Pbn);
/* xdptx_mst.c: Multi-stream transport (MST) functions for issuing sideband
* messages. */
u32 XDptx_SendSbMsgRemoteDpcdWrite(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress, u32 DpcdAddress, u8 BytesToWrite, u8 *WriteData);
u32 XDptx_SendSbMsgRemoteDpcdRead(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress, u32 DpcdAddress, u8 BytesToRead, u8 *ReadData);
u32 XDptx_SendSbMsgRemoteIicRead(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress, u32 IicDeviceId, u8 BytesToRead, u8 *ReadData);
u32 XDptx_SendSbMsgLinkAddress(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress, XDptx_SbMsgLinkAddressReplyDeviceInfo *DeviceInfo);
u32 XDptx_SendSbMsgEnumPathResources(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress, u16 *AvailPbn, u16 *FullPbn);
u32 XDptx_SendSbMsgAllocatePayload(XDptx *InstancePtr, u8 LinkCountTotal,
u8 *RelativeAddress, u8 VcId, u16 Pbn);
u32 XDptx_SendSbMsgClearPayloadIdTable(XDptx *InstancePtr);
#endif /* XDPTX_H_ */

View file

@ -1156,6 +1156,32 @@
#define XDPTX_EDID_DTD_SIGNAL_VPOLARITY_SHIFT 2
/* @} */
/******************************************************************************/
/**
* Multi-stream transport (MST) definitions.
*
*******************************************************************************/
/** @name Stream identification.
* @{
*/
#define XDPTX_STREAM_ID1 1
#define XDPTX_STREAM_ID2 2
#define XDPTX_STREAM_ID3 3
#define XDPTX_STREAM_ID4 4
/* @} */
/** @name Sideband message codes when the driver is in MST mode.
* @{
*/
#define XDPTX_SBMSG_LINK_ADDRESS 0x01
#define XDPTX_SBMSG_ENUM_PATH_RESOURCES 0x10
#define XDPTX_SBMSG_ALLOCATE_PAYLOAD 0x11
#define XDPTX_SBMSG_CLEAR_PAYLOAD_ID_TABLE 0x14
#define XDPTX_SBMSG_REMOTE_DPCD_READ 0x20
#define XDPTX_SBMSG_REMOTE_DPCD_WRITE 0x21
#define XDPTX_SBMSG_REMOTE_I2C_READ 0x22
/* @} */
/******************* Macros (Inline Functions) Definitions ********************/
/** @name Register access macro definitions.

File diff suppressed because it is too large Load diff

View file

@ -663,6 +663,24 @@ void XDptx_SetMsaValues(XDptx *InstancePtr, u8 Stream)
StreamOffset[Stream - 1], MsaConfig->InitWait);
}
/******************************************************************************/
/**
* When the driver is in multi-stream transport (MST) mode, this function will
* make the necessary calculations to describe a stream in MST mode. The key
* values are the payload bandwidth number (PBN), the number of timeslots
* required for allocating the bandwidth, and the average bytes per transfer
* unit (both the integer and the fractional part).
*
* @param InstancePtr is a pointer to the XDptx instance.
* @param Stream is the stream number to make the calculations for.
* @param BitsPerPixel is the number of bits that is used to store one
* pixel.
*
* @return None.
*
* @note None.
*
*******************************************************************************/
static void XDptx_CalculateTs(XDptx *InstancePtr, u8 Stream, u8 BitsPerPixel)
{
XDptx_MainStreamAttributes *MsaConfig =