public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
	Inki Dae <inki.dae@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Joonyoung Shim <jy0922.shim@samsung.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Fancy Fang <chen.fang@nxp.com>,
	Tim Harvey <tharvey@gateworks.com>,
	Michael Nazzareno Trimarchi <michael@amarulasolutions.com>,
	Adam Ford <aford173@gmail.com>,
	Neil Armstrong <narmstrong@linaro.org>,
	Robert Foss <robert.foss@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Tommaso Merciai <tommaso.merciai@amarulasolutions.com>,
	Marek Vasut <marex@denx.de>
Cc: Matteo Lisi <matteo.lisi@engicam.com>,
	dri-devel@lists.freedesktop.org,
	linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-amarula <linux-amarula@amarulasolutions.com>,
	Jagan Teki <jagan@amarulasolutions.com>
Subject: [RESEND PATCH v11 11/18] drm: exynos: dsi: Add atomic_get_input_bus_fmts
Date: Mon, 23 Jan 2023 20:42:05 +0530	[thread overview]
Message-ID: <20230123151212.269082-12-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20230123151212.269082-1-jagan@amarulasolutions.com>

Finding the right input bus format throughout the pipeline is hard
so add atomic_get_input_bus_fmts callback and initialize with the
proper input format from list of supported output formats.

This format can be used in pipeline for negotiating bus format between
the DSI-end of this bridge and the other component closer to pipeline
components.

List of Pixel formats are taken from,
AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022
3.7.4 Pixel formats
Table 14. DSI pixel packing formats

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v11:
- collect RB from Frieder
- drop extra line
Changes for v10:
- none
Changes for v9:
- added MEDIA_BUS_FMT_FIXED
- return MEDIA_BUS_FMT_RGB888_1X24 output_fmt if supported output_fmt
  list is unsupported.
- added MEDIA_BUS_FMT_YUYV10_1X20, MEDIA_BUS_FMT_YUYV12_1X24
Changes for v8:
- added pixel formats supported by NXP AN13573 i.MX 8/RT MIPI DSI/CSI-2
Changes for v7 - v4:
- none
Changes for v3:
- include media-bus-format.h
Changes for v2:
- none
Changes for v1:
- new patch

 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 68 +++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 5518d92c8455..7afbbe30d1d3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -12,6 +12,7 @@
 #include <linux/component.h>
 #include <linux/gpio/consumer.h>
 #include <linux/irq.h>
+#include <linux/media-bus-format.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
 #include <linux/phy/phy.h>
@@ -1466,6 +1467,72 @@ static void exynos_dsi_atomic_post_disable(struct drm_bridge *bridge,
 	pm_runtime_put_sync(dsi->dev);
 }
 
+/*
+ * This pixel output formats list referenced from,
+ * AN13573 i.MX 8/RT MIPI DSI/CSI-2, Rev. 0, 21 March 2022
+ * 3.7.4 Pixel formats
+ * Table 14. DSI pixel packing formats
+ */
+static const u32 exynos_dsi_pixel_output_fmts[] = {
+	MEDIA_BUS_FMT_YUYV10_1X20,
+	MEDIA_BUS_FMT_YUYV12_1X24,
+	MEDIA_BUS_FMT_UYVY8_1X16,
+	MEDIA_BUS_FMT_RGB101010_1X30,
+	MEDIA_BUS_FMT_RGB121212_1X36,
+	MEDIA_BUS_FMT_RGB565_1X16,
+	MEDIA_BUS_FMT_RGB666_1X18,
+	MEDIA_BUS_FMT_RGB888_1X24,
+	MEDIA_BUS_FMT_FIXED,
+};
+
+static bool exynos_dsi_pixel_output_fmt_supported(u32 fmt)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(exynos_dsi_pixel_output_fmts); i++) {
+		if (exynos_dsi_pixel_output_fmts[i] == fmt)
+			return true;
+	}
+
+	return false;
+}
+
+static u32 *
+exynos_dsi_atomic_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)
+{
+	u32 *input_fmts;
+
+	if (!exynos_dsi_pixel_output_fmt_supported(output_fmt))
+		/*
+		 * Some bridge/display drivers are still not able to pass the
+		 * correct format, so handle those pipelines by falling back
+		 * to the default format till the supported formats finalized.
+		 */
+		output_fmt = MEDIA_BUS_FMT_RGB888_1X24;
+
+	input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL);
+	if (!input_fmts)
+		return NULL;
+
+	switch (output_fmt) {
+	case MEDIA_BUS_FMT_FIXED:
+		input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+		break;
+	default:
+		input_fmts[0] = output_fmt;
+		break;
+	}
+
+	*num_input_fmts = 1;
+
+	return input_fmts;
+}
+
 static int exynos_dsi_atomic_check(struct drm_bridge *bridge,
 				   struct drm_bridge_state *bridge_state,
 				   struct drm_crtc_state *crtc_state,
@@ -1514,6 +1581,7 @@ static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = {
 	.atomic_duplicate_state		= drm_atomic_helper_bridge_duplicate_state,
 	.atomic_destroy_state		= drm_atomic_helper_bridge_destroy_state,
 	.atomic_reset			= drm_atomic_helper_bridge_reset,
+	.atomic_get_input_bus_fmts	= exynos_dsi_atomic_get_input_bus_fmts,
 	.atomic_check			= exynos_dsi_atomic_check,
 	.atomic_pre_enable		= exynos_dsi_atomic_pre_enable,
 	.atomic_enable			= exynos_dsi_atomic_enable,
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-01-23 15:22 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 15:11 [RESEND PATCH v11 00/18] drm: Add Samsung MIPI DSIM bridge Jagan Teki
2023-01-23 15:11 ` [RESEND PATCH v11 01/18] drm: of: Lookup if child node has DSI panel or bridge Jagan Teki
2023-01-23 15:11 ` [RESEND PATCH v11 02/18] drm: bridge: panel: Add devm_drm_of_dsi_get_bridge helper Jagan Teki
2023-01-26 12:12   ` Maxime Ripard
2023-01-26 15:18     ` Jagan Teki
2023-01-27 17:39       ` Jagan Teki
2023-01-30 12:56         ` Maxime Ripard
2023-01-30 13:24           ` Jagan Teki
2023-01-31 12:45             ` Maxime Ripard
2023-01-31 13:47               ` Jagan Teki
2023-01-31 13:59                 ` Maxime Ripard
2023-01-31 14:14                   ` Jagan Teki
2023-01-30 12:58       ` Maxime Ripard
2023-01-30 13:22         ` Jagan Teki
2023-02-02 16:52         ` Jagan Teki
2023-02-03  8:26           ` Maxime Ripard
2023-02-03 10:43             ` Jagan Teki
2023-02-03 10:49               ` Maxime Ripard
2023-02-03 10:58                 ` Jagan Teki
2023-02-03 11:04                   ` Maxime Ripard
2023-02-27 11:25                     ` Jagan Teki
2023-01-23 15:11 ` [RESEND PATCH v11 03/18] drm: exynos: dsi: Drop explicit call to bridge detach Jagan Teki
2023-01-23 15:11 ` [RESEND PATCH v11 04/18] drm: exynos: dsi: Switch to devm_drm_of_dsi_get_bridge Jagan Teki
2023-01-23 15:11 ` [RESEND PATCH v11 05/18] drm: exynos: dsi: Mark PHY as optional Jagan Teki
2023-01-23 15:12 ` [RESEND PATCH v11 06/18] drm: exynos: dsi: Add platform PLL_P (PMS_P) offset Jagan Teki
2023-01-23 15:12 ` [RESEND PATCH v11 07/18] drm: exynos: dsi: Introduce hw_type platform data Jagan Teki
2023-01-24 20:54   ` Marek Vasut
2023-01-23 15:12 ` [RESEND PATCH v11 08/18] drm: exynos: dsi: Handle proper host initialization Jagan Teki
2023-01-24 21:00   ` Marek Vasut
2023-01-23 15:12 ` [RESEND PATCH v11 09/18] drm: exynos: dsi: Add atomic check Jagan Teki
2023-01-24 20:55   ` Marek Vasut
2023-01-23 15:12 ` [RESEND PATCH v11 10/18] drm: exynos: dsi: Add input_bus_flags Jagan Teki
2023-01-24 20:55   ` Marek Vasut
2023-01-23 15:12 ` Jagan Teki [this message]
2023-01-24 20:45   ` [RESEND PATCH v11 11/18] drm: exynos: dsi: Add atomic_get_input_bus_fmts Marek Vasut
2023-01-24 21:16     ` Jagan Teki
2023-01-24 21:19       ` Marek Vasut
2023-01-24 21:22         ` Jagan Teki
2023-01-23 15:12 ` [RESEND PATCH v11 12/18] drm: exynos: dsi: Consolidate component and bridge Jagan Teki
2023-01-24 21:04   ` Marek Vasut
2023-01-23 15:12 ` [RESEND PATCH v11 13/18] drm: exynos: dsi: Add Exynos based host irq hooks Jagan Teki
2023-01-24 20:48   ` Marek Vasut
2023-01-24 21:01     ` Jagan Teki
2023-01-24 21:12       ` Marek Vasut
2023-01-24 21:24         ` Jagan Teki
2023-01-24 21:24           ` Jagan Teki
2023-01-25  6:54             ` Jagan Teki
2023-01-25 13:53               ` Marek Vasut
2023-01-25 14:04                 ` Jagan Teki
2023-01-25 16:46                   ` Marek Vasut
2023-01-25 17:12                     ` Jagan Teki
2023-01-25 17:27                       ` Marek Vasut
2023-01-25 17:35                         ` Jagan Teki
2023-01-25 18:03                           ` Marek Vasut
2023-01-25 19:24                             ` Jagan Teki
2023-01-25 21:53                               ` Marek Vasut
2023-01-25 16:02         ` Jagan Teki
2023-01-23 15:12 ` [RESEND PATCH v11 15/18] dt-bindings: display: exynos: dsim: Add NXP i.MX8M Mini/Nano support Jagan Teki
2023-01-24 20:56   ` Marek Vasut
2023-01-23 15:12 ` [RESEND PATCH v11 16/18] drm: bridge: samsung-dsim: Add " Jagan Teki
2023-01-24 20:56   ` Marek Vasut
2023-01-23 15:12 ` [RESEND PATCH v11 17/18] dt-bindings: display: exynos: dsim: Add NXP i.MX8M Plus support Jagan Teki
2023-01-24 20:57   ` Marek Vasut
2023-01-23 15:12 ` [RESEND PATCH v11 18/18] drm: bridge: samsung-dsim: Add " Jagan Teki
2023-01-24 20:59   ` Marek Vasut
2023-01-24 19:12 ` [RESEND PATCH v11 00/18] drm: Add Samsung MIPI DSIM bridge Jagan Teki
     [not found] ` <20230123151212.269082-15-jagan@amarulasolutions.com>
2023-01-24 20:57   ` [RESEND PATCH v11 14/18] drm: bridge: Generalize Exynos-DSI driver into a Samsung " Marek Vasut
2023-01-24 21:13 ` [RESEND PATCH v11 00/18] drm: Add Samsung MIPI " 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=20230123151212.269082-12-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=aford173@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=chen.fang@nxp.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=inki.dae@samsung.com \
    --cc=jy0922.shim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=marex@denx.de \
    --cc=matteo.lisi@engicam.com \
    --cc=michael@amarulasolutions.com \
    --cc=narmstrong@linaro.org \
    --cc=robert.foss@linaro.org \
    --cc=sw0312.kim@samsung.com \
    --cc=tharvey@gateworks.com \
    --cc=tommaso.merciai@amarulasolutions.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