Skip to content
  1. Sep 02, 2015
    • Ville Syrjälä's avatar
      drm/dp: Add dp_aux_i2c_speed_khz module param to set the assume i2c bus speed · f36203be
      Ville Syrjälä authored
      
      
      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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarSimon Farnsworth <simon.farnsworth@onelan.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      f36203be
    • Ville Syrjälä's avatar
      drm/dp: Adjust i2c-over-aux retry count based on message size and i2c bus speed · 4efa83c8
      Ville Syrjälä authored
      Calculate the number of retries we should do for each i2c-over-aux
      message based on the time it takes to perform the i2c transfer vs. the
      aux transfer. We assume the shortest possible length for the aux
      transfer, and the longest possible (exluding clock stretching) for the
      i2c transfer.
      
      The DP spec has some examples on how to calculate this, but we don't
      calculate things quite the same way. The spec doesn't account for the
      retry interval (assumes immediate retry on defer), and doesn't assume
      the best/worst case behaviour as we do.
      
      Note that currently we assume 10 kHz speed for the i2c bus. Some real
      world devices (eg. some Apple DP->VGA dongle) fails with less than 16
      retries. and that would correspond to something close to 15 kHz (with
      our method of calculating things) But let's just go for 10 kHz to be
      on the safe side. Ideally we should query/set the i2c bus speed via
      DPCD but for now this should at leaast remove the regression from the
      1->16 byte trasnfer size change. And of course if the sink completes
      the transfer quicker this shouldn't slow things down since we don't
      change the interval between retries.
      
      I did a few experiments with a DP->DVI dongle I have that allows you
      to change the i2c bus speed. Here are the results of me changing the
      actual bus speed and the assumed bus speed and seeing when we start
      to fail the operation:
      
      actual i2c khz          assumed i2c khz         max retries
      1                       1 ok -> 2 fail          211 ok -> 106 fail
      5                       8 ok -> 9 fail          27 ok -> 24 fail
      10                      17 ok -> 18 fail        13 ok -> 12 fail
      100                     210 ok -> 211 fail      2 ok -> 1 fail
      
      So based on that we have a fairly decent safety margin baked into
      the formula to calculate the max number of retries.
      
      Fixes a regression with some DP dongles from:
      commit 1d002fa7
      
      
      Author: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
      Date:   Tue Feb 10 18:38:08 2015 +0000
      
          drm/dp: Use large transactions for I2C over AUX
      
      v2: Use best case for AUX and worst case for i2c (Simon Farnsworth)
          Add a define our AUX retry interval and account for it
      v3: Make everything usecs to avoid confusion about units (Daniel)
          Add a comment reminding people about the AUX bitrate (Daniel)
          Use DIV_ROUND_UP() since we're after the "worst" case for i2c
      
      Cc: Simon Farnsworth <simon.farnsworth@onelan.com>
      Cc: moosotc@gmail.com
      Tested-by: default avatar <moosotc@gmail.com>
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91451
      
      
      Reviewed-by: default avatarSimon Farnsworth <simon.farnsworth@onelan.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      4efa83c8
    • Ville Syrjälä's avatar
      drm/dp: Define AUX_RETRY_INTERVAL as 500 us · 79a2b161
      Ville Syrjälä authored
      
      
      Currently we react to native and i2c defers by waiting either 400-500 us
      or 500-600 us, depending on which code path we take. Consolidate them
      all to one define AUX_RETRY_INTERVAL which defines the minimum interval.
      Since we've been using two different intervals pick the longer of them
      and define AUX_RETRY_INTERVAL as 500 us. For the maximum just use
      AUX_RETRY_INTERVAL+100 us.
      
      I want to have a define for this so that I can use it when calculating
      the estimated duration of i2c-over-aux transfers. Without a define it
      would be very easy to change the sleep duration and neglect to update
      the i2c-over-aux estimates.
      
      Cc: Simon Farnsworth <simon.farnsworth@onelan.com>
      Cc: moosotc@gmail.com
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarSimon Farnsworth <simon.farnsworth@onelan.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      79a2b161
  2. Sep 01, 2015
  3. Aug 31, 2015
  4. Aug 30, 2015
  5. Aug 28, 2015