From patchwork Wed Jan 8 08:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Lin X-Patchwork-Id: 11323077 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 D785D1398 for ; Wed, 8 Jan 2020 08:45:27 +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 B5156206DA for ; Wed, 8 Jan 2020 08:45:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="ij+bdVpM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5156206DA 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 C29A889C07; Wed, 8 Jan 2020 08:45:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20628.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::628]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB8BE89BF5; Wed, 8 Jan 2020 08:45:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OytobmJPZFSmE99MuD0VL8LLwRMC+FIwSIZXnYrNeyCSucxyBxo15VjlB5OaD3LZDIRAUR0r3wKNE7qVHwK8F2LGrtpmQuZpMyevI6vrbUGECulPn79YrHnyLN1MxLuycuTVSO291jH4ahtMrB7MWpXrpcMv331Y6twpC5J0JZ3NXi+SVG/AD63aZxFFPePcVJ07cRdwkF7Cvqd3QpSWSs1eNhiEz/ZAan5hVqLf99wN2tzaOFfUHcld71rL3qpR0oi7ZvxjOj4xfbFU4dW189TrEJRatdQcqKmqfOnngeaA43ppaGSN3QCfoTCPqjPgiKEhcf0PMnnKsj6cGD4cQg== 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=kYHOVDtgKjC/1Pje9fTTtFmpzpV2Sxpg8elqex5FiLY=; b=OLlDirB7XwoVDUU6/RzGvODmCyrtma07XLzspfWspeX/KeEWDAdGTrRjNO74XbbzlmBnzoR0sqq5VO486dfKvRLQTb9FBLRJoXU2HX12EBLTKZIVjRs1f1J66gK5Yq4h/YR3g2uaGJ7TvAkbts/URdif+D6qf0HC8kSknt6SwfF2mE8qWF6g60E34quVEzi/hZ5LyJobp6pNACNGdOgB9KEl/5FtvRaiEy6Q9qkOuaxysDP0Uv3p8UaDL1tJvbCZwvtEH8+HWaZ8BitrrMQQJ0WO3YcLYu1a1sB2/A0rrZRyTxR6ypZSLhJVOz0yVrqRIxSi/wy/own1GEkQiDcMZg== 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 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=kYHOVDtgKjC/1Pje9fTTtFmpzpV2Sxpg8elqex5FiLY=; b=ij+bdVpMJi4u/fiAOn7FmFns8eEnN2EKYp6cGYnw4jLbd5ivgerJzmn79zoR0CVmSrqNhG3gNoYR5JJAPgDgiTj8uO1S1vJMpskGrBiE38aNN0flO7+zDWLDWusYieLgz936fQCursA3i2gQwooGFIUgb/hrZ076MdbZw8AwPXI= Received: from CY4PR12CA0042.namprd12.prod.outlook.com (2603:10b6:903:129::28) by BN6PR12MB1649.namprd12.prod.outlook.com (2603:10b6:405:5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.13; Wed, 8 Jan 2020 08:45:21 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eaa::201) by CY4PR12CA0042.outlook.office365.com (2603:10b6:903:129::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9 via Frontend Transport; Wed, 8 Jan 2020 08:45:21 +0000 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; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB01.amd.com (165.204.84.17) by DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2623.9 via Frontend Transport; Wed, 8 Jan 2020 08:45:21 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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; Wed, 8 Jan 2020 02:45:20 -0600 Received: from SATLEXMB01.amd.com (10.181.40.142) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 8 Jan 2020 02:45:20 -0600 Received: from wayne-System-Product-Name.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, 8 Jan 2020 02:45:18 -0600 From: Wayne Lin To: , Subject: [PATCH 1/2] drm/dp_mst: Add a function to determine the mst end device Date: Wed, 8 Jan 2020 16:44:15 +0800 Message-ID: <20200108084416.6296-2-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200108084416.6296-1-Wayne.Lin@amd.com> References: <20200108084416.6296-1-Wayne.Lin@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:; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(396003)(346002)(376002)(428003)(189003)(199004)(36756003)(70206006)(426003)(356004)(8936002)(5660300002)(1076003)(6666004)(26005)(8676002)(86362001)(7696005)(81156014)(81166006)(4326008)(2906002)(316002)(2616005)(186003)(54906003)(478600001)(336012)(70586007)(110136005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1649; 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: 50605cdc-c2c2-4f1a-5165-08d7941718a0 X-MS-TrafficTypeDiagnostic: BN6PR12MB1649: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-Forefront-PRVS: 02760F0D1C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O4OaTsJYyvD8xrRejsSrw7hOSkM3qHQ6881q7tGVivMMiIhxE6VNg3riLOmaBMij4AjZOrVgqoT2pbA90JwKtgmCDku59GndZoWCWhEWYoPLy+tC0q681yTdCg+t39eAUBAmCUM1AaKgyFdUsGZ8+pLzADwFfD6FXQXYUxN4DAw9giURzVc6DEZ27CKd8nF+IoHlzStNgmt0ag52uqtamXi1Y+UqXcNYMqkHreB9T0rw876Uo/G7DoEfyKgZHAU/Ul/vK2R8qKx5iF7Q1hQNOaK6Lo9AnLGEThTx2+bzi3Fr6filc5RMfripaKgvG1cccEP7jzMoTSo9ZWurmWuB82Qfl3uMJq5FFFJuVtSBHEyQbctwH5Ma63p560h94Fgi6wQf7SoUwGM1Mpb0v60up0mpzTcXzO81lsIyoh50giBczT2WtaqRH9fz+QZmGQNT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2020 08:45:21.3686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 50605cdc-c2c2-4f1a-5165-08d7941718a0 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: BN6PR12MB1649 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jerry.zuo@amd.com, Nicholas.Kazlauskas@amd.com, Wayne Lin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] For later usage convenience, add the function drm_dp_mst_is_dp_mst_end_device() to decide whether a peer device connected to a DFP is mst end device. Which also indicates if the peer device is capable of handling message or not. Signed-off-by: Wayne Lin --- drivers/gpu/drm/drm_dp_mst_topology.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index eebf325d7f48..8f54b241db08 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1918,6 +1918,22 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port, return parent_lct + 1; } +static bool drm_dp_mst_is_dp_mst_end_device(u8 pdt, bool mcs) +{ + switch (pdt) { + case DP_PEER_DEVICE_DP_LEGACY_CONV: + case DP_PEER_DEVICE_SST_SINK: + return true; + case DP_PEER_DEVICE_MST_BRANCHING: + /* For sst branch device */ + if (!mcs) + return true; + + return false; + } + return true; +} + static int drm_dp_port_set_pdt(struct drm_dp_mst_port *port, u8 new_pdt) { struct drm_dp_mst_topology_mgr *mgr = port->mgr; From patchwork Wed Jan 8 08:44:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wayne Lin X-Patchwork-Id: 11323079 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 20798138D for ; Wed, 8 Jan 2020 08:45:33 +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 F10D720705 for ; Wed, 8 Jan 2020 08:45:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="OlGCuvaV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F10D720705 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 43ADC6E197; Wed, 8 Jan 2020 08:45:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2079.outbound.protection.outlook.com [40.107.220.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id A42616E197; Wed, 8 Jan 2020 08:45:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ET25wrw2FGS2+gd+x9u8IYpVDV2Ro0vnV9DeWZlvSsifEDl0iS7/0Ub/XLyeswI9+nLN4QZndFI1PTNnpZjqwm5fTNKXOWOsRzs8eVDOu9usYfstijxflEhnTf2H5I/BWdHWhVTiOJcKGKNvPt0EOniRPim61H0TVTUQgWFV13h5jFwoV5i+APpm9BskuBIK5RLQhRIBDdFOEYvUfL5/RMBtChDcaUjU/7rYs1Wx69WTMJ4NDYIxoK7J/YTrCkWnqA5o67BgApwlonLxgv8ZKT7aCooGyL8SKdLj2ddHxHmybVcKKYyApnSAZyAuwPXiOBgDljklFvN8S/V+hmZTGQ== 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=yH6yG7ONGsgA2CACY4lvyz6P9yDifny17I9V643ZfcQ=; b=Os4m8L8SoRfq1EgFFgiLZHqDc5m0tGv30+8JO9hMh/fSR9G54PC0A8TVSG737oPI2l4XDEw1h02MqjWqLJonOGomuUJIEzBso1S+kR0IHesryQiNlkonqujRrWHzTpOjIE7IbvlcMHtD/4c9PF94AefFhGXN6I1AzhBgMF7YqwlRPpwpNLU7vwz4xcVjwGHmScmTfGvRniWbL1zggimCOybuU3i9WvO6+eFU6WoSz6CvG0GSY0f3a3vsf2YvlQarnL1jk3pFl9v+Z/AwGDa74pITEUBBmqIqWlWdFXvyooGOUCaWUktdYemnmftK7UunzVjxLGp3CyEjoQiPkiJ8XA== 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 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=yH6yG7ONGsgA2CACY4lvyz6P9yDifny17I9V643ZfcQ=; b=OlGCuvaV/jvk4rwix58XcjctvuImXETHdA+vE+Xml3aeuYy9cTvFtiEgfcnnKTPfFbapG5bp+GIcI5wDcT7pVNIG0gL+4Wchr5P4hx4PW7WT/tZBG9Q6O6vpaMHhnqMI/G9wsuOh8rOFhzU2Pf/O6qB5Uye9C32p+OGXghA9LFc= Received: from MWHPR12CA0032.namprd12.prod.outlook.com (2603:10b6:301:2::18) by DM6PR12MB2891.namprd12.prod.outlook.com (2603:10b6:5:188::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.15; Wed, 8 Jan 2020 08:45:26 +0000 Received: from BN8NAM11FT053.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eae::201) by MWHPR12CA0032.outlook.office365.com (2603:10b6:301:2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.12 via Frontend Transport; Wed, 8 Jan 2020 08:45:26 +0000 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; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by BN8NAM11FT053.mail.protection.outlook.com (10.13.177.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2623.9 via Frontend Transport; Wed, 8 Jan 2020 08:45: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, 8 Jan 2020 02:45:25 -0600 Received: from wayne-System-Product-Name.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, 8 Jan 2020 02:45:23 -0600 From: Wayne Lin To: , Subject: [PATCH 2/2] drm/dp_mst: Handle SST-only branch device case Date: Wed, 8 Jan 2020 16:44:16 +0800 Message-ID: <20200108084416.6296-3-Wayne.Lin@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200108084416.6296-1-Wayne.Lin@amd.com> References: <20200108084416.6296-1-Wayne.Lin@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:; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(39860400002)(136003)(346002)(376002)(428003)(189003)(199004)(6666004)(356004)(426003)(2616005)(336012)(110136005)(186003)(7696005)(316002)(70206006)(70586007)(26005)(54906003)(5660300002)(86362001)(8936002)(1076003)(4326008)(478600001)(81156014)(66574012)(36756003)(2906002)(8676002)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB2891; 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: 916a3db9-2252-4085-1e53-08d794171b95 X-MS-TrafficTypeDiagnostic: DM6PR12MB2891: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-Forefront-PRVS: 02760F0D1C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DYypZYLA0TMb97sNOv7N1z8i/skb2x5Xpm7SFugpYh4D1AYOUUjKVzKljr/DbOFy6rkOfUP+Az7NaNjQ5ZrecwCrHeWIfxsx9Qxw85QGni4o0X+XdKf2lN2bajYQDZTLzFA7G4ozMiF1kziHm6w412gqom5asUkLIAHmn21xWDXxPMDq854dhKDG+72aKdh1R6QUBfVMhscSPVpQWE7E8p2sV7lbGlAl5tWZOY7MQAcSjU8ly8nn4gJCO3oJgJ19BJs4bfuO9NPQs47xwuPH58g5UY1DXrXIATJ1LKuWCSZJkbIiKDntlfmmwqEyg99YhM8M+MXsVpNgww2Y+/A/kz0gLEK604xFgq8JPWCmeEjzXh9DZuZDcKeCsfG3vBK6vKUXXuO5h5SfM/ZXYsM5II0bhVRxDnsUV7144ecCBHN7zN/tgySWD6rdFuE3pyt8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2020 08:45:26.3690 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 916a3db9-2252-4085-1e53-08d794171b95 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: DM6PR12MB2891 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Harry Wentland , jerry.zuo@amd.com, Wayne Lin , Nicholas.Kazlauskas@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" [Why] While handling LINK_ADDRESS reply, current code expects a peer device can handle sideband message once the peer device type is reported as DP_PEER_DEVICE_MST_BRANCHING. However, when the connected device is a SST branch case, it can't handle the sideband message(MST_CAP=0 in DPCD 00021h). Current code will try to send LINK_ADDRESS to SST branch device and end up with message timeout and monitor can't display normally. As the result of that, we should take SST branch device into account. [How] According to DP 1.4 spec, we can use Peer_Device_Type as DP_PEER_DEVICE_MST_BRANCHING and Message_Capability_Status as 0 to indicate peer device as a SST-only branch device. Fix following: - Take SST-only branch device case into account in drm_dp_port_set_pdt() and add a new parameter 'new_mcs'. Take sst branch device case as the same case as DP_PEER_DEVICE_DP_LEGACY_CONV and DP_PEER_DEVICE_SST_SINK. All original handling logics remain. - Take SST-only branch device case into account in drm_dp_mst_port_add_connector(). - Fix some parts in drm_dp_mst_handle_link_address_port() to have SST branch device case into consideration. - Fix the arguments of drm_dp_port_set_pdt() in drm_dp_mst_handle_conn_stat(). - Have SST branch device also report connector_status_connected when the ddps is true in drm_dp_mst_detect_port() - Fix the arguments of drm_dp_port_set_pdt() in drm_dp_delayed_destroy_port() Fixes: c485e2c97dae ("drm/dp_mst: Refactor pdt setup/teardown, add more locking") Cc: Ville Syrjälä Cc: Harry Wentland Cc: Lyude Paul Signed-off-by: Wayne Lin Reviewed-by: Lyude Paul --- drivers/gpu/drm/drm_dp_mst_topology.c | 131 +++++++++++++------------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 8f54b241db08..4395d5cc0645 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1934,73 +1934,74 @@ static bool drm_dp_mst_is_dp_mst_end_device(u8 pdt, bool mcs) return true; } -static int drm_dp_port_set_pdt(struct drm_dp_mst_port *port, u8 new_pdt) +static int +drm_dp_port_set_pdt(struct drm_dp_mst_port *port, u8 new_pdt, + bool new_mcs) { struct drm_dp_mst_topology_mgr *mgr = port->mgr; struct drm_dp_mst_branch *mstb; u8 rad[8], lct; int ret = 0; - if (port->pdt == new_pdt) + if (port->pdt == new_pdt && port->mcs == new_mcs) return 0; /* Teardown the old pdt, if there is one */ - switch (port->pdt) { - case DP_PEER_DEVICE_DP_LEGACY_CONV: - case DP_PEER_DEVICE_SST_SINK: - /* - * If the new PDT would also have an i2c bus, don't bother - * with reregistering it - */ - if (new_pdt == DP_PEER_DEVICE_DP_LEGACY_CONV || - new_pdt == DP_PEER_DEVICE_SST_SINK) { - port->pdt = new_pdt; - return 0; - } + if (port->pdt != DP_PEER_DEVICE_NONE) { + if (drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) { + /* + * If the new PDT would also have an i2c bus, + * don't bother with reregistering it + */ + if (new_pdt != DP_PEER_DEVICE_NONE && + drm_dp_mst_is_dp_mst_end_device(new_pdt, new_mcs)) { + port->pdt = new_pdt; + port->mcs = new_mcs; + return 0; + } - /* remove i2c over sideband */ - drm_dp_mst_unregister_i2c_bus(&port->aux); - break; - case DP_PEER_DEVICE_MST_BRANCHING: - mutex_lock(&mgr->lock); - drm_dp_mst_topology_put_mstb(port->mstb); - port->mstb = NULL; - mutex_unlock(&mgr->lock); - break; + /* remove i2c over sideband */ + drm_dp_mst_unregister_i2c_bus(&port->aux); + } else { + mutex_lock(&mgr->lock); + drm_dp_mst_topology_put_mstb(port->mstb); + port->mstb = NULL; + mutex_unlock(&mgr->lock); + } } port->pdt = new_pdt; - switch (port->pdt) { - case DP_PEER_DEVICE_DP_LEGACY_CONV: - case DP_PEER_DEVICE_SST_SINK: - /* add i2c over sideband */ - ret = drm_dp_mst_register_i2c_bus(&port->aux); - break; + port->mcs = new_mcs; - case DP_PEER_DEVICE_MST_BRANCHING: - lct = drm_dp_calculate_rad(port, rad); - mstb = drm_dp_add_mst_branch_device(lct, rad); - if (!mstb) { - ret = -ENOMEM; - DRM_ERROR("Failed to create MSTB for port %p", port); - goto out; - } + if (port->pdt != DP_PEER_DEVICE_NONE) { + if (drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) { + /* add i2c over sideband */ + ret = drm_dp_mst_register_i2c_bus(&port->aux); + } else { + lct = drm_dp_calculate_rad(port, rad); + mstb = drm_dp_add_mst_branch_device(lct, rad); + if (!mstb) { + ret = -ENOMEM; + DRM_ERROR("Failed to create MSTB for port %p", + port); + goto out; + } - mutex_lock(&mgr->lock); - port->mstb = mstb; - mstb->mgr = port->mgr; - mstb->port_parent = port; + mutex_lock(&mgr->lock); + port->mstb = mstb; + mstb->mgr = port->mgr; + mstb->port_parent = port; - /* - * Make sure this port's memory allocation stays - * around until its child MSTB releases it - */ - drm_dp_mst_get_port_malloc(port); - mutex_unlock(&mgr->lock); + /* + * Make sure this port's memory allocation stays + * around until its child MSTB releases it + */ + drm_dp_mst_get_port_malloc(port); + mutex_unlock(&mgr->lock); - /* And make sure we send a link address for this */ - ret = 1; - break; + /* And make sure we send a link address for this */ + ret = 1; + } } out: @@ -2153,12 +2154,12 @@ drm_dp_mst_port_add_connector(struct drm_dp_mst_branch *mstb, goto error; } - if ((port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV || - port->pdt == DP_PEER_DEVICE_SST_SINK) && - port->port_num >= DP_MST_LOGICAL_PORT_0) { - port->cached_edid = drm_get_edid(port->connector, - &port->aux.ddc); - drm_connector_set_tile_property(port->connector); + if (port->pdt != DP_PEER_DEVICE_NONE) { + if (drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) { + port->cached_edid = drm_get_edid(port->connector, + &port->aux.ddc); + drm_connector_set_tile_property(port->connector); + } } mgr->cbs->register_connector(port->connector); @@ -2223,6 +2224,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, struct drm_dp_mst_port *port; int old_ddps = 0, ret; u8 new_pdt = DP_PEER_DEVICE_NONE; + bool new_mcs = 0; bool created = false, send_link_addr = false, changed = false; port = drm_dp_get_port(mstb, port_msg->port_number); @@ -2267,7 +2269,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, port->input = port_msg->input_port; if (!port->input) new_pdt = port_msg->peer_device_type; - port->mcs = port_msg->mcs; + new_mcs = port_msg->mcs; port->ddps = port_msg->ddps; port->ldps = port_msg->legacy_device_plug_status; port->dpcd_rev = port_msg->dpcd_revision; @@ -2295,7 +2297,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, } } - ret = drm_dp_port_set_pdt(port, new_pdt); + ret = drm_dp_port_set_pdt(port, new_pdt, new_mcs); if (ret == 1) { send_link_addr = true; } else if (ret < 0) { @@ -2309,7 +2311,8 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, * we're coming out of suspend. In this case, always resend the link * address if there's an MSTB on this port */ - if (!created && port->pdt == DP_PEER_DEVICE_MST_BRANCHING) + if (!created && port->pdt == DP_PEER_DEVICE_MST_BRANCHING && + port->mcs) send_link_addr = true; if (port->connector) @@ -2346,6 +2349,7 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, struct drm_dp_mst_port *port; int old_ddps, old_input, ret, i; u8 new_pdt; + bool new_mcs; bool dowork = false, create_connector = false; port = drm_dp_get_port(mstb, conn_stat->port_number); @@ -2377,7 +2381,6 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, old_ddps = port->ddps; old_input = port->input; port->input = conn_stat->input_port; - port->mcs = conn_stat->message_capability_status; port->ldps = conn_stat->legacy_device_plug_status; port->ddps = conn_stat->displayport_device_plug_status; @@ -2390,8 +2393,8 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, } new_pdt = port->input ? DP_PEER_DEVICE_NONE : conn_stat->peer_device_type; - - ret = drm_dp_port_set_pdt(port, new_pdt); + new_mcs = conn_stat->message_capability_status; + ret = drm_dp_port_set_pdt(port, new_pdt, new_mcs); if (ret == 1) { dowork = true; } else if (ret < 0) { @@ -3958,6 +3961,8 @@ drm_dp_mst_detect_port(struct drm_connector *connector, switch (port->pdt) { case DP_PEER_DEVICE_NONE: case DP_PEER_DEVICE_MST_BRANCHING: + if (!port->mcs) + ret = connector_status_connected; break; case DP_PEER_DEVICE_SST_SINK: @@ -4597,7 +4602,7 @@ drm_dp_delayed_destroy_port(struct drm_dp_mst_port *port) if (port->connector) port->mgr->cbs->destroy_connector(port->mgr, port->connector); - drm_dp_port_set_pdt(port, DP_PEER_DEVICE_NONE); + drm_dp_port_set_pdt(port, DP_PEER_DEVICE_NONE, port->mcs); drm_dp_mst_put_port_malloc(port); }