All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: dri-devel@lists.freedesktop.org
Cc: Marek Vasut <marex@denx.de>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Maxime Ripard <maxime@cerno.tech>
Subject: [PATCH v4 06/11] drm/bridge: tc358767: Move (e)DP bridge endpoint parsing into dedicated function
Date: Mon, 28 Mar 2022 23:43:19 +0200	[thread overview]
Message-ID: <20220328214324.252472-7-marex@denx.de> (raw)
In-Reply-To: <20220328214324.252472-1-marex@denx.de>

The TC358767/TC358867/TC9595 are all capable of operating in multiple
modes, DPI-to-(e)DP, DSI-to-(e)DP, DSI-to-DPI. Only the first mode is
currently supported. In order to support the rest of the modes without
making the tc_probe() overly long, split the bridge endpoint parsing
into dedicated function, where the necessary logic to detect the bridge
mode based on which endpoints are connected, can be implemented.

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Lucas Stach <l.stach@pengutronix.de> # In both DPI to eDP and DSI to DPI mode.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
V2: - Rename tc_probe_bridge_mode() to tc_probe_edp_bridge_endpoint()
      to better reflect that it parses the (e)DP output endpoint
V3: - Add RB from Lucas
V4: - Add TB from Lucas
---
 drivers/gpu/drm/bridge/tc358767.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index e95153d9c1499..0f24156543bae 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -1583,19 +1583,12 @@ static irqreturn_t tc_irq_handler(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
-static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
+static int tc_probe_edp_bridge_endpoint(struct tc_data *tc)
 {
-	struct device *dev = &client->dev;
+	struct device *dev = tc->dev;
 	struct drm_panel *panel;
-	struct tc_data *tc;
 	int ret;
 
-	tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL);
-	if (!tc)
-		return -ENOMEM;
-
-	tc->dev = dev;
-
 	/* port@2 is the output port */
 	ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL);
 	if (ret && ret != -ENODEV)
@@ -1614,6 +1607,25 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		tc->bridge.type = DRM_MODE_CONNECTOR_DisplayPort;
 	}
 
+	return ret;
+}
+
+static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+	struct device *dev = &client->dev;
+	struct tc_data *tc;
+	int ret;
+
+	tc = devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL);
+	if (!tc)
+		return -ENOMEM;
+
+	tc->dev = dev;
+
+	ret = tc_probe_edp_bridge_endpoint(tc);
+	if (ret)
+		return ret;
+
 	/* Shut down GPIO is optional */
 	tc->sd_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH);
 	if (IS_ERR(tc->sd_gpio))
-- 
2.35.1


  parent reply	other threads:[~2022-03-28 21:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 21:43 [PATCH v4 00/11] drm/bridge: tc358767: Add DSI-to-DPI mode support Marek Vasut
2022-03-28 21:43 ` [PATCH v4 01/11] dt-bindings: display: bridge: tc358867: Document DPI output support Marek Vasut
2022-03-28 21:43   ` Marek Vasut
2022-03-28 21:43 ` [PATCH v4 02/11] dt-bindings: display: bridge: tc358867: Document DSI data-lanes property Marek Vasut
2022-03-28 21:43   ` Marek Vasut
2022-03-28 21:43 ` [PATCH v4 03/11] drm/bridge: tc358767: Change tc_ prefix to tc_edp_ for (e)DP specific functions Marek Vasut
2022-03-28 21:43 ` [PATCH v4 04/11] drm/bridge: tc358767: Convert to atomic ops Marek Vasut
2022-03-28 21:43 ` [PATCH v4 05/11] drm/bridge: tc358767: Implement atomic_check callback Marek Vasut
2022-03-28 21:43 ` Marek Vasut [this message]
2022-03-28 21:43 ` [PATCH v4 07/11] drm/bridge: tc358767: Wrap (e)DP aux I2C registration into tc_aux_link_setup() Marek Vasut
2022-03-28 21:43 ` [PATCH v4 08/11] drm/bridge: tc358767: Move bridge ops setup into tc_probe_edp_bridge_endpoint() Marek Vasut
2022-03-28 21:43 ` [PATCH v4 09/11] drm/bridge: tc358767: Detect bridge mode from connected endpoints in DT Marek Vasut
2022-03-28 21:43 ` [PATCH v4 10/11] drm/bridge: tc358767: Split tc_set_video_mode() into common and (e)DP part Marek Vasut
2022-03-29  1:54   ` kernel test robot
2022-03-29  2:05   ` kernel test robot
2022-03-29  2:05     ` kernel test robot
2022-03-28 21:43 ` [PATCH v4 11/11] drm/bridge: tc358767: Add DSI-to-DPI mode support Marek Vasut
2022-03-29  7:47 ` [PATCH v4 00/11] " Lucas Stach
2022-03-29  7:58   ` Marek Vasut

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=20220328214324.252472-7-marex@denx.de \
    --to=marex@denx.de \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonas@kwiboo.se \
    --cc=maxime@cerno.tech \
    --cc=narmstrong@baylibre.com \
    --cc=sam@ravnborg.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.