diff options
author | Simon Farnsworth <simon.farnsworth@onelan.co.uk> | 2015-02-10 13:38:08 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-11 17:04:56 -0400 |
commit | 1d002fa720738bcd0bddb9178e9ea0773288e1dd (patch) | |
tree | 4a01b874d3b25afd098209c5983e23f50b6b3bc2 /include/drm | |
parent | 967667fd6d96a16fd4a216251eee112a214207ec (diff) |
drm/dp: Use large transactions for I2C over AUX
Older DisplayPort to DVI-D Dual Link adapters designed by Bizlink have bugs
in their I2C over AUX implementation (fixed in newer revisions). They work
fine with Windows, but fail with Linux.
It turns out that they cannot keep an I2C transaction open unless the
previous read was 16 bytes; shorter reads can only be followed by a zero
byte transfer ending the I2C transaction.
Copy Windows's behaviour, and read 16 bytes at a time. If we get a short
reply, assume that there's a hardware bottleneck, and shrink our read size
to match. For this purpose, use the algorithm in the DisplayPort 1.2 spec,
in the hopes that it'll be closest to what Windows does.
Also provide an unsafe module parameter for testing smaller transfer sizes,
in case there are sinks out there that cannot work with Windows.
Note also that despite the previous comment in drm_dp_i2c_xfer, this speeds
up native DP EDID reads; Ville Syrjälä <ville.syrjala@linux.intel.com> found
the following changes in his testing:
Device under test: old -> with this patch
DP->DVI (OUI 001cf8): 40ms -> 35ms
DP->VGA (OUI 0022b9): 45ms -> 38ms
Zotac DP->2xHDMI: 25ms -> 4ms
Asus PB278 monitor: 22ms -> 3ms
A back of the envelope calculation shows that peak theoretical transfer rate
for 1 byte reads is around 60 kbit/s; with 16 byte reads, this increases to
around 500 kbit/s, which explains the increase in speed.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55228
Tested-by: Aidan Marks <aidanamarks@gmail.com> (v3)
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/drm_dp_helper.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index c5fdc2d3ca97..523f04c90dea 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
@@ -42,6 +42,8 @@ | |||
42 | * 1.2 formally includes both eDP and DPI definitions. | 42 | * 1.2 formally includes both eDP and DPI definitions. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #define DP_AUX_MAX_PAYLOAD_BYTES 16 | ||
46 | |||
45 | #define DP_AUX_I2C_WRITE 0x0 | 47 | #define DP_AUX_I2C_WRITE 0x0 |
46 | #define DP_AUX_I2C_READ 0x1 | 48 | #define DP_AUX_I2C_READ 0x1 |
47 | #define DP_AUX_I2C_STATUS 0x2 | 49 | #define DP_AUX_I2C_STATUS 0x2 |
@@ -680,6 +682,9 @@ struct drm_dp_aux_msg { | |||
680 | * transactions. The drm_dp_aux_register_i2c_bus() function registers an | 682 | * transactions. The drm_dp_aux_register_i2c_bus() function registers an |
681 | * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers | 683 | * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers |
682 | * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter. | 684 | * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter. |
685 | * The I2C adapter uses long transfers by default; if a partial response is | ||
686 | * received, the adapter will drop down to the size given by the partial | ||
687 | * response for this transaction only. | ||
683 | * | 688 | * |
684 | * Note that the aux helper code assumes that the .transfer() function | 689 | * Note that the aux helper code assumes that the .transfer() function |
685 | * only modifies the reply field of the drm_dp_aux_msg structure. The | 690 | * only modifies the reply field of the drm_dp_aux_msg structure. The |