From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Inki Dae <inki.dae@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@baylibre.com>,
Robert Foss <robert.foss@linaro.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Rob Herring <robh+dt@kernel.org>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.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>
Subject: Re: [PATCH 01/11] drm: bridge: Add Samsung DSIM bridge driver
Date: Tue, 12 Apr 2022 11:45:53 +0200 [thread overview]
Message-ID: <0146abe6-c588-820c-09f4-b12de2e734ac@samsung.com> (raw)
In-Reply-To: <20220408162108.184583-2-jagan@amarulasolutions.com>
Hi Jagan,
On 08.04.2022 18:20, Jagan Teki wrote:
> Samsung MIPI DSIM controller is common DSI IP that can be used in various
> SoCs like Exynos, i.MX8M Mini/Nano.
>
> In order to access this DSI controller between various platform SoCs, the
> ideal way to incorporate this in the drm stack is via the drm bridge driver.
>
> This patch is trying to differentiate platform-specific and bridge driver
> code and keep maintaining the exynos_drm_dsi.c code as platform-specific
> glue code and samsung-dsim.c as a common bridge driver code.
>
> - Exynos specific glue code is exynos specific te_irq, host_attach, and
> detach code along with conventional component_ops.
>
> - Samsung DSIM is a bridge driver which is common across all platforms and
> the respective platform-specific glue will initialize at the end of the
> probe. The platform-specific operations and other glue calls will invoke
> on associate code areas.
>
> Updated MAINTAINERS file for this bridge with exynos drm maintainers along
> with Andrzej as he is the original author.
>
> Tomasz Figa has been not included in MAINTAINERS as he is not available via
> samsung.com.
>
> v1:
> * Don't maintain component_ops in bridge driver
> * Don't maintain platform glue code in bridge driver
> * Add platform-specific glue code and make a common bridge
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Well, it took me a while to make this working on Exynos. I'm not really
happy of the design, although I didn't spent much time thinking how to
improve it and clarify some ambiguities. It doesn't even look that one
has compiled the Exynos code after this conversion.
The following changes are needed to get it to the same working state as
before this patch (the next patches however break it even further):
commit e358ee6239305744062713c5aa2e8d44f740b81a (HEAD)
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date: Tue Apr 12 11:30:26 2022 +0200
drm: exynos: dsi: fixup driver after conversion
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c
b/drivers/gpu/drm/bridge/samsung-dsim.c
index ee5d7e5518a6..8e0064282ce6 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -17,7 +17,6 @@
#include <linux/clk.h>
#include <linux/delay.h>
-#include <linux/gpio/consumer.h>
#include <linux/irq.h>
#include <linux/of_device.h>
#include <linux/phy/phy.h>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 97167c5ffc78..bbfacb22d99d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -8,6 +8,7 @@
*/
#include <linux/component.h>
+#include <linux/gpio/consumer.h>
#include <drm/bridge/samsung-dsim.h>
#include <drm/drm_probe_helper.h>
@@ -25,17 +26,19 @@ struct exynos_dsi {
struct samsung_dsim_plat_data pdata;
};
-static void exynos_dsi_enable_irq(void *priv)
+static void exynos_dsi_enable_irq(struct samsung_dsim *priv)
{
- struct exynos_dsi *dsi = priv;
+ const struct samsung_dsim_plat_data *pdata = priv->plat_data;
+ struct exynos_dsi *dsi = container_of(pdata, struct exynos_dsi,
pdata);
if (dsi->te_gpio)
enable_irq(gpiod_to_irq(dsi->te_gpio));
}
-static void exynos_dsi_disable_irq(void *priv)
+static void exynos_dsi_disable_irq(struct samsung_dsim *priv)
{
- struct exynos_dsi *dsi = priv;
+ const struct samsung_dsim_plat_data *pdata = priv->plat_data;
+ struct exynos_dsi *dsi = container_of(pdata, struct exynos_dsi,
pdata);
if (dsi->te_gpio)
disable_irq(gpiod_to_irq(dsi->te_gpio));
@@ -92,15 +95,15 @@ static void exynos_dsi_unregister_te_irq(struct
exynos_dsi *dsi)
}
}
-static int exynos_dsi_host_attach(void *priv, struct mipi_dsi_device
*device)
+static int exynos_dsi_host_attach(struct samsung_dsim *priv, struct
mipi_dsi_device *device)
{
- struct exynos_dsi *dsi = priv;
- struct samsung_dsim *_priv = dsi->priv;
+ const struct samsung_dsim_plat_data *pdata = priv->plat_data;
+ struct exynos_dsi *dsi = container_of(pdata, struct exynos_dsi,
pdata);
struct drm_encoder *encoder = &dsi->encoder;
struct drm_device *drm = encoder->dev;
int ret;
- drm_bridge_attach(encoder, &_priv->bridge, NULL, 0);
+ drm_bridge_attach(encoder, &priv->bridge, NULL, 0);
/*
* This is a temporary solution and should be made by more
generic way.
@@ -116,11 +119,11 @@ static int exynos_dsi_host_attach(void *priv,
struct mipi_dsi_device *device)
mutex_lock(&drm->mode_config.mutex);
- _priv->lanes = device->lanes;
- _priv->format = device->format;
- _priv->mode_flags = device->mode_flags;
+ priv->lanes = device->lanes;
+ priv->format = device->format;
+ priv->mode_flags = device->mode_flags;
exynos_drm_crtc_get_by_type(drm,
EXYNOS_DISPLAY_TYPE_LCD)->i80_mode =
- !(_priv->mode_flags & MIPI_DSI_MODE_VIDEO);
+ !(priv->mode_flags & MIPI_DSI_MODE_VIDEO);
mutex_unlock(&drm->mode_config.mutex);
@@ -130,9 +133,10 @@ static int exynos_dsi_host_attach(void *priv,
struct mipi_dsi_device *device)
return 0;
}
-static int exynos_dsi_host_detach(void *priv, struct mipi_dsi_device
*device)
+static int exynos_dsi_host_detach(struct samsung_dsim *priv, struct
mipi_dsi_device *device)
{
- struct exynos_dsi *dsi = priv;
+ const struct samsung_dsim_plat_data *pdata = priv->plat_data;
+ struct exynos_dsi *dsi = container_of(pdata, struct exynos_dsi,
pdata);
struct drm_device *drm = dsi->encoder.dev;
if (drm->mode_config.poll_enabled)
@@ -150,8 +154,9 @@ static const struct samsung_dsim_host_ops
samsung_dsim_exynos_host_ops = {
static int exynos_dsi_bind(struct device *dev, struct device *master,
void *data)
{
- struct exynos_dsi *dsi = dev_get_drvdata(dev);
- struct samsung_dsim *priv = dsi->priv;
+ struct samsung_dsim *priv = dev_get_drvdata(dev);
+ const struct samsung_dsim_plat_data *pdata = priv->plat_data;
+ struct exynos_dsi *dsi = container_of(pdata, struct exynos_dsi,
pdata);
struct drm_encoder *encoder = &dsi->encoder;
struct drm_device *drm_dev = data;
int ret;
@@ -167,8 +172,7 @@ static int exynos_dsi_bind(struct device *dev,
struct device *master, void *data
static void exynos_dsi_unbind(struct device *dev, struct device
*master, void *data)
{
- struct exynos_dsi *dsi = dev_get_drvdata(dev);
- struct samsung_dsim *priv = dsi->priv;
+ struct samsung_dsim *priv = dev_get_drvdata(dev);
priv->bridge.funcs->atomic_disable(&priv->bridge, NULL);
diff --git a/include/drm/bridge/samsung-dsim.h
b/include/drm/bridge/samsung-dsim.h
index 59a43f9c4477..9f579a798635 100644
--- a/include/drm/bridge/samsung-dsim.h
+++ b/include/drm/bridge/samsung-dsim.h
@@ -41,14 +41,18 @@ struct samsung_dsim_driver_data {
const unsigned int *reg_values;
};
+struct samsung_dsim;
+
struct samsung_dsim_host_ops {
- int (*attach)(void *priv, struct mipi_dsi_device *device);
- int (*detach)(void *priv, struct mipi_dsi_device *device);
+ int (*attach)(struct samsung_dsim *priv,
+ struct mipi_dsi_device *device);
+ int (*detach)(struct samsung_dsim *priv,
+ struct mipi_dsi_device *device);
};
struct samsung_dsim_irq_ops {
- void (*enable)(void *priv);
- void (*disable)(void *priv);
+ void (*enable)(struct samsung_dsim *priv);
+ void (*disable)(struct samsung_dsim *priv);
};
struct samsung_dsim_plat_data {
> ---
> MAINTAINERS | 12 +
> drivers/gpu/drm/bridge/Kconfig | 12 +
> drivers/gpu/drm/bridge/Makefile | 1 +
> drivers/gpu/drm/bridge/samsung-dsim.c | 1676 ++++++++++++++++++++++
> drivers/gpu/drm/exynos/Kconfig | 1 +
> drivers/gpu/drm/exynos/exynos_drm_dsi.c | 1704 +----------------------
> include/drm/bridge/samsung-dsim.h | 95 ++
> 7 files changed, 1852 insertions(+), 1649 deletions(-)
> create mode 100644 drivers/gpu/drm/bridge/samsung-dsim.c
> create mode 100644 include/drm/bridge/samsung-dsim.h
>
> ...
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-04-12 9:47 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220408162213eucas1p158d7c7ee27006a61d4af95d3c72c58e3@eucas1p1.samsung.com>
2022-04-08 16:20 ` [PATCH 00/11] drm: bridge: Add Samsung MIPI DSIM bridge Jagan Teki
2022-04-08 16:20 ` [PATCH 02/11] drm: bridge: samsung-dsim: Handle platform init via driver_data Jagan Teki
2022-04-12 9:55 ` Marek Szyprowski
2022-04-08 16:21 ` [PATCH 03/11] drm: bridge: samsung-dsim: Mark PHY as optional Jagan Teki
2022-04-08 16:21 ` [PATCH 04/11] drm: bridge: samsung-dsim: Add DSI init in bridge pre_enable() Jagan Teki
2022-04-11 12:23 ` Adam Ford
2022-04-08 16:21 ` [PATCH 05/11] drm: bridge: samsung-dsim: Fix PLL_P (PMS_P) offset Jagan Teki
2022-04-08 16:21 ` [PATCH 06/11] drm: bridge: samsung-dsim: Add module init, exit Jagan Teki
2022-04-08 16:21 ` [PATCH 07/11] drm: bridge: samsung-dsim: Add atomic_check Jagan Teki
2022-04-08 16:21 ` [PATCH 08/11] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts Jagan Teki
2022-04-08 16:21 ` [PATCH 09/11] drm: bridge: samsung-dsim: Add input_bus_flags Jagan Teki
2022-04-08 16:21 ` [PATCH 10/11] dt-bindings: display: exynos: dsim: Add NXP i.MX8MM support Jagan Teki
2022-04-10 18:12 ` Laurent Pinchart
2022-04-29 9:40 ` Jagan Teki
2022-04-08 16:21 ` [PATCH 11/11] drm: bridge: samsung-dsim: Add " Jagan Teki
2022-04-10 18:06 ` Laurent Pinchart
2022-04-09 0:25 ` [PATCH 00/11] drm: bridge: Add Samsung MIPI DSIM bridge Tim Harvey
2022-04-11 13:11 ` (EXT) " Alexander Stein
2022-04-11 13:56 ` Marek Szyprowski
2022-04-11 14:39 ` Adam Ford
2022-04-11 15:29 ` Adam Ford
2022-04-11 16:25 ` Marek Szyprowski
2022-04-11 20:26 ` Adam Ford
[not found] ` <CGME20220408162224eucas1p2a445493e9354f6ee72b348cb1c4ebc16@eucas1p2.samsung.com>
[not found] ` <20220408162108.184583-2-jagan@amarulasolutions.com>
2022-04-12 9:45 ` Marek Szyprowski [this message]
2022-05-04 9:16 ` [PATCH 01/11] drm: bridge: Add Samsung DSIM bridge driver Jagan Teki
2022-05-04 9:44 ` Marek Szyprowski
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=0146abe6-c588-820c-09f4-b12de2e734ac@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=aford173@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=chen.fang@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=frieder.schrempf@kontron.de \
--cc=inki.dae@samsung.com \
--cc=jagan@amarulasolutions.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=michael@amarulasolutions.com \
--cc=narmstrong@baylibre.com \
--cc=robert.foss@linaro.org \
--cc=robh+dt@kernel.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