linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: linux-kernel@vger.kernel.org
Cc: "Peter Rosin" <peda@axentia.se>,
	"Archit Taneja" <architt@codeaurora.org>,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"David Airlie" <airlied@linux.ie>,
	"Martin Donnelly" <martin.donnelly@ge.com>,
	"Martyn Welch" <martyn.welch@collabora.co.uk>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Sean Paul" <seanpaul@chromium.org>,
	"Inki Dae" <inki.dae@samsung.com>,
	"Joonyoung Shim" <jy0922.shim@samsung.com>,
	"Seung-Woo Kim" <sw0312.kim@samsung.com>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Kukjin Kim" <kgene@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"CK Hu" <ck.hu@mediatek.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Rob Clark" <robdclark@gmail.com>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
	"Vincent Abriou" <vincent.abriou@st.com>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	linux-renesas-soc@vger.kernel.org,
	linux-rockchip@lists.infradead.org, "Jyri Sarha" <jsarha@ti.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Subject: [PATCH v3 01/26] drm/bridge: allow optionally specifying an owner .odev device
Date: Wed, 16 May 2018 12:14:45 +0200	[thread overview]
Message-ID: <20180516101510.13215-2-peda@axentia.se> (raw)
In-Reply-To: <20180516101510.13215-1-peda@axentia.se>

Bridge drivers can now (temporarily, in a transition phase) select if
they want to provide a full owner device or keep just providing an
of_node.

By providing a full owner device, the bridge drivers no longer need
to provide an of_node since that node is available via the owner
device.

When all bridge drivers provide an owner device, that will become
mandatory and the .of_node member will be removed.

There is an interaction with the rockchip lvds driver, since that
driver peeks into somewhat private parts of the bridge struct in
order to find out things about the remote bridge. When there are
now two ways to get to the remote bridge, the rockchip lvds driver
has to adapt. That said, the correct thing to do for the rockchip
lvds driver is to use some other way than DT to find things out
about the remote bridge, but that is orthogonal to this patch.

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/gpu/drm/drm_bridge.c             | 3 ++-
 drivers/gpu/drm/rockchip/rockchip_lvds.c | 4 +++-
 include/drm/drm_bridge.h                 | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 1638bfe9627c..3872f5379998 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -365,7 +365,8 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np)
 	mutex_lock(&bridge_lock);
 
 	list_for_each_entry(bridge, &bridge_list, list) {
-		if (bridge->of_node == np) {
+		if ((bridge->odev && bridge->odev->of_node == np) ||
+		    bridge->of_node == np) {
 			mutex_unlock(&bridge_lock);
 			return bridge;
 		}
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 4bd94b167d2c..557e0079c98d 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -377,8 +377,10 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
 	}
 	if (lvds->panel)
 		remote = lvds->panel->dev->of_node;
-	else
+	else if (lvds->bridge->of_node)
 		remote = lvds->bridge->of_node;
+	else
+		remote = lvds->bridge->odev->of_node;
 	if (of_property_read_string(dev->of_node, "rockchip,output", &name))
 		/* default set it as output rgb */
 		lvds->output = DISPLAY_OUTPUT_RGB;
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 3270fec46979..7c17977c3537 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -254,6 +254,7 @@ struct drm_bridge_timings {
 
 /**
  * struct drm_bridge - central DRM bridge control structure
+ * @odev: device that owns the bridge
  * @dev: DRM device this bridge belongs to
  * @encoder: encoder to which this bridge is connected
  * @next: the next bridge in the encoder chain
@@ -265,6 +266,7 @@ struct drm_bridge_timings {
  * @driver_private: pointer to the bridge driver's internal context
  */
 struct drm_bridge {
+	struct device *odev;
 	struct drm_device *dev;
 	struct drm_encoder *encoder;
 	struct drm_bridge *next;
-- 
2.11.0

  reply	other threads:[~2018-05-16 10:23 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 10:14 [PATCH v3 00/26] device link, bridge supplier <-> drm device Peter Rosin
2018-05-16 10:14 ` Peter Rosin [this message]
2018-05-19 16:07   ` [PATCH v3 01/26] drm/bridge: allow optionally specifying an owner .odev device Heiko Stuebner
2018-05-16 10:14 ` [PATCH v3 02/26] drm/bridge: adv7511: provide " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 03/26] drm/bridge/analogix: core: specify the owner .odev of the bridge Peter Rosin
2018-05-16 10:14 ` [PATCH v3 04/26] drm/bridge: analogix-anx78xx: provide an owner .odev device Peter Rosin
2018-05-16 10:14 ` [PATCH v3 05/26] drm/bridge: cdns-dsi: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 06/26] drm/bridge: vga-dac: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 07/26] drm/bridge: lvds-encoder: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 08/26] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 09/26] drm/bridge: nxp-ptn3460: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 10/26] drm/bridge: panel: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 11/26] drm/bridge: ps8622: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 12/26] drm/bridge: sii902x: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 13/26] drm/bridge: sii9234: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 14/26] drm/bridge: sii8620: " Peter Rosin
2018-05-16 10:14 ` [PATCH v3 15/26] drm/bridge: synopsys: provide an owner .odev device for the bridges Peter Rosin
2018-05-16 10:15 ` [PATCH v3 16/26] drm/bridge: tc358767: provide an owner .odev device Peter Rosin
2018-05-16 10:15 ` [PATCH v3 17/26] drm/bridge: thc63lvd1024: " Peter Rosin
2018-05-21  8:00   ` jacopo mondi
2018-05-16 10:15 ` [PATCH v3 18/26] drm/bridge: ti-tfp410: " Peter Rosin
2018-05-16 10:15 ` [PATCH v3 19/26] drm/exynos: mic: provide an owner .odev device for the bridge Peter Rosin
2018-05-16 10:15 ` [PATCH v3 20/26] drm/mediatek: hdmi: " Peter Rosin
2018-05-16 10:22   ` Philipp Zabel
2018-05-16 10:15 ` [PATCH v3 21/26] drm/msm: specify the owner .odev of the bridges Peter Rosin
2018-05-16 10:15 ` [PATCH v3 22/26] drm/rcar-du: lvds: provide an owner .odev device for the bridge Peter Rosin
2018-05-16 10:15 ` [PATCH v3 23/26] drm/sti: provide an owner .odev device for the bridges Peter Rosin
2018-05-16 10:15 ` [PATCH v3 24/26] drm/bridge: remove the .of_node member Peter Rosin
2018-05-19 16:08   ` Heiko Stuebner
2018-05-16 10:15 ` [PATCH v3 25/26] drm/bridge: require the owner .odev to be filled in on drm_bridge_add/attach Peter Rosin
2018-05-16 10:15 ` [PATCH v3 26/26] drm/bridge: establish a link between the bridge supplier and consumer Peter Rosin

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=20180516101510.13215-2-peda@axentia.se \
    --to=peda@axentia.se \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=architt@codeaurora.org \
    --cc=benjamin.gaignard@linaro.org \
    --cc=ck.hu@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=inki.dae@samsung.com \
    --cc=jsarha@ti.com \
    --cc=jy0922.shim@samsung.com \
    --cc=kgene@kernel.org \
    --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-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=martin.donnelly@ge.com \
    --cc=martyn.welch@collabora.co.uk \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robdclark@gmail.com \
    --cc=seanpaul@chromium.org \
    --cc=sw0312.kim@samsung.com \
    --cc=vincent.abriou@st.com \
    /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).