From patchwork Wed Oct 30 21:08:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zuo, Jerry" X-Patchwork-Id: 11220073 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 396EA913 for ; Wed, 30 Oct 2019 21:09:32 +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 1FE5C20856 for ; Wed, 30 Oct 2019 21:09:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FE5C20856 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 01DC26EB40; Wed, 30 Oct 2019 21:09:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700089.outbound.protection.outlook.com [40.107.70.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id D06956EB40; Wed, 30 Oct 2019 21:09:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zg2X+3Ebd2yBZd4Lcq6imfJ2YlstiaxaYow2jN5D3zQzYjbzo5WudyGu5mNyR7MC7sGQWNj+DgPfT2bXYF7Yh3TxVAi2xOFzQB7KPKVLI/pVONt3Pi3eopW04IGIwnPgkLCri6FnkqX6EUTtva5DanYoXcu9e491lBm5H5+qJ46xkZ1f/V+xsWBupkr6lw1+MddvFhAhjMXx+BpjUEfZaw84JVpaX2u/+0HoV+O0yko8SI7fGBYjfgD9oVbe25TZPkM2ldoUJzUQ0j3Fhr2ddl8FcqYCkiAIUMYhHq19SJKIeHwC3j869TNMew6CSkZZzF2dQaOxF8D/IpsDjXE/dQ== 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=yDN9iovwnkV3d972qVszi7+N3rEpDxY7LqteNEUGM10=; b=oRa0kfuO/3zvBYnATc0iuB0OL9/KXkKtL7WwnD3JX58FLgRuadvMP3wDoBOUOcuwBm5Kje5y6glGG6fj8rSv37mu5Re3+LFu8R/LHHFmw2+0WclQ88dcpia5yDdndhpC8CrzudslPoOd09Cea7DskSlC8QlA1hKSsdDXXfblFTRLudpI39qwbxXciolI8jnjRK8zloyQyWO9M87fd0uEJ5pMxSpE++wyP1+7Rqvl1gyeDSOlKlHIDTalhrhmztQId8O4qh2OhuInSTqpTLvlllqco01tzqFBbsfodcIGwA88LV8h3a6fIwDm6rXPFlFq67jl2fXaFpXvaao55yBemg== 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 DM3PR12CA0101.namprd12.prod.outlook.com (2603:10b6:0:55::21) by BN6PR1201MB0131.namprd12.prod.outlook.com (2603:10b6:405:5b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.24; Wed, 30 Oct 2019 21:09:27 +0000 Received: from CO1NAM03FT042.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by DM3PR12CA0101.outlook.office365.com (2603:10b6:0:55::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.19 via Frontend Transport; Wed, 30 Oct 2019 21:09:27 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by CO1NAM03FT042.mail.protection.outlook.com (10.152.81.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2387.20 via Frontend Transport; Wed, 30 Oct 2019 21:09:26 +0000 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 30 Oct 2019 16:09:25 -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; Wed, 30 Oct 2019 16:09:25 -0500 From: "Jerry (Fangzhi) Zuo" To: , Subject: [PATCH 1/2] drm: Add support for DP 1.4 Compliance edid corruption test 4.2.2.6 Date: Wed, 30 Oct 2019 17:08:43 -0400 Message-ID: <20191030210844.19803-2-Jerry.Zuo@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20191030210844.19803-1-Jerry.Zuo@amd.com> References: <20191030210844.19803-1-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)(396003)(136003)(39860400002)(346002)(376002)(428003)(189003)(199004)(50466002)(11346002)(48376002)(446003)(126002)(6666004)(356004)(2616005)(2906002)(476003)(5660300002)(316002)(54906003)(47776003)(16586007)(86362001)(110136005)(478600001)(1076003)(50226002)(4326008)(186003)(81156014)(81166006)(8676002)(76176011)(305945005)(26005)(8936002)(36756003)(486006)(53416004)(14444005)(336012)(426003)(7696005)(51416003)(70586007)(70206006); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0131; H:SATLEXMB02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5b8b70bb-c835-467a-fad6-08d75d7d7245 X-MS-TrafficTypeDiagnostic: BN6PR1201MB0131: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-Forefront-PRVS: 02065A9E77 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DCKhXa+QJXmpGTRDgJpR13y0IbdzGKbw3AJ4wWi0UcPq9jxJJV6b4oIa+YqbShKhcwKq5qWSBBYYwy4uDHDDfhDXnFftQWYYSP3B9iXyVIhpvvilKNMrCqBa95bhX7mRVWx3kUxhkMfFnYpL1AfSuc9sMtBx9BFnhUe/EyBlyd86gQ6KZRhmNOTgJHQ9dAhFTKmqDLwF+RF8ZOw7sXyQdgiBPRtV8UjJMwQ/haGYhrNdylu75ZACfya4O9o8D7tcwFyO4rS6c3n6Pq+GJN6AFuB855rQGFH8KKNoxwkaDcWxDIPp/jJGXWvPIQbSW+Lzb/RCG4i0AmjT3zLeaIs+D8nWB5G14KY7ZzCANAxlSC8s94Bl4pddXUomYtGcTIw/zmu5LbfxN/oqjUJBdpyHUGdcXkDVXn4Vm+rKhv4JcWRdhoqD+TP2NLZamBxRuJSB X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2019 21:09:26.4077 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b8b70bb-c835-467a-fad6-08d75d7d7245 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=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0131 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=yDN9iovwnkV3d972qVszi7+N3rEpDxY7LqteNEUGM10=; b=XqrHUfBP17mWJjVvVtVJHi4dfvq2cHJiZ4LDp2s0J7hrUdFq21ptV9WYJyem9FNBJBMb8K4pIYqTu/zlhcJDUEStPryKuUV4aUmQe8lG/WWnjIENna46/1WdSr9cldP89RR2B9Vw7DW/E9o3a3EHghGe3Psq4EYolLOXkLzgMLM= 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.Zuo@amd.com 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. Signed-off-by: Jerry (Fangzhi) Zuo --- drivers/gpu/drm/drm_dp_helper.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_edid.c | 15 ++++++++++++--- include/drm/drm_connector.h | 7 +++++++ include/drm/drm_dp_helper.h | 3 +++ 4 files changed, 58 insertions(+), 3 deletions(-) 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..400064dcc010 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1344,13 +1344,19 @@ static void drm_get_displayid(struct drm_connector *connector, struct edid *edid); static int validate_displayid(u8 *displayid, int length, int idx); -static int drm_edid_block_checksum(const u8 *raw_edid) +static int drm_edid_block_checksum(const u8 *raw_edid, bool c) { int i; u8 csum = 0; - for (i = 0; i < EDID_LENGTH; i++) + u8 len; + + len = c ? EDID_LENGTH : (EDID_LENGTH - 1); + + for (i = 0; i < len; i++) csum += raw_edid[i]; + csum = c ? csum : (0x100 - csum); + return csum; } @@ -1408,7 +1414,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid, } } - csum = drm_edid_block_checksum(raw_edid); + csum = drm_edid_block_checksum(raw_edid, true); if (csum) { if (edid_corrupt) *edid_corrupt = true; @@ -1572,6 +1578,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_checksum(edid + edid[0x7e] * EDID_LENGTH, false); } /* 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 */