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>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Tim Harvey <tharvey@gateworks.com>,
	Adam Ford <aford173@gmail.com>,
	Robert Foss <robert.foss@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.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: [PATCH v12 08/18] drm: exynos: dsi: Handle proper host initialization
Date: Thu, 26 Jan 2023 20:14:17 +0530	[thread overview]
Message-ID: <20230126144427.607098-9-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20230126144427.607098-1-jagan@amarulasolutions.com>

From: Marek Szyprowski <m.szyprowski@samsung.com>

Host transfer() in the DSI master will invoke only when the DSI commands
are sent from DSI devices like DSI Panel or DSI bridges and this host
the transfer wouldn't invoke for I2C-based-DSI bridge drivers.

Handling DSI host initialization in transfer calls misses the controller
setup for I2C configured DSI bridges.

This patch updates the DSI host initialization by calling host to init
from bridge pre_enable as the bridge pre_enable API is invoked by core
as it is common across all classes of DSI device drivers.

The host init during pre_enable is conditional and not invoked for Exynos
as existing downstream drm panels and bridges in Exynos are expecting
the host initialization during DSI transfer.

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v12:
- collect RB from Marek
Changes for v11:
- collect RB from Frieder
Changes for v10:
- update the to simple logic to handle all platforms
Changs for v9 - v8:
- none
Changes for v2:
- check initialized state in samsung_dsim_init
Changes for v1:
- keep DSI init in host transfer

 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 27 +++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 902bd46964cb..d4a976d86f08 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -254,6 +254,9 @@ struct exynos_dsi_transfer {
 #define DSIM_STATE_CMD_LPM		BIT(2)
 #define DSIM_STATE_VIDOUT_AVAILABLE	BIT(3)
 
+#define exynos_dsi_hw_is_exynos(hw) \
+	((hw) >= DSIM_TYPE_EXYNOS3250 && (hw) <= DSIM_TYPE_EXYNOS5433)
+
 enum exynos_dsi_type {
 	DSIM_TYPE_EXYNOS3250,
 	DSIM_TYPE_EXYNOS4210,
@@ -1343,6 +1346,9 @@ static int exynos_dsi_init(struct exynos_dsi *dsi)
 {
 	const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;
 
+	if (dsi->state & DSIM_STATE_INITIALIZED)
+		return 0;
+
 	exynos_dsi_reset(dsi);
 	exynos_dsi_enable_irq(dsi);
 
@@ -1355,6 +1361,8 @@ static int exynos_dsi_init(struct exynos_dsi *dsi)
 	exynos_dsi_set_phy_ctrl(dsi);
 	exynos_dsi_init_link(dsi);
 
+	dsi->state |= DSIM_STATE_INITIALIZED;
+
 	return 0;
 }
 
@@ -1410,6 +1418,16 @@ static void exynos_dsi_atomic_pre_enable(struct drm_bridge *bridge,
 	}
 
 	dsi->state |= DSIM_STATE_ENABLED;
+
+	/*
+	 * For Exynos-DSIM the downstream bridge, or panel are expecting
+	 * the host initialization during DSI transfer.
+	 */
+	if (!exynos_dsi_hw_is_exynos(dsi->plat_data->hw_type)) {
+		ret = exynos_dsi_init(dsi);
+		if (ret)
+			return;
+	}
 }
 
 static void exynos_dsi_atomic_enable(struct drm_bridge *bridge,
@@ -1556,12 +1574,9 @@ static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host,
 	if (!(dsi->state & DSIM_STATE_ENABLED))
 		return -EINVAL;
 
-	if (!(dsi->state & DSIM_STATE_INITIALIZED)) {
-		ret = exynos_dsi_init(dsi);
-		if (ret)
-			return ret;
-		dsi->state |= DSIM_STATE_INITIALIZED;
-	}
+	ret = exynos_dsi_init(dsi);
+	if (ret)
+		return ret;
 
 	ret = mipi_dsi_create_packet(&xfer.packet, msg);
 	if (ret < 0)
-- 
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-26 14:49 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 14:44 [PATCH v12 00/18] drm: Add Samsung MIPI DSIM bridge Jagan Teki
2023-01-26 14:44 ` [PATCH v12 01/18] drm: of: Lookup if child node has DSI panel or bridge Jagan Teki
2023-01-26 14:44 ` [PATCH v12 02/18] drm: bridge: panel: Add devm_drm_of_dsi_get_bridge helper Jagan Teki
2023-01-26 14:47   ` Maxime Ripard
2023-01-26 14:58     ` Jagan Teki
2023-01-26 14:44 ` [PATCH v12 03/18] drm: exynos: dsi: Drop explicit call to bridge detach Jagan Teki
2023-01-26 14:44 ` [PATCH v12 04/18] drm: exynos: dsi: Switch to devm_drm_of_dsi_get_bridge Jagan Teki
2023-01-26 14:44 ` [PATCH v12 05/18] drm: exynos: dsi: Mark PHY as optional Jagan Teki
2023-01-26 14:44 ` [PATCH v12 06/18] drm: exynos: dsi: Add platform PLL_P (PMS_P) offset Jagan Teki
2023-01-26 14:44 ` [PATCH v12 07/18] drm: exynos: dsi: Introduce hw_type platform data Jagan Teki
2023-01-26 14:44 ` Jagan Teki [this message]
2023-01-26 14:44 ` [PATCH v12 09/18] drm: exynos: dsi: Add atomic check Jagan Teki
2023-01-26 14:44 ` [PATCH v12 10/18] drm: exynos: dsi: Add input_bus_flags Jagan Teki
2023-01-26 14:44 ` [PATCH v12 11/18] drm: exynos: dsi: Add atomic_get_input_bus_fmts Jagan Teki
2023-01-26 15:29   ` Marek Vasut
2023-01-26 14:44 ` [PATCH v12 12/18] drm: exynos: dsi: Consolidate component and bridge Jagan Teki
2023-01-26 14:44 ` [PATCH v12 13/18] drm: exynos: dsi: Add host helper for te_irq_handler Jagan Teki
2023-01-26 14:44 ` [PATCH v12 15/18] dt-bindings: display: exynos: dsim: Add NXP i.MX8M Mini/Nano support Jagan Teki
2023-01-26 14:44 ` [PATCH v12 16/18] drm: bridge: samsung-dsim: Add " Jagan Teki
2023-01-26 14:44 ` [PATCH v12 17/18] dt-bindings: display: exynos: dsim: Add NXP i.MX8M Plus support Jagan Teki
2023-01-26 14:44 ` [PATCH v12 18/18] drm: bridge: samsung-dsim: Add " Jagan Teki
2023-01-27 10:33 ` [PATCH v12 00/18] drm: Add Samsung MIPI DSIM bridge Rasmus Villemoes
2023-01-27 10:39   ` Jagan Teki
2023-01-27 10:56     ` Rasmus Villemoes
2023-01-27 11:04       ` Jagan Teki
2023-01-27 11:30         ` Marek Vasut
2023-01-30 12:45           ` Rasmus Villemoes
2023-01-31  7:27             ` Alexander Stein
2023-02-01 22:00             ` Marek Vasut
2023-02-03 12:29               ` Rasmus Villemoes
2023-02-06  8:11                 ` Frieder Schrempf
2023-02-07  9:09                   ` Rasmus Villemoes
2023-02-07  9:23                     ` Marek Vasut
2023-02-14 10:55                       ` Rasmus Villemoes
2023-02-14 11:08                         ` Rasmus Villemoes
2023-02-14 11:09                         ` Fabio Estevam
2023-02-14 11:11                           ` Fabio Estevam
2023-02-17  8:55                           ` Rasmus Villemoes
2023-02-17 10:05                             ` Alexander Stein
2023-02-17 18:22                     ` Rasmus Villemoes
2023-02-22 10:05                       ` Frieder Schrempf
2023-02-24 14:08                         ` Rasmus Villemoes
2023-02-24 15:00                           ` Adam Ford
2023-02-01  8:37 ` Frieder Schrempf

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=20230126144427.607098-9-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=aford173@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=inki.dae@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=robert.foss@linaro.org \
    --cc=sw0312.kim@samsung.com \
    --cc=tharvey@gateworks.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