linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: "Neil Armstrong" <narmstrong@baylibre.com>,
	"Maxime Ripard" <maxime.ripard@bootlin.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Shawn Guo" <shawnguo@kernel.org>,
	kernel@collabora.com, linux-samsung-soc@vger.kernel.org,
	"Oleksandr Andrushchenko" <oleksandr_andrushchenko@epam.com>,
	"Sean Paul" <sean@poorly.run>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"David Airlie" <airlied@linux.ie>, "Chen-Yu Tsai" <wens@csie.org>,
	"Kukjin Kim" <kgene@kernel.org>,
	"NXP Linux Team" <linux-imx@nxp.com>,
	linux-rockchip@lists.infradead.org,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	"Jyri Sarha" <jsarha@ti.com>,
	"Alexios Zavras" <alexios.zavras@intel.com>,
	"Mamta Shukla" <mamtashukla555@gmail.com>,
	linux-mediatek@lists.infradead.org,
	"Dave Airlie" <airlied@redhat.com>,
	linux-tegra@vger.kernel.org,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Vincent Abriou" <vincent.abriou@st.com>,
	linux-arm-kernel@lists.infradead.org,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	amd-gfx@lists.freedesktop.org,
	"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Seung-Woo Kim" <sw0312.kim@samsung.com>,
	"Douglas Anderson" <dianders@chromium.org>,
	"Todor Tomov" <todor.tomov@linaro.org>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Huang Rui" <ray.huang@amd.com>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	freedreno@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: Re: [PATCH v5 01/24] drm: Include ddc adapter pointer in struct drm_connector
Date: Fri, 26 Jul 2019 10:08:55 +0200	[thread overview]
Message-ID: <20190726080855.GA9143@ravnborg.org> (raw)
In-Reply-To: <20190726063759.GB6443@ravnborg.org>

Hi Andrzej.

After reading through the series a few more comments.

1) The subject of this patch could be improved.
   Consider something like:
   drm: add ddc link in sysfs created by drm_connector

   This spells out much better what the patch achieve.


2) The purpsoe of drm_connector.ddc is to provide drm_connector with
   info to create the symlink.
   Yet in many follow-up patches the drivers are changed so
   drm_connector.ddc is their only reference to struct i2c_adapter.

   But the ownership is not clear here.
   Who owns the reference to i2c_adapter - and who has the
   responsibility to call put() on the adapter.

   Looking at the conversions done then some drivers are converted
   so they only use drm_connector.ddc, and other drivers have their own
   reference to i2c_adapter.
   The latter looks like the correct solution as the ownership of the
   reference belongs to the driver and not drm_connector.

   In other words - a conversion where the drivers only assigned
   drm_connector.ddc (using drm_connector_init_with_ddc()),
   seems like a more clean design that does not mix up ownership.
   This is at least how I see it.
   I did not take this type of look at the patches before. Sorry
   for providing feedback this late.

	Sam

On Fri, Jul 26, 2019 at 08:37:59AM +0200, Sam Ravnborg wrote:
> Hi Andrzej.
> 
> Patch looks good, but one kernel-doc detail.
> 
> On Wed, Jul 24, 2019 at 03:59:23PM +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.
> > +	 */
> > +	struct i2c_adapter *ddc;
> 
> To help the reader could you add in the above a reference to
> drm_connector_init_with_ddc() sp the reader is told how to init this
> field.
> 
> Either add it in PATCH 2 - or merge patch 1 and 2.
> 
> 	Sam
> 
> > +
> >  	/**
> >  	 * @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
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-07-26  8:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1563960855.git.andrzej.p@collabora.com>
     [not found] ` <53f5ded2971235e5b63c9a3ed4ed8bccf10c78f2.1563960855.git.andrzej.p@collabora.com>
2019-07-24 17:16   ` [PATCH v5 02/24] drm: Add drm_connector_init() variant with ddc Thomas Zimmermann
     [not found] ` <0afab6e2f61907409ba13a0ba91b8ee701eb7d74.1563960855.git.andrzej.p@collabora.com>
2019-07-24 17:17   ` [PATCH v5 18/24] drm/ast: Provide ddc symlink in connector sysfs directory Thomas Zimmermann
     [not found] ` <e82d6aca4f8abc95834c8a36c101d153518bb1ac.1563960855.git.andrzej.p@collabora.com>
     [not found]   ` <20190726063759.GB6443@ravnborg.org>
2019-07-26  8:08     ` Sam Ravnborg [this message]
2019-07-26 12:18     ` [PATCH v5 01/24] drm: Include ddc adapter pointer in struct drm_connector Andrzej Pietrasiewicz

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=20190726080855.GA9143@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexios.zavras@intel.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrzej.p@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=jonathanh@nvidia.com \
    --cc=jsarha@ti.com \
    --cc=kernel@collabora.com \
    --cc=kernel@pengutronix.de \
    --cc=kgene@kernel.org \
    --cc=kraxel@redhat.com \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mamtashukla555@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=narmstrong@baylibre.com \
    --cc=oleksandr_andrushchenko@epam.com \
    --cc=ray.huang@amd.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sean@poorly.run \
    --cc=shawnguo@kernel.org \
    --cc=sw0312.kim@samsung.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=todor.tomov@linaro.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tzimmermann@suse.de \
    --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).