dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Cc: Sam Ravnborg <sam@ravnborg.org>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	dri-devel@lists.freedesktop.org,
	Douglas Anderson <dianders@chromium.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	kernel@collabora.com, Vincent Abriou <vincent.abriou@st.com>,
	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>,
	Dave Airlie <airlied@redhat.com>, Jonas Karlman <jonas@kwiboo.se>,
	Jyri Sarha <jsarha@ti.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Sean Paul <sean@poorly.run>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Tomi
Subject: Re: [PATCH v4 01/23] drm: Include ddc adapter pointer in struct drm_connector
Date: Thu, 11 Jul 2019 15:00:17 +0300	[thread overview]
Message-ID: <20190711120017.GU5942@intel.com> (raw)
In-Reply-To: <5957ae96ee20eed5cfcb8a9619e2f61d71fe227e.1562843413.git.andrzej.p@collabora.com>

On Thu, Jul 11, 2019 at 01:26:28PM +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 |  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 <linux/i2c.h>

struct i2c_adapter;
would suffice.

>  #include <linux/list.h>
>  #include <linux/llist.h>
>  #include <linux/ctype.h>
> @@ -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

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-07-11 12:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 11:26 [PATCH v4 00/23] Associate ddc adapters with connectors Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 01/23] drm: Include ddc adapter pointer in struct drm_connector Andrzej Pietrasiewicz
2019-07-11 12:00   ` Ville Syrjälä [this message]
2019-07-11 11:26 ` [PATCH v4 02/23] drm/exynos: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 03/23] drm: rockchip: Provide ddc symlink in rk3066_hdmi sysfs directory Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 06/23] drm/sun4i: hdmi: Provide ddc symlink in sun4i hdmi connector " Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 07/23] drm/mediatek: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 08/23] drm/tegra: Provide ddc symlink in output " Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 09/23] drm/imx: imx-ldb: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 10/23] drm/imx: imx-tve: " Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 11/23] drm/vc4: Provide ddc symlink in connector sysfs directory Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 12/23] drm: zte: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
2019-07-23  5:58   ` Shawn Guo
2019-07-11 11:26 ` [PATCH v4 13/23] drm: zte: Provide ddc symlink in vga " Andrzej Pietrasiewicz
     [not found]   ` <9cdd2fc46dbcb6b596786e5a12b7176c77a38d78.1562843413.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-23  5:58     ` Shawn Guo
2019-07-11 11:26 ` [PATCH v4 14/23] drm/tilcdc: Provide ddc symlink in " Andrzej Pietrasiewicz
     [not found]   ` <d1d415022c598fb7acd033f0f322dd67250adaa9.1562843413.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-23  9:05     ` Sam Ravnborg
2019-07-23 12:44       ` Andrzej Pietrasiewicz
     [not found]         ` <3ad60be5-49cf-4017-4b74-53a2d6272deb-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-23 15:19           ` Sam Ravnborg
2019-07-24  8:01         ` Thomas Zimmermann
2019-07-24  8:51           ` Andrzej Pietrasiewicz
     [not found]           ` <acfd895d-ab59-0190-e25c-1827bd8d214b-l3A5Bk7waGM@public.gmane.org>
2019-07-31 19:39             ` Ezequiel Garcia
     [not found] ` <cover.1562843413.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-11 11:26   ` [PATCH v4 04/23] drm: rockchip: Provide ddc symlink in inno_hdmi " Andrzej Pietrasiewicz
2019-07-11 11:26   ` [PATCH v4 05/23] drm/msm/hdmi: Provide ddc symlink in hdmi connector " Andrzej Pietrasiewicz
2019-07-11 11:26   ` [PATCH v4 15/23] drm: sti: " Andrzej Pietrasiewicz
     [not found]     ` <86afdc0bca6939901870176dcf55f279f7b10a08.1562843413.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-12  7:42       ` Benjamin Gaignard
2019-07-11 11:26   ` [PATCH v4 16/23] drm/mgag200: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-11 17:26     ` Thomas Zimmermann
2019-07-23  9:07     ` Sam Ravnborg
2019-07-11 11:26   ` [PATCH v4 17/23] drm/ast: " Andrzej Pietrasiewicz
2019-07-11 17:27     ` Thomas Zimmermann
2019-07-23  9:09     ` Sam Ravnborg
2019-07-11 11:26   ` [PATCH v4 18/23] drm/bridge: dumb-vga-dac: " Andrzej Pietrasiewicz
2019-07-30 12:15     ` Neil Armstrong
2019-07-11 11:26   ` [PATCH v4 20/23] drm/bridge: ti-tfp410: " Andrzej Pietrasiewicz
2019-07-30 12:25     ` Neil Armstrong
2019-07-11 11:26   ` [PATCH v4 23/23] drm/i915: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
2019-07-11 11:59     ` Ville Syrjälä
2019-07-11 13:21       ` Daniel Vetter
2019-07-11 11:26 ` [PATCH v4 19/23] drm/bridge: dw-hdmi: Provide ddc symlink in " Andrzej Pietrasiewicz
     [not found]   ` <ec88a18feffa37eceb947bb83a6f9f51fb575566.1562843413.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-30 12:17     ` Neil Armstrong
     [not found]       ` <449b11e6-2386-4e5b-26f7-eb6046911f24-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2019-07-30 17:30         ` Sam Ravnborg
     [not found]           ` <20190730173007.GA28537-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
2019-07-31  7:32             ` Neil Armstrong
2019-07-11 11:26 ` [PATCH v4 21/23] drm/amdgpu: " Andrzej Pietrasiewicz
2019-07-11 11:26 ` [PATCH v4 22/23] drm/radeon: " 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=20190711120017.GU5942@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=andrzej.p@collabora.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --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=krzk@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=liviu.dudau@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=narmstrong@baylibre.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    --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