drm/dp_mst: Add new quirk for Synaptics MST hubs
authorMikita Lipski <mikita.lipski@amd.com>
Fri, 20 Sep 2019 19:44:56 +0000 (15:44 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 9 Jan 2020 23:07:46 +0000 (18:07 -0500)
Synaptics DP1.4 hubs (BRANCH_ID 0x90CC24) do not
support virtual DPCD registers, but do support DSC.
The DSC caps can be read from the physical aux,
like in SST DSC. These hubs have many different
DEVICE_IDs.  Add a new quirk to detect this case.

v2: Fix error when checking return of drm_dp_read_desc

Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/drm_dp_helper.c
drivers/gpu/drm/drm_dp_mst_topology.c
include/drm/drm_dp_helper.h

index 2faef8b..374cedc 100644 (file)
@@ -1165,6 +1165,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = {
        { OUI(0x00, 0x10, 0xfa), DEVICE_ID_ANY, false, BIT(DP_DPCD_QUIRK_NO_PSR) },
        /* CH7511 seems to leave SINK_COUNT zeroed */
        { OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) },
+       /* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */
+       { OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) },
 };
 
 #undef OUI
index 2b20caa..480c71a 100644 (file)
@@ -5148,6 +5148,7 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port)
 {
        struct drm_dp_mst_port *immediate_upstream_port;
        struct drm_dp_mst_port *fec_port;
+       struct drm_dp_desc desc = { 0 };
        u8 endpoint_fec;
        u8 endpoint_dsc;
 
@@ -5201,6 +5202,32 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port)
                return &port->aux;
 
        /*
+        * Synaptics quirk
+        * Applies to ports for which:
+        * - Physical aux has Synaptics OUI
+        * - DPv1.4 or higher
+        * - Port is on primary branch device
+        * - Not a VGA adapter (DP_DWN_STRM_PORT_TYPE_ANALOG)
+        */
+       if (drm_dp_read_desc(port->mgr->aux, &desc, true))
+               return NULL;
+
+       if (drm_dp_has_quirk(&desc, DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) &&
+           port->mgr->dpcd[DP_DPCD_REV] >= DP_DPCD_REV_14 &&
+           port->parent == port->mgr->mst_primary) {
+               u8 downstreamport;
+
+               if (drm_dp_dpcd_read(&port->aux, DP_DOWNSTREAMPORT_PRESENT,
+                                    &downstreamport, 1) < 0)
+                       return NULL;
+
+               if ((downstreamport & DP_DWN_STRM_PORT_PRESENT) &&
+                  ((downstreamport & DP_DWN_STRM_PORT_TYPE_MASK)
+                    != DP_DWN_STRM_PORT_TYPE_ANALOG))
+                       return port->mgr->aux;
+       }
+
+       /*
         * The check below verifies if the MST sink
         * connected to the GPU is capable of DSC -
         * therefore the endpoint needs to be
index 8f8f363..0aeaf4a 100644 (file)
@@ -1522,6 +1522,13 @@ enum drm_dp_quirk {
         * The driver should ignore SINK_COUNT during detection.
         */
        DP_DPCD_QUIRK_NO_SINK_COUNT,
+       /**
+        * @DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD:
+        *
+        * The device supports MST DSC despite not supporting Virtual DPCD.
+        * The DSC caps can be read from the physical aux instead.
+        */
+       DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD,
 };
 
 /**