From patchwork Sat Jul 12 23:47:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 4540301 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E325C0514 for ; Sat, 12 Jul 2014 23:47:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 962102017E for ; Sat, 12 Jul 2014 23:47:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C910420176 for ; Sat, 12 Jul 2014 23:47:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A94546E395; Sat, 12 Jul 2014 16:47:28 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx-out-1.rwth-aachen.de (mx-out-1.rwth-aachen.de [134.130.5.186]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C99B6E395 for ; Sat, 12 Jul 2014 16:47:26 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.01,651,1400018400"; d="scan'208";a="339782772" Received: from hub1.rwth-ad.de (HELO mail.rwth-aachen.de) ([134.130.26.142]) by mx-1.rz.rwth-aachen.de with ESMTP; 13 Jul 2014 01:47:25 +0200 Received: from appserver.fset.rwth-aachen.de (137.226.172.40) by mail.rwth-aachen.de (134.130.26.142) with Microsoft SMTP Server (TLS) id 14.3.181.6; Sun, 13 Jul 2014 01:47:25 +0200 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: Subject: [PATCH] drm/radeon: Fix manufacturer/product ID and monitor name in ELD data Date: Sun, 13 Jul 2014 01:47:16 +0200 Message-ID: <1405208836-14854-3-git-send-email-stefan.bruens@rwth-aachen.de> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1405208836-14854-1-git-send-email-stefan.bruens@rwth-aachen.de> References: <1405208836-14854-1-git-send-email-stefan.bruens@rwth-aachen.de> MIME-Version: 1.0 X-PMWin-Version: 3.1.1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);*/