diff mbox

[V6] drm: edid: add support for E-DDC

Message ID 1346310246-21412-2-git-send-email-s.shirish@samsung.com (mailing list archive)
State Accepted
Headers show

Commit Message

Shirish S Aug. 30, 2012, 7:04 a.m. UTC
The current logic for probing ddc is limited to
2 blocks (256 bytes), this patch adds support
for the 4 block (512) data.

To do this, a single 8-bit segment index is
passed to the display via the I2C address 30h.
Data from the selected segment is then immediately
read via the regular DDC2 address using a repeated
I2C 'START' signal.

Signed-off-by: Shirish S <s.shirish@samsung.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

Comments

Ville Syrjälä Aug. 30, 2012, 10:58 a.m. UTC | #1
On Thu, Aug 30, 2012 at 12:34:06PM +0530, Shirish S wrote:
> @@ -276,15 +283,21 @@ 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.
> +	 */

Indentation is still wrong. Or is it gettimg mangled by some email server?

> +		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
> +
>  		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)
Shirish S Aug. 30, 2012, 4:17 p.m. UTC | #2
On Thu, Aug 30, 2012 at 3:58 AM, Ville Syrjälä <
ville.syrjala@linux.intel.com> wrote:

> On Thu, Aug 30, 2012 at 12:34:06PM +0530, Shirish S wrote:
> > @@ -276,15 +283,21 @@ 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.
> > +      */
>
> Indentation is still wrong. Or is it gettimg mangled by some email server?
>
> I have double checked with checkpatch, i did not get any errors or
warnings,
looks like as you are saying may be true.
Requesting for merge!

> > +             ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
> > +
> >               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)
>
> --
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
Shirish S Sept. 3, 2012, 3:54 p.m. UTC | #3
Hello Dave,

My patch-set for adding support for 4 block EDID is now reviewed and ready.
Please let me know if you want any further clarification

Regards,
Shirish S

On Thu, Aug 30, 2012 at 12:04 AM, Shirish S <s.shirish@samsung.com> wrote:

> The current logic for probing ddc is limited to
> 2 blocks (256 bytes), this patch adds support
> for the 4 block (512) data.
>
> To do this, a single 8-bit segment index is
> passed to the display via the I2C address 30h.
> Data from the selected segment is then immediately
> read via the regular DDC2 address using a repeated
> I2C 'START' signal.
>
> Signed-off-by: Shirish S <s.shirish@samsung.com>
> Reviewed-by: Jean Delvare <jdelvare@suse.de>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
>  1 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index bcc4725..7f62de5 100644
> --- 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
> @@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
> unsigned char *buf,
>         do {
>                 struct i2c_msg msgs[] = {
>                         {
> +                               .addr   = DDC_SEGMENT_ADDR,
> +                               .flags  = 0,
> +                               .len    = 1,
> +                               .buf    = &segment,
> +                       }, {
>                                 .addr   = DDC_ADDR,
>                                 .flags  = 0,
>                                 .len    = 1,
> @@ -276,15 +283,21 @@ 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.
> +        */
> +               ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
> +
>                 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)
> --
> 1.7.0.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
Adam Jackson Sept. 4, 2012, 1:45 p.m. UTC | #4
On 9/3/12 11:54 AM, Shirish S wrote:
> Hello Dave,
>
> My patch-set for adding support for 4 block EDID is now reviewed and ready.
> Please let me know if you want any further clarification

I assume you have actual displays with that many EDID extensions.  Can 
you send a sample of the complete EDID block from one such display?  I'd 
be interested to know what extensions are present.

- ajax
Shirish S Sept. 8, 2012, 2:30 a.m. UTC | #5
Hi Dave,
Gentle Reminder!
This patch is required for passing the very first test case of HDMI
Compliance test suite.
Regards,
Shirish S

On Mon, Sep 3, 2012 at 8:54 AM, Shirish S <shirish.s12@gmail.com> wrote:

> Hello Dave,
>
> My patch-set for adding support for 4 block EDID is now reviewed and ready.
> Please let me know if you want any further clarification
>
> Regards,
> Shirish S
>
>
> On Thu, Aug 30, 2012 at 12:04 AM, Shirish S <s.shirish@samsung.com> wrote:
>
>> The current logic for probing ddc is limited to
>> 2 blocks (256 bytes), this patch adds support
>> for the 4 block (512) data.
>>
>> To do this, a single 8-bit segment index is
>> passed to the display via the I2C address 30h.
>> Data from the selected segment is then immediately
>> read via the regular DDC2 address using a repeated
>> I2C 'START' signal.
>>
>> Signed-off-by: Shirish S <s.shirish@samsung.com>
>> Reviewed-by: Jean Delvare <jdelvare@suse.de>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
>> ---
>>  drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
>>  1 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index bcc4725..7f62de5 100644
>> --- 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
>> @@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
>> unsigned char *buf,
>>         do {
>>                 struct i2c_msg msgs[] = {
>>                         {
>> +                               .addr   = DDC_SEGMENT_ADDR,
>> +                               .flags  = 0,
>> +                               .len    = 1,
>> +                               .buf    = &segment,
>> +                       }, {
>>                                 .addr   = DDC_ADDR,
>>                                 .flags  = 0,
>>                                 .len    = 1,
>> @@ -276,15 +283,21 @@ 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.
>> +        */
>> +               ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
>> +
>>                 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)
>> --
>> 1.7.0.4
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>
>
Dave Airlie Sept. 8, 2012, 10:35 a.m. UTC | #6
On Sat, Sep 8, 2012 at 3:30 AM, Shirish S <shirish.s12@gmail.com> wrote:
> Hi Dave,
> Gentle Reminder!
> This patch is required for passing the very first test case of HDMI
> Compliance test suite.
> Regards,
> Shirish S

Can you provide ajax with the sample he asked for previously?

Dave.
Shirish S Sept. 8, 2012, 3:49 p.m. UTC | #7
I have already sent him the sample he had asked for.
Regards,
Shirish S

On Sat, Sep 8, 2012 at 3:35 AM, Dave Airlie <airlied@gmail.com> wrote:

> On Sat, Sep 8, 2012 at 3:30 AM, Shirish S <shirish.s12@gmail.com> wrote:
> > Hi Dave,
> > Gentle Reminder!
> > This patch is required for passing the very first test case of HDMI
> > Compliance test suite.
> > Regards,
> > Shirish S
>
> Can you provide ajax with the sample he asked for previously?
>
> Dave.
>
Paul Menzel Sept. 8, 2012, 4:13 p.m. UTC | #8
Dear Shirish,


thank you for your answers and patience.

Please just sent plain text message to mailings lists and adhere to the
netiquette (inline quoting) [1]. That would be awesome.


Am Samstag, den 08.09.2012, 08:49 -0700 schrieb Shirish S:
> On Sat, Sep 8, 2012 at 3:35 AM, Dave Airlie <airlied@gmail.com> wrote:
> 
> > On Sat, Sep 8, 2012 at 3:30 AM, Shirish S <shirish.s12@gmail.com> wrote:
> > > Hi Dave,
> > > Gentle Reminder!
> > > This patch is required for passing the very first test case of HDMI
> > > Compliance test suite.
> > > Regards,
> > > Shirish S
> >
> > Can you provide ajax with the sample he asked for previously?
>
> I have already sent him the sample he had asked for.

Could you sent it to the list again as we are all interested in it? If
you are allowed that is of course.


Thanks and hopefully your patch will go in soon,

Paul


[1] http://en.opensuse.org/openSUSE:Mailing_list_netiquette
Shirish S Sept. 9, 2012, 1:04 a.m. UTC | #9
On Sat, Sep 8, 2012 at 9:13 AM, Paul Menzel <
paulepanter@users.sourceforge.net> wrote:

> Dear Shirish,
>
>
> thank you for your answers and patience.
>
> Please just sent plain text message to mailings lists and adhere to the
> netiquette (inline quoting) [1]. That would be awesome.
>
> Have been replying inline, anyways,thanks for the correction.

>
> Am Samstag, den 08.09.2012, 08:49 -0700 schrieb Shirish S:
> > On Sat, Sep 8, 2012 at 3:35 AM, Dave Airlie <airlied@gmail.com> wrote:
> >
> > > On Sat, Sep 8, 2012 at 3:30 AM, Shirish S <shirish.s12@gmail.com>
> wrote:
> > > > Hi Dave,
> > > > Gentle Reminder!
> > > > This patch is required for passing the very first test case of HDMI
> > > > Compliance test suite.
> > > > Regards,
> > > > Shirish S
> > >
> > > Can you provide ajax with the sample he asked for previously?
> >
> > I have already sent him the sample he had asked for.
>
> Could you sent it to the list again as we are all interested in it? If
> you are allowed that is of course.
>
> am not sure if i can mail it to list, but you can get it from
http://www.quantumdata.com/index.asp
by mailing their technical support.

>
> Thanks and hopefully your patch will go in soon,
>
> Paul
>
>
> [1] http://en.opensuse.org/openSUSE:Mailing_list_netiquette
>

Regards,
Shirish S
Adam Jackson Sept. 10, 2012, 6:46 p.m. UTC | #10
On 9/8/12 6:35 AM, Dave Airlie wrote:
> On Sat, Sep 8, 2012 at 3:30 AM, Shirish S <shirish.s12@gmail.com> wrote:
>> Hi Dave,
>> Gentle Reminder!
>> This patch is required for passing the very first test case of HDMI
>> Compliance test suite.
>> Regards,
>> Shirish S
>
> Can you provide ajax with the sample he asked for previously?

He did, it even looks like I expected it to look: a (correct) block map 
and two CEA extension blocks.  Which I think means there are now ways 
two successive CEA blocks could disagree with each other, so that's 
probably something to audit, but I don't expect that to be common.

- ajax
Shirish S Sept. 13, 2012, 2:36 p.m. UTC | #11
Gentle Reminder!

On Mon, Sep 3, 2012 at 9:24 PM, Shirish S <shirish.s12@gmail.com> wrote:

> Hello Dave,
>
> My patch-set for adding support for 4 block EDID is now reviewed and ready.
> Please let me know if you want any further clarification
>
> Regards,
> Shirish S
>
>
> On Thu, Aug 30, 2012 at 12:04 AM, Shirish S <s.shirish@samsung.com> wrote:
>
>> The current logic for probing ddc is limited to
>> 2 blocks (256 bytes), this patch adds support
>> for the 4 block (512) data.
>>
>> To do this, a single 8-bit segment index is
>> passed to the display via the I2C address 30h.
>> Data from the selected segment is then immediately
>> read via the regular DDC2 address using a repeated
>> I2C 'START' signal.
>>
>> Signed-off-by: Shirish S <s.shirish@samsung.com>
>> Reviewed-by: Jean Delvare <jdelvare@suse.de>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
>> ---
>>  drivers/gpu/drm/drm_edid.c |   19 ++++++++++++++++---
>>  1 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index bcc4725..7f62de5 100644
>> --- 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
>> @@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
>> unsigned char *buf,
>>         do {
>>                 struct i2c_msg msgs[] = {
>>                         {
>> +                               .addr   = DDC_SEGMENT_ADDR,
>> +                               .flags  = 0,
>> +                               .len    = 1,
>> +                               .buf    = &segment,
>> +                       }, {
>>                                 .addr   = DDC_ADDR,
>>                                 .flags  = 0,
>>                                 .len    = 1,
>> @@ -276,15 +283,21 @@ 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.
>> +        */
>> +               ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
>> +
>>                 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)
>> --
>> 1.7.0.4
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>
>
Dave Airlie Sept. 13, 2012, 8:08 p.m. UTC | #12
On Fri, Sep 14, 2012 at 12:36 AM, Shirish S <shirish.s12@gmail.com> wrote:
> Gentle Reminder!

you are a day late,

I pushed it into drm-next yesterday :-)

Dave.
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index bcc4725..7f62de5 100644
--- 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
@@ -265,6 +267,11 @@  drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
 	do {
 		struct i2c_msg msgs[] = {
 			{
+				.addr	= DDC_SEGMENT_ADDR,
+				.flags	= 0,
+				.len	= 1,
+				.buf	= &segment,
+			}, {
 				.addr	= DDC_ADDR,
 				.flags	= 0,
 				.len	= 1,
@@ -276,15 +283,21 @@  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.
+	 */
+		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
+
 		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)