dp/mst: add SDP stream support

This adds code to initialise the SDP streams
for a sink in the simplest ordering.

I've no idea how you'd want to control the
ordering at this level, so don't bother
until someone comes up with a use case.

Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1449036584-105393-1-git-send-email-libin.yang@linux.intel.com
This commit is contained in:
Libin Yang 2015-12-02 14:09:43 +08:00 коммит произвёл Daniel Vetter
Родитель e8ebd8e2bd
Коммит ef8f9bea13
2 изменённых файлов: 40 добавлений и 5 удалений

Просмотреть файл

@ -666,7 +666,9 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
} }
static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num, static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
u8 vcpi, uint16_t pbn) u8 vcpi, uint16_t pbn,
u8 number_sdp_streams,
u8 *sdp_stream_sink)
{ {
struct drm_dp_sideband_msg_req_body req; struct drm_dp_sideband_msg_req_body req;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
@ -674,6 +676,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
req.u.allocate_payload.port_number = port_num; req.u.allocate_payload.port_number = port_num;
req.u.allocate_payload.vcpi = vcpi; req.u.allocate_payload.vcpi = vcpi;
req.u.allocate_payload.pbn = pbn; req.u.allocate_payload.pbn = pbn;
req.u.allocate_payload.number_sdp_streams = number_sdp_streams;
memcpy(req.u.allocate_payload.sdp_stream_sink, sdp_stream_sink,
number_sdp_streams);
drm_dp_encode_sideband_req(&req, msg); drm_dp_encode_sideband_req(&req, msg);
msg->path_msg = true; msg->path_msg = true;
return 0; return 0;
@ -1562,6 +1567,8 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_sideband_msg_tx *txmsg; struct drm_dp_sideband_msg_tx *txmsg;
struct drm_dp_mst_branch *mstb; struct drm_dp_mst_branch *mstb;
int len, ret; int len, ret;
u8 sinks[DRM_DP_MAX_SDP_STREAMS];
int i;
mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent); mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);
if (!mstb) if (!mstb)
@ -1573,10 +1580,13 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
goto fail_put; goto fail_put;
} }
for (i = 0; i < port->num_sdp_streams; i++)
sinks[i] = i;
txmsg->dst = mstb; txmsg->dst = mstb;
len = build_allocate_payload(txmsg, port->port_num, len = build_allocate_payload(txmsg, port->port_num,
id, id,
pbn); pbn, port->num_sdp_streams, sinks);
drm_dp_queue_down_tx(mgr, txmsg); drm_dp_queue_down_tx(mgr, txmsg);
@ -2258,6 +2268,27 @@ out:
} }
EXPORT_SYMBOL(drm_dp_mst_detect_port); EXPORT_SYMBOL(drm_dp_mst_detect_port);
/**
* drm_dp_mst_port_has_audio() - Check whether port has audio capability or not
* @mgr: manager for this port
* @port: unverified pointer to a port.
*
* This returns whether the port supports audio or not.
*/
bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port)
{
bool ret = false;
port = drm_dp_get_validated_port_ref(mgr, port);
if (!port)
return ret;
ret = port->has_audio;
drm_dp_put_port(port);
return ret;
}
EXPORT_SYMBOL(drm_dp_mst_port_has_audio);
/** /**
* drm_dp_mst_get_edid() - get EDID for an MST port * drm_dp_mst_get_edid() - get EDID for an MST port
* @connector: toplevel connector to get EDID for * @connector: toplevel connector to get EDID for
@ -2283,6 +2314,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
edid = drm_get_edid(connector, &port->aux.ddc); edid = drm_get_edid(connector, &port->aux.ddc);
drm_mode_connector_set_tile_property(connector); drm_mode_connector_set_tile_property(connector);
} }
port->has_audio = drm_detect_monitor_audio(edid);
drm_dp_put_port(port); drm_dp_put_port(port);
return edid; return edid;
} }
@ -2566,7 +2598,7 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m,
seq_printf(m, "%smst: %p, %d\n", prefix, mstb, mstb->num_ports); seq_printf(m, "%smst: %p, %d\n", prefix, mstb, mstb->num_ports);
list_for_each_entry(port, &mstb->ports, next) { list_for_each_entry(port, &mstb->ports, next) {
seq_printf(m, "%sport: %d: ddps: %d ldps: %d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port, port->connector); seq_printf(m, "%sport: %d: ddps: %d ldps: %d, sdp: %d/%d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port->num_sdp_streams, port->num_sdp_stream_sinks, port, port->connector);
if (port->mstb) if (port->mstb)
drm_dp_mst_dump_mstb(m, port->mstb); drm_dp_mst_dump_mstb(m, port->mstb);
} }

Просмотреть файл

@ -94,6 +94,7 @@ struct drm_dp_mst_port {
struct drm_dp_mst_topology_mgr *mgr; struct drm_dp_mst_topology_mgr *mgr;
struct edid *cached_edid; /* for DP logical ports - make tiling work */ struct edid *cached_edid; /* for DP logical ports - make tiling work */
bool has_audio;
}; };
/** /**
@ -215,13 +216,13 @@ struct drm_dp_sideband_msg_rx {
struct drm_dp_sideband_msg_hdr initial_hdr; struct drm_dp_sideband_msg_hdr initial_hdr;
}; };
#define DRM_DP_MAX_SDP_STREAMS 16
struct drm_dp_allocate_payload { struct drm_dp_allocate_payload {
u8 port_number; u8 port_number;
u8 number_sdp_streams; u8 number_sdp_streams;
u8 vcpi; u8 vcpi;
u16 pbn; u16 pbn;
u8 sdp_stream_sink[8]; u8 sdp_stream_sink[DRM_DP_MAX_SDP_STREAMS];
}; };
struct drm_dp_allocate_payload_ack_reply { struct drm_dp_allocate_payload_ack_reply {
@ -484,6 +485,8 @@ int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handl
enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port);
struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);