dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: s.shirish@samsung.com, "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH V4] drm: edid: add support for E-DDC
Date: Wed, 29 Aug 2012 15:44:17 +0200	[thread overview]
Message-ID: <1346247857.21586.17.camel@amber.site> (raw)
In-Reply-To: <1345887836-15314-2-git-send-email-s.shirish@samsung.com>

Hi all,

Sorry for breaking message threading but I was not included in
iterations 3 and 4 of this patch.

Random comments about v4:

> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -254,6 +254,8 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned 
> char *buf,
>                       int block, int len)
>  {
>         unsigned char start = block * EDID_LENGTH;
> +       unsigned char segment = block >> 1;
> +       unsigned char xfers = segment ? 3 : 2;
>         int ret, retries = 5;
>  
>         /* The core i2c driver will automatically retry the transfer if the
> @@ -264,7 +266,12 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, 
> unsigned char *buf,
>          */
>         do {
>                 struct i2c_msg msgs[] = {
> -                       {
> +                       { /*set segment pointer */
> +                               .addr   = DDC_SEGMENT_ADDR,
> +                               .flags  = segment ? 0 : I2C_M_IGNORE_NAK,

I don't get the idea. If segment == 0, this message is never sent, so the
value of field flags doesn't matter. So flags will always be 0 when this
message is sent, so it can be hard-coded.

But from previous discussions my understanding was an agreement on always
using I2C_M_IGNORE_NAK for improved compatibility. So I2C_M_IGNORE_NAK
should be hard-coded, not 0?

> +                               .len    = 1,
> +                               .buf    = &segment,
> +                       }, {
>                                 .addr   = DDC_ADDR,
>                                 .flags  = 0,
>                                 .len    = 1,
> @@ -276,15 +283,22 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, 
> unsigned char *buf,
>                                 .buf    = buf,
>                         }
>                 };
> -               ret = i2c_transfer(adapter, msgs, 2);
> +       /* Avoid sending the segment addr to not upset non-compliant ddc
> +        * monitors.
> +        */

s/segment addr/segment/, plus it's abot E-DCC compliance as I understand it,
not DDC.

> +               if (!segment)
> +                       ret = i2c_transfer(adapter, &msgs[1], xfers);
> +               else
> +                       ret = i2c_transfer(adapter, msgs, xfers);
> +

This can be written:

		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);

Which is more compact and, I suspect, faster.

>                 if (ret == -ENXIO) {
>                         DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
>                                         adapter->name);
>                         break;
>                 }
> -       } while (ret != 2 && --retries);
> +       } while (ret != xfers && --retries);
>  
> -       return ret == 2 ? 0 : -1;
> +       return ret == xfers ? 0 : -1;
>  }
>  
>  static bool drm_edid_is_zero(u8 *in_edid, int length)

Other than this, your code looks reasonable, not so different from what
I submitted 8 months ago actually. But ISTU you can test the code with
real hardware while I couldn't.

With the changes above applied, you can add:

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
Suse L3

  parent reply	other threads:[~2012-08-29 13:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-25  9:43 [PATCH V4] drm: edid: add support for E-DDC Shirish S
2012-08-25  9:43 ` Shirish S
2012-08-26 18:44   ` Daniel Vetter
2012-08-29 11:08   ` Ville Syrjälä
2012-08-29 13:54     ` Shirish S
2012-08-29 13:44   ` Jean Delvare [this message]
2012-08-30  0:22     ` Shirish S

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=1346247857.21586.17.camel@amber.site \
    --to=jdelvare@suse.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=s.shirish@samsung.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