[PATCH 19/76] drm/amd/dal: Remove adapter service dependency from dc_link

Harry Wentland harry.wentland at amd.com
Mon Nov 21 23:00:39 UTC 2016


From: Yongqiang Sun <yongqiang.sun at amd.com>

Signed-off-by: Yongqiang Sun <yongqiang.sun at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c         | 14 ++++++------
 drivers/gpu/drm/amd/dal/dc/core/dc_link_ddc.c     |  8 ++-----
 drivers/gpu/drm/amd/dal/dc/dc_bios_types.h        |  1 +
 drivers/gpu/drm/amd/dal/dc/dc_types.h             |  1 +
 drivers/gpu/drm/amd/dal/dc/dce/dce_link_encoder.c | 27 ++++++++++++++---------
 5 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
index fb902558d6a2..d86817606f39 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -945,6 +945,7 @@ static bool construct(
 	struct encoder_init_data enc_init_data = { 0 };
 	struct integrated_info info = {{{ 0 }}};
 	struct dc_bios *bios = init_params->dc->ctx->dc_bios;
+	const struct dc_vbios_funcs *bp_funcs = bios->funcs;
 
 	link->public.irq_source_hpd = DC_IRQ_SOURCE_INVALID;
 	link->public.irq_source_hpd_rx = DC_IRQ_SOURCE_INVALID;
@@ -1033,8 +1034,7 @@ static bool construct(
 
 	enc_init_data.adapter_service = as;
 	enc_init_data.ctx = dc_ctx;
-	enc_init_data.encoder = dal_adapter_service_get_src_obj(
-							as, link->link_id, 0);
+	bp_funcs->get_src_obj(dc_ctx->dc_bios, link->link_id, 0, &enc_init_data.encoder);
 	enc_init_data.connector = link->link_id;
 	enc_init_data.channel = get_ddc_line(link, as);
 	enc_init_data.hpd_source = get_hpd_line(link, as);
@@ -1050,11 +1050,12 @@ static bool construct(
 
 	link->public.link_enc_hw_inst = link->link_enc->transmitter;
 
-	dal_adapter_service_get_integrated_info(as, &info);
+	/* TODO: refactor dal_adapter_service_get_integrated_info(as, &info); */
+	memmove(&info, dc_ctx->dc_bios->integrated_info, sizeof(struct integrated_info));
 
 	for (i = 0; ; i++) {
-		if (!dal_adapter_service_get_device_tag(
-				as, link->link_id, i, &link->device_tag)) {
+		if (BP_RESULT_OK !=
+				bp_funcs->get_device_tag(dc_ctx->dc_bios, link->link_id, i, &link->device_tag)) {
 			DC_ERROR("Failed to find device tag!\n");
 			goto device_tag_fail;
 		}
@@ -1062,8 +1063,7 @@ static bool construct(
 		/* Look for device tag that matches connector signal,
 		 * CRT for rgb, LCD for other supported signal tyes
 		 */
-		if (!dal_adapter_service_is_device_id_supported(
-						as, link->device_tag.dev_id))
+		if (!bp_funcs->is_device_id_supported(dc_ctx->dc_bios, link->device_tag.dev_id))
 			continue;
 		if (link->device_tag.dev_id.device_type == DEVICE_TYPE_CRT
 			&& link->public.connector_signal != SIGNAL_TYPE_RGB)
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link_ddc.c
index fd60a4c6d2a3..cc4c238ed0a6 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link_ddc.c
@@ -304,13 +304,9 @@ static bool construct(
 
 	ddc_service->flags.EDID_QUERY_DONE_ONCE = false;
 
-	ddc_service->flags.FORCE_READ_REPEATED_START =
-		dal_adapter_service_is_feature_supported(ddc_service->as,
-			FEATURE_DDC_READ_FORCE_REPEATED_START);
+	ddc_service->flags.FORCE_READ_REPEATED_START = false;
 
-	ddc_service->flags.EDID_STRESS_READ =
-		dal_adapter_service_is_feature_supported(ddc_service->as,
-				FEATURE_EDID_STRESS_READ);
+	ddc_service->flags.EDID_STRESS_READ = false;
 
 	ddc_service->flags.IS_INTERNAL_DISPLAY =
 		connector_id == CONNECTOR_ID_EDP ||
diff --git a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
index 2d598d004281..7c1f9d817f9c 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
@@ -226,6 +226,7 @@ struct dc_bios {
 
 	struct dc_context *ctx;
 	const struct bios_registers *regs;
+	struct integrated_info *integrated_info;
 };
 
 #endif /* DC_BIOS_TYPES_H */
diff --git a/drivers/gpu/drm/amd/dal/dc/dc_types.h b/drivers/gpu/drm/amd/dal/dc/dc_types.h
index 573db6ef5a1d..38ca365da1ad 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc_types.h
@@ -76,6 +76,7 @@ struct dc_context {
 	struct dc_bios *dc_bios;
 	bool created_bios;
 	struct gpio_service *gpio_service;
+	struct i2caux *i2caux;
 };
 
 /*
diff --git a/drivers/gpu/drm/amd/dal/dc/dce/dce_link_encoder.c b/drivers/gpu/drm/amd/dal/dc/dce/dce_link_encoder.c
index ae9de4824378..670d7f3987d0 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce/dce_link_encoder.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce/dce_link_encoder.c
@@ -1002,10 +1002,10 @@ bool dce110_link_encoder_construct(
 	 * while doing the DP sink detect
 	 */
 
-	if (dal_adapter_service_is_feature_supported(as,
+/*	if (dal_adapter_service_is_feature_supported(as,
 		FEATURE_DP_SINK_DETECT_POLL_DATA_PIN))
 		enc110->base.features.flags.bits.
-			DP_SINK_DETECT_POLL_DATA_PIN = true;
+			DP_SINK_DETECT_POLL_DATA_PIN = true;*/
 
 	enc110->base.output_signals =
 		SIGNAL_TYPE_DVI_SINGLE_LINK |
@@ -1061,22 +1061,29 @@ bool dce110_link_encoder_construct(
 			init_data->channel);
 
 	/* Override features with DCE-specific values */
-	if (dal_adapter_service_get_encoder_cap_info(
-			enc110->base.adapter_service,
-			enc110->base.id, &enc_cap_info))
-		enc110->base.features.flags.bits.IS_HBR2_CAPABLE =
-				enc_cap_info.dp_hbr2_cap;
+	{
+	struct bp_encoder_cap_info bp_cap_info = {0};
+	const struct dc_vbios_funcs *bp_funcs = enc110->base.ctx->dc_bios->funcs;
 
+	if (BP_RESULT_OK != bp_funcs->get_encoder_cap_info(
+			enc110->base.ctx->dc_bios, enc110->base.id,
+			&bp_cap_info))
+		enc110->base.features.flags.bits.IS_HBR2_CAPABLE =
+				bp_cap_info.DP_HBR2_CAP;
+	}
 	/* test pattern 3 support */
 	enc110->base.features.flags.bits.IS_TPS3_CAPABLE = true;
 
-	enc110->base.features.flags.bits.IS_Y_ONLY_CAPABLE =
+	enc110->base.features.flags.bits.IS_Y_ONLY_CAPABLE = false;
+	/*
 		dal_adapter_service_is_feature_supported(as,
 			FEATURE_SUPPORT_DP_Y_ONLY);
-
-	enc110->base.features.flags.bits.IS_YCBCR_CAPABLE =
+*/
+	enc110->base.features.flags.bits.IS_YCBCR_CAPABLE = true;
+	/*
 		dal_adapter_service_is_feature_supported(as,
 			FEATURE_SUPPORT_DP_YUV);
+			*/
 	return true;
 }
 
-- 
2.10.1



More information about the amd-gfx mailing list