[PATCH 21/76] drm/amd/dal: remove unnessary AS dependency

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


From: Tony Cheng <tony.cheng at amd.com>

- ddc instantiation
- default i2c speed from dc_cap.

Signed-off-by: Tony Cheng <tony.cheng at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 .../gpu/drm/amd/dal/dc/adapter/adapter_service.c   | 26 ----------------------
 .../amd/dal/dc/asic_capability/asic_capability.c   |  1 -
 .../dc/asic_capability/carrizo_asic_capability.c   |  1 -
 .../dc/asic_capability/hawaii_asic_capability.c    |  2 --
 .../dc/asic_capability/polaris10_asic_capability.c |  1 -
 .../dal/dc/asic_capability/tonga_asic_capability.c |  1 -
 drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c      |  4 +++-
 drivers/gpu/drm/amd/dal/dc/core/dc_link_ddc.c      |  9 +++-----
 .../amd/dal/include/adapter_service_interface.h    |  8 -------
 .../drm/amd/dal/include/asic_capability_types.h    |  1 -
 10 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c b/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
index 6d2f5762ef63..d25f9da35b07 100644
--- a/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
+++ b/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
@@ -118,7 +118,6 @@ static const struct feature_source_entry feature_entry_table[] = {
 	{FEATURE_DP_DISPLAY_FORCE_SS_ENABLE, false, true},
 	{FEATURE_REPORT_CE_MODE_ONLY, false, true},
 	{FEATURE_ALLOW_OPTIMIZED_MODE_AS_DEFAULT, false, true},
-	{FEATURE_DDC_READ_FORCE_REPEATED_START, false, true},
 	{FEATURE_FORCE_TIMING_RESYNC, false, true},
 	{FEATURE_TMDS_DISABLE_DITHERING, false, true},
 	{FEATURE_HDMI_DISABLE_DITHERING, false, true},
@@ -136,7 +135,6 @@ static const struct feature_source_entry feature_entry_table[] = {
 	{FEATURE_PSR_ENABLE, false, true},
 	{FEATURE_WIRELESS_ENABLE_COMPRESSED_AUDIO, false, true},
 	{FEATURE_WIRELESS_INCLUDE_UNVERIFIED_TIMINGS, true, true},
-	{FEATURE_EDID_STRESS_READ, false, true},
 	{FEATURE_DP_FRAME_PACK_STEREO3D, false, true},
 	{FEATURE_DISPLAY_PREFERRED_VIEW, 0, false},
 	{FEATURE_ALLOW_HDMI_WITHOUT_AUDIO, false, true},
@@ -928,30 +926,6 @@ bool dal_adapter_service_is_dfs_bypass_enabled(
 }
 
 /*
- * dal_adapter_service_get_sw_i2c_speed
- *
- * Get SW I2C speed
- */
-uint32_t dal_adapter_service_get_sw_i2c_speed(
-	struct adapter_service *as)
-{
-	/* TODO: only from ASIC caps. Feature key is not implemented*/
-	return as->asic_cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ];
-}
-
-/*
- * dal_adapter_service_get_hw_i2c_speed
- *
- * Get HW I2C speed
- */
-uint32_t dal_adapter_service_get_hw_i2c_speed(
-	struct adapter_service *as)
-{
-	/* TODO: only from ASIC caps. Feature key is not implemented*/
-	return as->asic_cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ];
-}
-
-/*
  * dal_adapter_service_get_asic_vram_bit_width
  *
  * Get the video RAM bit width set on the ASIC
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c
index 24ab4a5b5232..543fee50c21a 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c
@@ -58,7 +58,6 @@ static bool construct(
 	cap->runtime_flags = init->runtime_flags;
 	cap->data[ASIC_DATA_MAX_UNDERSCAN_PERCENTAGE] = 10;
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 4;
-	cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 25;
 	cap->data[ASIC_DATA_DOWNSCALE_LIMIT] = 200;
 
 	/* ASIC basic capability */
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c
index d23d186c670f..982d1cd5bad9 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c
@@ -56,7 +56,6 @@ void carrizo_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_STUTTERMODE] = 0x200A;
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2;
 	cap->data[ASIC_DATA_MEMORYTYPE_MULTIPLIER] = 2;
-	cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 100;
 	cap->data[ASIC_DATA_DOWNSCALE_LIMIT] = 150;
 
 	/* ASIC basic capability */
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c
index 6678053d4601..628f985acf23 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c
@@ -69,8 +69,6 @@ void dal_hawaii_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_PATH_NUM_PER_DPMST_CONNECTOR] = 4;
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2;
 
-	cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 40;
-
 	mc_seq_misc0 = dm_read_reg(cap->ctx, mmMC_SEQ_MISC0);
 
 	switch (mc_seq_misc0 & MC_MISC0__MEMORY_TYPE_MASK) {
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c
index 15b1f7a59066..1b1524b2e6e4 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c
@@ -58,7 +58,6 @@ void polaris10_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2;
 
 	cap->data[ASIC_DATA_MEMORYTYPE_MULTIPLIER] = 4;
-	cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 100;
 
 	cap->data[ASIC_DATA_MIN_DISPCLK_FOR_UNDERSCAN] = 300000;
 
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c
index 2475de9c0bf5..58d4913e3aea 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c
@@ -58,7 +58,6 @@ void tonga_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_DCE_VERSION] = 0x100; /* DCE 11 */
 
 	cap->data[ASIC_DATA_MEMORYTYPE_MULTIPLIER] = 4;
-	cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 40;
 
 	/* ASIC basic capability */
 	cap->caps.IS_FUSION = true;
diff --git a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
index 79669d9516cb..eae92f53694f 100644
--- a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
@@ -44,6 +44,8 @@
 
 /* TODO remove - only needed for gpio_service */
 #include "adapter/adapter_service.h"
+/* TODO remove - only needed for default i2c speed */
+#include "dc.h"
 
 #define THREE_PERCENT_OF_10000 300
 
@@ -2940,7 +2942,7 @@ static bool i2c_read(
 
 	/*Using SW engine */
 	cmd.engine = I2C_COMMAND_ENGINE_SW;
-	cmd.speed = dal_adapter_service_get_sw_i2c_speed(as);
+	cmd.speed = ddc->ctx->dc->caps.i2c_speed_in_khz;
 
 	{
 		struct i2c_payload payloads[] = {
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 cc4c238ed0a6..c440d9d123ad 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
@@ -303,9 +303,7 @@ static bool construct(
 	}
 
 	ddc_service->flags.EDID_QUERY_DONE_ONCE = false;
-
 	ddc_service->flags.FORCE_READ_REPEATED_START = false;
-
 	ddc_service->flags.EDID_STRESS_READ = false;
 
 	ddc_service->flags.IS_INTERNAL_DISPLAY =
@@ -450,7 +448,7 @@ static bool i2c_read(
 		.payloads = payloads,
 		.number_of_payloads = 2,
 		.engine = DDC_I2C_COMMAND_ENGINE,
-		.speed = dal_adapter_service_get_sw_i2c_speed(ddc->as) };
+		.speed = ddc->ctx->dc->caps.i2c_speed_in_khz };
 
 	return dm_helpers_submit_i2c(
 			ddc->ctx,
@@ -561,7 +559,7 @@ static uint8_t i2c_read_edid_block(
 		.payloads = NULL,
 		.number_of_payloads = 0,
 		.engine = DDC_I2C_COMMAND_ENGINE,
-		.speed = dal_adapter_service_get_sw_i2c_speed(ddc->as) };
+		.speed = ddc->ctx->dc->caps.i2c_speed_in_khz };
 
 	struct i2c_payload payloads[3] = {
 		{
@@ -943,8 +941,7 @@ bool dal_ddc_service_query_ddc_data(
 			.payloads = dal_ddc_i2c_payloads_get(payloads),
 			.number_of_payloads = 0,
 			.engine = DDC_I2C_COMMAND_ENGINE,
-			.speed =
-				dal_adapter_service_get_sw_i2c_speed(ddc->as) };
+			.speed = ddc->ctx->dc->caps.i2c_speed_in_khz };
 
 		dal_ddc_i2c_payloads_add(
 			payloads, address, write_size, write_buf, true);
diff --git a/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h b/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
index 052cd9ab5cf3..ef45693925d6 100644
--- a/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
+++ b/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
@@ -87,7 +87,6 @@ enum adapter_feature_id {
 	FEATURE_DP_DISPLAY_FORCE_SS_ENABLE,
 	FEATURE_REPORT_CE_MODE_ONLY,
 	FEATURE_ALLOW_OPTIMIZED_MODE_AS_DEFAULT,
-	FEATURE_DDC_READ_FORCE_REPEATED_START,
 	FEATURE_FORCE_TIMING_RESYNC,
 	FEATURE_TMDS_DISABLE_DITHERING,
 	FEATURE_HDMI_DISABLE_DITHERING,
@@ -111,7 +110,6 @@ enum adapter_feature_id {
 	FEATURE_PREFER_3D_TIMING,
 	FEATURE_VARI_BRIGHT_ENABLE,
 	FEATURE_PSR_ENABLE,
-	FEATURE_EDID_STRESS_READ,
 	FEATURE_DP_FRAME_PACK_STEREO3D,
 	FEATURE_ALLOW_HDMI_WITHOUT_AUDIO,
 	FEATURE_RESTORE_USAGE_I2C_SW_ENGING,
@@ -380,12 +378,6 @@ bool dal_adapter_service_get_feature_value(struct adapter_service *as,
 	void *data,
 	uint32_t size);
 
-/* Get SW I2C speed */
-uint32_t dal_adapter_service_get_sw_i2c_speed(struct adapter_service *as);
-
-/* Get HW I2C speed */
-uint32_t dal_adapter_service_get_hw_i2c_speed(struct adapter_service *as);
-
 /* Get I2C information from BIOS */
 bool dal_adapter_service_get_i2c_info(
 	struct adapter_service *as,
diff --git a/drivers/gpu/drm/amd/dal/include/asic_capability_types.h b/drivers/gpu/drm/amd/dal/include/asic_capability_types.h
index 1f78dc9f52f3..8c6c40247e02 100644
--- a/drivers/gpu/drm/amd/dal/include/asic_capability_types.h
+++ b/drivers/gpu/drm/amd/dal/include/asic_capability_types.h
@@ -97,7 +97,6 @@ enum asic_data {
 	ASIC_DATA_MAX_UNDERSCAN_PERCENTAGE,
 	ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY,
 	ASIC_DATA_MIN_DISPCLK_FOR_UNDERSCAN,
-	ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ,
 	ASIC_DATA_DOWNSCALE_LIMIT,
 	ASIC_DATA_MAX_NUMBER /* end of enum */
 };
-- 
2.10.1



More information about the amd-gfx mailing list