amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
To: amd-gfx@lists.freedesktop.org
Cc: Sunpeng.Li@amd.com, Harry.Wentland@amd.com,
	qingqing.zhuo@amd.com, Rodrigo.Siqueira@amd.com,
	Wenjing Liu <wenjing.liu@amd.com>,
	Aurabindo.Pillai@amd.com, Jun Lei <Jun.Lei@amd.com>,
	Bhawanpreet.Lakha@amd.com
Subject: [PATCH 26/30] drm/amd/display: allow query ddc data over aux to be read only operation
Date: Fri, 19 Jun 2020 16:12:18 -0400	[thread overview]
Message-ID: <20200619201222.2916504-27-Rodrigo.Siqueira@amd.com> (raw)
In-Reply-To: <20200619201222.2916504-1-Rodrigo.Siqueira@amd.com>

From: Wenjing Liu <wenjing.liu@amd.com>

[why]
Two issues:
1. Add read only operation support for query ddc data over aux.
2. Fix a bug where if read size is multiple of 16,
mot of the last read transaction will not be set to 0.

Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
---
 .../gpu/drm/amd/display/dc/core/dc_link_ddc.c | 29 ++++++++++++-------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index aefd29a440b5..be8f265976b0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -503,7 +503,7 @@ bool dal_ddc_service_query_ddc_data(
 	uint8_t *read_buf,
 	uint32_t read_size)
 {
-	bool ret = false;
+	bool success = true;
 	uint32_t payload_size =
 		dal_ddc_service_is_in_aux_transaction_mode(ddc) ?
 			DEFAULT_AUX_MAX_DATA_SIZE : EDID_SEGMENT_SIZE;
@@ -527,7 +527,6 @@ bool dal_ddc_service_query_ddc_data(
 	 *  but we want to read 256 over i2c!!!!*/
 	if (dal_ddc_service_is_in_aux_transaction_mode(ddc)) {
 		struct aux_payload payload;
-		bool read_available = true;
 
 		payload.i2c_over_aux = true;
 		payload.address = address;
@@ -536,21 +535,26 @@ bool dal_ddc_service_query_ddc_data(
 
 		if (write_size != 0) {
 			payload.write = true;
-			payload.mot = false;
+			/* should not set mot (middle of transaction) to 0
+			 * if there are pending read payloads
+			 */
+			payload.mot = read_size == 0 ? false : true;
 			payload.length = write_size;
 			payload.data = write_buf;
 
-			ret = dal_ddc_submit_aux_command(ddc, &payload);
-			read_available = ret;
+			success = dal_ddc_submit_aux_command(ddc, &payload);
 		}
 
-		if (read_size != 0 && read_available) {
+		if (read_size != 0 && success) {
 			payload.write = false;
+			/* should set mot (middle of transaction) to 0
+			 * since it is the last payload to send
+			 */
 			payload.mot = false;
 			payload.length = read_size;
 			payload.data = read_buf;
 
-			ret = dal_ddc_submit_aux_command(ddc, &payload);
+			success = dal_ddc_submit_aux_command(ddc, &payload);
 		}
 	} else {
 		struct i2c_command command = {0};
@@ -573,7 +577,7 @@ bool dal_ddc_service_query_ddc_data(
 		command.number_of_payloads =
 			dal_ddc_i2c_payloads_get_count(&payloads);
 
-		ret = dm_helpers_submit_i2c(
+		success = dm_helpers_submit_i2c(
 				ddc->ctx,
 				ddc->link,
 				&command);
@@ -581,7 +585,7 @@ bool dal_ddc_service_query_ddc_data(
 		dal_ddc_i2c_payloads_destroy(&payloads);
 	}
 
-	return ret;
+	return success;
 }
 
 bool dal_ddc_submit_aux_command(struct ddc_service *ddc,
@@ -598,7 +602,7 @@ bool dal_ddc_submit_aux_command(struct ddc_service *ddc,
 
 	do {
 		struct aux_payload current_payload;
-		bool is_end_of_payload = (retrieved + DEFAULT_AUX_MAX_DATA_SIZE) >
+		bool is_end_of_payload = (retrieved + DEFAULT_AUX_MAX_DATA_SIZE) >=
 			payload->length;
 
 		current_payload.address = payload->address;
@@ -607,7 +611,10 @@ bool dal_ddc_submit_aux_command(struct ddc_service *ddc,
 		current_payload.i2c_over_aux = payload->i2c_over_aux;
 		current_payload.length = is_end_of_payload ?
 			payload->length - retrieved : DEFAULT_AUX_MAX_DATA_SIZE;
-		current_payload.mot = !is_end_of_payload;
+		/* set mot (middle of transaction) to false
+		 * if it is the last payload
+		 */
+		current_payload.mot = is_end_of_payload ? payload->mot:true;
 		current_payload.reply = payload->reply;
 		current_payload.write = payload->write;
 
-- 
2.27.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2020-06-19 20:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 20:11 [PATCH 00/30] DC Patches Jun 19, 2020 Rodrigo Siqueira
2020-06-19 20:11 ` [PATCH 01/30] drm/amd/display: Use dmub fw to lock pipe, cursor, dig Rodrigo Siqueira
2020-06-19 20:11 ` [PATCH 02/30] drm/amd/display: [FW Promotion] Release 1.0.16 Rodrigo Siqueira
2020-06-19 20:11 ` [PATCH 03/30] drm/amd/display: Fix calculation of virtual channel payload Rodrigo Siqueira
2020-06-19 20:11 ` [PATCH 04/30] drm/amd/display: Fixed using wrong eDP power sequence function pointer Rodrigo Siqueira
2020-06-19 20:11 ` [PATCH 05/30] drm/amd/display: [FW Promotion] Release 1.0.17 Rodrigo Siqueira
2020-06-19 20:11 ` [PATCH 06/30] drm/amd/display: implement edid max TMDS clock check in DC Rodrigo Siqueira
2020-06-19 20:11 ` [PATCH 07/30] drm/amd/display: enable assr Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 08/30] drm/amd/display: Fix DML failures caused by doubled stereo viewport Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 09/30] drm/amd/display: Correctly respond in psr enablement interface Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 10/30] drm/amd/display: [FW Promotion] Release 1.0.18 Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 11/30] drm/amd/display: 3.2.90 Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 12/30] drm/amd/display: clip plane rects in DM before passing into DC Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 13/30] drm/amd/display: Added local_sink null check before access Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 14/30] drm/amd/display: fine tune logic of edid max TMDS clock check Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 15/30] drm/amd/display: add mechanism to skip DCN init Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 16/30] drm/amd/display: use dispclk AVFS for dppclk Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 17/30] drm/amd/display: fix 4to1 odm MPC_OUT_FLOW_CONTROL_COUNT Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 18/30] drm/amd/display: Force ODM combine on 5K+ 420 modes Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 19/30] drm/amd/display: Enable output_bpc property on all outputs Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 20/30] drm/amd/display: Fill in dmub_srv fw_version from firmware metadata Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 21/30] drm/amd/display: VSC SDP supported for SST Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 22/30] drm/amd/display: Allow 4 split on 10K 420 modes Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 23/30] drm/amd/display: Red screen observed on startup Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 24/30] drm/amd/display: enable seamless boot for dcn30 Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 25/30] drm/amd/display: Compare v_front_porch when checking if streams are synchronizable Rodrigo Siqueira
2020-06-19 20:12 ` Rodrigo Siqueira [this message]
2020-06-19 20:12 ` [PATCH 27/30] drm/amd/display: DP link layer test 4.2.1.1 fix due to specs update Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 28/30] drm/amd/display: [FW Promotion] Release 1.0.19 Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 29/30] drm/amd/display: Fix ineffective setting of max bpc property Rodrigo Siqueira
2020-06-19 20:12 ` [PATCH 30/30] drm/amd/display: 3.2.91 Rodrigo Siqueira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200619201222.2916504-27-Rodrigo.Siqueira@amd.com \
    --to=rodrigo.siqueira@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Jun.Lei@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=qingqing.zhuo@amd.com \
    --cc=wenjing.liu@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).