aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-08-26 15:55:07 -0400
committerJani Nikula <jani.nikula@intel.com>2015-09-02 09:13:43 -0400
commitf36203be608a38a5b5523a7aa52cc72f757b9679 (patch)
treea0cc8fdf761f93bcdb61d15ae4d2928457019510 /drivers/gpu/drm
parent4efa83c8c786ab7ec7982e3dd348cb7e7ecbeb04 (diff)
drm/dp: Add dp_aux_i2c_speed_khz module param to set the assume i2c bus speed
To help with debugging i2c-over-aux issues, add a module parameter than can be used to tweak the assumed i2c bus speed, and thus the maximum number of retries we will do for each aux message. Cc: Simon Farnsworth <simon.farnsworth@onelan.com> Cc: moosotc@gmail.com Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_dp_helper.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 214a4c649d56..291734e87fca 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -500,6 +500,15 @@ static int drm_dp_i2c_retry_count(const struct drm_dp_aux_msg *msg,
500} 500}
501 501
502/* 502/*
503 * FIXME currently assumes 10 kHz as some real world devices seem
504 * to require it. We should query/set the speed via DPCD if supported.
505 */
506static int dp_aux_i2c_speed_khz __read_mostly = 10;
507module_param_unsafe(dp_aux_i2c_speed_khz, int, 0644);
508MODULE_PARM_DESC(dp_aux_i2c_speed_khz,
509 "Assumed speed of the i2c bus in kHz, (1-400, default 10)");
510
511/*
503 * Transfer a single I2C-over-AUX message and handle various error conditions, 512 * Transfer a single I2C-over-AUX message and handle various error conditions,
504 * retrying the transaction as appropriate. It is assumed that the 513 * retrying the transaction as appropriate. It is assumed that the
505 * aux->transfer function does not modify anything in the msg other than the 514 * aux->transfer function does not modify anything in the msg other than the
@@ -517,10 +526,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
517 * before giving up the AUX transaction. 526 * before giving up the AUX transaction.
518 * 527 *
519 * We also try to account for the i2c bus speed. 528 * We also try to account for the i2c bus speed.
520 * FIXME currently assumes 10 kHz as some real world devices seem
521 * to require it. We should query/set the speed via DPCD if supported.
522 */ 529 */
523 int max_retries = max(7, drm_dp_i2c_retry_count(msg, 10)); 530 int max_retries = max(7, drm_dp_i2c_retry_count(msg, dp_aux_i2c_speed_khz));
524 531
525 for (retry = 0, defer_i2c = 0; retry < (max_retries + defer_i2c); retry++) { 532 for (retry = 0, defer_i2c = 0; retry < (max_retries + defer_i2c); retry++) {
526 mutex_lock(&aux->hw_mutex); 533 mutex_lock(&aux->hw_mutex);