diff mbox

drm/radeon: Fix manufacturer/product ID and monitor name in ELD data

Message ID 1405208836-14854-3-git-send-email-stefan.bruens@rwth-aachen.de (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Brüns July 12, 2014, 11:47 p.m. UTC
Low/high bytes were for manufacturer and product ID were swapped.
Monitor name in ELD data is not zero terminated, use length field from
ELD data and initialize remaining bytes to 0.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
---
 drivers/gpu/drm/radeon/dce6_afmt.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Alex Deucher July 14, 2014, 3:13 p.m. UTC | #1
On Sat, Jul 12, 2014 at 7:47 PM, Stefan Brüns
<stefan.bruens@rwth-aachen.de> wrote:
> Low/high bytes were for manufacturer and product ID were swapped.
> Monitor name in ELD data is not zero terminated, use length field from
> ELD data and initialize remaining bytes to 0.
>
> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>

I squashed this into your original patch.

Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/dce6_afmt.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c
> index 8a76180..f07b360 100644
> --- a/drivers/gpu/drm/radeon/dce6_afmt.c
> +++ b/drivers/gpu/drm/radeon/dce6_afmt.c
> @@ -309,18 +309,20 @@ void dce6_afmt_write_sinkinfo(struct drm_encoder *encoder)
>
>         eld = connector->eld;
>
> -       tmp = MANUFACTURER_ID(eld[16]<<8 | eld[17]) | PRODUCT_ID(eld[18]<<8 | eld[19]);
> +       tmp = MANUFACTURER_ID(eld[17]<<8 | eld[16]) | PRODUCT_ID(eld[19]<<8 | eld[18]);
>         WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO0, tmp);
>
> -       tmp = SINK_DESCRIPTION_LEN(strlen(&eld[20])) + 1;
> -       tmp = (tmp > 19) ? 19 : tmp;
> +       tmp = SINK_DESCRIPTION_LEN((eld[4] & 0xf) + 1);
>         WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO1, tmp);
>
> -       strncpy(description, &eld[20], 18);
> +       memset(description, 0, sizeof(description));
> +       strncpy(description, &eld[20], tmp);
>
> +       /* fglrx uses crt# here */
>         tmp = PORT_ID0(0x1);
>         /*WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO2, tmp);*/
>
> +       /* PCI:1:0:0 ? */
>         tmp = PORT_ID1(0x100);
>         /*WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO3, tmp);*/
>
> --
> 1.8.4.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c
index 8a76180..f07b360 100644
--- a/drivers/gpu/drm/radeon/dce6_afmt.c
+++ b/drivers/gpu/drm/radeon/dce6_afmt.c
@@ -309,18 +309,20 @@  void dce6_afmt_write_sinkinfo(struct drm_encoder *encoder)
 
 	eld = connector->eld;
 
-	tmp = MANUFACTURER_ID(eld[16]<<8 | eld[17]) | PRODUCT_ID(eld[18]<<8 | eld[19]);
+	tmp = MANUFACTURER_ID(eld[17]<<8 | eld[16]) | PRODUCT_ID(eld[19]<<8 | eld[18]);
 	WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO0, tmp);
 
-	tmp = SINK_DESCRIPTION_LEN(strlen(&eld[20])) + 1;
-	tmp = (tmp > 19) ? 19 : tmp;
+	tmp = SINK_DESCRIPTION_LEN((eld[4] & 0xf) + 1);
 	WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO1, tmp);
 
-	strncpy(description, &eld[20], 18);
+	memset(description, 0, sizeof(description));
+	strncpy(description, &eld[20], tmp);
 
+	/* fglrx uses crt# here */
 	tmp = PORT_ID0(0x1);
 	/*WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO2, tmp);*/
 
+	/* PCI:1:0:0 ? */
 	tmp = PORT_ID1(0x100);
 	/*WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO3, tmp);*/