Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp384282rwb; Wed, 9 Nov 2022 03:58:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf4kKx2kXjuWwoY8DvavLJoTJJOcBt6jXfUUNxcaYSpedSdubv5Xx6+iHuEEEgV2c/NxLh1Z X-Received: by 2002:a17:903:2782:b0:188:7a1f:fb18 with SMTP id jw2-20020a170903278200b001887a1ffb18mr681522plb.0.1667995081251; Wed, 09 Nov 2022 03:58:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667995081; cv=none; d=google.com; s=arc-20160816; b=Uvt51+AKT/rgSaqn5GF6Di0bkQUbQBy3Db3V3fNtAenwdKUNFtLXX95Bnz0q6F+AhU 7rq4yXLI0WeE9Uqt06WobDCO3IBcN/57ML3IaMK7vu4OAl5c8Pj3psx0r+KNloFkiYKm sICJ7CE6Q/KhyImeuBObaY1tnTt2AsbFJ3kCJzsXgm5iMdWPiiNZPgZJIO55obfzxOP3 6T5wr5PSyq0eKyLa/tyWI8YkRi7J15QKCh+2WlD2xcVQDBBd+PHBYPAPQwT9XcvSQhbz d34Cz8bm/OsCbfSmS8NdspS032VuS8kCH1pJmuqzerB12l87/a/8yGqK7pgo3gWniERl eaxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=QbjdwZrO7CchEGO52zV1EUktiYbcH8urhzFHSgEULX8=; b=Xxix3ZNFXbyOhvaNbyWKfhQCkUcvu+SRd/Osr/khPoVzJZ8O2XXAIb7S5AUcM+Fojl QpcyA5m5P8puedyXw4TLU2nVIuGoMlYx1uUgWZs2gT1JPj3GldVV4+w9q4SZT+B09/ac Q7CzcCKFeUEC0+h77rUVx8LC8Y9lpKBRqN3tFTAdYIo2bLqhmdxvgu2+dJ2nGJtHWkT0 A6Latsi0ND7odt5h8isHWGXfK2VMOeJJBNyW5lD3AUf3+oVeV3ZM47/TDMrYt4Oti2No Zx79aHCv/JeUDEy3oaFW2nF9VtPW+QTasb7K9n+xhfvdEJk3dWs7Xcri+Wxn8pnnFeBo RaaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="icI6//b9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jb6-20020a170903258600b0017e20ec5490si14193211plb.301.2022.11.09.03.57.48; Wed, 09 Nov 2022 03:58:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="icI6//b9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229533AbiKILyh (ORCPT + 93 others); Wed, 9 Nov 2022 06:54:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbiKILyf (ORCPT ); Wed, 9 Nov 2022 06:54:35 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D9E162CE for ; Wed, 9 Nov 2022 03:54:34 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id f5so46014230ejc.5 for ; Wed, 09 Nov 2022 03:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=QbjdwZrO7CchEGO52zV1EUktiYbcH8urhzFHSgEULX8=; b=icI6//b9KXQ9JyGkkWGolJBXMaLR5OOL0QzWOOUfc8Nv1c7/dHXb+Vp595R1bPKzRe WDpWoHdjrjlIpSO7FF0zBnHnEtFRTOyQuPJ6ygGucJNbQAWzriyHTLAqD5FRAHJ/04Ub a8FGSqIsvRGiC1/j+Qb3WSwi14RvbW73qGVSw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QbjdwZrO7CchEGO52zV1EUktiYbcH8urhzFHSgEULX8=; b=xsWRE4kSet675iOPSU8V5oHD90CeykUzs/QwsbcaGSjqAEZN07MC+uKSXibM9oE0Wn LQyNP2NeMMkqKrkAOoRdY2QC615mKCQfMbWMiqxWW4GNJSC7rQrZSyzU2vWk5HbKwwyw a8J/klCDxS/03nFGqDCPyJiPxQgkc+s9ZooYdPXpHmQe2ux8hihmJmpQQd+6EHueJQT3 4GbH10XFkkFNaHkTFZWKXTRPqmABz9Xve8ANeRP+FkYppZnaEHiPeXgbZ1rgsLUEdsrU led16a8SupX3nUdGgPqYiPh1EHQZF6CtSK0csOJPcnoCdxTaGlhTo5F7xrgabPorqWgr 1PaA== X-Gm-Message-State: ACrzQf1Olfuzn/rmt13TVqBdJCWAQuhUS4nZqSjAbftwHyDOndaUC9Lg t0yoWanVhP5tAy+9pixDCVUSUg== X-Received: by 2002:a17:907:7da9:b0:7ad:f381:b9f7 with SMTP id oz41-20020a1709077da900b007adf381b9f7mr40990549ejc.729.1667994873103; Wed, 09 Nov 2022 03:54:33 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-33.fiber7.init7.net. [212.51.149.33]) by smtp.gmail.com with ESMTPSA id g18-20020a17090604d200b0073dc5bb7c32sm5864101eja.64.2022.11.09.03.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 03:54:32 -0800 (PST) Date: Wed, 9 Nov 2022 12:54:29 +0100 From: Daniel Vetter To: Won Chung Cc: bleung@google.com, pmalani@chromium.org, heikki.krogerus@linux.intel.com, imre.deak@intel.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, jani.nikula@linux.intel.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] drm/sysfs: Link DRM connectors to corresponding Type-C connectors Message-ID: Mail-Followup-To: Won Chung , bleung@google.com, pmalani@chromium.org, heikki.krogerus@linux.intel.com, imre.deak@intel.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, jani.nikula@linux.intel.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20221108185004.2263578-1-wonchung@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221108185004.2263578-1-wonchung@google.com> X-Operating-System: Linux phenom 5.19.0-2-amd64 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 08, 2022 at 06:50:04PM +0000, Won Chung wrote: > Create a symlink pointing to USB Type-C connector for DRM connectors > when they are created. The link will be created only if the firmware is > able to describe the connection beween the two connectors. > > Currently, even if a display uses a USB Type-C port, there is no way for > the userspace to find which port is used for which display. With the > symlink, display information would be accessible from Type-C connectors > and port information would be accessible from DRM connectors. > Associating the two subsystems, userspace would have potential to expose > and utilize more complex information, such as bandwidth used for a > specific USB Type-C port. > > Signed-off-by: Won Chung > Acked-by: Heikki Krogerus > --- > Changes from v3: > - Append to the commit message on why this patch is needed > > Changes from v2: > - Resend the patch to dri-devel list > > Changes from v1: > - Fix multiple lines to single line We seem to be spinning wheels a bit here (or at least I'm missing a lot of important information from this series alone) with already at v4 but the fundamentals not answered: - where's the usb side of this, and anything we need to do in drivers? This should all be one series, or if that's too big, then a link in the cover letter for where to find all the other pieces - since I'm guessing this is for cros, will this also work on standard acpi x86 that are built for windows? arm with dt? Might be answered with the full picture - you say this helps userspace, but how? Best way here is to just point at the userspace change set that makes use of this link, code explains concepts much more precisely than lots of words, and it's also easier to review for corner cases that might be missed. That link also needs to be in the commit message/cover letter somewhere, so people can find it. In principle nothing against the idea, seems reasonable (but I'm also not sure what exact problem it's solving) - but all the detail work to make this work than an RFP to kick of some discussion is missing. And I think it's not even enough to really kick off a discussion as-is since there's really no user of this at all (in-kernel or userspace) linked. Cheers, Daniel > > > drivers/gpu/drm/drm_sysfs.c | 40 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c > index 430e00b16eec..6a9904fa9186 100644 > --- a/drivers/gpu/drm/drm_sysfs.c > +++ b/drivers/gpu/drm/drm_sysfs.c > @@ -11,12 +11,14 @@ > */ > > #include > +#include > #include > #include > #include > #include > #include > #include > +#include > #include > > #include > @@ -95,6 +97,34 @@ static char *drm_devnode(struct device *dev, umode_t *mode) > return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); > } > > +static int typec_connector_bind(struct device *dev, > + struct device *typec_connector, void *data) > +{ > + int ret; > + > + ret = sysfs_create_link(&dev->kobj, &typec_connector->kobj, "typec_connector"); > + if (ret) > + return ret; > + > + ret = sysfs_create_link(&typec_connector->kobj, &dev->kobj, "drm_connector"); > + if (ret) > + sysfs_remove_link(&dev->kobj, "typec_connector"); > + > + return ret; > +} > + > +static void typec_connector_unbind(struct device *dev, > + struct device *typec_connector, void *data) > +{ > + sysfs_remove_link(&typec_connector->kobj, "drm_connector"); > + sysfs_remove_link(&dev->kobj, "typec_connector"); > +} > + > +static const struct component_ops typec_connector_ops = { > + .bind = typec_connector_bind, > + .unbind = typec_connector_unbind, > +}; > + > static CLASS_ATTR_STRING(version, S_IRUGO, "drm 1.1.0 20060810"); > > /** > @@ -355,6 +385,13 @@ int drm_sysfs_connector_add(struct drm_connector *connector) > if (connector->ddc) > return sysfs_create_link(&connector->kdev->kobj, > &connector->ddc->dev.kobj, "ddc"); > + > + if (dev_fwnode(kdev)) { > + r = component_add(kdev, &typec_connector_ops); > + if (r) > + drm_err(dev, "failed to add component\n"); > + } > + > return 0; > > err_free: > @@ -367,6 +404,9 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) > if (!connector->kdev) > return; > > + if (dev_fwnode(connector->kdev)) > + component_del(connector->kdev, &typec_connector_ops); > + > if (connector->ddc) > sysfs_remove_link(&connector->kdev->kobj, "ddc"); > > -- > 2.37.3.998.g577e59143f-goog > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch