From patchwork Fri Jul 5 14:32:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Leo Li X-Patchwork-Id: 11032751 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 D09E31580 for ; Fri, 5 Jul 2019 14:32:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEBFE28AA0 for ; Fri, 5 Jul 2019 14:32:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1A9528AB0; Fri, 5 Jul 2019 14:32:32 +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 4F32E28AA0 for ; Fri, 5 Jul 2019 14:32:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5EB646E4D4; Fri, 5 Jul 2019 14:32:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750050.outbound.protection.outlook.com [40.107.75.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id 336356E4D2; Fri, 5 Jul 2019 14:32:30 +0000 (UTC) Received: from DM3PR12CA0068.namprd12.prod.outlook.com (2603:10b6:0:57::12) by DM5PR12MB1196.namprd12.prod.outlook.com (2603:10b6:3:74::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.20; Fri, 5 Jul 2019 14:32:27 +0000 Received: from DM3NAM03FT032.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by DM3PR12CA0068.outlook.office365.com (2603:10b6:0:57::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.19 via Frontend Transport; Fri, 5 Jul 2019 14:32:27 +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 DM3NAM03FT032.mail.protection.outlook.com (10.152.82.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.18 via Frontend Transport; Fri, 5 Jul 2019 14:32:27 +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; Fri, 5 Jul 2019 09:32:27 -0500 From: To: , Subject: [PATCH v2] drm/sysfs: Add mstpath attribute to connector devices Date: Fri, 5 Jul 2019 10:32:20 -0400 Message-ID: <20190705143220.11109-1-sunpeng.li@amd.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190704190519.29525-4-sunpeng.li@amd.com> References: <20190704190519.29525-4-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)(39860400002)(396003)(376002)(136003)(346002)(2980300002)(428003)(199004)(189003)(81166006)(8676002)(68736007)(81156014)(8936002)(72206003)(305945005)(478600001)(54906003)(110136005)(53936002)(36756003)(1076003)(356004)(6666004)(316002)(4326008)(2876002)(486006)(476003)(2616005)(11346002)(446003)(426003)(126002)(86362001)(47776003)(49486002)(186003)(77096007)(2906002)(48376002)(70206006)(26005)(50466002)(70586007)(5660300002)(51416003)(76176011)(50226002)(336012)(2870700001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1196; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 201367c0-4a52-45cf-bd18-08d701559ad1 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:DM5PR12MB1196; X-MS-TrafficTypeDiagnostic: DM5PR12MB1196: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 008960E8EC X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: bQVhTU+hehHk0rPbU1RD+Eqoy37/ZDPNAHGnzP1oeKsoj67CvV/A/mnSwuNNEiPOeQRu7JbpBJK8P38YGHDf57EAzoTxcDl0/vUxj6ESedvCav1IOnle92riNh6JLmwX8zWC7vVzDYA4JutqpvA4x7JHs7kEpcw6mgQTJ8VwiVFRBiKTRp83qVKPUxN3oNMpQr2duslVXZlGWk2EhZO5b1Wkdvl2MypQ1q/1zZ26vDQfzuVLTHcKCpGLPkZedA42oyTXDMRYm/9Gp4XaMpReUFPxRJV9vngW7mLpsviynYu3UpPhq/FxJSP0AuQ97YqJAYNqPAsAG2iEi4J2fAhm6rUlE+0+iAqJPprnJeWqOT0wWcmS0LejpRtX64pNhib9jAfZgaQq4s3703u0a761xbBvNRx2sBBBzmFtY+4J+Ig= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2019 14:32:27.4186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 201367c0-4a52-45cf-bd18-08d701559ad1 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: DM5PR12MB1196 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=+uuFFoZE5k4n9xlDyOehYNZgegiCNzVKaqSPx8AC7RE=; b=yvIDM7ZiTrpOA6lRVXaeg9sLgMEtDoXATEer4hj2aW637sefxQiT8GMJyI6GFpa2IA01e4Ux1w8fMtbD950X58l4RJ8HfAQCb2hOYDi8mrPd2FtmbsyE9LUxaeM+QlwfZaq07Q6QRRgjzFlti9kY4yMOjDY+vGZ73RvS4GQ8zIA= 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: Leo Li , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org 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 v2: remove unnecessary locking of mode_config.mutex Signed-off-by: Leo Li Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/drm_sysfs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index ad10810bc972..7d483ab684a0 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -236,16 +236,36 @@ 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; + + if (!connector->path_blob_ptr) + return ret; + + path = connector->path_blob_ptr->data; + ret = snprintf(buf, PAGE_SIZE, "card%d-%s\n", + connector->dev->primary->index, path); + + 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 };