drm/dp: i2c-over-aux short write support
Subsystems (6)
cover drm/dp: i2c-over-aux short write support
From: Ville Syrjälä <[email protected]>
This series tries to implement support for short i2c-over-aux writes.
I did notice that my monitor (HP ZR24w) does support DDC/CI so I was able to do some writes, but I only saw native defers instead of i2c defers/short acks. So I've not actually been able to test this.
Another complication with DDC/CI seems to be that the monitor doesn't seem to like the default 100kHz bus speed. I had to drop it to 10kHz to make it reliable (my dongle supports bus speed control fortunately). Currently we have no standard way to configure the bus speed AFAICS, so at least with this monitor DDC/CI is a bit useless.
I tried to fix up radeon and tegra too. gma500 I left alone since it's not using dp i2c helper.
Ville Syrjälä (5):
drm/dp: s/I2C_STATUS/I2C_WRITE_STATUS_UPDATE/ drm/i915: Handle DP_AUX_I2C_WRITE_STATUS_UPDATE drm/radeon: Handle DP_AUX_I2C_WRITE_STATUS_UPDATE drm/tegra: Handle I2C_WRITE_STATUS_UPDATE for address only writes drm/dp: Use I2C_WRITE_STATUS_UPDATE to drain partial I2C_WRITE
requests
drivers/gpu/drm/drm_dp_helper.c | 42 ++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_dp.c | 1 + drivers/gpu/drm/radeon/atombios_dp.c | 1 + drivers/gpu/drm/tegra/dpaux.c | 3 ++- include/drm/drm_dp_helper.h | 2 +- 5 files changed, 43 insertions(+), 6 deletions(-)
Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/5 drm/dp: s/I2C_STATUS/I2C_WRITE_STATUS_UPDATE/
From: Ville Syrjälä <[email protected]>
Rename the I2C_STATUS request to I2C_WRITE_STATUS_UPDATE to match the spec.
--- drivers/gpu/drm/tegra/dpaux.c | 2 +- include/drm/drm_dp_helper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tegra/dpaux.c +1 -1
@@ -152,7 +152,7 @@ static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux,break ; -case DP_AUX_I2C_STATUS : +case DP_AUX_I2C_WRITE_STATUS_UPDATE :if (msg->request &DP_AUX_I2C_MOT ) value |=DPAUX_DP_AUXCTL_CMD_MOT_RQ ;else
include/drm/drm_dp_helper.h +1 -1
@@ -46,7 +46,7 @@#define DP_AUX_I2C_WRITE 0x0#define DP_AUX_I2C_READ 0x1 -#define DP_AUX_I2C_STATUS 0x2 +#define DP_AUX_I2C_WRITE_STATUS_UPDATE 0x2#define DP_AUX_I2C_MOT 0x4#define DP_AUX_NATIVE_WRITE 0x8#define DP_AUX_NATIVE_READ 0x9
Signature · 6 lines
2.0.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 1/5] drm/dp: s/I2C_STATUS/I2C_WRITE_STATUS_UPDATE/
Quoted 6 lines · On Fri, 13 Mar 2015, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Rename the
I2C_STATUSrequest toI2C_WRITE_STATUS_UPDATEto match the spec.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 38 lines
--- drivers/gpu/drm/tegra/dpaux.c | 2 +- include/drm/drm_dp_helper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/tegra/dpaux.c +1
-1@@ -152,7 +152,7 @@ static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux,break ; -case DP_AUX_I2C_STATUS : +case DP_AUX_I2C_WRITE_STATUS_UPDATE :if (msg->request &DP_AUX_I2C_MOT ) value |=DPAUX_DP_AUXCTL_CMD_MOT_RQ ;else include/drm/drm_dp_helper.h +1
-1@@ -46,7 +46,7 @@#define DP_AUX_I2C_WRITE 0x0#define DP_AUX_I2C_READ 0x1 -#define DP_AUX_I2C_STATUS 0x2 +#define DP_AUX_I2C_WRITE_STATUS_UPDATE 0x2#define DP_AUX_I2C_MOT 0x4#define DP_AUX_NATIVE_WRITE 0x8#define DP_AUX_NATIVE_READ 0x9Signature · 6 lines
2.0.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm/i915: Handle DP_AUX_I2C_WRITE_STATUS_UPDATE
In reply to [email protected]From: Ville Syrjälä <[email protected]>
When we get an i2c defer or short ack for i2c-over-aux write we need to switch to WRITE_STATUS_UPDATE to poll for the completion of the original request.
i915 doesn't try to interpret wht request type apart from separating reads from writes, and so we should be able to treat this the same as a normal i2c write.
--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -956,6 +956,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)switch (msg->request & ~DP_AUX_I2C_MOT ) {case DP_AUX_NATIVE_WRITE :case DP_AUX_I2C_WRITE : +case DP_AUX_I2C_WRITE_STATUS_UPDATE : txsize = msg->size ?HEADER_SIZE + msg->size :BARE_ADDRESS_SIZE ; rxsize =1 ;
Signature · 6 lines
2.0.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/5] drm/i915: Handle DP_AUX_I2C_WRITE_STATUS_UPDATE
Quoted 11 lines · On Fri, 13 Mar 2015, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
When we get an i2c defer or short ack for i2c-over-aux write we need to switch to
WRITE_STATUS_UPDATEto poll for the completion of the original request.i915 doesn't try to interpret wht request type apart from separating reads from writes, and so we should be able to treat this the same as a normal i2c write.
Signed-off-by Ville Syrjälä <[email protected]>
Probably needs a refresh due to context change due to my short writes patch though.
Quoted 23 lines
--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/intel_dp.c +1
-0@@ -956,6 +956,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)switch (msg->request & ~DP_AUX_I2C_MOT ) {case DP_AUX_NATIVE_WRITE :case DP_AUX_I2C_WRITE : +case DP_AUX_I2C_WRITE_STATUS_UPDATE : txsize = msg->size ?HEADER_SIZE + msg->size :BARE_ADDRESS_SIZE ; rxsize =1 ;Signature · 6 lines
2.0.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/radeon: Handle DP_AUX_I2C_WRITE_STATUS_UPDATE
In reply to [email protected]From: Ville Syrjälä <[email protected]>
When we get an i2c defer or short ack for i2c-over-aux write we need to switch to WRITE_STATUS_UPDATE to poll for the completion of the original request.
Looks like radeon doesn't do anything special with the request type, so hopefully just treating it the same as a i2c write is enough.
--- drivers/gpu/drm/radeon/atombios_dp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/atombios_dp.c +1 -0
@@ -178,6 +178,7 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)switch (msg->request & ~DP_AUX_I2C_MOT ) {case DP_AUX_NATIVE_WRITE :case DP_AUX_I2C_WRITE : +case DP_AUX_I2C_WRITE_STATUS_UPDATE :/* The atom implementation only supports writes with a max payload of * 12 bytes since it uses 4 bits for the total count (header + payload) * in the parameter space. The atom interface supports 16 byte
Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/tegra: Handle I2C_WRITE_STATUS_UPDATE for address only writes
In reply to [email protected]From: Ville Syrjälä <[email protected]>
A address-only I2C_WRITE can't be replied with a short i2c ack, but I suppose it could be replied with an i2c defer. So the code should be prepared for an address-only I2C_WRITE_STATUS_UPDATE.
--- drivers/gpu/drm/tegra/dpaux.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/dpaux.c +1 -0
@@ -122,6 +122,7 @@ static ssize_t tegra_dpaux_transfer(struct drm_dp_aux *aux,*/ if (msg->size <1 ) {switch (msg->request & ~DP_AUX_I2C_MOT ) { +case DP_AUX_I2C_WRITE_STATUS_UPDATE :case DP_AUX_I2C_WRITE :case DP_AUX_I2C_READ : value =DPAUX_DP_AUXCTL_CMD_ADDRESS_ONLY ;
Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/dp: Use I2C_WRITE_STATUS_UPDATE to drain partial I2C_WRITE requests
In reply to [email protected]From: Ville Syrjälä <[email protected]>
When an i2c WRITE gets an i2c defer or short i2c ack reply, we are supposed to switch the request from I2C_WRITE to I2C_WRITE_STATUS_UPDATE when we continue to poll for the completion of the request.
--- drivers/gpu/drm/drm_dp_helper.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_dp_helper.c +37 -4
@@ -422,6 +422,25 @@ static u32 drm_dp_i2c_functionality(struct i2c_adapter *adapter)I2C_FUNC_10BIT_ADDR ; } +static void drm_dp_i2c_msg_set_request (struct drm_dp_aux_msg *msg, +const struct i2c_msg *i2c_msg) +{ + msg->request = (i2c_msg->flags &I2C_M_RD ) ? +DP_AUX_I2C_READ :DP_AUX_I2C_WRITE ; + msg->request |=DP_AUX_I2C_MOT ; +} + +static void drm_dp_i2c_msg_write_status_update (struct drm_dp_aux_msg *msg) +{ +/* +* In case of i2c defer or short i2c ack reply to a write, +* we need to switch to WRITE_STATUS_UPDATE to drain the +* rest of the message +*/ +if ((msg->request & ~DP_AUX_I2C_MOT ) ==DP_AUX_I2C_WRITE ) + msg->request |=DP_AUX_I2C_WRITE_STATUS_UPDATE ; +} +/* * Transfer a single I2C-over-AUX message and handle various error conditions, * retrying the transaction as appropriate. It is assumed that the
@@ -490,6 +509,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)* Both native ACK and I2C ACK replies received. We * can assume the transfer was successful. */ +if (ret != msg->size) +drm_dp_i2c_msg_write_status_update (msg);return ret;case DP_AUX_I2C_REPLY_NACK :
@@ -501,6 +522,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)DRM_DEBUG_KMS ("I2C defer\n" ); aux->i2c_defer_count++;usleep_range (400 ,500 ); +drm_dp_i2c_msg_write_status_update (msg);continue ;default :
@@ -566,10 +588,7 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,for (i =0 ; i < num; i++) { msg.address = msgs[i].addr; - msg.request = (msgs[i].flags &I2C_M_RD ) ? -DP_AUX_I2C_READ : -DP_AUX_I2C_WRITE ; - msg.request |=DP_AUX_I2C_MOT ; +drm_dp_i2c_msg_set_request (&msg, &msgs[i]);/* Send a bare address packet to start the transaction. * Zero sized messages specify an address only (bare * address) transaction.
@@ -577,6 +596,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.buffer =NULL ; msg.size =0 ; err =drm_dp_i2c_do_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ;/* We want each transaction to be as large as possible, but
@@ -589,6 +615,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.size =min (transfer_size, msgs[i].len - j); err =drm_dp_i2c_drain_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ; transfer_size = err;
Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/dp: Use I2C_WRITE_STATUS_UPDATE to drain partial I2C_WRITE requests
Task id: 5948 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 276/276 276/276 ILK 303/303 303/303 SNB -1 279/279 278/279 IVB 343/343 343/343 BYT 287/287 287/287 HSW 363/363 363/363 BDW 308/308 308/308
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*SNB igt_gem_persistent_relocs_forked-interruptible-faulting-reloc-thrash-inactive PASS(2) DMESG_WARN(1)PASS(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 5/5] drm/dp: Use I2C_WRITE_STATUS_UPDATE to drain partial I2C_WRITE requests
In reply to [email protected]Quoted 5 lines · On Fri, 13 Mar 2015, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
When an i2c WRITE gets an i2c defer or short i2c ack reply, we are supposed to switch the request from
I2C_WRITEtoI2C_WRITE_STATUS_UPDATEwhen we continue to poll for the completion of the request.
As I said IRL, it's a bit unfortunate that setting and resetting of DP_AUX_I2C_WRITE_STATUS_UPDATE happen at different levels of the abstraction. But I can live with that.
We also have another problem with reporting short writes in i915, hopefully fixed by [1]. Before that gets fixed, can't really r-b.
BR,
Jani.
[1] http://mid.gmane.org/[email protected]
Quoted 100 lines
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_dp_helper.c +37
-4@@ -422,6 +422,25 @@ static u32 drm_dp_i2c_functionality(struct i2c_adapter *adapter)I2C_FUNC_10BIT_ADDR ; } +static void drm_dp_i2c_msg_set_request (struct drm_dp_aux_msg *msg, +const struct i2c_msg *i2c_msg) +{ + msg->request = (i2c_msg->flags &I2C_M_RD ) ? +DP_AUX_I2C_READ :DP_AUX_I2C_WRITE ; + msg->request |=DP_AUX_I2C_MOT ; +} + +static void drm_dp_i2c_msg_write_status_update (struct drm_dp_aux_msg *msg) +{ +/* +* In case of i2c defer or short i2c ack reply to a write, +* we need to switch to WRITE_STATUS_UPDATE to drain the +* rest of the message +*/ +if ((msg->request & ~DP_AUX_I2C_MOT ) ==DP_AUX_I2C_WRITE ) + msg->request |=DP_AUX_I2C_WRITE_STATUS_UPDATE ; +} +/* * Transfer a single I2C-over-AUX message and handle various error conditions, * retrying the transaction as appropriate. It is assumed that the @@ -490,6 +509,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)* Both native ACK and I2C ACK replies received. We * can assume the transfer was successful. */ +if (ret != msg->size) +drm_dp_i2c_msg_write_status_update (msg);return ret;case DP_AUX_I2C_REPLY_NACK :@@ -501,6 +522,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)DRM_DEBUG_KMS ("I2C defer\n" ); aux->i2c_defer_count++;usleep_range (400 ,500 ); +drm_dp_i2c_msg_write_status_update (msg);continue ;default :@@ -566,10 +588,7 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,for (i =0 ; i < num; i++) { msg.address = msgs[i].addr; - msg.request = (msgs[i].flags &I2C_M_RD ) ? -DP_AUX_I2C_READ : -DP_AUX_I2C_WRITE ; - msg.request |=DP_AUX_I2C_MOT ; +drm_dp_i2c_msg_set_request (&msg, &msgs[i]);/* Send a bare address packet to start the transaction. * Zero sized messages specify an address only (bare * address) transaction. @@ -577,6 +596,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.buffer =NULL ; msg.size =0 ; err =drm_dp_i2c_do_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ;/* We want each transaction to be as large as possible, but @@ -589,6 +615,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.size =min (transfer_size, msgs[i].len - j); err =drm_dp_i2c_drain_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ; transfer_size = err;Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/dp: Use I2C_WRITE_STATUS_UPDATE to drain partial I2C_WRITE requests
Quoted 11 lines · Jani Nikula
Quoted 5 lines · On Fri, 13 Mar 2015, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
When an i2c WRITE gets an i2c defer or short i2c ack reply, we are supposed to switch the request from
I2C_WRITEtoI2C_WRITE_STATUS_UPDATEwhen we continue to poll for the completion of the request.As I said IRL, it's a bit unfortunate that setting and resetting of
DP_AUX_I2C_WRITE_STATUS_UPDATEhappen at different levels of the abstraction. But I can live with that.
Quoted 8 lines
We also have another problem with reporting short writes in i915, hopefully fixed by [1]. Before that gets fixed, can't really r-b.
BR,
Jani.
BTW I notice now that radeon seems to have that same problem. I won't try to fix that, so just a FYI for the radeon folks...
Quoted 104 lines
Quoted 101 lines
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_dp_helper.c +37
-4@@ -422,6 +422,25 @@ static u32 drm_dp_i2c_functionality(struct i2c_adapter *adapter)I2C_FUNC_10BIT_ADDR ; } +static void drm_dp_i2c_msg_set_request (struct drm_dp_aux_msg *msg, +const struct i2c_msg *i2c_msg) +{ + msg->request = (i2c_msg->flags &I2C_M_RD ) ? +DP_AUX_I2C_READ :DP_AUX_I2C_WRITE ; + msg->request |=DP_AUX_I2C_MOT ; +} + +static void drm_dp_i2c_msg_write_status_update (struct drm_dp_aux_msg *msg) +{ +/* +* In case of i2c defer or short i2c ack reply to a write, +* we need to switch to WRITE_STATUS_UPDATE to drain the +* rest of the message +*/ +if ((msg->request & ~DP_AUX_I2C_MOT ) ==DP_AUX_I2C_WRITE ) + msg->request |=DP_AUX_I2C_WRITE_STATUS_UPDATE ; +} +/* * Transfer a single I2C-over-AUX message and handle various error conditions, * retrying the transaction as appropriate. It is assumed that the @@ -490,6 +509,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)* Both native ACK and I2C ACK replies received. We * can assume the transfer was successful. */ +if (ret != msg->size) +drm_dp_i2c_msg_write_status_update (msg);return ret;case DP_AUX_I2C_REPLY_NACK :@@ -501,6 +522,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)DRM_DEBUG_KMS ("I2C defer\n" ); aux->i2c_defer_count++;usleep_range (400 ,500 ); +drm_dp_i2c_msg_write_status_update (msg);continue ;default :@@ -566,10 +588,7 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,for (i =0 ; i < num; i++) { msg.address = msgs[i].addr; - msg.request = (msgs[i].flags &I2C_M_RD ) ? -DP_AUX_I2C_READ : -DP_AUX_I2C_WRITE ; - msg.request |=DP_AUX_I2C_MOT ; +drm_dp_i2c_msg_set_request (&msg, &msgs[i]);/* Send a bare address packet to start the transaction. * Zero sized messages specify an address only (bare * address) transaction. @@ -577,6 +596,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.buffer =NULL ; msg.size =0 ; err =drm_dp_i2c_do_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ;/* We want each transaction to be as large as possible, but @@ -589,6 +615,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.size =min (transfer_size, msgs[i].len - j); err =drm_dp_i2c_drain_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ; transfer_size = err;Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-develSignature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/dp: Use I2C_WRITE_STATUS_UPDATE to drain partial I2C_WRITE requests
In reply to [email protected]Quoted 26 lines · On Fri, 13 Mar 2015, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
When an i2c WRITE gets an i2c defer or short i2c ack reply, we are supposed to switch the request from
I2C_WRITEtoI2C_WRITE_STATUS_UPDATEwhen we continue to poll for the completion of the request.Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_dp_helper.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_dp_helper.c +7
-0@@ -422,6 +422,25 @@ static u32 drm_dp_i2c_functionality(struct i2c_adapter *adapter)I2C_FUNC_10BIT_ADDR ; } +static void drm_dp_i2c_msg_set_request (struct drm_dp_aux_msg *msg, +const struct i2c_msg *i2c_msg) +{ + msg->request = (i2c_msg->flags &I2C_M_RD ) ? +DP_AUX_I2C_READ :DP_AUX_I2C_WRITE ; + msg->request |=DP_AUX_I2C_MOT ; +}
drivers/gpu/drm/drm_dp_helper.c static u32 drm_dp_i2c_functionality(struct i2c_adapter *adapter) · line 441
Quoted 10 lines
drivers/gpu/drm/drm_dp_helper.c +10
-0+ +static void drm_dp_i2c_msg_write_status_update (struct drm_dp_aux_msg *msg) +{ +/* +* In case of i2c defer or short i2c ack reply to a write, +* we need to switch to WRITE_STATUS_UPDATE to drain the +* rest of the message +*/ +if ((msg->request & ~DP_AUX_I2C_MOT ) ==DP_AUX_I2C_WRITE ) + msg->request |=DP_AUX_I2C_WRITE_STATUS_UPDATE ;
This only works because DP_AUX_I2C_WRITE == 0, and it may not be obvious to the casual reader that DP_AUX_I2C_WRITE_STATUS_UPDATE is a replacement not an addition to DP_AUX_I2C_WRITE.
Whether you fix that or not, this is
Quoted 69 lines
drivers/gpu/drm/drm_dp_helper.c +20
-4+} +/* * Transfer a single I2C-over-AUX message and handle various error conditions, * retrying the transaction as appropriate. It is assumed that the @@ -490,6 +509,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)* Both native ACK and I2C ACK replies received. We * can assume the transfer was successful. */ +if (ret != msg->size) +drm_dp_i2c_msg_write_status_update (msg);return ret;case DP_AUX_I2C_REPLY_NACK :@@ -501,6 +522,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)DRM_DEBUG_KMS ("I2C defer\n" ); aux->i2c_defer_count++;usleep_range (400 ,500 ); +drm_dp_i2c_msg_write_status_update (msg);continue ;default :@@ -566,10 +588,7 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,for (i =0 ; i < num; i++) { msg.address = msgs[i].addr; - msg.request = (msgs[i].flags &I2C_M_RD ) ? -DP_AUX_I2C_READ : -DP_AUX_I2C_WRITE ; - msg.request |=DP_AUX_I2C_MOT ; +drm_dp_i2c_msg_set_request (&msg, &msgs[i]);/* Send a bare address packet to start the transaction. * Zero sized messages specify an address only (bare * address) transaction. @@ -577,6 +596,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.buffer =NULL ; msg.size =0 ; err =drm_dp_i2c_do_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ;/* We want each transaction to be as large as possible, but @@ -589,6 +615,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, msg.size =min (transfer_size, msgs[i].len - j); err =drm_dp_i2c_drain_msg (aux, &msg); + +/* +* Reset msg.request in case in case it got +* changed into a WRITE_STATUS_UPDATE. +*/ +drm_dp_i2c_msg_set_request (&msg, &msgs[i]); +if (err <0 )break ; transfer_size = err;Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): CADnq5_NZyw-vY761GyrDapWjdY94Jk-2+6uoj906yG3BPWBsNQ@mail.gmail.com
cover drm/dp: i2c-over-aux short write support
fwd to the list.
---------- Forwarded message ----------
From: Alex Deucher <[email protected]>
Date: Mon, Mar 16, 2015 at 9:49 AM
Subject: Re: [PATCH 0/5] drm/dp: i2c-over-aux short write support
To: Ville Syrjälä <[email protected]>
Quoted 17 lines · On Fri, Mar 13, 2015 at 12:13 PM, <[email protected]> wrote:
From: Ville Syrjälä <[email protected]>
This series tries to implement support for short i2c-over-aux writes.
I did notice that my monitor (HP ZR24w) does support DDC/CI so I was able to do some writes, but I only saw native defers instead of i2c defers/short acks. So I've not actually been able to test this.
Another complication with DDC/CI seems to be that the monitor doesn't seem to like the default 100kHz bus speed. I had to drop it to 10kHz to make it reliable (my dongle supports bus speed control fortunately). Currently we have no standard way to configure the bus speed AFAICS, so at least with this monitor DDC/CI is a bit useless.
I tried to fix up radeon and tegra too. gma500 I left alone since it's not using dp i2c helper.
Quoted 7 lines
Ville Syrjälä (5):
drm/dp: s/I2C_STATUS/I2C_WRITE_STATUS_UPDATE/ drm/i915: HandleDP_AUX_I2C_WRITE_STATUS_UPDATEdrm/radeon: HandleDP_AUX_I2C_WRITE_STATUS_UPDATEdrm/tegra: HandleI2C_WRITE_STATUS_UPDATEfor address only writes drm/dp: UseI2C_WRITE_STATUS_UPDATEto drain partialI2C_WRITE
requests
Patches 1, 3, 5 are:
Quoted 8 lines
drivers/gpu/drm/drm_dp_helper.c | 42 ++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_dp.c | 1 + drivers/gpu/drm/radeon/atombios_dp.c | 1 + drivers/gpu/drm/tegra/dpaux.c | 3 ++- include/drm/drm_dp_helper.h | 2 +- 5 files changed, 43 insertions(+), 6 deletions(-)
Quoted 7 lines
--
2.0.5_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel