All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikhil Devshatwar <nikhil.nd@ti.com>
To: <dri-devel@lists.freedesktop.org>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	 Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Boris Brezillon <boris.brezillon@collabora.com>
Cc: Sekhar Nori <nsekhar@ti.com>, Yuti Amonkar <yamonkar@cadence.com>,
	Swapnil Jakhade <sjakhade@cadence.com>
Subject: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Date: Tue, 1 Dec 2020 17:48:28 +0530	[thread overview]
Message-ID: <20201201121830.29704-6-nikhil.nd@ti.com> (raw)
In-Reply-To: <20201201121830.29704-1-nikhil.nd@ti.com>

Remove the old code to iterate over the bridge chain, as this is
already done by the framework.
The bridge state should have the negotiated bus format and flags.
Use these from the bridge's state.
If the bridge does not support format negotiation, error out
and fail.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---

Notes:
    changes from v3:
    * cosmetic updates
    changes from v2:
    * Remove the old code and use the flags from the bridge state

 drivers/gpu/drm/tidss/tidss_encoder.c | 36 +++++++++++----------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c b/drivers/gpu/drm/tidss/tidss_encoder.c
index e278a9c89476..5deb8102e4d3 100644
--- a/drivers/gpu/drm/tidss/tidss_encoder.c
+++ b/drivers/gpu/drm/tidss/tidss_encoder.c
@@ -21,37 +21,29 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
 {
 	struct drm_device *ddev = encoder->dev;
 	struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state);
-	struct drm_display_info *di = &conn_state->connector->display_info;
+	struct drm_bridge_state *bstate;
 	struct drm_bridge *bridge;
-	bool bus_flags_set = false;
 
 	dev_dbg(ddev->dev, "%s\n", __func__);
 
-	/*
-	 * Take the bus_flags from the first bridge that defines
-	 * bridge timings, or from the connector's display_info if no
-	 * bridge defines the timings.
-	 */
-	drm_for_each_bridge_in_chain(encoder, bridge) {
-		if (!bridge->timings)
-			continue;
-
-		tcrtc_state->bus_flags = bridge->timings->input_bus_flags;
-		bus_flags_set = true;
-		break;
+	/* Copy the bus_format and flags from the first bridge's state */
+	bridge = drm_bridge_chain_get_first_bridge(encoder);
+	bstate = drm_atomic_get_new_bridge_state(crtc_state->state, bridge);
+	if (!bstate) {
+		dev_err(ddev->dev, "Could not get the bridge state\n");
+		return -EINVAL;
 	}
 
-	if (!di->bus_formats || di->num_bus_formats == 0)  {
-		dev_err(ddev->dev, "%s: No bus_formats in connected display\n",
-			__func__);
+	tcrtc_state->bus_format = bstate->input_bus_cfg.format;
+	tcrtc_state->bus_flags = bstate->input_bus_cfg.flags;
+
+	if (tcrtc_state->bus_format == 0 ||
+	    tcrtc_state->bus_format == MEDIA_BUS_FMT_FIXED) {
+
+		dev_err(ddev->dev, "Bridge connected to the encoder did not specify media bus format\n");
 		return -EINVAL;
 	}
 
-	// XXX any cleaner way to set bus format and flags?
-	tcrtc_state->bus_format = di->bus_formats[0];
-	if (!bus_flags_set)
-		tcrtc_state->bus_flags = di->bus_flags;
-
 	return 0;
 }
 
-- 
2.17.1

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

  parent reply	other threads:[~2020-12-01 12:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 12:18 [PATCH v4 0/7] drm/tidss: Use new connector model for tidss Nikhil Devshatwar
2020-12-01 12:18 ` [PATCH v4 1/7] drm/bridge: tfp410: Support format negotiation hooks Nikhil Devshatwar
2020-12-01 12:18 ` [PATCH v4 2/7] drm/bridge: tfp410: Set input_bus_flags in atomic_check Nikhil Devshatwar
2020-12-01 14:29   ` kernel test robot
2020-12-01 14:29     ` kernel test robot
2020-12-03 12:50   ` [PATCH v5] " Nikhil Devshatwar
2020-12-04 10:31     ` Boris Brezillon
2020-12-01 12:18 ` [PATCH v4 3/7] drm/bridge: mhdp8546: Add minimal format negotiation Nikhil Devshatwar
2020-12-04 10:33   ` Boris Brezillon
2020-12-01 12:18 ` [PATCH v4 4/7] drm/bridge: mhdp8546: Set input_bus_flags from atomic_check Nikhil Devshatwar
2020-12-04 10:32   ` Boris Brezillon
2020-12-07 13:23     ` Nikhil Devshatwar
2020-12-04 10:42   ` Boris Brezillon
2020-12-07 13:25     ` Nikhil Devshatwar
2020-12-01 12:18 ` Nikhil Devshatwar [this message]
2020-12-04 10:50   ` [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector Boris Brezillon
2020-12-04 10:56     ` Tomi Valkeinen
2020-12-04 11:12       ` Boris Brezillon
2020-12-04 11:47         ` Tomi Valkeinen
2020-12-04 13:54           ` Boris Brezillon
2020-12-04 14:19             ` Tomi Valkeinen
2023-03-30 17:17     ` Francesco Dolcini
2023-04-14  7:49       ` Aradhya Bhatia
2023-04-14  8:30         ` Francesco Dolcini
2023-04-14 20:18           ` Aradhya Bhatia
2020-12-01 12:18 ` [PATCH v4 6/7] drm/tidss: Move to newer connector model Nikhil Devshatwar
2020-12-01 12:18 ` [PATCH v4 7/7] drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable Nikhil Devshatwar

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=20201201121830.29704-6-nikhil.nd@ti.com \
    --to=nikhil.nd@ti.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=nsekhar@ti.com \
    --cc=sjakhade@cadence.com \
    --cc=tomi.valkeinen@ti.com \
    --cc=yamonkar@cadence.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 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.