From patchwork Thu Aug 22 13:57:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Francis, David" X-Patchwork-Id: 11109351 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 433A113B1 for ; Thu, 22 Aug 2019 13:58:00 +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 2B44B22CE3 for ; Thu, 22 Aug 2019 13:58:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B44B22CE3 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 2466F6EB41; Thu, 22 Aug 2019 13:57:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770053.outbound.protection.outlook.com [40.107.77.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EEE06EB3F for ; Thu, 22 Aug 2019 13:57:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YeMF4QD1k1RpPSkE+quPksWiJ492QLaKBPjntktNvDNJbTRvaZxo0SsbgZpM5s5HOI0DhOh8+PG/T8EEcnBx55lGtjqesxO75l5pbxSOvwu0W6k0Pd34PumDVz4H9PUkSDwGcGtPieC+4cMD1GC+WQ6SvKIsasmxgAr2uKjrsH6X9npjQi0+UCPd1KSluuV2vgRa+3eCQNRVzyLNtcdl21zk7V7avaejbEy/xOP4Nlm1Rfjro4F9tEqWALhAm3hsFZRtGNu9iUWzV6YrDcvGNwLzk5O3b9zRrGBYy2MseP913vMiJFeuclewUFjUmfUtIEmPVH8efhJWEtc7EUMlig== 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=6tghymll+DLkIrA+sT+JSr3VAT/xCTp3q8vQOIIaaWc=; b=Md/8xip3E+4WhOwiRaPmZnPsaF+HzQhUBMsa1TR2Eg/fokJsEgf19cs2LX+teccHaRTpLbHqeAsStKfWXL9a+1DNngJBbn436mv+M0z5DMeCXBvnMZM9pEKbslPwbNA7P2J7pDCede8nyTIog7zyxz9bQbwZyvUcIwetn3byc3W4JFRSdPx5+Hi5qQp6iNZPFPFNHHIg7fFQo1DrOVXjOYDrU6DtiJ3b+cADkxViIAz+bX5ezfBpMEPc/U7gnXlQys4/LIgUlsv16JGtnKyoN8reKemGREcmZgu8s4YW3wyJxRf4+Z+R5s4f12wNQhneIzIic0O0J1D+7v2wAMVxRw== 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 DM3PR12CA0074.namprd12.prod.outlook.com (2603:10b6:0:57::18) by BN6PR12MB1266.namprd12.prod.outlook.com (2603:10b6:404:14::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Thu, 22 Aug 2019 13:57:49 +0000 Received: from CO1NAM03FT023.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by DM3PR12CA0074.outlook.office365.com (2603:10b6:0:57::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2199.14 via Frontend Transport; Thu, 22 Aug 2019 13:57:49 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT023.mail.protection.outlook.com (10.152.80.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Thu, 22 Aug 2019 13:57:49 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Thu, 22 Aug 2019 08:57:45 -0500 From: David Francis To: Subject: [PATCH v4 3/5] drm/dp-mst: Add MST support to DP DPCD R/W functions Date: Thu, 22 Aug 2019 09:57:39 -0400 Message-ID: <20190822135741.12923-4-David.Francis@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190822135741.12923-1-David.Francis@amd.com> References: <20190822135741.12923-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)(346002)(396003)(136003)(39860400002)(376002)(2980300002)(428003)(189003)(199004)(51416003)(126002)(81166006)(16586007)(50466002)(4326008)(26005)(76176011)(14444005)(86362001)(70586007)(70206006)(8936002)(336012)(426003)(186003)(478600001)(36756003)(6916009)(6666004)(47776003)(356004)(48376002)(49486002)(81156014)(8676002)(50226002)(316002)(2906002)(476003)(305945005)(2351001)(54906003)(446003)(486006)(2616005)(5660300002)(11346002)(1076003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1266; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9394ad19-9dfa-4f81-eb8d-08d72708b7cb X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328); SRVR:BN6PR12MB1266; X-MS-TrafficTypeDiagnostic: BN6PR12MB1266: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 01371B902F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: Sl3ukovUJ62uTKEk7oLhif8WXt/+sCgdZOjLGefpYRUeGucTfIpfN3vFZVp+t83WKq6CcID3YefzO+2172mBkOJCFeA0gDz+sZ1/egNpGOkyhHFGkbSmW/BAa4IN4nIzs1thXSWsVkBvWrsnFUh6IrH/YUqrY75MxsXKuGlw7JAlia09jC6A8aOYPAN1fwT1Ka4PRCh0hly3pVPsHpJXlmrNgDcgunmw6ro8S8516vZaXIvm9X+ftJ+c8mFkMpsJVP8rm6LTBaYnn4P+EMYkNtZJZxoCPB78dIWr0/qqkDkjV1lkXKsyjQ/hRXThxpMqU+WtGiLJnpZTkEPhE+Gq1whClL6I2vXnIk4LSyBM5RytWkp/72oBA4SD3D8F2Z3h/jh2BXT/fYEb9ndZg/df5Tz67WAelSrde0vAgqG0efM= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2019 13:57:49.1079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9394ad19-9dfa-4f81-eb8d-08d72708b7cb 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1266 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=6tghymll+DLkIrA+sT+JSr3VAT/xCTp3q8vQOIIaaWc=; b=yld0Q+c60Df2OAGsR8lJQWnHW3c4tTmZZO3flNlj0N2plftsOOUxHORQ8HYXXb6HxeaH04j0+vbX5R+EDrIMve1Z+ahGyKgSqiNziNK/ryx96TbUgE975UC8QzQV67H3sOH18ZgM9IxJCH0eHK/vYLeYIVUP0J0NygSBjMdJjn0= 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. v2: Fix spacing Cc: Leo Li Cc: Lyude Paul Signed-off-by: David Francis Reviewed-by: Lyude Paul --- 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 0cfb386754c3..418cad4f649a 100644 --- a/drivers/gpu/drm/drm_dp_aux_dev.c +++ b/drivers/gpu/drm/drm_dp_aux_dev.c @@ -163,11 +163,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; @@ -215,11 +211,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 ffc68d305afe..b1599760b6a3 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -251,7 +252,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 @@ -268,6 +269,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 @@ -296,7 +299,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 @@ -313,6 +316,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);