dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Alex Deucher <alexdeucher@gmail.com>,
	dri-devel@lists.freedesktop.org, ville.syrjala@linux.intel.com,
	treding@nvidia.com
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [PATCH 1/4] drm/radeon/dp: handle zero sized i2c over aux transactions
Date: Mon, 07 Apr 2014 10:57:43 +0300	[thread overview]
Message-ID: <87ppkta7wo.fsf@intel.com> (raw)
In-Reply-To: <1396641519-18529-2-git-send-email-alexander.deucher@amd.com>

On Fri, 04 Apr 2014, Alex Deucher <alexdeucher@gmail.com> wrote:
> Needed for proper i2c over aux handling for certain
> monitors and configurations (e.g., dp bridges or
> adapters).
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  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);

I think your tz_size and tx_buf[3] are confused. Shouldn't you only send
3 bytes of tx_buf when msg->size == 0?

Disclaimer, I don't know anything about your hw and all that... :)

BR,
Jani.


> @@ -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;
> -- 
> 1.8.3.1
>

-- 
Jani Nikula, Intel Open Source Technology Center

  parent reply	other threads:[~2014-04-07  7:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 19:58 [PATCH 0/4] Reset i2c connection between xfers (v3) Alex Deucher
2014-04-04 19:58 ` [PATCH 1/4] drm/radeon/dp: handle zero sized i2c over aux transactions Alex Deucher
2014-04-05  9:25   ` Christian König
2014-04-05 16:16     ` Daniel Vetter
2014-04-07  0:45     ` Alex Deucher
2014-04-07  7:57   ` Jani Nikula [this message]
2014-04-07 13:24     ` Alex Deucher
2014-04-07 13:29       ` Alex Deucher
2014-04-04 19:58 ` [PATCH 2/4] drm/dp/i2c: send bare addresses to properly reset i2c connections (v3) Alex Deucher
2014-04-07  7:49   ` Thierry Reding
2014-04-07 13:44     ` Alex Deucher
2014-04-07 13:58       ` Thierry Reding
2014-04-07  8:44   ` Thierry Reding
2014-04-04 19:58 ` [PATCH 3/4] drm/dp/i2c: Update comments about common i2c over dp assumptions Alex Deucher
2014-04-04 19:58 ` [PATCH 4/4] drm/radeon/dp: switch to the common i2c over aux code Alex Deucher
  -- strict thread matches above, loose matches on Subject: below --
2014-04-04 17:52 [PATCH 0/4] Reset i2c connection between xfers (v2) Alex Deucher
2014-04-04 17:52 ` [PATCH 1/4] drm/radeon/dp: handle zero sized i2c over aux transactions Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppkta7wo.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=treding@nvidia.com \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox