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 1/7] drm/bridge: tfp410: Support format negotiation hooks
Date: Tue, 1 Dec 2020 17:48:24 +0530	[thread overview]
Message-ID: <20201201121830.29704-2-nikhil.nd@ti.com> (raw)
In-Reply-To: <20201201121830.29704-1-nikhil.nd@ti.com>

With new connector model, tfp410 will not create the connector and
SoC driver will rely on format negotiation to setup the encoder format.

Support format negotiations hooks in the drm_bridge_funcs.
Use helper functions for state management.

Output format is expected to be MEDIA_BUS_FMT_FIXED
Input format is the one selected by the bridge from DT properties.

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

Notes:
    changes from v1:
    * Use only MEDIA_BUS_FMT_FIXED for output

 drivers/gpu/drm/bridge/ti-tfp410.c | 33 ++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index ba3fa2a9b8a4..3def9acba86b 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -204,12 +204,45 @@ static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge,
 	return MODE_OK;
 }
 
+static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge,
+				      struct drm_bridge_state *bridge_state,
+				      struct drm_crtc_state *crtc_state,
+				      struct drm_connector_state *conn_state,
+				      u32 output_fmt,
+				      unsigned int *num_input_fmts)
+{
+	struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
+	u32 *input_fmts;
+
+	*num_input_fmts = 0;
+
+	/*
+	 * Output of tfp410 is DVI, which is TMDS.
+	 * There is no media format defined for this.
+	 * Using MEDIA_BUS_FMT_FIXED for now.
+	 */
+	if (output_fmt != MEDIA_BUS_FMT_FIXED)
+		return NULL;
+
+	input_fmts = kzalloc(sizeof(*input_fmts), GFP_KERNEL);
+	if (!input_fmts)
+		return NULL;
+
+	*num_input_fmts = 1;
+	input_fmts[0] = dvi->bus_format;
+	return input_fmts;
+}
+
 static const struct drm_bridge_funcs tfp410_bridge_funcs = {
 	.attach		= tfp410_attach,
 	.detach		= tfp410_detach,
 	.enable		= tfp410_enable,
 	.disable	= tfp410_disable,
 	.mode_valid	= tfp410_mode_valid,
+	.atomic_reset = drm_atomic_helper_bridge_reset,
+	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+	.atomic_get_input_bus_fmts = tfp410_get_input_bus_fmts,
 };
 
 static const struct drm_bridge_timings tfp410_default_timings = {
-- 
2.17.1

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

  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 ` Nikhil Devshatwar [this message]
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 ` [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector Nikhil Devshatwar
2020-12-04 10:50   ` 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-2-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.