Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3720174ybd; Tue, 25 Jun 2019 07:22:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMw2WfbAodgwyNPC36cmYyAglFjm31t7Y/JB0LTKJonalhTTMvO/LbkxGdaFceDbvRfr9G X-Received: by 2002:a63:f150:: with SMTP id o16mr3493080pgk.105.1561472540329; Tue, 25 Jun 2019 07:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561472540; cv=none; d=google.com; s=arc-20160816; b=vbFhnVl8ZBIYQBYNBcdsQDhKVO60flUJvRg3EblEoAvzNc4dXOBKw4djMc3A9sMJaE U6lVDepz8XCMTYGdD7qUB+ErynZh6qkMyLAkrkHeG8yhHKreznele2AkgBlpKowRz/zs r+cvpgaPBXQSxQAPZ581FLhqLfVDiI1EGwSzb+D0SSwEw4loWEcq8+JxONjQq258oVNZ xLQdxsoTh5ooBQGe1vve3XQkCm/cTZfHWKrWP/NvzcvkTdW+SfNtyc825BhKdulYS1K8 WbiWgpd7JfQrvSYekSbNQbA1/A3Xu2PyY7TlhGRCM4gUWl7rK6bQzhHvUUnxLbJ4MbmV 4Log== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=24gzO0A0maaezXLn4Sf+YkjPoPGU5cIzahsVUvGWJpM=; b=nwqa02g63G7UzPCqXYUG94jQoIUMhybiaTKeeIbz5qNVXHN39Ed0w4dFBw3u4uVKbw YlrVQ1VxD2pGEvZMej38h+HxhfLrDalTi7KldanRbkVWT6uowDhUkG2U4TnWBWb3WiB0 988BT30a9x8WWnFSodCobSCRbAHk2gHysT3kFugrXHU5y5tn3Lb5UsUtl5U5Sw8PgJge agK5P2ez/YXml3L1KGFtgzu3q6qrVtomPLSxg+p41pUmSL8bZwKjQA1zjhX6JOef+w7a XQaDuSKowPqrZdosU6ne3v8IMzKB1EJ7COUpDYXzZpvZ7DA4bqdksrtg7FuR08nyBCWW NQIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b="Y+iwXU//"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si7627873pgq.134.2019.06.25.07.22.03; Tue, 25 Jun 2019 07:22:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b="Y+iwXU//"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729899AbfFYOVz (ORCPT + 99 others); Tue, 25 Jun 2019 10:21:55 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:41142 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728247AbfFYOVz (ORCPT ); Tue, 25 Jun 2019 10:21:55 -0400 Received: by mail-ed1-f68.google.com with SMTP id p15so27389355eds.8 for ; Tue, 25 Jun 2019 07:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=24gzO0A0maaezXLn4Sf+YkjPoPGU5cIzahsVUvGWJpM=; b=Y+iwXU//8GiwvhB5OdOIwFWmfTwBckBPRRYgH6kue66lsWyh9dCVA2FaKmL02xFKEp ZfANSgyGzfjQvccuoaiACu2E9hFGEvf3GDPGF1PFAIvlKZ7isxVSmuGTE6shmB2zXpAr IoDUAySoIuAmV09dUoCcTV15LJhra9BJbO9AQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=24gzO0A0maaezXLn4Sf+YkjPoPGU5cIzahsVUvGWJpM=; b=o5f5hfmxbUYkFgLqABj7PvAjCvkJ9Payd81+Nxi123KTJElzox1Srl5lGERi1WzcVI rk6ZmZLcLJC5XjzeQdo1q+6HL9Q1XHrT88ys1fNhxx/R+76DmTBE7mBhCjRW/ujgUNAS u6alMEfCbbPB1p4pA0Q58kbrafCWB42d8s4p9Z7H9SPupDNyi8HSXEl/DvEYrmo0M2CP Zs1zLEBim/orPNj78/AwkXn3VkSvOlRs5DBCG+KxL+UpEE14g7IAFUufMu5cx2ILcppy vLpaMli2bpe9yD4BWBYcRcIW2jyleo79tgeIaF33W0WSBGasw7a5snIrG/ZlEPGJMmDF 5TSg== X-Gm-Message-State: APjAAAUAylsbD6+tVpukGF3SpI8oqKIkMR9Hvq1l2yobGTZ9FVVYAOkh mRFOLybBoF4rGgSnmiZzsIY+yg== X-Received: by 2002:aa7:d30b:: with SMTP id p11mr133074273edq.23.1561472512705; Tue, 25 Jun 2019 07:21:52 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id z2sm2477457ejp.73.2019.06.25.07.21.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 25 Jun 2019 07:21:51 -0700 (PDT) Date: Tue, 25 Jun 2019 16:21:49 +0200 From: Daniel Vetter To: Andrzej Pietrasiewicz Cc: dri-devel@lists.freedesktop.org, kernel@collabora.com, m.szyprowski@samsung.com, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Kukjin Kim , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: Re: [PATCH v2 1/2] drm: Include ddc adapter pointer in struct drm_connector Message-ID: <20190625142149.GW12905@phenom.ffwll.local> Mail-Followup-To: Andrzej Pietrasiewicz , dri-devel@lists.freedesktop.org, kernel@collabora.com, m.szyprowski@samsung.com, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Kukjin Kim , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.19.0-5-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 25, 2019 at 12:24:40PM +0200, Andrzej Pietrasiewicz wrote: > Add generic code which creates symbolic links in sysfs, pointing to ddc > interface used by a particular video output. For example: > > ls -l /sys/class/drm/card0-HDMI-A-1/ddc > lrwxrwxrwx 1 root root 0 Jun 24 10:42 /sys/class/drm/card0-HDMI-A-1/ddc \ > -> ../../../../soc/13880000.i2c/i2c-2 > > This makes it easy for user to associate a display with its ddc adapter > and use e.g. ddcutil to control the chosen monitor. > > This patch adds an i2c_adapter pointer to struct drm_connector. Particular > drivers can then use it instead of using their own private instance. If a > connector contains a ddc, then create a symbolic link in sysfs. > > Signed-off-by: Andrzej Pietrasiewicz Acked-by: Daniel Vetter As mentioned in the other subthread, I think the important bit to sell this is rolling it out to as many drivers as feasible and collecting all the acks from driver maintainers. -Daniel > --- > drivers/gpu/drm/drm_sysfs.c | 7 +++++++ > include/drm/drm_connector.h | 11 +++++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c > index ad10810bc972..26d359b39785 100644 > --- a/drivers/gpu/drm/drm_sysfs.c > +++ b/drivers/gpu/drm/drm_sysfs.c > @@ -294,6 +294,9 @@ int drm_sysfs_connector_add(struct drm_connector *connector) > /* Let userspace know we have a new connector */ > drm_sysfs_hotplug_event(dev); > > + if (connector->ddc) > + return sysfs_create_link(&connector->kdev->kobj, > + &connector->ddc->dev.kobj, "ddc"); > return 0; > } > > @@ -301,6 +304,10 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) > { > if (!connector->kdev) > return; > + > + if (connector->ddc) > + sysfs_remove_link(&connector->kdev->kobj, "ddc"); > + > DRM_DEBUG("removing \"%s\" from sysfs\n", > connector->name); > > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h > index ca745d9feaf5..1ad3d1d54ba7 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -23,6 +23,7 @@ > #ifndef __DRM_CONNECTOR_H__ > #define __DRM_CONNECTOR_H__ > > +#include > #include > #include > #include > @@ -1308,6 +1309,16 @@ struct drm_connector { > * [0]: progressive, [1]: interlaced > */ > int audio_latency[2]; > + > + /** > + * @ddc: associated ddc adapter. > + * A connector usually has its associated ddc adapter. If a driver uses > + * this field, then an appropriate symbolic link is created in connector > + * sysfs directory to make it easy for the user to tell which i2c > + * adapter is for a particular display. > + */ > + struct i2c_adapter *ddc; > + > /** > * @null_edid_counter: track sinks that give us all zeros for the EDID. > * Needed to workaround some HW bugs where we get all 0s > -- > 2.17.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch