From patchwork Thu Jul 4 19:05:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Li X-Patchwork-Id: 11031851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1F61912 for ; Thu, 4 Jul 2019 19:06:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2C0B28A78 for ; Thu, 4 Jul 2019 19:06:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A78AB28A7E; Thu, 4 Jul 2019 19:06:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5754228A78 for ; Thu, 4 Jul 2019 19:06:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F420A6E3BB; Thu, 4 Jul 2019 19:06:28 +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-eopbgr710082.outbound.protection.outlook.com [40.107.71.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18B486E3BF; Thu, 4 Jul 2019 19:06:27 +0000 (UTC) Received: from BN8PR12CA0034.namprd12.prod.outlook.com (20.178.208.47) by MWHPR12MB1853.namprd12.prod.outlook.com (10.175.55.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.18; Thu, 4 Jul 2019 19:06:24 +0000 Received: from DM3NAM03FT017.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::205) by BN8PR12CA0034.outlook.office365.com (2603:10b6:408:60::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16 via Frontend Transport; Thu, 4 Jul 2019 19:06:24 +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 DM3NAM03FT017.mail.protection.outlook.com (10.152.82.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18 via Frontend Transport; Thu, 4 Jul 2019 19:06:24 +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; Thu, 4 Jul 2019 14:06:21 -0500 From: To: , Subject: [PATCH 03/10] drm/sysfs: Add mstpath attribute to connector devices Date: Thu, 4 Jul 2019 15:05:12 -0400 Message-ID: <20190704190519.29525-4-sunpeng.li@amd.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190704190519.29525-1-sunpeng.li@amd.com> References: <20190704190519.29525-1-sunpeng.li@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)(376002)(136003)(396003)(39860400002)(346002)(2980300002)(428003)(189003)(199004)(426003)(86362001)(336012)(51416003)(2870700001)(81166006)(72206003)(81156014)(2906002)(53936002)(50466002)(486006)(49486002)(356004)(5660300002)(77096007)(2616005)(476003)(47776003)(2876002)(54906003)(110136005)(11346002)(6666004)(126002)(446003)(316002)(76176011)(305945005)(48376002)(4326008)(14444005)(26005)(1076003)(68736007)(70586007)(70206006)(478600001)(186003)(50226002)(36756003)(8676002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1853; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc20d7b8-f4ca-4eb6-d8cd-08d700b2b553 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:MWHPR12MB1853; X-MS-TrafficTypeDiagnostic: MWHPR12MB1853: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0088C92887 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: NtA94wCP+Wy/Y4xDCVJRST0bs6MUx9P1WCksDqjlosRRSBdy+sMLARUnItaPWHGDMk1DZB7AZgvdzaUTekS9S9LpwOurZH5ybw44hF4UMza8yuE2FMnfbtGRZVua0dnlTotTROXl6vjuaps7YWTgXzNbm9bhPttLMdhExWWgQF+4vsZQX8+Sk+gnxyN84CfSHn3jcokeaV2ZfWDfnGXnOrDNjgd9mt/ToIiWE/MpuihKZi7N76i1y90gisr/jlmfE/TLbPjkIhhXx/uuRiztOv7pgUn3Gt5uXkZDs0qY78SZ4IvbQBX1G23QACvdzhuh07lwBZs0AvjzuUdphVQzKHAXbKl5HjdBrBSss/jSwEzNmcD6Yd/LXVchO0YpxLdGe4JCDoWKxDPMgeyUljMOccS3WYMI6gMThxRRTykcCpk= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2019 19:06:24.0049 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc20d7b8-f4ca-4eb6-d8cd-08d700b2b553 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: MWHPR12MB1853 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h+3gst5YjhqJe3AaE/ls5vzkvJ8xbYHZVWH9mcDD4os=; b=P3jWJwtPI7mpC3wrvBOGapSD85WX6g9zUGAS0E9+W5rKKCULU/sLvSHLtYFuIEbuA0WJjBqXcGXoaW29T3+razRPqdL76mxeGGyrouEfUsFzXJNvtBZGYM40iCaYYU5sD7t1l91QLl2kH5stE0H/sK8Pn8MRayur/qAwM9KdlMk= 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 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Leo Li This can be used to create more descriptive symlinks for MST aux devices. Consider the following udev rule: SUBSYSTEM=="drm_dp_aux_dev", SUBSYSTEMS=="drm", ATTRS{mstpath}=="?*", SYMLINK+="drm_dp_aux/by-path/$attr{mstpath}" The following symlinks will be created (depending on your MST topology): $ ls /dev/drm_dp_aux/by-path/ card0-mst:0-1 card0-mst:0-1-1 card0-mst:0-1-8 card0-mst:0-8 Signed-off-by: Leo Li --- drivers/gpu/drm/drm_sysfs.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index ad10810bc972..53fd1f71e900 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -236,16 +236,39 @@ static ssize_t modes_show(struct device *device, return written; } +static ssize_t mstpath_show(struct device *device, + struct device_attribute *attr, + char *buf) +{ + struct drm_connector *connector = to_drm_connector(device); + ssize_t ret = 0; + char *path; + + mutex_lock(&connector->dev->mode_config.mutex); + if (!connector->path_blob_ptr) + goto unlock; + + path = connector->path_blob_ptr->data; + ret = snprintf(buf, PAGE_SIZE, "card%d-%s\n", + connector->dev->primary->index, path); + +unlock: + mutex_unlock(&connector->dev->mode_config.mutex); + return ret; +} + static DEVICE_ATTR_RW(status); static DEVICE_ATTR_RO(enabled); static DEVICE_ATTR_RO(dpms); static DEVICE_ATTR_RO(modes); +static DEVICE_ATTR_RO(mstpath); static struct attribute *connector_dev_attrs[] = { &dev_attr_status.attr, &dev_attr_enabled.attr, &dev_attr_dpms.attr, &dev_attr_modes.attr, + &dev_attr_mstpath.attr, NULL };