From patchwork Wed Aug 21 20:01:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Francis, David" X-Patchwork-Id: 11108101 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 833901395 for ; Wed, 21 Aug 2019 20:02:10 +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 6BB6D2332A for ; Wed, 21 Aug 2019 20:02:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BB6D2332A 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 11B476E9E8; Wed, 21 Aug 2019 20:02:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710048.outbound.protection.outlook.com [40.107.71.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0E8166E98B; Wed, 21 Aug 2019 20:02:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MnoUwbHxKDv3x1M1bYOYzEwuGlO/D29CoiRuWrNoRAOICS4AvAPF96QwYn1NFoUzPjTl7PrRyTn9phO6bWdwBwaOcGp4SP7fEYod4+laRq2oD4KP5QmTDH101j1tnjV//QZmKqmLXawilRIKhCe1SjH60tGT6bYLpuy0xp0cec1a+rqw/ZCk/zcS+fISfRLEDtVhLVYZGsTF4B8aArDtCidUheScBkcr7QFd44lbB4EjZj9Ueho/6AeUgsZFmid1OlwRhxXLVZ5Ljh/FiHH9Kqt7umFooUOUbDlpkno3C+4LZAsL/LQOD6/I378t+1Qe2R+JumiPFlve6V7wbvEvtQ== 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=xIvWAceDVD2k+60d16/y6RGV1tC12FlLoAugcbhXyvM=; b=hhbnfvb6D3PadHa1+ikm62zoPaZ5RSwRU+VZqNN6AHdxWa6kCK/fLMxkxuEIZzCfQKVrWA6zn4ohCVqOvmziv0fzHp6OyhJD1Z9wCtgRWQ9/gUzeNshUkOvJe5D0ynMK4glbo5PGJyZML6mQGxEDboR8bcc1mBfZ/H4mBllEFjFSuaSFl5plSNT48gxoqTC3S8cOKlDgfXDdrjZyBklVjfGle1bT8aDpiA3TkPijXHZSGrjR3ltkvXajvO1J6LOFCCmGanPwG+aUsu1vbCOP0USUyI176O/7mbk32v0gya514fRfOHaCp68JqFwQAcZ07SHvED7yhLh1elhyw16TIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from BN4PR12CA0014.namprd12.prod.outlook.com (2603:10b6:403:2::24) by BYAPR12MB2711.namprd12.prod.outlook.com (2603:10b6:a03:68::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Wed, 21 Aug 2019 20:01:59 +0000 Received: from CO1NAM03FT063.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::201) by BN4PR12CA0014.outlook.office365.com (2603:10b6:403:2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Wed, 21 Aug 2019 20:01:59 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT063.mail.protection.outlook.com (10.152.81.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Wed, 21 Aug 2019 20:01:58 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Wed, 21 Aug 2019 15:01:40 -0500 From: David Francis To: , Subject: [PATCH v3 10/16] drm/dp-mst: Add MST support to DP DPCD R/W functions Date: Wed, 21 Aug 2019 16:01:23 -0400 Message-ID: <20190821200129.11575-11-David.Francis@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190821200129.11575-1-David.Francis@amd.com> References: <20190821200129.11575-1-David.Francis@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)(346002)(376002)(136003)(39860400002)(2980300002)(428003)(199004)(189003)(6666004)(2616005)(486006)(426003)(53936002)(476003)(336012)(126002)(14444005)(11346002)(76176011)(446003)(478600001)(70206006)(54906003)(186003)(26005)(51416003)(356004)(70586007)(36756003)(2906002)(5660300002)(1076003)(86362001)(50466002)(305945005)(8676002)(8936002)(49486002)(316002)(48376002)(81156014)(81166006)(47776003)(110136005)(16586007)(50226002)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB2711; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 429a918e-2598-47d7-4cd3-08d726726cb7 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:BYAPR12MB2711; X-MS-TrafficTypeDiagnostic: BYAPR12MB2711: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0136C1DDA4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: bOMCTiev1cROwiSF08jp//TLBpld6wL168DLlgPo7pe0hucToPCeZ4NaqYEa5rfhfwQ0y4ZjzAsbgJ0bPpS7DqKV6R0KLhLIvCx3tLHkhRux2Dd6bJGfcaRIwf7iDzNTBHV0IJogbKDoO6xjIbzbSb2mCAQ5sJOP2Z4rj5864BlmPACJoEGj3kjvgiXGMrcQS/xewOCnIj2ZkCGxwnm0kmL1lP76ZkRySN7MMtqz5ZmMgahpGXhTBpGgdrpI+2h3pamC5X6RdW2yYmgCPbGOhvA0pqZbbqJALz163TFFPzvZKYsfY5oVmTum6kadbWiaEPzMROH1kZbtde9obFITa5Olz9R2zs0IDaEUjlLJa0sJCL+SnlRJGq2r6MD3f2hGeAUOkKkTk0INzCKABEcYNfHCIavYWZBHcSxpFxrGZic= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2019 20:01:58.6292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 429a918e-2598-47d7-4cd3-08d726726cb7 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2711 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=xIvWAceDVD2k+60d16/y6RGV1tC12FlLoAugcbhXyvM=; b=gSWbtGdeMGPl7xFSuVo8ukFVoeTPP87jZCFlXNzrfL4hHDYrhkJN1jR9ImJ1C1NZ88ePHphg4aeiMhSO2Z73FpX53Fpl9Ww3xv4bFhI+hroy3jMzB9b6PC5h28baKuNNYDrxNR9ys15TqhYN5tgUpJra5eAgUcucAKKsNazfKxg= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; 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: Leo Li , David Francis Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of having drm_dp_dpcd_read/write and drm_dp_mst_dpcd_read/write as entry points into the aux code, have drm_dp_dpcd_read/write handle both. This means that DRM drivers can make MST DPCD read/writes. Cc: Leo Li Cc: Lyude Paul Signed-off-by: David Francis --- drivers/gpu/drm/drm_dp_aux_dev.c | 12 ++---------- drivers/gpu/drm/drm_dp_helper.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c index 00610bd8d6c1..0780fc358389 100644 --- a/drivers/gpu/drm/drm_dp_aux_dev.c +++ b/drivers/gpu/drm/drm_dp_aux_dev.c @@ -162,11 +162,7 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to) break; } - if (aux_dev->aux->is_remote) - res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf, - todo); - else - res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo); + res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo); if (res <= 0) break; @@ -214,11 +210,7 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from) break; } - if (aux_dev->aux->is_remote) - res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf, - todo); - else - res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo); + res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf, todo); if (res <= 0) break; diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 54a6414c5d96..9f976b90c53a 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "drm_crtc_helper_internal.h" @@ -272,7 +273,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request, /** * drm_dp_dpcd_read() - read a series of bytes from the DPCD - * @aux: DisplayPort AUX channel + * @aux: DisplayPort AUX channel (SST or MST) * @offset: address of the (first) register to read * @buffer: buffer to store the register values * @size: number of bytes in @buffer @@ -289,6 +290,8 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, { int ret; + if (aux->is_remote) + return drm_dp_mst_dpcd_read(aux, offset, buffer, size); /* * HP ZR24w corrupts the first DPCD access after entering power save * mode. Eg. on a read, the entire buffer will be filled with the same @@ -317,7 +320,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read); /** * drm_dp_dpcd_write() - write a series of bytes to the DPCD - * @aux: DisplayPort AUX channel + * @aux: DisplayPort AUX channel (SST or MST) * @offset: address of the (first) register to write * @buffer: buffer containing the values to write * @size: number of bytes in @buffer @@ -334,6 +337,9 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, { int ret; + if (aux->is_remote) + return drm_dp_mst_dpcd_write(aux, offset, buffer, size); + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, size); drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);