From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Christian_K=F6nig?= Subject: Re: [PATCH 1/4] drm/radeon/dp: handle zero sized i2c over aux transactions Date: Sat, 05 Apr 2014 11:25:01 +0200 Message-ID: <533FCBED.6000803@vodafone.de> References: <1396641519-18529-1-git-send-email-alexander.deucher@amd.com> <1396641519-18529-2-git-send-email-alexander.deucher@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 388C06E1C2 for ; Sat, 5 Apr 2014 02:25:16 -0700 (PDT) In-Reply-To: <1396641519-18529-2-git-send-email-alexander.deucher@amd.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Alex Deucher , dri-devel@lists.freedesktop.org, jani.nikula@linux.intel.com, ville.syrjala@linux.intel.com, treding@nvidia.com Cc: Alex Deucher List-Id: dri-devel@lists.freedesktop.org Am 04.04.2014 21:58, schrieb Alex Deucher: > Needed for proper i2c over aux handling for certain > monitors and configurations (e.g., dp bridges or > adapters). > > Signed-off-by: Alex Deucher My planning was that yesterdays pull request is the last one with new features. I can't judge how invasive this series is, so should I add it to my 3.15 branch and send Dave another pull request or should we wait for 3.16? Christian. > --- > drivers/gpu/drm/radeon/atombios_dp.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c > index 8b0ab17..e914008 100644 > --- a/drivers/gpu/drm/radeon/atombios_dp.c > +++ b/drivers/gpu/drm/radeon/atombios_dp.c > @@ -143,6 +143,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, > } > > #define HEADER_SIZE 4 > +#define BARE_ADDRESS_SIZE 3 > > static ssize_t > radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) > @@ -160,13 +161,16 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) > tx_buf[0] = msg->address & 0xff; > tx_buf[1] = msg->address >> 8; > tx_buf[2] = msg->request << 4; > - tx_buf[3] = msg->size - 1; > + tx_buf[3] = msg->size ? (msg->size - 1) : 0; > > switch (msg->request & ~DP_AUX_I2C_MOT) { > case DP_AUX_NATIVE_WRITE: > case DP_AUX_I2C_WRITE: > tx_size = HEADER_SIZE + msg->size; > - tx_buf[3] |= tx_size << 4; > + if (msg->size == 0) > + tx_buf[3] |= BARE_ADDRESS_SIZE << 4; > + else > + tx_buf[3] |= tx_size << 4; > memcpy(tx_buf + HEADER_SIZE, msg->buffer, msg->size); > ret = radeon_process_aux_ch(chan, > tx_buf, tx_size, NULL, 0, delay, &ack); > @@ -177,7 +181,10 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) > case DP_AUX_NATIVE_READ: > case DP_AUX_I2C_READ: > tx_size = HEADER_SIZE; > - tx_buf[3] |= tx_size << 4; > + if (msg->size == 0) > + tx_buf[3] |= BARE_ADDRESS_SIZE << 4; > + else > + tx_buf[3] |= tx_size << 4; > ret = radeon_process_aux_ch(chan, > tx_buf, tx_size, msg->buffer, msg->size, delay, &ack); > break; > @@ -186,7 +193,7 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) > break; > } > > - if (ret > 0) > + if (ret >= 0) > msg->reply = ack >> 4; > > return ret;