Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/dp: add intel_dp_test_reset() and intel_dp_test_short_pulse()

Abstract more DP test stuff. Now the only place touching
intel_dp->compliance is intel_dp_test.c.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ea2ad218bdba21be30bd15a3707663508518dfa5.1726833193.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+42 -24
+3 -24
drivers/gpu/drm/i915/display/intel_dp.c
··· 5161 5161 static bool 5162 5162 intel_dp_short_pulse(struct intel_dp *intel_dp) 5163 5163 { 5164 - struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); 5165 5164 u8 old_sink_count = intel_dp->sink_count; 5166 5165 bool reprobe_needed = false; 5167 5166 bool ret; 5168 5167 5169 - /* 5170 - * Clearing compliance test variables to allow capturing 5171 - * of values for next automated test request. 5172 - */ 5173 - memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance)); 5168 + intel_dp_test_reset(intel_dp); 5174 5169 5175 5170 /* 5176 5171 * Now read the DPCD to see if it's actually running ··· 5190 5195 5191 5196 intel_psr_short_pulse(intel_dp); 5192 5197 5193 - switch (intel_dp->compliance.test_type) { 5194 - case DP_TEST_LINK_TRAINING: 5195 - drm_dbg_kms(&dev_priv->drm, 5196 - "Link Training Compliance Test requested\n"); 5197 - /* Send a Hotplug Uevent to userspace to start modeset */ 5198 - drm_kms_helper_hotplug_event(&dev_priv->drm); 5199 - break; 5200 - case DP_TEST_LINK_PHY_TEST_PATTERN: 5201 - drm_dbg_kms(&dev_priv->drm, 5202 - "PHY test pattern Compliance Test requested\n"); 5203 - /* 5204 - * Schedule long hpd to do the test 5205 - * 5206 - * FIXME get rid of the ad-hoc phy test modeset code 5207 - * and properly incorporate it into the normal modeset. 5208 - */ 5198 + if (intel_dp_test_short_pulse(intel_dp)) 5209 5199 reprobe_needed = true; 5210 - } 5211 5200 5212 5201 return !reprobe_needed; 5213 5202 } ··· 5548 5569 status = connector_status_disconnected; 5549 5570 5550 5571 if (status == connector_status_disconnected) { 5551 - memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance)); 5572 + intel_dp_test_reset(intel_dp); 5552 5573 memset(intel_connector->dp.dsc_dpcd, 0, sizeof(intel_connector->dp.dsc_dpcd)); 5553 5574 intel_dp->psr.sink_panel_replay_support = false; 5554 5575 intel_dp->psr.sink_panel_replay_su_support = false;
+37
drivers/gpu/drm/i915/display/intel_dp_test.c
··· 6 6 #include <drm/display/drm_dp.h> 7 7 #include <drm/display/drm_dp_helper.h> 8 8 #include <drm/drm_edid.h> 9 + #include <drm/drm_probe_helper.h> 9 10 10 11 #include "i915_drv.h" 11 12 #include "i915_reg.h" ··· 17 16 #include "intel_dp_link_training.h" 18 17 #include "intel_dp_mst.h" 19 18 #include "intel_dp_test.h" 19 + 20 + void intel_dp_test_reset(struct intel_dp *intel_dp) 21 + { 22 + /* 23 + * Clearing compliance test variables to allow capturing 24 + * of values for next automated test request. 25 + */ 26 + memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance)); 27 + } 20 28 21 29 /* Adjust link config limits based on compliance test requests. */ 22 30 void intel_dp_test_compute_config(struct intel_dp *intel_dp, ··· 518 508 "Acquiring modeset locks failed with %i\n", ret); 519 509 520 510 return true; 511 + } 512 + 513 + bool intel_dp_test_short_pulse(struct intel_dp *intel_dp) 514 + { 515 + struct intel_display *display = to_intel_display(intel_dp); 516 + bool reprobe_needed = false; 517 + 518 + switch (intel_dp->compliance.test_type) { 519 + case DP_TEST_LINK_TRAINING: 520 + drm_dbg_kms(display->drm, 521 + "Link Training Compliance Test requested\n"); 522 + /* Send a Hotplug Uevent to userspace to start modeset */ 523 + drm_kms_helper_hotplug_event(display->drm); 524 + break; 525 + case DP_TEST_LINK_PHY_TEST_PATTERN: 526 + drm_dbg_kms(display->drm, 527 + "PHY test pattern Compliance Test requested\n"); 528 + /* 529 + * Schedule long hpd to do the test 530 + * 531 + * FIXME get rid of the ad-hoc phy test modeset code 532 + * and properly incorporate it into the normal modeset. 533 + */ 534 + reprobe_needed = true; 535 + } 536 + 537 + return reprobe_needed; 521 538 } 522 539 523 540 static ssize_t i915_displayport_test_active_write(struct file *file,
+2
drivers/gpu/drm/i915/display/intel_dp_test.h
··· 11 11 struct intel_dp; 12 12 struct link_config_limits; 13 13 14 + void intel_dp_test_reset(struct intel_dp *intel_dp); 14 15 void intel_dp_test_request(struct intel_dp *intel_dp); 15 16 void intel_dp_test_compute_config(struct intel_dp *intel_dp, 16 17 struct intel_crtc_state *pipe_config, 17 18 struct link_config_limits *limits); 18 19 bool intel_dp_test_phy(struct intel_dp *intel_dp); 20 + bool intel_dp_test_short_pulse(struct intel_dp *intel_dp); 19 21 void intel_dp_test_debugfs_register(struct intel_display *display); 20 22 21 23 #endif /* __INTEL_DP_TEST_H__ */