From patchwork Fri Nov 1 19:38:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zuo, Jerry" X-Patchwork-Id: 11223637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F37D13BD for ; Fri, 1 Nov 2019 19:38:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7820421906 for ; Fri, 1 Nov 2019 19:38:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7820421906 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B77CB6F859; Fri, 1 Nov 2019 19:38:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-eopbgr760040.outbound.protection.outlook.com [40.107.76.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id B73D16E054; Fri, 1 Nov 2019 19:38:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OP1zmdoGBDDGNW1sh+M94+Z/DbYFXiBOoQRKxhU+de5Cpx7MbLBrJ0X3TsR8Fr97U/O/1gmXSVwG8B9CfV0zDFlzLphozOgKSpLBwPpP3AcQIT314gEyjzvb4i0khl7FeY7+ICnEc7m4xIPgzmsc8eqvsIYJSbUNoRFD3L7RUdR/N4ohN0s9waFiIAKec4QMZA/S/odSQNZMTZ/0gGMsbq/zeilP2tf+B2+Dbk+13/Z3SEzS8+4PColWznBGKQtaaxKCEZKJaqA46Nx350YgEm3ayEJrAn0fHgLBqXdki6+skeKCTwO45e7c7ayd4fnH+TzKwAFF05OB9VdW6B9c6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lpFzxtISR0iHyMQ7azMxXkgewo0UuFBMdyBJZJp7PNI=; b=gThl5wS9dpehc3TZyw7XjBY3H69Z4BL++YXjKdWnaQk8LjOc/sS8FbgGQ1POO4HlWF6Q7uVascBaE7gxkYVgoFW/xx3/dhTUO58VRvTs3gUXe7JsWAIKAVW2viN6Y0T6Ft6+rVZpY7AWW5+vvQZXqVTDE26/PIGJ2EQG+B3Xj88k06i3+cKR3YOAnSCLvyLdcR9BN/BZN9MDpfQ+VTr4ZDT8pVlw/7+XTosr00GgSPoPOxjrMyk+vbknwGPL9SKFQbwDHq5OXwytm58RkX8XU5mS8+7vL8/bf8xiOEjG/EuyE+qyT+/uGUS6vBV0dBMFtpvaTeeDcn402xNSPQaoaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from CY4PR1201CA0012.namprd12.prod.outlook.com (2603:10b6:910:16::22) by BY5PR12MB4018.namprd12.prod.outlook.com (2603:10b6:a03:1a7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.24; Fri, 1 Nov 2019 19:38:44 +0000 Received: from DM3NAM03FT035.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::206) by CY4PR1201CA0012.outlook.office365.com (2603:10b6:910:16::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.18 via Frontend Transport; Fri, 1 Nov 2019 19:38:44 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM3NAM03FT035.mail.protection.outlook.com (10.152.82.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 19:38:44 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 1 Nov 2019 14:38:43 -0500 Received: from jzuo-linux.amd.com (10.180.168.240) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Fri, 1 Nov 2019 14:38:43 -0500 From: "Jerry (Fangzhi) Zuo" To: , Subject: [PATCH v2 1/2] drm: Add support for DP 1.4 Compliance edid corruption test 4.2.2.6 Date: Fri, 1 Nov 2019 15:38:39 -0400 Message-ID: <20191101193839.25582-1-Jerry.Zuo@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20191030210844.19803-2-Jerry.Zuo@amd.com> References: <20191030210844.19803-2-Jerry.Zuo@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(376002)(346002)(396003)(39860400002)(428003)(189003)(199004)(16586007)(53416004)(50466002)(426003)(336012)(48376002)(14444005)(110136005)(50226002)(54906003)(26005)(316002)(2906002)(1076003)(356004)(126002)(5660300002)(81156014)(70586007)(86362001)(11346002)(8936002)(186003)(6666004)(2616005)(76176011)(36756003)(4326008)(7696005)(305945005)(70206006)(486006)(47776003)(51416003)(446003)(8676002)(476003)(478600001)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:BY5PR12MB4018; H:SATLEXMB01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 528ba9ae-ac93-4338-604e-08d75f031b73 X-MS-TrafficTypeDiagnostic: BY5PR12MB4018: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YMy7pnazzUQ/ijL2dzduOoEqocncWVwu0XPQNg8LRR2vHh5jFCJKGgqmd2EmkWyFrYd8K1m7pnkSRRVX1PgeOFliUmgmxQs9eeRkhqRGIZL0ZkC6Gbi2Zqm7py0GIyqgTMOIRqx5K/FNY/TWMKgv5+SNDrbClzkOZ1wVZm3H0094OTl9dvQmBFLXAnHglheBko4xR9T0STyLKhUMSIEo4dTsQhIsRIuM946J3CvE4HMPyrpo3DLAsBVjZt2Qf2BxQ+eEvRtX3O3T+YhYDqQzu4DGmXumKkyZlg1ZbLHqQN02YKCZT+T/k2xdJDF7wGEJ0/5bk/dfHvEmDGXhImsBRjK1aDQH8hEcJXHBE4FASjq7WAqrg7Dqyyc0jbCIYwWd2uaq+pxr6Tcv1w8YPrTi5NocB+J1vHIHT5tKdaAbpxI65c2TyQM/VmnZ8KS+tDLK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 19:38:44.5380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 528ba9ae-ac93-4338-604e-08d75f031b73 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4018 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lpFzxtISR0iHyMQ7azMxXkgewo0UuFBMdyBJZJp7PNI=; b=kWNSBBzp7gZvOgAQAhQ85zlFacK343ULf7fILlQor13qignrKG3uY9Xp6PKsQvSc0VCg8YhGXLitItFPlcIlYsEnNUxGC6HLicTUko/KvGPFXGcBDXbX1m0A3dimosTKii/K2UHezAG9/0Dufwdfz8pTtgmirJwfimKqH+LHhkc= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: manasi.d.navare@intel.com, "Jerry \(Fangzhi\) Zuo" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DP 1.4 edid corruption test requires source DUT to write calculated CRC, not the corrupted CRC from reference sink. Return the calculated CRC back, and initiate the required sequence. -v2: Have separate routine for returning real CRC Signed-off-by: Jerry (Fangzhi) Zuo --- drivers/gpu/drm/drm_dp_helper.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++ include/drm/drm_connector.h | 7 +++++++ include/drm/drm_dp_helper.h | 3 +++ 4 files changed, 60 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index ffc68d305afe..75dbd30c62a7 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -336,6 +336,42 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, } EXPORT_SYMBOL(drm_dp_dpcd_read_link_status); +/** + * drm_dp_send_bad_edid_checksum() - send back real edid checksum value + * @aux: DisplayPort AUX channel + * @bad_edid_checksum: real edid checksum for the last block + * + * Returns true on success + */ +bool drm_dp_send_bad_edid_checksum(struct drm_dp_aux *aux, + u8 bad_edid_checksum) +{ + u8 link_edid_read = 0, auto_test_req = 0; + u8 test_resp = 0; + + drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, &auto_test_req, 1); + auto_test_req &= DP_AUTOMATED_TEST_REQUEST; + + drm_dp_dpcd_read(aux, DP_TEST_REQUEST, &link_edid_read, 1); + link_edid_read &= DP_TEST_LINK_EDID_READ; + + if (!auto_test_req || !link_edid_read) { + DRM_DEBUG_KMS("Source DUT does not support TEST_EDID_READ\n"); + return false; + } + + drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, &auto_test_req, 1); + + /* send back checksum for the last edid extension block data */ + drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, &bad_edid_checksum, 1); + + test_resp |= DP_TEST_EDID_CHECKSUM_WRITE; + drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, &test_resp, 1); + + return true; +} +EXPORT_SYMBOL(drm_dp_send_bad_edid_checksum); + /** * drm_dp_link_probe() - probe a DisplayPort link for capabilities * @aux: DisplayPort AUX channel diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 82a4ceed3fcf..0598314e3f46 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1354,6 +1354,17 @@ static int drm_edid_block_checksum(const u8 *raw_edid) return csum; } +static int drm_edid_block_real_checksum(const u8 *raw_edid) +{ + int i; + u8 csum = 0; + + for (i = 0; i < EDID_LENGTH - 1; i++) + csum += raw_edid[i]; + + return (0x100 - csum); +} + static bool drm_edid_is_zero(const u8 *in_edid, int length) { if (memchr_inv(in_edid, 0, length)) @@ -1572,6 +1583,9 @@ static void connector_bad_edid(struct drm_connector *connector, prefix, DUMP_PREFIX_NONE, 16, 1, block, EDID_LENGTH, false); } + + /* Calculate real checksum for the last edid extension block data */ + connector->bad_edid_checksum = drm_edid_block_real_checksum(edid + edid[0x7e] * EDID_LENGTH); } /* Get override or firmware EDID */ diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 681cb590f952..8442461542b9 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1345,6 +1345,13 @@ struct drm_connector { * rev1.1 4.2.2.6 */ bool edid_corrupt; + /** + * @bad_edid_checksum: real edid checksum value for corrupted edid block. + * Required in Displayport 1.4 compliance testing + * rev1.1 4.2.2.6 + */ + uint8_t bad_edid_checksum; + /** @debugfs_entry: debugfs directory for this connector */ struct dentry *debugfs_entry; diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 5a795075d5da..2a7e54bebb18 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1383,6 +1383,9 @@ static inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux, int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, u8 status[DP_LINK_STATUS_SIZE]); +bool drm_dp_send_bad_edid_checksum(struct drm_dp_aux *aux, + u8 bad_edid_checksum); + /* * DisplayPort link */