drm/amd/display: Add audio/video ContainerId implementation
authorxhdu <Duke.Du@amd.com>
Tue, 21 Mar 2017 15:05:32 +0000 (11:05 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 21:20:54 +0000 (17:20 -0400)
Leave hardcoded if no ContainerId provided by DM.

Signed-off-by: Duke Du <Duke.Du@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_sink.c
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
drivers/gpu/drm/amd/display/dc/dc.h

index 8a204731301dbee7437a2103ca557313fc6d5041..da9955675fbf838d941c4e19123a491d69fb4517 100644 (file)
@@ -45,7 +45,10 @@ struct sink {
 
 static void destruct(struct sink *sink)
 {
-
+       if (sink->protected.public.dc_container_id) {
+               dm_free(sink->protected.public.dc_container_id);
+               sink->protected.public.dc_container_id = NULL;
+       }
 }
 
 static bool construct(struct sink *sink, const struct dc_sink_init_data *init_params)
@@ -63,6 +66,7 @@ static bool construct(struct sink *sink, const struct dc_sink_init_data *init_pa
        sink->protected.public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
        sink->protected.public.converter_disable_audio =
                        init_params->converter_disable_audio;
+       sink->protected.public.dc_container_id = NULL;
 
        return true;
 }
@@ -113,6 +117,39 @@ alloc_fail:
        return NULL;
 }
 
+bool dc_sink_get_container_id(struct dc_sink *dc_sink, struct dc_container_id *container_id)
+{
+       if (dc_sink && container_id && dc_sink->dc_container_id) {
+               memmove(&container_id->guid, &dc_sink->dc_container_id->guid,
+                       sizeof(container_id->guid));
+               memmove(&container_id->portId, &dc_sink->dc_container_id->portId,
+                       sizeof(container_id->portId));
+               container_id->manufacturerName = dc_sink->dc_container_id->manufacturerName;
+               container_id->productCode = dc_sink->dc_container_id->productCode;
+               return true;
+       }
+       return false;
+}
+
+bool dc_sink_set_container_id(struct dc_sink *dc_sink, const struct dc_container_id *container_id)
+{
+       if (dc_sink && container_id) {
+               if (!dc_sink->dc_container_id)
+                       dc_sink->dc_container_id = dm_alloc(sizeof(*dc_sink->dc_container_id));
+
+               if (dc_sink->dc_container_id) {
+                       memmove(&dc_sink->dc_container_id->guid, &container_id->guid,
+                               sizeof(container_id->guid));
+                       memmove(&dc_sink->dc_container_id->portId, &container_id->portId,
+                               sizeof(container_id->portId));
+                       dc_sink->dc_container_id->manufacturerName = container_id->manufacturerName;
+                       dc_sink->dc_container_id->productCode = container_id->productCode;
+                       return true;
+               }
+       }
+       return false;
+}
+
 /*******************************************************************************
  * Protected functions - visible only inside of DC (not visible in DM)
  ******************************************************************************/
index bafba1f13a1a117b20af4c733a33219b865df817..512a53bdc32f0ca9d96bf7abd5db1dc265ae7db6 100644 (file)
@@ -76,9 +76,17 @@ static bool construct(struct core_stream *stream,
        stream->public.audio_info.product_id = dc_sink_data->edid_caps.product_id;
        stream->public.audio_info.flags.all = dc_sink_data->edid_caps.speaker_flags;
 
-       /* TODO - Unhardcode port_id */
-       stream->public.audio_info.port_id[0] = 0x5558859e;
-       stream->public.audio_info.port_id[1] = 0xd989449;
+       if (dc_sink_data->dc_container_id != NULL) {
+               struct dc_container_id *dc_container_id = dc_sink_data->dc_container_id;
+
+               stream->public.audio_info.port_id[0] = dc_container_id->portId[0];
+               stream->public.audio_info.port_id[1] = dc_container_id->portId[1];
+       } else {
+               /* TODO - WindowDM has implemented,
+               other DMs need Unhardcode port_id */
+               stream->public.audio_info.port_id[0] = 0x5558859e;
+               stream->public.audio_info.port_id[1] = 0xd989449;
+       }
 
        /* EDID CAP translation for HDMI 2.0 */
        stream->public.timing.flags.LTE_340MCSC_SCRAMBLE = dc_sink_data->edid_caps.lte_340mcsc_scramble;
index 8b033ba5df6ea6c1db8decbbe27c80000d3c0c05..b3d5b922aae4799f78b898022f2ee9ab87a5ff43 100644 (file)
@@ -695,6 +695,17 @@ bool dc_link_dp_set_test_pattern(
  * Sink Interfaces - A sink corresponds to a display output device
  ******************************************************************************/
 
+struct dc_container_id {
+       // 128bit GUID in binary form
+       unsigned char  guid[16];
+       // 8 byte port ID -> ELD.PortID
+       unsigned int   portId[2];
+       // 128bit GUID in binary formufacturer name -> ELD.ManufacturerName
+       unsigned short manufacturerName;
+       // 2 byte product code -> ELD.ProductCode
+       unsigned short productCode;
+};
+
 /*
  * The sink structure contains EDID and other display device properties
  */
@@ -702,6 +713,7 @@ struct dc_sink {
        enum signal_type sink_signal;
        struct dc_edid dc_edid; /* raw edid */
        struct dc_edid_caps edid_caps; /* parse display caps */
+       struct dc_container_id *dc_container_id;
        uint32_t dongle_max_pix_clk;
        bool converter_disable_audio;
 };
@@ -719,6 +731,8 @@ struct dc_sink_init_data {
 };
 
 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
+bool dc_sink_get_container_id(struct dc_sink *dc_sink, struct dc_container_id *container_id);
+bool dc_sink_set_container_id(struct dc_sink *dc_sink, const struct dc_container_id *container_id);
 
 /*******************************************************************************
  * Cursor interfaces - To manages the cursor within a stream