Re: [PATCH 1/2] drm/amd/display: query hdcp capability during link detect
Reviewed-by: Rodrigo Siqueira On 04/01, Bhawanpreet Lakha wrote: > [Why] > Query the hdcp caps of a link, it is useful and can be reported to the user > > [How] > Create a query function and call it during link detect > > Signed-off-by: Bhawanpreet Lakha > --- > drivers/gpu/drm/amd/display/dc/core/dc_link.c | 56 > drivers/gpu/drm/amd/display/dc/dc.h | 41 + > drivers/gpu/drm/amd/display/dc/dc_link.h | 3 + > .../gpu/drm/amd/display/dc/hdcp/hdcp_msg.c| 89 +++ > .../gpu/drm/amd/display/include/hdcp_types.h | 7 ++ > 5 files changed, 196 insertions(+) > > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c > b/drivers/gpu/drm/amd/display/dc/core/dc_link.c > index a93997ff0419..49c63e27dfe9 100644 > --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c > @@ -514,6 +514,50 @@ static void link_disconnect_remap(struct dc_sink > *prev_sink, struct dc_link *lin > link->local_sink = prev_sink; > } > > +#if defined(CONFIG_DRM_AMD_DC_HDCP) > +static void query_hdcp_capability(enum signal_type signal, struct dc_link > *link) > +{ > + struct hdcp_protection_message msg22; > + struct hdcp_protection_message msg14; > + > + memset(&msg22, 0, sizeof(struct hdcp_protection_message)); > + memset(&msg14, 0, sizeof(struct hdcp_protection_message)); > + memset(link->hdcp_caps.rx_caps.raw, 0, > + sizeof(link->hdcp_caps.rx_caps.raw)); > + > + if ((link->connector_signal == SIGNAL_TYPE_DISPLAY_PORT && > + link->ddc->transaction_type == > + DDC_TRANSACTION_TYPE_I2C_OVER_AUX) || > + link->connector_signal == SIGNAL_TYPE_EDP) { > + msg22.data = link->hdcp_caps.rx_caps.raw; > + msg22.length = sizeof(link->hdcp_caps.rx_caps.raw); > + msg22.msg_id = HDCP_MESSAGE_ID_RX_CAPS; > + } else { > + msg22.data = &link->hdcp_caps.rx_caps.fields.version; > + msg22.length = sizeof(link->hdcp_caps.rx_caps.fields.version); > + msg22.msg_id = HDCP_MESSAGE_ID_HDCP2VERSION; > + } > + msg22.version = HDCP_VERSION_22; > + msg22.link = HDCP_LINK_PRIMARY; > + msg22.max_retries = 5; > + dc_process_hdcp_msg(signal, link, &msg22); > + > + if (signal == SIGNAL_TYPE_DISPLAY_PORT || signal == > SIGNAL_TYPE_DISPLAY_PORT_MST) { > + enum hdcp_message_status status = HDCP_MESSAGE_UNSUPPORTED; > + > + msg14.data = &link->hdcp_caps.bcaps.raw; > + msg14.length = sizeof(link->hdcp_caps.bcaps.raw); > + msg14.msg_id = HDCP_MESSAGE_ID_READ_BCAPS; > + msg14.version = HDCP_VERSION_14; > + msg14.link = HDCP_LINK_PRIMARY; > + msg14.max_retries = 5; > + > + status = dc_process_hdcp_msg(signal, link, &msg14); > + } > + > +} > +#endif > + > static void read_current_link_settings_on_detect(struct dc_link *link) > { > union lane_count_set lane_count_set = { {0} }; > @@ -606,6 +650,12 @@ static bool detect_dp(struct dc_link *link, > dal_ddc_service_set_transaction_type(link->ddc, > > sink_caps->transaction_type); > > +#if defined(CONFIG_DRM_AMD_DC_HDCP) > + /* In case of fallback to SST when topology discovery > below fails > + * HDCP caps will be querried again later by the upper > layer (caller > + * of this function). */ > + query_hdcp_capability(SIGNAL_TYPE_DISPLAY_PORT_MST, > link); > +#endif > /* >* This call will initiate MST topology discovery. Which >* will detect MST ports and add new DRM connector DRM > @@ -975,6 +1025,9 @@ static bool dc_link_detect_helper(struct dc_link *link, >* TODO debug why Dell 2413 doesn't like >* two link trainings >*/ > +#if defined(CONFIG_DRM_AMD_DC_HDCP) > + query_hdcp_capability(sink->sink_signal, link); > +#endif > > // verify link cap for SST non-seamless boot > if (!perform_dp_seamless_boot) > @@ -988,6 +1041,9 @@ static bool dc_link_detect_helper(struct dc_link *link, > sink = prev_sink; > prev_sink = NULL; > } > +#if defined(CONFIG_DRM_AMD_DC_HDCP) > + query_hdcp_capability(sink->sink_signal, link); > +#endif > } > > /* HDMI-DVI Dongle */ > diff --git a/drivers/gpu/drm/amd/display/dc/dc.h > b/drivers/gpu/drm/amd/display/dc/dc.h > index 92123b0d1196..9235d04c32dc 100644 > --- a/drivers/gpu/drm/amd/display/dc/dc.h > +++ b/drivers/gpu/drm/amd/display/dc/dc.h > @@ -29,6 +29,9 @@ > #include "dc_types.h" >
Re: [PATCH 1/2] drm/amd/display: query hdcp capability during link detect
Both patches look good to me. The series is Reviewed-by: Mikita Lipski Thanks, Mikita On 2020-04-01 5:00 p.m., Bhawanpreet Lakha wrote: [Why] Query the hdcp caps of a link, it is useful and can be reported to the user [How] Create a query function and call it during link detect Signed-off-by: Bhawanpreet Lakha --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 56 drivers/gpu/drm/amd/display/dc/dc.h | 41 + drivers/gpu/drm/amd/display/dc/dc_link.h | 3 + .../gpu/drm/amd/display/dc/hdcp/hdcp_msg.c| 89 +++ .../gpu/drm/amd/display/include/hdcp_types.h | 7 ++ 5 files changed, 196 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index a93997ff0419..49c63e27dfe9 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -514,6 +514,50 @@ static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *lin link->local_sink = prev_sink; } +#if defined(CONFIG_DRM_AMD_DC_HDCP) +static void query_hdcp_capability(enum signal_type signal, struct dc_link *link) +{ + struct hdcp_protection_message msg22; + struct hdcp_protection_message msg14; + + memset(&msg22, 0, sizeof(struct hdcp_protection_message)); + memset(&msg14, 0, sizeof(struct hdcp_protection_message)); + memset(link->hdcp_caps.rx_caps.raw, 0, + sizeof(link->hdcp_caps.rx_caps.raw)); + + if ((link->connector_signal == SIGNAL_TYPE_DISPLAY_PORT && + link->ddc->transaction_type == + DDC_TRANSACTION_TYPE_I2C_OVER_AUX) || + link->connector_signal == SIGNAL_TYPE_EDP) { + msg22.data = link->hdcp_caps.rx_caps.raw; + msg22.length = sizeof(link->hdcp_caps.rx_caps.raw); + msg22.msg_id = HDCP_MESSAGE_ID_RX_CAPS; + } else { + msg22.data = &link->hdcp_caps.rx_caps.fields.version; + msg22.length = sizeof(link->hdcp_caps.rx_caps.fields.version); + msg22.msg_id = HDCP_MESSAGE_ID_HDCP2VERSION; + } + msg22.version = HDCP_VERSION_22; + msg22.link = HDCP_LINK_PRIMARY; + msg22.max_retries = 5; + dc_process_hdcp_msg(signal, link, &msg22); + + if (signal == SIGNAL_TYPE_DISPLAY_PORT || signal == SIGNAL_TYPE_DISPLAY_PORT_MST) { + enum hdcp_message_status status = HDCP_MESSAGE_UNSUPPORTED; + + msg14.data = &link->hdcp_caps.bcaps.raw; + msg14.length = sizeof(link->hdcp_caps.bcaps.raw); + msg14.msg_id = HDCP_MESSAGE_ID_READ_BCAPS; + msg14.version = HDCP_VERSION_14; + msg14.link = HDCP_LINK_PRIMARY; + msg14.max_retries = 5; + + status = dc_process_hdcp_msg(signal, link, &msg14); + } + +} +#endif + static void read_current_link_settings_on_detect(struct dc_link *link) { union lane_count_set lane_count_set = { {0} }; @@ -606,6 +650,12 @@ static bool detect_dp(struct dc_link *link, dal_ddc_service_set_transaction_type(link->ddc, sink_caps->transaction_type); +#if defined(CONFIG_DRM_AMD_DC_HDCP) + /* In case of fallback to SST when topology discovery below fails +* HDCP caps will be querried again later by the upper layer (caller +* of this function). */ + query_hdcp_capability(SIGNAL_TYPE_DISPLAY_PORT_MST, link); +#endif /* * This call will initiate MST topology discovery. Which * will detect MST ports and add new DRM connector DRM @@ -975,6 +1025,9 @@ static bool dc_link_detect_helper(struct dc_link *link, * TODO debug why Dell 2413 doesn't like * two link trainings */ +#if defined(CONFIG_DRM_AMD_DC_HDCP) + query_hdcp_capability(sink->sink_signal, link); +#endif // verify link cap for SST non-seamless boot if (!perform_dp_seamless_boot) @@ -988,6 +1041,9 @@ static bool dc_link_detect_helper(struct dc_link *link, sink = prev_sink; prev_sink = NULL; } +#if defined(CONFIG_DRM_AMD_DC_HDCP) + query_hdcp_capability(sink->sink_signal, link); +#endif } /* HDMI-DVI Dongle */ diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 92123b0d1196..9235d04c32dc 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -29,6 +29,9 @@ #include "dc_types.h" #include "grph_object_defs.h" #include "logger_types.h" +#if de
[PATCH 1/2] drm/amd/display: query hdcp capability during link detect
[Why] Query the hdcp caps of a link, it is useful and can be reported to the user [How] Create a query function and call it during link detect Signed-off-by: Bhawanpreet Lakha --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 56 drivers/gpu/drm/amd/display/dc/dc.h | 41 + drivers/gpu/drm/amd/display/dc/dc_link.h | 3 + .../gpu/drm/amd/display/dc/hdcp/hdcp_msg.c| 89 +++ .../gpu/drm/amd/display/include/hdcp_types.h | 7 ++ 5 files changed, 196 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index a93997ff0419..49c63e27dfe9 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -514,6 +514,50 @@ static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *lin link->local_sink = prev_sink; } +#if defined(CONFIG_DRM_AMD_DC_HDCP) +static void query_hdcp_capability(enum signal_type signal, struct dc_link *link) +{ + struct hdcp_protection_message msg22; + struct hdcp_protection_message msg14; + + memset(&msg22, 0, sizeof(struct hdcp_protection_message)); + memset(&msg14, 0, sizeof(struct hdcp_protection_message)); + memset(link->hdcp_caps.rx_caps.raw, 0, + sizeof(link->hdcp_caps.rx_caps.raw)); + + if ((link->connector_signal == SIGNAL_TYPE_DISPLAY_PORT && + link->ddc->transaction_type == + DDC_TRANSACTION_TYPE_I2C_OVER_AUX) || + link->connector_signal == SIGNAL_TYPE_EDP) { + msg22.data = link->hdcp_caps.rx_caps.raw; + msg22.length = sizeof(link->hdcp_caps.rx_caps.raw); + msg22.msg_id = HDCP_MESSAGE_ID_RX_CAPS; + } else { + msg22.data = &link->hdcp_caps.rx_caps.fields.version; + msg22.length = sizeof(link->hdcp_caps.rx_caps.fields.version); + msg22.msg_id = HDCP_MESSAGE_ID_HDCP2VERSION; + } + msg22.version = HDCP_VERSION_22; + msg22.link = HDCP_LINK_PRIMARY; + msg22.max_retries = 5; + dc_process_hdcp_msg(signal, link, &msg22); + + if (signal == SIGNAL_TYPE_DISPLAY_PORT || signal == SIGNAL_TYPE_DISPLAY_PORT_MST) { + enum hdcp_message_status status = HDCP_MESSAGE_UNSUPPORTED; + + msg14.data = &link->hdcp_caps.bcaps.raw; + msg14.length = sizeof(link->hdcp_caps.bcaps.raw); + msg14.msg_id = HDCP_MESSAGE_ID_READ_BCAPS; + msg14.version = HDCP_VERSION_14; + msg14.link = HDCP_LINK_PRIMARY; + msg14.max_retries = 5; + + status = dc_process_hdcp_msg(signal, link, &msg14); + } + +} +#endif + static void read_current_link_settings_on_detect(struct dc_link *link) { union lane_count_set lane_count_set = { {0} }; @@ -606,6 +650,12 @@ static bool detect_dp(struct dc_link *link, dal_ddc_service_set_transaction_type(link->ddc, sink_caps->transaction_type); +#if defined(CONFIG_DRM_AMD_DC_HDCP) + /* In case of fallback to SST when topology discovery below fails +* HDCP caps will be querried again later by the upper layer (caller +* of this function). */ + query_hdcp_capability(SIGNAL_TYPE_DISPLAY_PORT_MST, link); +#endif /* * This call will initiate MST topology discovery. Which * will detect MST ports and add new DRM connector DRM @@ -975,6 +1025,9 @@ static bool dc_link_detect_helper(struct dc_link *link, * TODO debug why Dell 2413 doesn't like * two link trainings */ +#if defined(CONFIG_DRM_AMD_DC_HDCP) + query_hdcp_capability(sink->sink_signal, link); +#endif // verify link cap for SST non-seamless boot if (!perform_dp_seamless_boot) @@ -988,6 +1041,9 @@ static bool dc_link_detect_helper(struct dc_link *link, sink = prev_sink; prev_sink = NULL; } +#if defined(CONFIG_DRM_AMD_DC_HDCP) + query_hdcp_capability(sink->sink_signal, link); +#endif } /* HDMI-DVI Dongle */ diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 92123b0d1196..9235d04c32dc 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -29,6 +29,9 @@ #include "dc_types.h" #include "grph_object_defs.h" #include "logger_types.h" +#if defined(CONFIG_DRM_AMD_DC_HDCP) +#include "hdcp_types.h" +#endif #include "gpio_types.h" #include "link_service_types.h" #include