linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: Sam Ravnborg <sam@ravnborg.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	Douglas Anderson <dianders@chromium.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	kernel@collabora.com, linux-samsung-soc@vger.kernel.org,
	Jyri Sarha <jsarha@ti.com>,
	Vincent Abriou <vincent.abriou@st.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	linux-rockchip@lists.infradead.org, Chen-Yu Tsai <wens@csie.org>,
	Kukjin Kim <kgene@kernel.org>, NXP Linux Team <linux-imx@nxp.com>,
	Dave Airlie <airlied@redhat.com>,
	intel-gfx@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	linux-tegra@vger.kernel.org, Jonas Karlman <jonas@kwiboo.se>,
	linux-arm-msm@vger.kernel.org,
	Alexios Zavras <alexios.zavras@intel.com>,
	Mamta Shukla <mamtashukla555@gmail.com>,
	linux-me
Subject: Re: [PATCH v6 01/24] drm: Add ddc link in sysfs created by drm_connector
Date: Sun, 4 Aug 2019 15:27:04 +0300	[thread overview]
Message-ID: <20190804122704.GC4984@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190804120437.GB4984@pendragon.ideasonboard.com>

Hi Andrzej,

On Sun, Aug 04, 2019 at 03:04:37PM +0300, Laurent Pinchart wrote:
> Hi Andrzej,
> 
> Thank you for the patch, and sorry for the late review (I've been
> travelling for the past few weeks).
> 
> On Fri, Jul 26, 2019 at 07:22:55PM +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 <andrzej.p@collabora.com>
> > Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
> > ---
> >  drivers/gpu/drm/drm_sysfs.c |  8 ++++++++
> >  include/drm/drm_connector.h | 11 +++++++++++
> >  2 files changed, 19 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> > index ad10810bc972..e962a9d45f7e 100644
> > --- a/drivers/gpu/drm/drm_sysfs.c
> > +++ b/drivers/gpu/drm/drm_sysfs.c
> > @@ -14,6 +14,7 @@
> >  #include <linux/err.h>
> >  #include <linux/export.h>
> >  #include <linux/gfp.h>
> > +#include <linux/i2c.h>
> >  #include <linux/kdev_t.h>
> >  #include <linux/slab.h>
> >  
> > @@ -294,6 +295,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 +305,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 4c30d751487a..33a6fff85fdb 100644
> > --- a/include/drm/drm_connector.h
> > +++ b/include/drm/drm_connector.h
> > @@ -41,6 +41,7 @@ struct drm_property;
> >  struct drm_property_blob;
> >  struct drm_printer;
> >  struct edid;
> > +struct i2c_adapter;
> >  
> >  enum drm_connector_force {
> >  	DRM_FORCE_UNSPECIFIED,
> > @@ -1311,6 +1312,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.
> 
> The first sentence isn't very clear. The rest is mixing "ddc adapter"
> and "i2c adapter". How about the following ?
> 
> "When the connector carries DDC signals, this field points to the I2C
> adapter connected to the DDC signals, if any. When this field is not
> NULL a symbolic link is created in the connector's sysfs directory to
> expose the I2C adapter used by the connector."
> 
> Should we also mention that the field isn't meant to be set directly,
> but shall be set with drm_connector_init_with_ddc() ?
> 
> "This field shall not be set directly by drivers, use
> drm_connector_init_with_ddc() instead."

I should have read patch 02/24 before answering this :-)

> I'm also slightly concerned about the lifetime of this pointer, and what
> would happen if the I2C adapter disappears while the connector is still
> exposed to userspace, but I suppose this isn't a new issue, existing
> code likely suffers from this.
> 
> With the updated documentation,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I've just realised that this patch has been applied already. I'll send
the above as a documentation update patch.

> > +	 */
> > +	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

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-08-04 12:27 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26 17:22 [PATCH v6 00/24] Associate ddc adapters with connectors Andrzej Pietrasiewicz
2019-07-26 17:22 ` [PATCH v6 02/24] drm: Add drm_connector_init() variant with ddc Andrzej Pietrasiewicz
2019-07-26 17:22 ` [PATCH v6 04/24] drm: rockchip: Provide ddc symlink in rk3066_hdmi sysfs directory Andrzej Pietrasiewicz
2019-07-26 17:22 ` [PATCH v6 05/24] drm: rockchip: Provide ddc symlink in inno_hdmi " Andrzej Pietrasiewicz
2019-07-26 17:23 ` [PATCH v6 06/24] drm/msm/hdmi: Provide ddc symlink in hdmi connector " Andrzej Pietrasiewicz
2019-07-26 17:23 ` [PATCH v6 08/24] drm/mediatek: " Andrzej Pietrasiewicz
2019-07-26 17:23 ` [PATCH v6 09/24] drm/tegra: Provide ddc symlink in output " Andrzej Pietrasiewicz
2019-07-26 17:23 ` [PATCH v6 12/24] drm/vc4: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-26 17:23 ` [PATCH v6 13/24] drm: zte: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
     [not found] ` <cover.1564161140.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-26 17:22   ` [PATCH v6 01/24] drm: Add ddc link in sysfs created by drm_connector Andrzej Pietrasiewicz
     [not found]     ` <d470def6cd661b777faeee67b5838a4623c4010e.1564161140.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-08-04 12:04       ` Laurent Pinchart
2019-08-04 12:27         ` Laurent Pinchart [this message]
2019-07-26 17:22   ` [PATCH v6 03/24] drm/exynos: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-07-26 17:23   ` [PATCH v6 07/24] drm/sun4i: hdmi: Provide ddc symlink in sun4i hdmi connector sysfs directory Andrzej Pietrasiewicz
2019-07-27 10:37     ` Maxime Ripard
2019-07-26 17:23   ` [PATCH v6 10/24] drm/imx: imx-ldb: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-07-29  9:20     ` Philipp Zabel
2019-07-26 17:23   ` [PATCH v6 11/24] drm/imx: imx-tve: " Andrzej Pietrasiewicz
2019-07-29  9:20     ` Philipp Zabel
2019-07-26 17:23   ` [PATCH v6 14/24] drm: zte: Provide ddc symlink in vga connector sysfs directory Andrzej Pietrasiewicz
2019-07-26 17:23   ` [PATCH v6 18/24] drm/ast: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-26 17:23   ` [PATCH v6 20/24] drm/bridge: dw-hdmi: " Andrzej Pietrasiewicz
     [not found]     ` <4bcf0f154c683c9787fa34f911ebc52de6b4a7a1.1564161140.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-26 19:18       ` Jernej Škrabec
2019-07-26 17:23   ` [PATCH v6 24/24] drm/i915: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
2019-07-30 15:01   ` [PATCH v6 00/24] Associate ddc adapters with connectors Emil Velikov
2019-08-04 12:36     ` Laurent Pinchart
2019-07-26 17:23 ` [PATCH v6 15/24] drm/tilcdc: Provide ddc symlink in connector sysfs directory Andrzej Pietrasiewicz
2019-07-26 17:23 ` [PATCH v6 16/24] drm: sti: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
     [not found]   ` <510765aff8ef99683aa2da48bd08004376b1980a.1564161140.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-30 12:36     ` Benjamin Gaignard
2019-07-26 17:23 ` [PATCH v6 17/24] drm/mgag200: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-26 17:23 ` [PATCH v6 19/24] drm/bridge: dumb-vga-dac: " Andrzej Pietrasiewicz
     [not found]   ` <ebb75e71b8b7c8d65d54a947a03fd21b8969fb3a.1564161140.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-30 12:28     ` Neil Armstrong
2019-08-08  3:42     ` Guenter Roeck
2019-08-13  9:33       ` Geert Uytterhoeven
2019-07-26 17:23 ` [PATCH v6 21/24] drm/bridge: ti-tfp410: " Andrzej Pietrasiewicz
     [not found]   ` <3b61da77a6456805db0deffe6d1a2343dd784730.1564161140.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-30 12:30     ` Neil Armstrong
2019-07-26 17:23 ` [PATCH v6 22/24] drm/amdgpu: " Andrzej Pietrasiewicz
2019-07-26 19:28   ` Alex Deucher
     [not found]     ` <CADnq5_O1B59Q+68fJgtf_bn_=WQ9yrVPq-V5tL1VQ3+vzgf1Zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-07-26 19:42       ` Andrzej Pietrasiewicz
     [not found]         ` <038809c7-e664-e365-a778-03bc11299193-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-26 20:00           ` Alex Deucher
2019-07-26 17:23 ` [PATCH v6 23/24] drm/radeon: " Andrzej Pietrasiewicz
2019-07-26 19:26   ` Alex Deucher
2019-07-26 18:35 ` [PATCH v6 00/24] Associate ddc adapters with connectors Sam Ravnborg
2019-07-26 18:55   ` Review required [Was: Associate ddc adapters with connectors] Sam Ravnborg
     [not found]     ` <20190726185538.GD14981-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
2019-07-31  8:00       ` Neil Armstrong
2019-07-31 10:40         ` Sam Ravnborg
2019-07-31 13:10           ` Andrzej Pietrasiewicz
     [not found]             ` <959cf323-c6b9-895b-592c-81c52aacae6e-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-31 14:22               ` Neil Armstrong
     [not found]                 ` <ce68a0df-1719-7b53-b0ed-89caa9afc4a0-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2019-07-31 15:32                   ` Neil Armstrong
2019-07-31 16:58                     ` [PATCH 00/13] Next round of associating ddc adapters with connectors Andrzej Pietrasiewicz
2019-07-31 16:58                       ` [PATCH 02/13] drm/radeon: Eliminate possible use of an uninitialized variable Andrzej Pietrasiewicz
     [not found]                         ` <cfff357a07bfa572baad058947f281b7095e1794.1564591626.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-08-01 12:15                           ` Neil Armstrong
2019-07-31 16:58                       ` [PATCH 10/13] drm: zte: Provide ddc symlink in hdmi connector sysfs directory Andrzej Pietrasiewicz
     [not found]                       ` <cover.1564591626.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-31 16:58                         ` [PATCH 01/13] drm/amdgpu: Provide ddc symlink in dm connector's " Andrzej Pietrasiewicz
2019-07-31 16:58                         ` [PATCH 03/13] drm/exynos: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-11-08  0:22                           ` Inki Dae
2019-07-31 16:58                         ` [PATCH 04/13] drm: rockchip: Provide ddc symlink in rk3066_hdmi sysfs directory Andrzej Pietrasiewicz
2019-08-06  8:36                           ` Heiko Stuebner
2019-07-31 16:58                         ` [PATCH 05/13] drm: rockchip: Provide ddc symlink in inno_hdmi " Andrzej Pietrasiewicz
2019-08-06  8:36                           ` Heiko Stuebner
2019-07-31 16:58                         ` [PATCH 06/13] drm/msm/hdmi: Provide ddc symlink in hdmi connector " Andrzej Pietrasiewicz
2019-07-31 16:58                         ` [PATCH 07/13] drm/mediatek: " Andrzej Pietrasiewicz
2019-08-01  9:06                           ` Philipp Zabel
2019-07-31 16:58                         ` [PATCH 08/13] drm/tegra: Provide ddc symlink in output " Andrzej Pietrasiewicz
2019-07-31 16:58                         ` [PATCH 09/13] drm/vc4: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-31 16:58                         ` [PATCH 11/13] drm: zte: Provide ddc symlink in vga " Andrzej Pietrasiewicz
2019-07-31 16:58                         ` [PATCH 12/13] drm/tilcdc: Provide ddc symlink in " Andrzej Pietrasiewicz
     [not found]                           ` <b8faad34102a91698b55dfc1ce02b1a90fda5e44.1564591626.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-08-05  8:32                             ` Jyri Sarha
2019-07-31 16:58                       ` [PATCH 13/13] drm/i915: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
2019-08-04 12:33 ` [PATCH v6 00/24] Associate ddc adapters with connectors Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190804122704.GC4984@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=alexios.zavras@intel.com \
    --cc=andrzej.p@collabora.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jonas@kwiboo.se \
    --cc=jonathanh@nvidia.com \
    --cc=jsarha@ti.com \
    --cc=kernel@collabora.com \
    --cc=kgene@kernel.org \
    --cc=kraxel@redhat.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mamtashukla555@gmail.com \
    --cc=narmstrong@baylibre.com \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    --cc=vincent.abriou@st.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).