summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2026-09-16 11:29:41 +0300
committerJani Nikula <jani.nikula@intel.com>2026-09-22 16:37:41 +0300
commit3216d9cc254bb03c0bec1084d7bfccff2ecbcc7a (patch)
tree5e87d473ed6bb5c2792fc47900d30bd4ffc03cb4 /drivers/gpu
parent791a8519ff8407fd17a9ef04cf97771b5a37435b (diff)
downloadlinux-next-3216d9cc254bb03c0bec1084d7bfccff2ecbcc7a.tar.gz
linux-next-3216d9cc254bb03c0bec1084d7bfccff2ecbcc7a.zip
drm/i915/dp-test: switch to drm_dp_dpcd_{read_byte, read_data, write_byte, write_data}()
Switch to the modern DPCD access functions that return negative error codes on errors, -EIO for incomplete access, and 0 on success. This flags incomplete reads, and simplifies error handling all over the place. Rename local int status to ret for clarity and consistency. Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Link: https://patch.msgid.link/ddf90aeb0dae3779d92381f550d95111398e7e02.1789547331.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/display/intel_dp_test.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_dp_test.c b/drivers/gpu/drm/i915/display/intel_dp_test.c
index 0551a1ce60d3..424183a65155 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_test.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_test.c
@@ -147,25 +147,24 @@ bool intel_dp_test_compute_config(struct intel_connector *connector,
static u8 intel_dp_autotest_link_training(struct intel_dp *intel_dp)
{
struct intel_display *display = to_intel_display(intel_dp);
- int status = 0;
+ int ret;
int test_link_rate;
u8 test_lane_count, test_link_bw;
/* (DP CTS 1.2)
* 4.3.1.11
*/
/* Read the TEST_LANE_COUNT and TEST_LINK_RTAE fields (DP CTS 3.1.4) */
- status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_LANE_COUNT,
- &test_lane_count);
-
- if (status <= 0) {
+ ret = drm_dp_dpcd_read_byte(&intel_dp->aux, DP_TEST_LANE_COUNT,
+ &test_lane_count);
+ if (ret < 0) {
drm_dbg_kms(display->drm, "Lane count read failed\n");
return DP_TEST_NAK;
}
test_lane_count &= DP_MAX_LANE_COUNT_MASK;
- status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_LINK_RATE,
- &test_link_bw);
- if (status <= 0) {
+ ret = drm_dp_dpcd_read_byte(&intel_dp->aux, DP_TEST_LINK_RATE,
+ &test_link_bw);
+ if (ret < 0) {
drm_dbg_kms(display->drm, "Link Rate read failed\n");
return DP_TEST_NAK;
}
@@ -188,35 +187,33 @@ static u8 intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)
u8 test_pattern;
u8 test_misc;
__be16 h_width, v_height;
- int status = 0;
+ int ret;
/* Read the TEST_PATTERN (DP CTS 3.1.5) */
- status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_PATTERN,
- &test_pattern);
- if (status <= 0) {
+ ret = drm_dp_dpcd_read_byte(&intel_dp->aux, DP_TEST_PATTERN,
+ &test_pattern);
+ if (ret < 0) {
drm_dbg_kms(display->drm, "Test pattern read failed\n");
return DP_TEST_NAK;
}
if (test_pattern != DP_COLOR_RAMP)
return DP_TEST_NAK;
- status = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_H_WIDTH_HI,
- &h_width, 2);
- if (status <= 0) {
+ ret = drm_dp_dpcd_read_data(&intel_dp->aux, DP_TEST_H_WIDTH_HI, &h_width, 2);
+ if (ret < 0) {
drm_dbg_kms(display->drm, "H Width read failed\n");
return DP_TEST_NAK;
}
- status = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_V_HEIGHT_HI,
- &v_height, 2);
- if (status <= 0) {
+ ret = drm_dp_dpcd_read_data(&intel_dp->aux, DP_TEST_V_HEIGHT_HI,
+ &v_height, 2);
+ if (ret < 0) {
drm_dbg_kms(display->drm, "V Height read failed\n");
return DP_TEST_NAK;
}
- status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_MISC0,
- &test_misc);
- if (status <= 0) {
+ ret = drm_dp_dpcd_read_byte(&intel_dp->aux, DP_TEST_MISC0, &test_misc);
+ if (ret < 0) {
drm_dbg_kms(display->drm, "TEST MISC read failed\n");
return DP_TEST_NAK;
}
@@ -274,8 +271,8 @@ static u8 intel_dp_autotest_edid(struct intel_dp *intel_dp)
/* We have to write the checksum of the last block read */
block += block->extensions;
- if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_EDID_CHECKSUM,
- block->checksum) <= 0)
+ if (drm_dp_dpcd_write_byte(&intel_dp->aux, DP_TEST_EDID_CHECKSUM,
+ block->checksum) < 0)
drm_dbg_kms(display->drm,
"Failed to write EDID checksum\n");
@@ -397,8 +394,8 @@ static void intel_dp_process_phy_request(struct intel_dp *intel_dp,
intel_dp_phy_pattern_update(intel_dp, crtc_state);
- drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET,
- intel_dp->train_set, crtc_state->lane_count);
+ drm_dp_dpcd_write_data(&intel_dp->aux, DP_TRAINING_LANE0_SET,
+ intel_dp->train_set, crtc_state->lane_count);
drm_dp_set_phy_test_pattern(&intel_dp->aux, data,
intel_dp->dpcd[DP_DPCD_REV]);
@@ -427,10 +424,10 @@ void intel_dp_test_request(struct intel_dp *intel_dp)
struct intel_display *display = to_intel_display(intel_dp);
u8 response = DP_TEST_NAK;
u8 request = 0;
- int status;
+ int ret;
- status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_REQUEST, &request);
- if (status <= 0) {
+ ret = drm_dp_dpcd_read_byte(&intel_dp->aux, DP_TEST_REQUEST, &request);
+ if (ret < 0) {
drm_dbg_kms(display->drm,
"Could not read test request from sink\n");
goto update_status;
@@ -463,8 +460,8 @@ void intel_dp_test_request(struct intel_dp *intel_dp)
intel_dp->compliance.test_type = request;
update_status:
- status = drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_RESPONSE, response);
- if (status <= 0)
+ ret = drm_dp_dpcd_write_byte(&intel_dp->aux, DP_TEST_RESPONSE, response);
+ if (ret < 0)
drm_dbg_kms(display->drm,
"Could not write test response to sink\n");
}