* [PATCH 01/32] drm/mipi-dsi: add sanity check of lane number in mipi_dsi_attach()
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 02/32] drm/hisilicon/kirin: remove redundant lanes number check Luca Ceresoli
` (31 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
Several drivers do some sanity checks on the lane number. Checking it is
non-zero will allow to remove such checks.
Additionally, we are about to move to an .attach_new host op which won't
pass a pointer that the host driver can store. This will prevent host
drivers to check for the presence of a device by storing such pointer and
checking whether it is NULL. As a replacement, host drivers will be able to
check the lane number to be non-zero, so ensuring a zero value is never
passed along will make such checks robust.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index a00d76443128e4972f939a8c9e26d949d2b30bb9..82d4f9c1de5fbc60f32d0b0baf41e1bd2991ebe4 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -379,6 +379,9 @@ int mipi_dsi_attach(struct mipi_dsi_device *dsi)
if (!ops || !ops->attach)
return -ENOSYS;
+ if (dsi->lanes < 1)
+ return dev_err_probe(&dsi->dev, -EINVAL, "Incorrect lanes number\n");
+
ret = ops->attach(dsi->host, dsi);
if (ret)
return ret;
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 02/32] drm/hisilicon/kirin: remove redundant lanes number check
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
2025-06-25 16:45 ` [PATCH 01/32] drm/mipi-dsi: add sanity check of lane number in mipi_dsi_attach() Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 03/32] drm/bridge: nwl-dsi: " Luca Ceresoli
` (30 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
Checking that the number of lanes is > 0 is now done by the DRM MIPI DSI
core in mipi_dsi_attach().
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index e80debdc41763357cb2cf321205c0dfac80a911e..1a5b97abae86a187c751b4b579d7c22f206e4c90 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -728,7 +728,7 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
struct device *dev = host->dev;
int ret;
- if (mdsi->lanes < 1 || mdsi->lanes > 4) {
+ if (mdsi->lanes > 4) {
DRM_ERROR("dsi device params invalid\n");
return -EINVAL;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 03/32] drm/bridge: nwl-dsi: remove redundant lanes number check
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
2025-06-25 16:45 ` [PATCH 01/32] drm/mipi-dsi: add sanity check of lane number in mipi_dsi_attach() Luca Ceresoli
2025-06-25 16:45 ` [PATCH 02/32] drm/hisilicon/kirin: remove redundant lanes number check Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 04/32] drm/mcde: " Luca Ceresoli
` (29 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
Checking that the number of lanes is > 0 is now done by the DRM MIPI DSI
core in mipi_dsi_attach().
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 2f7429b24fc20db104dec17182f1119c6c75e600..ccce663192b35a795dad8cb479203d05b414173b 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -352,7 +352,7 @@ static int nwl_dsi_host_attach(struct mipi_dsi_host *dsi_host,
DRM_DEV_INFO(dev, "lanes=%u, format=0x%x flags=0x%lx\n", device->lanes,
device->format, device->mode_flags);
- if (device->lanes < 1 || device->lanes > 4)
+ if (device->lanes > 4)
return -EINVAL;
dsi->lanes = device->lanes;
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 04/32] drm/mcde: remove redundant lanes number check
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (2 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 03/32] drm/bridge: nwl-dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 05/32] drm/mipi-dsi: log DSI device attach and detach Luca Ceresoli
` (28 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
Checking that the number of lanes is > 0 is now done by the DRM MIPI DSI
core in mipi_dsi_attach().
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/mcde/mcde_dsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index a3423459dd7ac8395b77d0479a02ebb3a9ba259c..8e3b9c9c64e99239e54ba5a338cf3bbb6c84b40f 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -172,7 +172,7 @@ static int mcde_dsi_host_attach(struct mipi_dsi_host *host,
{
struct mcde_dsi *d = host_to_mcde_dsi(host);
- if (mdsi->lanes < 1 || mdsi->lanes > 2) {
+ if (mdsi->lanes > 2) {
DRM_ERROR("dsi device params invalid, 1 or 2 lanes supported\n");
return -EINVAL;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 05/32] drm/mipi-dsi: log DSI device attach and detach
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (3 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 04/32] drm/mcde: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 06/32] drm/bridge: samsung-dsim: remove redundant logging Luca Ceresoli
` (27 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
Some MIPI DSI host drivers log a line on attach success, failure, or
attempt. These log lines are inconsistent and sparse across
drivers. Moreover most of them use the "info" logging level, but drivers
should be mostly or totally silent when successful.
Add logging in the DSI core, so that it is consistent across drivers and
not redundant. Log for both attach success and failure, and while there
also log on detach. Print the main format parameters on each line (lanes,
bpp and mode flags). Finally, use "debug" logging level (except for the
"error" logging level in case of failure).
Later commits will remove the now-redundant logging in individual drivers.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 82d4f9c1de5fbc60f32d0b0baf41e1bd2991ebe4..f16f70c70c87988a95f959d0b8b18a6941dd2808 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -383,11 +383,19 @@ int mipi_dsi_attach(struct mipi_dsi_device *dsi)
return dev_err_probe(&dsi->dev, -EINVAL, "Incorrect lanes number\n");
ret = ops->attach(dsi->host, dsi);
- if (ret)
+ if (ret) {
+ dev_err(dsi->host->dev,
+ "Failed to attach %s device (lanes:%d bpp:%d mode-flags:0x%lx) (%d)\n",
+ dsi->name, dsi->lanes, mipi_dsi_pixel_format_to_bpp(dsi->format),
+ dsi->mode_flags, ret);
return ret;
+ }
dsi->attached = true;
+ dev_dbg(dsi->host->dev, "Attached %s device (lanes:%d bpp:%d mode-flags:0x%lx)\n",
+ dsi->name, dsi->lanes, mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->mode_flags);
+
return 0;
}
EXPORT_SYMBOL(mipi_dsi_attach);
@@ -406,6 +414,10 @@ int mipi_dsi_detach(struct mipi_dsi_device *dsi)
if (!ops || !ops->detach)
return -ENOSYS;
+ dev_dbg(dsi->host->dev, "Detaching %s device (lanes:%d bpp:%d mode-flags:0x%lx)\n",
+ dsi->name, dsi->lanes, mipi_dsi_pixel_format_to_bpp(dsi->format),
+ dsi->mode_flags);
+
dsi->attached = false;
return ops->detach(dsi->host, dsi);
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 06/32] drm/bridge: samsung-dsim: remove redundant logging
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (4 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 05/32] drm/mipi-dsi: log DSI device attach and detach Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 07/32] drm/bridge: nwl-dsi: " Luca Ceresoli
` (26 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This line logged as info is too much, drivers should be mostly silent when
everything works. And now there is an equivalent dbg line logged in
mipi_dsi_attach(), valid for all DSI hosts.
This avoids the need to access the @name field in struct mipi_dsi_device.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/samsung-dsim.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
index f2f666b27d2d5ec016d7a7f47c87fcdf1377d41a..612651ca02c02df0e4f434b8d76bd2f1274e3e4c 100644
--- a/drivers/gpu/drm/bridge/samsung-dsim.c
+++ b/drivers/gpu/drm/bridge/samsung-dsim.c
@@ -1757,11 +1757,6 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host,
return ret;
}
- DRM_DEV_INFO(dev, "Attached %s device (lanes:%d bpp:%d mode-flags:0x%lx)\n",
- device->name, device->lanes,
- mipi_dsi_pixel_format_to_bpp(device->format),
- device->mode_flags);
-
drm_bridge_add(&dsi->bridge);
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 07/32] drm/bridge: nwl-dsi: remove redundant logging
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (5 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 06/32] drm/bridge: samsung-dsim: remove redundant logging Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 08/32] drm/bridge: cdns-dsi: " Luca Ceresoli
` (25 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This line logged as info is too much, drivers should be mostly silent when
everything works. And now there is an equivalent dbg line logged in
mipi_dsi_attach(), valid for all DSI hosts.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index ccce663192b35a795dad8cb479203d05b414173b..94356d02a7009a4d333f2df6c628d57c4bf66fdb 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -347,10 +347,6 @@ static int nwl_dsi_host_attach(struct mipi_dsi_host *dsi_host,
struct mipi_dsi_device *device)
{
struct nwl_dsi *dsi = container_of(dsi_host, struct nwl_dsi, dsi_host);
- struct device *dev = dsi->dev;
-
- DRM_DEV_INFO(dev, "lanes=%u, format=0x%x flags=0x%lx\n", device->lanes,
- device->format, device->mode_flags);
if (device->lanes > 4)
return -EINVAL;
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 08/32] drm/bridge: cdns-dsi: remove redundant logging
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (6 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 07/32] drm/bridge: nwl-dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 09/32] drm/mcde: " Luca Ceresoli
` (24 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
Now there is an equivalent of this dev_err in mipi_dsi_attach(), valid for
all DSI hosts.
This avoids the need to access the @name field in struct mipi_dsi_device.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index a57ca8c3bdaea9d4d15dd23af221c111b7319ac4..005aa6121227b2f7ac682f3b724e4518e8e5f721 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -1072,7 +1072,6 @@ static int cdns_dsi_attach(struct mipi_dsi_host *host,
struct cdns_dsi_output *output = &dsi->output;
struct cdns_dsi_input *input = &dsi->input;
struct drm_bridge *bridge;
- int ret;
/*
* We currently do not support connecting several DSI devices to the
@@ -1093,12 +1092,8 @@ static int cdns_dsi_attach(struct mipi_dsi_host *host,
*/
bridge = devm_drm_of_get_bridge(dsi->base.dev, dsi->base.dev->of_node,
DSI_OUTPUT_PORT, dev->channel);
- if (IS_ERR(bridge)) {
- ret = PTR_ERR(bridge);
- dev_err(host->dev, "failed to add DSI device %s (err = %d)",
- dev->name, ret);
- return ret;
- }
+ if (IS_ERR(bridge))
+ return PTR_ERR(bridge);
output->dev = dev;
output->bridge = bridge;
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 09/32] drm/mcde: remove redundant logging
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (7 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 08/32] drm/bridge: cdns-dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 10/32] drm/sun4i: dsi: " Luca Ceresoli
` (23 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
These lines logged as info are too much, drivers should be mostly silent
when everything works. And now there is an equivalent dbg line logged in
mipi_dsi_attach(), valid for all DSI hosts.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/mcde/mcde_dsi.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 8e3b9c9c64e99239e54ba5a338cf3bbb6c84b40f..04041ad9231bd53cf4bfa18ad41caa19df3b838a 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -177,12 +177,6 @@ static int mcde_dsi_host_attach(struct mipi_dsi_host *host,
return -EINVAL;
}
- dev_info(d->dev, "attached DSI device with %d lanes\n", mdsi->lanes);
- /* MIPI_DSI_FMT_RGB88 etc */
- dev_info(d->dev, "format %08x, %dbpp\n", mdsi->format,
- mipi_dsi_pixel_format_to_bpp(mdsi->format));
- dev_info(d->dev, "mode flags: %08lx\n", mdsi->mode_flags);
-
d->mdsi = mdsi;
if (d->mcde)
mcde_dsi_attach_to_mcde(d);
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 10/32] drm/sun4i: dsi: remove redundant logging
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (8 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 09/32] drm/mcde: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 11/32] drm/bridge: synopsys/dsi2: remove DSI device pointer from private callbacks Luca Ceresoli
` (22 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
Now there is an equivalent of this dev_err in mipi_dsi_attach(), valid for
all DSI hosts.
This avoids the need to access the @name field in struct mipi_dsi_device.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index c35b70d83e53b7397c6e38dde45824bd49fdf099..50e41bc147c92e2f9df415a96eb3e1c5efdc6958 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -975,8 +975,6 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host,
drm_kms_helper_hotplug_event(dsi->drm);
- dev_info(host->dev, "Attached device %s\n", device->name);
-
return 0;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 11/32] drm/bridge: synopsys/dsi2: remove DSI device pointer from private callbacks
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (9 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 10/32] drm/sun4i: dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH RFC 12/32] drm/meson: dsi: remove unneeded DSI device check Luca Ceresoli
` (21 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
The callbacks in struct dw_mipi_dsi2_host_ops have a struct mipi_dsi_device
pointer to the device, which is unused. Remove it as a step towards
avoiding DSI host drivers to hold a pointer to the DSI device.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 4 ++--
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c | 6 ++----
include/drm/bridge/dw_mipi_dsi2.h | 6 ++----
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
index 5926a3a05d79ff42f56adb4d09c7378191493ba1..a994dfc1c0d2f6bbcab615c645d4dff7b90a756f 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
@@ -538,7 +538,7 @@ static int dw_mipi_dsi2_host_attach(struct mipi_dsi_host *host,
drm_bridge_add(&dsi2->bridge);
if (pdata->host_ops && pdata->host_ops->attach) {
- ret = pdata->host_ops->attach(pdata->priv_data, device);
+ ret = pdata->host_ops->attach(pdata->priv_data);
if (ret < 0)
return ret;
}
@@ -554,7 +554,7 @@ static int dw_mipi_dsi2_host_detach(struct mipi_dsi_host *host,
int ret;
if (pdata->host_ops && pdata->host_ops->detach) {
- ret = pdata->host_ops->detach(pdata->priv_data, device);
+ ret = pdata->host_ops->detach(pdata->priv_data);
if (ret < 0)
return ret;
}
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
index cdd490778756f67be69a5c4319b30520c42cdec8..998cbeb78d15562090910df5a25b3ca9cc60d33a 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
@@ -335,8 +335,7 @@ static const struct component_ops dw_mipi_dsi2_rockchip_ops = {
.unbind = dw_mipi_dsi2_rockchip_unbind,
};
-static int dw_mipi_dsi2_rockchip_host_attach(void *priv_data,
- struct mipi_dsi_device *device)
+static int dw_mipi_dsi2_rockchip_host_attach(void *priv_data)
{
struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
int ret;
@@ -348,8 +347,7 @@ static int dw_mipi_dsi2_rockchip_host_attach(void *priv_data,
return 0;
}
-static int dw_mipi_dsi2_rockchip_host_detach(void *priv_data,
- struct mipi_dsi_device *device)
+static int dw_mipi_dsi2_rockchip_host_detach(void *priv_data)
{
struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
diff --git a/include/drm/bridge/dw_mipi_dsi2.h b/include/drm/bridge/dw_mipi_dsi2.h
index c18c49379247cd5df31a1b014524347b4d92a0a5..0117fe218ea79a30353b2a5949164aa88b18a2b7 100644
--- a/include/drm/bridge/dw_mipi_dsi2.h
+++ b/include/drm/bridge/dw_mipi_dsi2.h
@@ -54,10 +54,8 @@ struct dw_mipi_dsi2_phy_ops {
};
struct dw_mipi_dsi2_host_ops {
- int (*attach)(void *priv_data,
- struct mipi_dsi_device *dsi);
- int (*detach)(void *priv_data,
- struct mipi_dsi_device *dsi);
+ int (*attach)(void *priv_data);
+ int (*detach)(void *priv_data);
};
struct dw_mipi_dsi2_plat_data {
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH RFC 12/32] drm/meson: dsi: remove unneeded DSI device check
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (10 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 11/32] drm/bridge: synopsys/dsi2: remove DSI device pointer from private callbacks Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 13/32] drm/mipi-dsi: move format define above Luca Ceresoli
` (20 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
linux-amlogic
This check is not really needed: there is no reason the detaching client
can be different from the attached one. Should this happen, that would be a
bug elsewhere.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
**NOTE**: I'm not 100% sure this is correct, but it appears so, and other
drivers have no such check. And anyway it appears that such a check should
belong to the core, not to individual drivers. Comments welcome!
To: Kevin Hilman <khilman@baylibre.com>
To: Jerome Brunet <jbrunet@baylibre.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org
---
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
index 66c73c512b0e68ff0e9dbbfaba5f8bf2d347e6b1..4dc726cef5455075def7927a469ae23020ebfec7 100644
--- a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
+++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
@@ -252,11 +252,6 @@ static int meson_dw_mipi_dsi_host_detach(void *priv_data,
{
struct meson_dw_mipi_dsi *mipi_dsi = priv_data;
- if (device == mipi_dsi->dsi_device)
- mipi_dsi->dsi_device = NULL;
- else
- return -EINVAL;
-
return phy_exit(mipi_dsi->phy);
}
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 13/32] drm/mipi-dsi: move format define above
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (11 preceding siblings ...)
2025-06-25 16:45 ` [PATCH RFC 12/32] drm/meson: dsi: remove unneeded DSI device check Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 14/32] drm/mipi-dsi: add .attach_new to mipi_dsi_host_ops Luca Ceresoli
` (19 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
In preparation for adding a new struct using them, but visible to the
struct mipi_dsi_host_ops declaration, move them above such declaration.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
include/drm/drm_mipi_dsi.h | 76 +++++++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index b37860f4a895c25ef8ba1c5b3f44827ef53aa100..e42483fd022fed4dfc9e5ef180117c3dd37a3b51 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -64,6 +64,44 @@ struct mipi_dsi_packet {
int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
const struct mipi_dsi_msg *msg);
+/* DSI mode flags */
+
+/* video mode */
+#define MIPI_DSI_MODE_VIDEO BIT(0)
+/* video burst mode */
+#define MIPI_DSI_MODE_VIDEO_BURST BIT(1)
+/* video pulse mode */
+#define MIPI_DSI_MODE_VIDEO_SYNC_PULSE BIT(2)
+/* enable auto vertical count mode */
+#define MIPI_DSI_MODE_VIDEO_AUTO_VERT BIT(3)
+/* enable hsync-end packets in vsync-pulse and v-porch area */
+#define MIPI_DSI_MODE_VIDEO_HSE BIT(4)
+/* disable hfront-porch area */
+#define MIPI_DSI_MODE_VIDEO_NO_HFP BIT(5)
+/* disable hback-porch area */
+#define MIPI_DSI_MODE_VIDEO_NO_HBP BIT(6)
+/* disable hsync-active area */
+#define MIPI_DSI_MODE_VIDEO_NO_HSA BIT(7)
+/* flush display FIFO on vsync pulse */
+#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8)
+/* disable EoT packets in HS mode */
+#define MIPI_DSI_MODE_NO_EOT_PACKET BIT(9)
+/* device supports non-continuous clock behavior (DSI spec 5.6.1) */
+#define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10)
+/* transmit data in low power */
+#define MIPI_DSI_MODE_LPM BIT(11)
+/* transmit data ending at the same time for all lanes within one hsync */
+#define MIPI_DSI_HS_PKT_END_ALIGNED BIT(12)
+
+enum mipi_dsi_pixel_format {
+ MIPI_DSI_FMT_RGB888,
+ MIPI_DSI_FMT_RGB666,
+ MIPI_DSI_FMT_RGB666_PACKED,
+ MIPI_DSI_FMT_RGB565,
+};
+
+#define DSI_DEV_NAME_SIZE 20
+
/**
* struct mipi_dsi_host_ops - DSI bus operations
* @attach: attach DSI device to DSI host
@@ -112,44 +150,6 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host);
void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
-/* DSI mode flags */
-
-/* video mode */
-#define MIPI_DSI_MODE_VIDEO BIT(0)
-/* video burst mode */
-#define MIPI_DSI_MODE_VIDEO_BURST BIT(1)
-/* video pulse mode */
-#define MIPI_DSI_MODE_VIDEO_SYNC_PULSE BIT(2)
-/* enable auto vertical count mode */
-#define MIPI_DSI_MODE_VIDEO_AUTO_VERT BIT(3)
-/* enable hsync-end packets in vsync-pulse and v-porch area */
-#define MIPI_DSI_MODE_VIDEO_HSE BIT(4)
-/* disable hfront-porch area */
-#define MIPI_DSI_MODE_VIDEO_NO_HFP BIT(5)
-/* disable hback-porch area */
-#define MIPI_DSI_MODE_VIDEO_NO_HBP BIT(6)
-/* disable hsync-active area */
-#define MIPI_DSI_MODE_VIDEO_NO_HSA BIT(7)
-/* flush display FIFO on vsync pulse */
-#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8)
-/* disable EoT packets in HS mode */
-#define MIPI_DSI_MODE_NO_EOT_PACKET BIT(9)
-/* device supports non-continuous clock behavior (DSI spec 5.6.1) */
-#define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10)
-/* transmit data in low power */
-#define MIPI_DSI_MODE_LPM BIT(11)
-/* transmit data ending at the same time for all lanes within one hsync */
-#define MIPI_DSI_HS_PKT_END_ALIGNED BIT(12)
-
-enum mipi_dsi_pixel_format {
- MIPI_DSI_FMT_RGB888,
- MIPI_DSI_FMT_RGB666,
- MIPI_DSI_FMT_RGB666_PACKED,
- MIPI_DSI_FMT_RGB565,
-};
-
-#define DSI_DEV_NAME_SIZE 20
-
/**
* struct mipi_dsi_device_info - template for creating a mipi_dsi_device
* @type: DSI peripheral chip type
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 14/32] drm/mipi-dsi: add .attach_new to mipi_dsi_host_ops
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (12 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 13/32] drm/mipi-dsi: move format define above Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 15/32] drm: adp: mipi: convert to the .attach_new op Luca Ceresoli
` (18 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
In preparation to avoid DSI host drivers to take any pointer to struct
mipi_dsi_device, add a new host op which does not take such pointer. The
old op can be removed once all users are converted to the new one.
The .attach_new op takes the DSI device format values, (part of) which are
needed by most DSI host drivers. It passes a temporary struct, in order to
ensure host drivers copy the values they need and not keep a pointer.
The struct with the data (struct mipi_dsi_bus_fmt) is a subset of struct
mipi_dsi_device. After all host drivers are converted, struct
mipi_dsi_device can be modified to hold a struct mipi_dsi_bus_fmt instead
of individual fields.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/drm_mipi_dsi.c | 21 +++++++++++++++++++--
include/drm/drm_mipi_dsi.h | 29 ++++++++++++++++++++++++++++-
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index f16f70c70c87988a95f959d0b8b18a6941dd2808..f45425f777f6bed6ac5f261b0097455c52ab7d9e 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -367,6 +367,18 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
}
EXPORT_SYMBOL(mipi_dsi_host_unregister);
+static void mipi_dsi_dev_copy_bus_fmt(struct mipi_dsi_bus_fmt *fmt,
+ const struct mipi_dsi_device *dsi_dev)
+{
+ fmt->channel = dsi_dev->channel;
+ fmt->lanes = dsi_dev->lanes;
+ fmt->format = dsi_dev->format;
+ fmt->mode_flags = dsi_dev->mode_flags;
+ fmt->hs_rate = dsi_dev->hs_rate;
+ fmt->lp_rate = dsi_dev->lp_rate;
+ fmt->dsc = dsi_dev->dsc;
+}
+
/**
* mipi_dsi_attach - attach a DSI device to its DSI host
* @dsi: DSI peripheral
@@ -374,15 +386,20 @@ EXPORT_SYMBOL(mipi_dsi_host_unregister);
int mipi_dsi_attach(struct mipi_dsi_device *dsi)
{
const struct mipi_dsi_host_ops *ops = dsi->host->ops;
+ struct mipi_dsi_bus_fmt bus_fmt;
int ret;
- if (!ops || !ops->attach)
+ if (!ops || !(ops->attach_new || ops->attach))
return -ENOSYS;
if (dsi->lanes < 1)
return dev_err_probe(&dsi->dev, -EINVAL, "Incorrect lanes number\n");
- ret = ops->attach(dsi->host, dsi);
+ mipi_dsi_dev_copy_bus_fmt(&bus_fmt, dsi);
+
+ ret = ops->attach_new ?
+ ops->attach_new(dsi->host, &bus_fmt) :
+ ops->attach(dsi->host, dsi);
if (ret) {
dev_err(dsi->host->dev,
"Failed to attach %s device (lanes:%d bpp:%d mode-flags:0x%lx) (%d)\n",
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index e42483fd022fed4dfc9e5ef180117c3dd37a3b51..5d5f3dca1ec1a654378ccca15f3f15a5ce957518 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -102,9 +102,34 @@ enum mipi_dsi_pixel_format {
#define DSI_DEV_NAME_SIZE 20
+/**
+ * struct mipi_dsi_bus_fmt - format required by a DSI peripheral device
+ * @channel: virtual channel assigned to the peripheral
+ * @format: pixel format for video mode
+ * @lanes: number of active data lanes
+ * @mode_flags: DSI operation mode related flags
+ * @hs_rate: maximum lane frequency for high speed mode in hertz, this should
+ * be set to the real limits of the hardware, zero is only accepted for
+ * legacy drivers
+ * @lp_rate: maximum lane frequency for low power mode in hertz, this should
+ * be set to the real limits of the hardware, zero is only accepted for
+ * legacy drivers
+ * @dsc: panel/bridge DSC pps payload to be sent
+ */
+struct mipi_dsi_bus_fmt {
+ unsigned int channel;
+ unsigned int lanes;
+ enum mipi_dsi_pixel_format format;
+ unsigned long mode_flags;
+ unsigned long hs_rate;
+ unsigned long lp_rate;
+ struct drm_dsc_config *dsc;
+};
+
/**
* struct mipi_dsi_host_ops - DSI bus operations
- * @attach: attach DSI device to DSI host
+ * @attach_new: attach DSI device to DSI host; either @attach_new or @attach is mandatory
+ * @attach: deprecated version of @attach_new
* @detach: detach DSI device from DSI host
* @transfer: transmit a DSI packet
*
@@ -126,6 +151,8 @@ enum mipi_dsi_pixel_format {
* properly enabled.
*/
struct mipi_dsi_host_ops {
+ int (*attach_new)(struct mipi_dsi_host *host,
+ const struct mipi_dsi_bus_fmt *bus_fmt);
int (*attach)(struct mipi_dsi_host *host,
struct mipi_dsi_device *dsi);
int (*detach)(struct mipi_dsi_host *host,
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 15/32] drm: adp: mipi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (13 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 14/32] drm/mipi-dsi: add .attach_new to mipi_dsi_host_ops Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 16/32] drm/kmb: dsi: " Luca Ceresoli
` (17 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/adp/adp-mipi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/adp/adp-mipi.c b/drivers/gpu/drm/adp/adp-mipi.c
index cba7d32150a98d78d07a25b1822dec6bf2f08f65..088b13ed0c89ce5e1fd3f4e57fa842fb2f31f257 100644
--- a/drivers/gpu/drm/adp/adp-mipi.c
+++ b/drivers/gpu/drm/adp/adp-mipi.c
@@ -171,7 +171,7 @@ static const struct component_ops adp_dsi_component_ops = {
};
static int adp_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *dev)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct adp_mipi_drv_private *adp = mipi_to_adp(host);
struct drm_bridge *next;
@@ -207,7 +207,7 @@ static int adp_dsi_host_detach(struct mipi_dsi_host *host,
static const struct mipi_dsi_host_ops adp_dsi_host_ops = {
.transfer = adp_dsi_host_transfer,
- .attach = adp_dsi_host_attach,
+ .attach_new = adp_dsi_host_attach,
.detach = adp_dsi_host_detach,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 16/32] drm/kmb: dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (14 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 15/32] drm: adp: mipi: convert to the .attach_new op Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 17/32] drm/i915/dsi: " Luca Ceresoli
` (16 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/kmb/kmb_dsi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/kmb/kmb_dsi.c b/drivers/gpu/drm/kmb/kmb_dsi.c
index faf38ca9e44c38068dad78d80529a77eb0203bd9..5163fd48db142f3cb87e3ee864480c49cb443abb 100644
--- a/drivers/gpu/drm/kmb/kmb_dsi.c
+++ b/drivers/gpu/drm/kmb/kmb_dsi.c
@@ -197,7 +197,7 @@ static ssize_t kmb_dsi_host_transfer(struct mipi_dsi_host *host,
}
static int kmb_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *dev)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
return 0;
}
@@ -209,7 +209,7 @@ static int kmb_dsi_host_detach(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops kmb_dsi_host_ops = {
- .attach = kmb_dsi_host_attach,
+ .attach_new = kmb_dsi_host_attach,
.detach = kmb_dsi_host_detach,
.transfer = kmb_dsi_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 17/32] drm/i915/dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (15 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 16/32] drm/kmb: dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 18:42 ` Jani Nikula
2025-06-25 16:45 ` [PATCH 18/32] drm/hisilicon/kirin: " Luca Ceresoli
` (15 subsequent siblings)
32 siblings, 1 reply; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/i915/display/icl_dsi.c | 4 ++--
drivers/gpu/drm/i915/display/vlv_dsi.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
index aa566ad3f5cd72fb8f9440e2645da0047da222b1..ce5d7b77444d2ac7bc71aecc150d42e2dbb59e0f 100644
--- a/drivers/gpu/drm/i915/display/icl_dsi.c
+++ b/drivers/gpu/drm/i915/display/icl_dsi.c
@@ -1780,7 +1780,7 @@ static const struct drm_connector_helper_funcs gen11_dsi_connector_helper_funcs
};
static int gen11_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *dsi)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
return 0;
}
@@ -1826,7 +1826,7 @@ static ssize_t gen11_dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops gen11_dsi_host_ops = {
- .attach = gen11_dsi_host_attach,
+ .attach_new = gen11_dsi_host_attach,
.detach = gen11_dsi_host_detach,
.transfer = gen11_dsi_host_transfer,
};
diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c
index 346737f15fa93264ab8791912cc4cc128f2f3324..5f73919c4bb626f8c293e383479ce393869e47d4 100644
--- a/drivers/gpu/drm/i915/display/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/display/vlv_dsi.c
@@ -199,7 +199,7 @@ static ssize_t intel_dsi_host_transfer(struct mipi_dsi_host *host,
}
static int intel_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *dsi)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
return 0;
}
@@ -211,7 +211,7 @@ static int intel_dsi_host_detach(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops intel_dsi_host_ops = {
- .attach = intel_dsi_host_attach,
+ .attach_new = intel_dsi_host_attach,
.detach = intel_dsi_host_detach,
.transfer = intel_dsi_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 17/32] drm/i915/dsi: convert to the .attach_new op
2025-06-25 16:45 ` [PATCH 17/32] drm/i915/dsi: " Luca Ceresoli
@ 2025-06-25 18:42 ` Jani Nikula
0 siblings, 0 replies; 42+ messages in thread
From: Jani Nikula @ 2025-06-25 18:42 UTC (permalink / raw)
To: Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Inki Dae, Jagan Teki, Marek Szyprowski,
Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
On Wed, 25 Jun 2025, Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
> This op does not pass any pointer to the DSI device, so the DSI host driver
> cannot store it.
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
for merging via whichever tree you find suitable.
> ---
> drivers/gpu/drm/i915/display/icl_dsi.c | 4 ++--
> drivers/gpu/drm/i915/display/vlv_dsi.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
> index aa566ad3f5cd72fb8f9440e2645da0047da222b1..ce5d7b77444d2ac7bc71aecc150d42e2dbb59e0f 100644
> --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> @@ -1780,7 +1780,7 @@ static const struct drm_connector_helper_funcs gen11_dsi_connector_helper_funcs
> };
>
> static int gen11_dsi_host_attach(struct mipi_dsi_host *host,
> - struct mipi_dsi_device *dsi)
> + const struct mipi_dsi_bus_fmt *bus_fmt)
> {
> return 0;
> }
> @@ -1826,7 +1826,7 @@ static ssize_t gen11_dsi_host_transfer(struct mipi_dsi_host *host,
> }
>
> static const struct mipi_dsi_host_ops gen11_dsi_host_ops = {
> - .attach = gen11_dsi_host_attach,
> + .attach_new = gen11_dsi_host_attach,
> .detach = gen11_dsi_host_detach,
> .transfer = gen11_dsi_host_transfer,
> };
> diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c
> index 346737f15fa93264ab8791912cc4cc128f2f3324..5f73919c4bb626f8c293e383479ce393869e47d4 100644
> --- a/drivers/gpu/drm/i915/display/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c
> @@ -199,7 +199,7 @@ static ssize_t intel_dsi_host_transfer(struct mipi_dsi_host *host,
> }
>
> static int intel_dsi_host_attach(struct mipi_dsi_host *host,
> - struct mipi_dsi_device *dsi)
> + const struct mipi_dsi_bus_fmt *bus_fmt)
> {
> return 0;
> }
> @@ -211,7 +211,7 @@ static int intel_dsi_host_detach(struct mipi_dsi_host *host,
> }
>
> static const struct mipi_dsi_host_ops intel_dsi_host_ops = {
> - .attach = intel_dsi_host_attach,
> + .attach_new = intel_dsi_host_attach,
> .detach = intel_dsi_host_detach,
> .transfer = intel_dsi_host_transfer,
> };
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 18/32] drm/hisilicon/kirin: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (16 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 17/32] drm/i915/dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 19/32] drm/bridge: synopsys/dsi2: " Luca Ceresoli
` (14 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
index 1a5b97abae86a187c751b4b579d7c22f206e4c90..f299958d7be6207dfe6e0e0e2bbc7b38ffe865ed 100644
--- a/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
+++ b/drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
@@ -722,20 +722,20 @@ static int dw_drm_encoder_init(struct device *dev,
static const struct component_ops dsi_ops;
static int dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *mdsi)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct dw_dsi *dsi = host_to_dsi(host);
struct device *dev = host->dev;
int ret;
- if (mdsi->lanes > 4) {
+ if (bus_fmt->lanes > 4) {
DRM_ERROR("dsi device params invalid\n");
return -EINVAL;
}
- dsi->lanes = mdsi->lanes;
- dsi->format = mdsi->format;
- dsi->mode_flags = mdsi->mode_flags;
+ dsi->lanes = bus_fmt->lanes;
+ dsi->format = bus_fmt->format;
+ dsi->mode_flags = bus_fmt->mode_flags;
ret = component_add(dev, &dsi_ops);
if (ret)
@@ -755,7 +755,7 @@ static int dsi_host_detach(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops dsi_host_ops = {
- .attach = dsi_host_attach,
+ .attach_new = dsi_host_attach,
.detach = dsi_host_detach,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 19/32] drm/bridge: synopsys/dsi2: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (17 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 18/32] drm/hisilicon/kirin: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 20/32] drm/msm/dsi: " Luca Ceresoli
` (13 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
index a994dfc1c0d2f6bbcab615c645d4dff7b90a756f..760b7920592506268f137dce5dafb14771440cdb 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
@@ -510,23 +510,23 @@ dw_mipi_dsi2_work_mode(struct dw_mipi_dsi2 *dsi2, u32 mode)
}
static int dw_mipi_dsi2_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct dw_mipi_dsi2 *dsi2 = host_to_dsi2(host);
const struct dw_mipi_dsi2_plat_data *pdata = dsi2->plat_data;
struct drm_bridge *bridge;
int ret;
- if (device->lanes > dsi2->plat_data->max_data_lanes) {
+ if (bus_fmt->lanes > dsi2->plat_data->max_data_lanes) {
dev_err(dsi2->dev, "the number of data lanes(%u) is too many\n",
- device->lanes);
+ bus_fmt->lanes);
return -EINVAL;
}
- dsi2->lanes = device->lanes;
- dsi2->channel = device->channel;
- dsi2->format = device->format;
- dsi2->mode_flags = device->mode_flags;
+ dsi2->lanes = bus_fmt->lanes;
+ dsi2->channel = bus_fmt->channel;
+ dsi2->format = bus_fmt->format;
+ dsi2->mode_flags = bus_fmt->mode_flags;
bridge = devm_drm_of_get_bridge(dsi2->dev, dsi2->dev->of_node, 1, 0);
if (IS_ERR(bridge))
@@ -687,7 +687,7 @@ static ssize_t dw_mipi_dsi2_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops dw_mipi_dsi2_host_ops = {
- .attach = dw_mipi_dsi2_host_attach,
+ .attach_new = dw_mipi_dsi2_host_attach,
.detach = dw_mipi_dsi2_host_detach,
.transfer = dw_mipi_dsi2_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 20/32] drm/msm/dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (18 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 19/32] drm/bridge: synopsys/dsi2: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 21/32] drm/rcar-du: dsi: " Luca Ceresoli
` (12 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 4d75529c0e858160761f5eb55db65e5d7565c27b..79cdb34074de3662d535a8d9b386c5399c8d23ba 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1610,20 +1610,20 @@ static irqreturn_t dsi_host_irq(int irq, void *ptr)
}
static int dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *dsi)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
int ret;
- if (dsi->lanes > msm_host->num_data_lanes)
+ if (bus_fmt->lanes > msm_host->num_data_lanes)
return -EINVAL;
- msm_host->channel = dsi->channel;
- msm_host->lanes = dsi->lanes;
- msm_host->format = dsi->format;
- msm_host->mode_flags = dsi->mode_flags;
- if (dsi->dsc)
- msm_host->dsc = dsi->dsc;
+ msm_host->channel = bus_fmt->channel;
+ msm_host->lanes = bus_fmt->lanes;
+ msm_host->format = bus_fmt->format;
+ msm_host->mode_flags = bus_fmt->mode_flags;
+ if (bus_fmt->dsc)
+ msm_host->dsc = bus_fmt->dsc;
ret = dsi_dev_attach(msm_host->pdev);
if (ret)
@@ -1663,7 +1663,7 @@ static ssize_t dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops dsi_host_ops = {
- .attach = dsi_host_attach,
+ .attach_new = dsi_host_attach,
.detach = dsi_host_detach,
.transfer = dsi_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 21/32] drm/rcar-du: dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (19 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 20/32] drm/msm/dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 22/32] drm: renesas: rz-du: rzg2l_mipi_dsi: " Luca Ceresoli
` (11 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
index 1af4c73f7a887712aef8c8176b0d0338d9ca9727..e46f194a15aaa9ba7dc22362e59561fe4f17721b 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c
@@ -898,16 +898,16 @@ static const struct drm_bridge_funcs rcar_mipi_dsi_bridge_ops = {
*/
static int rcar_mipi_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct rcar_mipi_dsi *dsi = host_to_rcar_mipi_dsi(host);
int ret;
- if (device->lanes > dsi->num_data_lanes)
+ if (bus_fmt->lanes > dsi->num_data_lanes)
return -EINVAL;
- dsi->lanes = device->lanes;
- dsi->format = device->format;
+ dsi->lanes = bus_fmt->lanes;
+ dsi->format = bus_fmt->format;
dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node,
1, 0);
@@ -935,7 +935,7 @@ static int rcar_mipi_dsi_host_detach(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops rcar_mipi_dsi_host_ops = {
- .attach = rcar_mipi_dsi_host_attach,
+ .attach_new = rcar_mipi_dsi_host_attach,
.detach = rcar_mipi_dsi_host_detach,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 22/32] drm: renesas: rz-du: rzg2l_mipi_dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (20 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 21/32] drm/rcar-du: dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-26 23:42 ` kernel test robot
2025-06-25 16:45 ` [PATCH 23/32] drm/vc4: dsi: " Luca Ceresoli
` (10 subsequent siblings)
32 siblings, 1 reply; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
index f87337c3cbb54559e9e8d416cbe801647f4a7688..33bd2d20be9c3f8d0c43b67d21e0e86566b48ab3 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
@@ -689,19 +689,19 @@ static const struct drm_bridge_funcs rzg2l_mipi_dsi_bridge_ops = {
*/
static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct rzg2l_mipi_dsi *dsi = host_to_rzg2l_mipi_dsi(host);
int ret;
- if (device->lanes > dsi->num_data_lanes) {
+ if (bus_fmt->lanes > dsi->num_data_lanes) {
dev_err(dsi->dev,
"Number of lines of device (%u) exceeds host (%u)\n",
- device->lanes, dsi->num_data_lanes);
+ bus_fmt->lanes, dsi->num_data_lanes);
return -EINVAL;
}
- switch (mipi_dsi_pixel_format_to_bpp(device->format)) {
+ switch (mipi_dsi_pixel_format_to_bpp(bus_fmt->format)) {
case 24:
break;
case 18:
@@ -714,13 +714,13 @@ static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
}
break;
default:
- dev_err(dsi->dev, "Unsupported format 0x%04x\n", device->format);
+ dev_err(dsi->dev, "Unsupported format 0x%04x\n", bus_fmt->format);
return -EINVAL;
}
- dsi->lanes = device->lanes;
- dsi->format = device->format;
- dsi->mode_flags = device->mode_flags;
+ dsi->lanes = bus_fmt->lanes;
+ dsi->format = bus_fmt->format;
+ dsi->mode_flags = bus_fmt->mode_flags;
dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node,
1, 0);
@@ -904,7 +904,7 @@ static ssize_t rzg2l_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops rzg2l_mipi_dsi_host_ops = {
- .attach = rzg2l_mipi_dsi_host_attach,
+ .attach_new = rzg2l_mipi_dsi_host_attach,
.detach = rzg2l_mipi_dsi_host_detach,
.transfer = rzg2l_mipi_dsi_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 22/32] drm: renesas: rz-du: rzg2l_mipi_dsi: convert to the .attach_new op
2025-06-25 16:45 ` [PATCH 22/32] drm: renesas: rz-du: rzg2l_mipi_dsi: " Luca Ceresoli
@ 2025-06-26 23:42 ` kernel test robot
0 siblings, 0 replies; 42+ messages in thread
From: kernel test robot @ 2025-06-26 23:42 UTC (permalink / raw)
To: Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Jernej Skrabec, Inki Dae, Jagan Teki, Marek Szyprowski,
Jani Nikula, Dmitry Baryshkov
Cc: oe-kbuild-all, Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel,
linux-sunxi, Luca Ceresoli
Hi Luca,
kernel test robot noticed the following build errors:
[auto build test ERROR on 1174bf15bd601f17556f721798cd9183e169549a]
url: https://github.com/intel-lab-lkp/linux/commits/Luca-Ceresoli/drm-mipi-dsi-add-sanity-check-of-lane-number-in-mipi_dsi_attach/20250626-005002
base: 1174bf15bd601f17556f721798cd9183e169549a
patch link: https://lore.kernel.org/r/20250625-drm-dsi-host-no-device-ptr-v1-22-e36bc258a7c5%40bootlin.com
patch subject: [PATCH 22/32] drm: renesas: rz-du: rzg2l_mipi_dsi: convert to the .attach_new op
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20250627/202506270718.iCW6cHYD-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250627/202506270718.iCW6cHYD-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506270718.iCW6cHYD-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:5,
from drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c:11:
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c: In function 'rzg2l_mipi_dsi_host_attach':
>> drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c:712:33: error: 'device' undeclared (first use in this function)
712 | device->format);
| ^~~~~~
include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c:711:25: note: in expansion of macro 'dev_err'
711 | dev_err(dsi->dev, "Unsupported format 0x%04x\n",
| ^~~~~~~
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c:712:33: note: each undeclared identifier is reported only once for each function it appears in
712 | device->format);
| ^~~~~~
include/linux/dev_printk.h:110:37: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c:711:25: note: in expansion of macro 'dev_err'
711 | dev_err(dsi->dev, "Unsupported format 0x%04x\n",
| ^~~~~~~
vim +/device +712 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 686
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 687 /* -----------------------------------------------------------------------------
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 688 * Host setting
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 689 */
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 690
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 691 static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host,
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 692 const struct mipi_dsi_bus_fmt *bus_fmt)
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 693 {
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 694 struct rzg2l_mipi_dsi *dsi = host_to_rzg2l_mipi_dsi(host);
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 695 int ret;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 696
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 697 if (bus_fmt->lanes > dsi->num_data_lanes) {
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 698 dev_err(dsi->dev,
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 699 "Number of lines of device (%u) exceeds host (%u)\n",
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 700 bus_fmt->lanes, dsi->num_data_lanes);
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 701 return -EINVAL;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 702 }
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 703
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 704 switch (mipi_dsi_pixel_format_to_bpp(bus_fmt->format)) {
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 705 case 24:
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 706 break;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 707 case 18:
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 708 break;
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 709 case 16:
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 710 if (!(dsi->info->features & RZ_MIPI_DSI_FEATURE_16BPP)) {
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 711 dev_err(dsi->dev, "Unsupported format 0x%04x\n",
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 @712 device->format);
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 713 return -EINVAL;
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 714 }
a56a6b81d80fdf drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Lad Prabhakar 2025-06-09 715 break;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 716 default:
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 717 dev_err(dsi->dev, "Unsupported format 0x%04x\n", bus_fmt->format);
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 718 return -EINVAL;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 719 }
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 720
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 721 dsi->lanes = bus_fmt->lanes;
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 722 dsi->format = bus_fmt->format;
e8120e232c40c1 drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c Luca Ceresoli 2025-06-25 723 dsi->mode_flags = bus_fmt->mode_flags;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 724
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 725 dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node,
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 726 1, 0);
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 727 if (IS_ERR(dsi->next_bridge)) {
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 728 ret = PTR_ERR(dsi->next_bridge);
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 729 dev_err(dsi->dev, "failed to get next bridge: %d\n", ret);
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 730 return ret;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 731 }
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 732
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 733 drm_bridge_add(&dsi->bridge);
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 734
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 735 return 0;
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 736 }
7a043f978ed143 drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c Biju Das 2022-09-20 737
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 23/32] drm/vc4: dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (21 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 22/32] drm: renesas: rz-du: rzg2l_mipi_dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 24/32] drm/mediatek: " Luca Ceresoli
` (9 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/vc4/vc4_dsi.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 458e5d9879645f18bcbcaeeb71b5f1038f9581da..b623e013747522b524ee00aede897ecafbc88e2a 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -1342,16 +1342,16 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host,
static const struct component_ops vc4_dsi_ops;
static int vc4_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct vc4_dsi *dsi = host_to_dsi(host);
int ret;
- dsi->lanes = device->lanes;
- dsi->channel = device->channel;
- dsi->mode_flags = device->mode_flags;
+ dsi->lanes = bus_fmt->lanes;
+ dsi->channel = bus_fmt->channel;
+ dsi->mode_flags = bus_fmt->mode_flags;
- switch (device->format) {
+ switch (bus_fmt->format) {
case MIPI_DSI_FMT_RGB888:
dsi->format = DSI_PFORMAT_RGB888;
dsi->divider = 24 / dsi->lanes;
@@ -1402,7 +1402,7 @@ static int vc4_dsi_host_detach(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops vc4_dsi_host_ops = {
- .attach = vc4_dsi_host_attach,
+ .attach_new = vc4_dsi_host_attach,
.detach = vc4_dsi_host_detach,
.transfer = vc4_dsi_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 24/32] drm/mediatek: dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (22 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 23/32] drm/vc4: dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 25/32] drm/bridge: nwl-dsi: " Luca Ceresoli
` (8 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d7726091819c4762698b41060b3d4d8d27940238..33475a5c18c1146cd4ea40c3c6ccaba1271a6cd9 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -981,15 +981,15 @@ static const struct component_ops mtk_dsi_component_ops = {
};
static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct mtk_dsi *dsi = host_to_dsi(host);
struct device *dev = host->dev;
int ret;
- dsi->lanes = device->lanes;
- dsi->format = device->format;
- dsi->mode_flags = device->mode_flags;
+ dsi->lanes = bus_fmt->lanes;
+ dsi->format = bus_fmt->format;
+ dsi->mode_flags = bus_fmt->mode_flags;
dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
if (IS_ERR(dsi->next_bridge)) {
ret = PTR_ERR(dsi->next_bridge);
@@ -1184,7 +1184,7 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops mtk_dsi_ops = {
- .attach = mtk_dsi_host_attach,
+ .attach_new = mtk_dsi_host_attach,
.detach = mtk_dsi_host_detach,
.transfer = mtk_dsi_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 25/32] drm/bridge: nwl-dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (23 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 24/32] drm/mediatek: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 26/32] drm/bridge: cdns-dsi: " Luca Ceresoli
` (7 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/nwl-dsi.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 94356d02a7009a4d333f2df6c628d57c4bf66fdb..76bb3828a615d75161aa7910a18ed909ee9cad2d 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -344,16 +344,16 @@ static int nwl_dsi_init_interrupts(struct nwl_dsi *dsi)
}
static int nwl_dsi_host_attach(struct mipi_dsi_host *dsi_host,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct nwl_dsi *dsi = container_of(dsi_host, struct nwl_dsi, dsi_host);
- if (device->lanes > 4)
+ if (bus_fmt->lanes > 4)
return -EINVAL;
- dsi->lanes = device->lanes;
- dsi->format = device->format;
- dsi->dsi_mode_flags = device->mode_flags;
+ dsi->lanes = bus_fmt->lanes;
+ dsi->format = bus_fmt->format;
+ dsi->dsi_mode_flags = bus_fmt->mode_flags;
return 0;
}
@@ -620,7 +620,7 @@ static ssize_t nwl_dsi_host_transfer(struct mipi_dsi_host *dsi_host,
}
static const struct mipi_dsi_host_ops nwl_dsi_host_ops = {
- .attach = nwl_dsi_host_attach,
+ .attach_new = nwl_dsi_host_attach,
.transfer = nwl_dsi_host_transfer,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 26/32] drm/bridge: cdns-dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (24 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 25/32] drm/bridge: nwl-dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 27/32] drm/bridge: tc358768: " Luca Ceresoli
` (6 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
This driver uses the DSI device format parameters in various places outside
the .attach op, and currently it does so by storing a pointer to the struct
mipi_dsi_device. That's exactly what .attach_new aims at removing.
Store a copy of the format parameters instead of the struct mipi_dsi_device
pointer.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 57 +++++++++++++-------------
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h | 2 +-
2 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 005aa6121227b2f7ac682f3b724e4518e8e5f721..15743d29a8d4fb9074f04b65a3c4bb390a5829d2 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -487,10 +487,10 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi,
memset(dsi_cfg, 0, sizeof(*dsi_cfg));
- if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
+ if (output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
sync_pulse = true;
- bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format);
+ bpp = mipi_dsi_pixel_format_to_bpp(output->bus_fmt.format);
if (mode_valid_check)
tmp = mode->htotal -
@@ -534,10 +534,10 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
unsigned long dpi_htotal;
unsigned long dpi_hz;
unsigned int dsi_hfp_ext;
- unsigned int lanes = output->dev->lanes;
+ unsigned int lanes = output->bus_fmt.lanes;
dsi_htotal = dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD;
- if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
+ if (output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
dsi_htotal += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD;
dsi_htotal += dsi_cfg->hact;
@@ -578,7 +578,7 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi,
struct cdns_dsi_output *output = &dsi->output;
struct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy;
unsigned long dsi_hss_hsa_hse_hbp;
- unsigned int nlanes = output->dev->lanes;
+ unsigned int nlanes = output->bus_fmt.lanes;
int mode_clock = (mode_valid_check ? mode->clock : mode->crtc_clock);
int ret;
@@ -587,7 +587,7 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi,
return ret;
ret = phy_mipi_dphy_get_default_config(mode_clock * 1000,
- mipi_dsi_pixel_format_to_bpp(output->dev->format),
+ mipi_dsi_pixel_format_to_bpp(output->bus_fmt.format),
nlanes, phy_cfg);
if (ret)
return ret;
@@ -601,7 +601,7 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi,
return ret;
dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD;
- if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
+ if (output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
dsi_hss_hsa_hse_hbp += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD;
/*
@@ -659,7 +659,7 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge,
return MODE_V_ILLEGAL;
/* HACT must be 32-bits aligned. */
- bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format);
+ bpp = mipi_dsi_pixel_format_to_bpp(output->bus_fmt.format);
if ((mode->hdisplay * bpp) % 32)
return MODE_H_ILLEGAL;
@@ -739,7 +739,7 @@ static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
status & PLL_LOCKED, 100, 100));
/* De-assert data and clock reset lines. */
writel(DPHY_CMN_PSO | DPHY_ALL_D_PDN | DPHY_C_PDN | DPHY_CMN_PDN |
- DPHY_D_RSTB(output->dev->lanes) | DPHY_C_RSTB,
+ DPHY_D_RSTB(output->bus_fmt.lanes) | DPHY_C_RSTB,
dsi->regs + MCTL_DPHY_CFG0);
dsi->phy_initialized = true;
}
@@ -755,10 +755,10 @@ static void cdns_dsi_init_link(struct cdns_dsi *dsi)
return;
val = 0;
- for (i = 1; i < output->dev->lanes; i++)
+ for (i = 1; i < output->bus_fmt.lanes; i++)
val |= DATA_LANE_EN(i);
- if (!(output->dev->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS))
+ if (!(output->bus_fmt.mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS))
val |= CLK_CONTINUOUS;
writel(val, dsi->regs + MCTL_MAIN_PHY_CTL);
@@ -772,7 +772,7 @@ static void cdns_dsi_init_link(struct cdns_dsi *dsi)
writel(LINK_EN, dsi->regs + MCTL_MAIN_DATA_CTL);
val = CLK_LANE_EN | PLL_START;
- for (i = 0; i < output->dev->lanes; i++)
+ for (i = 0; i < output->bus_fmt.lanes; i++)
val |= DATA_LANE_START(i);
writel(val, dsi->regs + MCTL_MAIN_EN);
@@ -830,7 +830,7 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
conn_state = drm_atomic_get_new_connector_state(state, connector);
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
mode = &crtc_state->adjusted_mode;
- nlanes = output->dev->lanes;
+ nlanes = output->bus_fmt.lanes;
cdns_dsi_init_link(dsi);
cdns_dsi_hs_init(dsi);
@@ -863,21 +863,21 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
(dsi_cfg.hsa + DSI_BLANKING_FRAME_OVERHEAD +
DSI_HSA_FRAME_OVERHEAD);
writel(BLK_LINE_PULSE_PKT_LEN(tmp), dsi->regs + VID_BLKSIZE2);
- if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
+ if (output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
writel(MAX_LINE_LIMIT(tmp - DSI_NULL_FRAME_OVERHEAD),
dsi->regs + VID_VCA_SETTING2);
tmp = dsi_cfg.htotal -
(DSI_HSS_VSS_VSE_FRAME_OVERHEAD + DSI_BLANKING_FRAME_OVERHEAD);
writel(BLK_LINE_EVENT_PKT_LEN(tmp), dsi->regs + VID_BLKSIZE1);
- if (!(output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))
+ if (!(output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))
writel(MAX_LINE_LIMIT(tmp - DSI_NULL_FRAME_OVERHEAD),
dsi->regs + VID_VCA_SETTING2);
tmp = DIV_ROUND_UP(dsi_cfg.htotal, nlanes) -
DIV_ROUND_UP(dsi_cfg.hsa, nlanes);
- if (!(output->dev->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET))
+ if (!(output->bus_fmt.mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET))
tmp -= DIV_ROUND_UP(DSI_EOT_PKT_SIZE, nlanes);
tx_byte_period = DIV_ROUND_DOWN_ULL((u64)NSEC_PER_SEC * 8,
@@ -909,8 +909,8 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
writel(LPRX_TIMEOUT(tmp), dsi->regs + MCTL_DPHY_TIMEOUT2);
- if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO) {
- switch (output->dev->format) {
+ if (output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO) {
+ switch (output->bus_fmt.format) {
case MIPI_DSI_FMT_RGB888:
tmp = VID_PIXEL_MODE_RGB888 |
VID_DATATYPE(MIPI_DSI_PACKED_PIXEL_STREAM_24);
@@ -936,7 +936,7 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
return;
}
- if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
+ if (output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
tmp |= SYNC_PULSE_ACTIVE | SYNC_PULSE_HORIZONTAL;
tmp |= REG_BLKLINE_MODE(REG_BLK_MODE_BLANKING_PKT) |
@@ -950,10 +950,10 @@ static void cdns_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
tmp = readl(dsi->regs + MCTL_MAIN_DATA_CTL);
tmp &= ~(IF_VID_SELECT_MASK | HOST_EOT_GEN | IF_VID_MODE);
- if (!(output->dev->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET))
+ if (!(output->bus_fmt.mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET))
tmp |= HOST_EOT_GEN;
- if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO)
+ if (output->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO)
tmp |= IF_VID_MODE | IF_VID_SELECT(input->id) | VID_EN;
writel(tmp, dsi->regs + MCTL_MAIN_DATA_CTL);
@@ -980,7 +980,7 @@ static u32 *cdns_dsi_bridge_get_input_bus_fmts(struct drm_bridge *bridge,
if (!input_fmts)
return NULL;
- input_fmts[0] = drm_mipi_dsi_get_input_bus_fmt(output->dev->format);
+ input_fmts[0] = drm_mipi_dsi_get_input_bus_fmt(output->bus_fmt.format);
if (!input_fmts[0])
return NULL;
@@ -1066,7 +1066,7 @@ static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = {
};
static int cdns_dsi_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *dev)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct cdns_dsi *dsi = to_cdns_dsi(host);
struct cdns_dsi_output *output = &dsi->output;
@@ -1078,11 +1078,11 @@ static int cdns_dsi_attach(struct mipi_dsi_host *host,
* same host. In order to support that we'd need the DRM bridge
* framework to allow dynamic reconfiguration of the bridge chain.
*/
- if (output->dev)
+ if (output->bus_fmt.lanes)
return -EBUSY;
/* We do not support burst mode yet. */
- if (dev->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
+ if (bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
return -ENOTSUPP;
/*
@@ -1091,12 +1091,12 @@ static int cdns_dsi_attach(struct mipi_dsi_host *host,
* this representation.
*/
bridge = devm_drm_of_get_bridge(dsi->base.dev, dsi->base.dev->of_node,
- DSI_OUTPUT_PORT, dev->channel);
+ DSI_OUTPUT_PORT, bus_fmt->channel);
if (IS_ERR(bridge))
return PTR_ERR(bridge);
- output->dev = dev;
output->bridge = bridge;
+ output->bus_fmt = *bus_fmt;
/*
* The DSI output has been properly configured, we can now safely
@@ -1254,7 +1254,7 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops cdns_dsi_ops = {
- .attach = cdns_dsi_attach,
+ .attach_new = cdns_dsi_attach,
.detach = cdns_dsi_detach,
.transfer = cdns_dsi_transfer,
};
@@ -1437,4 +1437,3 @@ MODULE_AUTHOR("Boris Brezillon <boris.brezillon@bootlin.com>");
MODULE_DESCRIPTION("Cadence DSI driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:cdns-dsi");
-
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
index 5db5dbbbcaadbe7a49596b349e381a671741a810..7439f88994cac1d454d7027fd88abcd82b7847e3 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.h
@@ -19,9 +19,9 @@ struct clk;
struct reset_control;
struct cdns_dsi_output {
- struct mipi_dsi_device *dev;
struct drm_bridge *bridge;
union phy_configure_opts phy_opts;
+ struct mipi_dsi_bus_fmt bus_fmt;
};
enum cdns_dsi_input_id {
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 27/32] drm/bridge: tc358768: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (25 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 26/32] drm/bridge: cdns-dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 28/32] drm/sprd: " Luca Ceresoli
` (5 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
This driver uses the DSI device format parameters in various places outside
the .attach op, and currently it does so by storing a pointer to the struct
mipi_dsi_device. That's exactly what .attach_new aims at removing.
Store a copy of the format parameters instead of the struct mipi_dsi_device
pointer.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/tc358768.c | 40 +++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c
index fbdc44e162293f2f9b090bc956604184a2a406b2..5793e15f23e4f36cb967a5c32eb8463eb47beded 100644
--- a/drivers/gpu/drm/bridge/tc358768.c
+++ b/drivers/gpu/drm/bridge/tc358768.c
@@ -133,9 +133,9 @@ static const char * const tc358768_supplies[] = {
};
struct tc358768_dsi_output {
- struct mipi_dsi_device *dev;
struct drm_panel *panel;
struct drm_bridge *bridge;
+ struct mipi_dsi_bus_fmt bus_fmt;
};
struct tc358768_priv {
@@ -406,7 +406,7 @@ static int tc358768_calc_pll(struct tc358768_priv *priv,
}
static int tc358768_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *dev)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct tc358768_priv *priv = dsi_host_to_tc358768(host);
struct drm_bridge *bridge;
@@ -414,9 +414,9 @@ static int tc358768_dsi_host_attach(struct mipi_dsi_host *host,
struct device_node *ep;
int ret;
- if (dev->lanes > 4) {
+ if (bus_fmt->lanes > 4) {
dev_err(priv->dev, "unsupported number of data lanes(%u)\n",
- dev->lanes);
+ bus_fmt->lanes);
return -EINVAL;
}
@@ -424,7 +424,7 @@ static int tc358768_dsi_host_attach(struct mipi_dsi_host *host,
* tc358768 supports both Video and Pulse mode, but the driver only
* implements Video (event) mode currently
*/
- if (!(dev->mode_flags & MIPI_DSI_MODE_VIDEO)) {
+ if (!(bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO)) {
dev_err(priv->dev, "Only MIPI_DSI_MODE_VIDEO is supported\n");
return -ENOTSUPP;
}
@@ -433,7 +433,7 @@ static int tc358768_dsi_host_attach(struct mipi_dsi_host *host,
* tc358768 supports RGB888, RGB666, RGB666_PACKED and RGB565, but only
* RGB888 is verified.
*/
- if (dev->format != MIPI_DSI_FMT_RGB888) {
+ if (bus_fmt->format != MIPI_DSI_FMT_RGB888) {
dev_warn(priv->dev, "Only MIPI_DSI_FMT_RGB888 tested!\n");
return -ENOTSUPP;
}
@@ -450,12 +450,12 @@ static int tc358768_dsi_host_attach(struct mipi_dsi_host *host,
return PTR_ERR(bridge);
}
- priv->output.dev = dev;
+ priv->output.bus_fmt = *bus_fmt;
priv->output.bridge = bridge;
priv->output.panel = panel;
- priv->dsi_lanes = dev->lanes;
- priv->dsi_bpp = mipi_dsi_pixel_format_to_bpp(dev->format);
+ priv->dsi_lanes = bus_fmt->lanes;
+ priv->dsi_bpp = mipi_dsi_pixel_format_to_bpp(bus_fmt->format);
/* get input ep (port0/endpoint0) */
ret = -EINVAL;
@@ -548,7 +548,7 @@ static ssize_t tc358768_dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops tc358768_dsi_host_ops = {
- .attach = tc358768_dsi_host_attach,
+ .attach_new = tc358768_dsi_host_attach,
.detach = tc358768_dsi_host_detach,
.transfer = tc358768_dsi_host_transfer,
};
@@ -689,8 +689,8 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
struct drm_atomic_state *state)
{
struct tc358768_priv *priv = bridge_to_tc358768(bridge);
- struct mipi_dsi_device *dsi_dev = priv->output.dev;
- unsigned long mode_flags = dsi_dev->mode_flags;
+ const struct mipi_dsi_bus_fmt *bus_fmt = &priv->output.bus_fmt;
+ unsigned long mode_flags = bus_fmt->mode_flags;
u32 val, val2, lptxcnt, hact, data_type;
s32 raw_val;
struct drm_crtc_state *crtc_state;
@@ -744,7 +744,7 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
/* Data Format Control Register */
val = BIT(2) | BIT(1) | BIT(0); /* rdswap_en | dsitx_en | txdt_en */
- switch (dsi_dev->format) {
+ switch (bus_fmt->format) {
case MIPI_DSI_FMT_RGB888:
val |= (0x3 << 4);
hact = vm.hactive * 3;
@@ -769,7 +769,7 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
break;
default:
dev_err(dev, "Invalid data format (%u)\n",
- dsi_dev->format);
+ bus_fmt->format);
tc358768_hw_disable(priv);
return;
}
@@ -811,7 +811,7 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
dsi_dpi_htot = tc358768_dpi_to_dsi_bytes(priv, dpi_htot);
dsi_dpi_data_start = tc358768_dpi_to_dsi_bytes(priv, dpi_data_start);
- if (dsi_dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
+ if (bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
dsi_hsw = tc358768_dpi_to_dsi_bytes(priv, vm.hsync_len);
dsi_hbp = tc358768_dpi_to_dsi_bytes(priv, vm.hback_porch);
} else {
@@ -927,7 +927,7 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
/* Enable D-PHY (HiZ->LP11) */
tc358768_write(priv, TC358768_CLW_CNTRL, 0x0000);
/* Enable lanes */
- for (i = 0; i < dsi_dev->lanes; i++)
+ for (i = 0; i < bus_fmt->lanes; i++)
tc358768_write(priv, TC358768_D0W_CNTRL + i * 4, 0x0000);
/* DSI Timings */
@@ -995,7 +995,7 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
tc358768_write(priv, TC358768_THS_TRAILCNT, val);
val = BIT(0);
- for (i = 0; i < dsi_dev->lanes; i++)
+ for (i = 0; i < bus_fmt->lanes; i++)
val |= BIT(i + 1);
tc358768_write(priv, TC358768_HSTXVREGEN, val);
@@ -1015,7 +1015,7 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
/* START[0] */
tc358768_write(priv, TC358768_STARTCNTRL, 1);
- if (dsi_dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
+ if (bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
/* Set pulse mode */
tc358768_write(priv, TC358768_DSI_EVENT, 0);
@@ -1069,14 +1069,14 @@ static void tc358768_bridge_atomic_pre_enable(struct drm_bridge *bridge,
tc358768_write(priv, TC358768_DSI_CONFW, val);
val = TC358768_DSI_CONFW_MODE_SET | TC358768_DSI_CONFW_ADDR_DSI_CONTROL;
- val |= (dsi_dev->lanes - 1) << 1;
+ val |= (bus_fmt->lanes - 1) << 1;
val |= TC358768_DSI_CONTROL_TXMD;
if (!(mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS))
val |= TC358768_DSI_CONTROL_HSCKMD;
- if (dsi_dev->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)
+ if (bus_fmt->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)
val |= TC358768_DSI_CONTROL_EOTDIS;
tc358768_write(priv, TC358768_DSI_CONFW, val);
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 28/32] drm/sprd: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (26 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 27/32] drm/bridge: tc358768: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 29/32] drm/bridge: synopsys: dw-mipi-dsi: " Luca Ceresoli
` (4 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
This driver uses the DSI device format parameters in various places outside
the .attach op, and currently it does so by storing a pointer to the struct
mipi_dsi_device. That's exactly what .attach_new aims at removing.
Store a copy of the format parameters instead of the struct mipi_dsi_device
pointer.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/sprd/megacores_pll.c | 2 +-
drivers/gpu/drm/sprd/sprd_dpu.c | 2 +-
drivers/gpu/drm/sprd/sprd_dsi.c | 28 ++++++++++++++--------------
drivers/gpu/drm/sprd/sprd_dsi.h | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/sprd/megacores_pll.c b/drivers/gpu/drm/sprd/megacores_pll.c
index 3091dfdc11e3b547a05a9edaa4047a1e367c1596..e2558b77f4d4100052327c370fc4ba9eb5f722f1 100644
--- a/drivers/gpu/drm/sprd/megacores_pll.c
+++ b/drivers/gpu/drm/sprd/megacores_pll.c
@@ -111,7 +111,7 @@ int dphy_pll_config(struct dsi_context *ctx)
struct dphy_pll *pll = &ctx->pll;
int ret;
- pll->freq = dsi->slave->hs_rate;
+ pll->freq = dsi->bus_fmt.hs_rate;
/* FREQ = 26M * (NINT + KINT / 2^20) / out_sel */
ret = dphy_calc_pll_param(pll);
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index a3447622a33cd612e34be038e833222567bdcd2c..c1996fb72a52c7483dc68bfd5156ddfaa065aa57 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -626,7 +626,7 @@ static void sprd_crtc_mode_set_nofb(struct drm_crtc *crtc)
crtc->state->encoder_mask) {
dsi = encoder_to_dsi(encoder);
- if (dsi->slave->mode_flags & MIPI_DSI_MODE_VIDEO)
+ if (dsi->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO)
dpu->ctx.if_type = SPRD_DPU_IF_DPI;
else
dpu->ctx.if_type = SPRD_DPU_IF_EDPI;
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
index 23b0e1dc547a5023ee6ad7d5e1c49e2cec986bf0..2962836e34c0c6f6b2ed615f66d149af2aac48bd 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.c
+++ b/drivers/gpu/drm/sprd/sprd_dsi.c
@@ -389,7 +389,7 @@ static u32 fmt_to_coding(u32 fmt)
static void sprd_dsi_init(struct dsi_context *ctx)
{
struct sprd_dsi *dsi = container_of(ctx, struct sprd_dsi, ctx);
- u32 byte_clk = dsi->slave->hs_rate / 8;
+ u32 byte_clk = dsi->bus_fmt.hs_rate / 8;
u16 data_hs2lp, data_lp2hs, clk_hs2lp, clk_lp2hs;
u16 max_rd_time;
int div;
@@ -406,7 +406,7 @@ static void sprd_dsi_init(struct dsi_context *ctx)
dsi_reg_up(ctx, VIRTUAL_CHANNEL_ID, VIDEO_PKT_VCID, 0);
dsi_reg_up(ctx, VIRTUAL_CHANNEL_ID, GEN_RX_VCID, 0);
- div = DIV_ROUND_UP(byte_clk, dsi->slave->lp_rate);
+ div = DIV_ROUND_UP(byte_clk, dsi->bus_fmt.lp_rate);
writel(div, ctx->base + TX_ESC_CLK_CONFIG);
max_rd_time = ns_to_cycle(ctx->max_rd_time, byte_clk);
@@ -448,7 +448,7 @@ static int sprd_dsi_dpi_video(struct dsi_context *ctx)
{
struct sprd_dsi *dsi = container_of(ctx, struct sprd_dsi, ctx);
struct videomode *vm = &ctx->vm;
- u32 byte_clk = dsi->slave->hs_rate / 8;
+ u32 byte_clk = dsi->bus_fmt.hs_rate / 8;
u16 bpp_x100;
u16 video_size;
u32 ratio_x1000;
@@ -466,7 +466,7 @@ static int sprd_dsi_dpi_video(struct dsi_context *ctx)
u16 hline;
u16 byte_cycle;
- coding = fmt_to_coding(dsi->slave->format);
+ coding = fmt_to_coding(dsi->bus_fmt.format);
video_size = round_video_size(coding, vm->hactive);
bpp_x100 = calc_bytes_per_pixel_x100(coding);
video_size_step = calc_video_size_step(coding);
@@ -517,7 +517,7 @@ static int sprd_dsi_dpi_video(struct dsi_context *ctx)
/* hline total bytes from the DPI interface */
total_bytes = (vm->hactive + vm->hfront_porch) *
- ratio_x1000 / dsi->slave->lanes / 1000;
+ ratio_x1000 / dsi->bus_fmt.lanes / 1000;
/* check if the pixels actually fit on the DSI link */
if (total_bytes < bytes_per_chunk) {
@@ -588,7 +588,7 @@ static void sprd_dsi_edpi_video(struct dsi_context *ctx)
u32 max_fifo_len;
u8 coding;
- coding = fmt_to_coding(dsi->slave->format);
+ coding = fmt_to_coding(dsi->bus_fmt.format);
bpp_x100 = calc_bytes_per_pixel_x100(coding);
max_fifo_len = word_length * fifo_depth * 100 / bpp_x100;
@@ -760,7 +760,7 @@ static int sprd_dphy_init(struct dsi_context *ctx)
dsi_reg_up(ctx, PHY_INTERFACE_CTRL, RF_PHY_RESET_N, RF_PHY_RESET_N);
writel(0x1C, ctx->base + PHY_MIN_STOP_TIME);
dsi_reg_up(ctx, PHY_INTERFACE_CTRL, RF_PHY_CLK_EN, RF_PHY_CLK_EN);
- writel(dsi->slave->lanes - 1, ctx->base + PHY_LANE_NUM_CONFIG);
+ writel(dsi->bus_fmt.lanes - 1, ctx->base + PHY_LANE_NUM_CONFIG);
ret = dphy_wait_pll_locked(ctx);
if (ret) {
@@ -809,7 +809,7 @@ static void sprd_dsi_encoder_enable(struct drm_encoder *encoder)
sprd_dsi_set_work_mode(ctx, ctx->work_mode);
sprd_dsi_state_reset(ctx);
- if (dsi->slave->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) {
+ if (dsi->bus_fmt.mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) {
dsi_reg_up(ctx, PHY_CLK_LANE_LP_CTRL, AUTO_CLKLANE_CTRL_EN,
AUTO_CLKLANE_CTRL_EN);
} else {
@@ -965,21 +965,21 @@ static const struct component_ops dsi_component_ops = {
};
static int sprd_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *slave)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct sprd_dsi *dsi = host_to_dsi(host);
struct dsi_context *ctx = &dsi->ctx;
- dsi->slave = slave;
+ dsi->bus_fmt = *bus_fmt;
- if (slave->mode_flags & MIPI_DSI_MODE_VIDEO)
+ if (bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO)
ctx->work_mode = DSI_MODE_VIDEO;
else
ctx->work_mode = DSI_MODE_CMD;
- if (slave->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
+ if (bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
ctx->burst_mode = VIDEO_BURST_WITH_SYNC_PULSES;
- else if (slave->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
+ else if (bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
ctx->burst_mode = VIDEO_NON_BURST_WITH_SYNC_PULSES;
else
ctx->burst_mode = VIDEO_NON_BURST_WITH_SYNC_EVENTS;
@@ -1017,7 +1017,7 @@ static ssize_t sprd_dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops sprd_dsi_host_ops = {
- .attach = sprd_dsi_host_attach,
+ .attach_new = sprd_dsi_host_attach,
.detach = sprd_dsi_host_detach,
.transfer = sprd_dsi_host_transfer,
};
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.h b/drivers/gpu/drm/sprd/sprd_dsi.h
index d858ebb111150546e99403a87bc7cea42cad0158..2a0a5700d93c30bda5e33f2142cef8a7cce0271c 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.h
+++ b/drivers/gpu/drm/sprd/sprd_dsi.h
@@ -114,7 +114,7 @@ struct dsi_context {
struct sprd_dsi {
struct drm_device *drm;
struct mipi_dsi_host host;
- struct mipi_dsi_device *slave;
+ struct mipi_dsi_bus_fmt bus_fmt;
struct drm_encoder encoder;
struct drm_bridge *panel_bridge;
struct dsi_context ctx;
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 29/32] drm/bridge: synopsys: dw-mipi-dsi: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (27 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 28/32] drm/sprd: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 30/32] drm/mcde: store a pointer to mipi_dsi_host to perform TE requests Luca Ceresoli
` (3 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
This requires propagating the change to the dw-mipi-dsi-specific host op in
struct dw_mipi_dsi_host_ops and thus to the drivers based on
dw-mipi-dsi.c.
Among those, the meson driver uses the DSI device format parameters in
various places outside the .attach op, and currently it does so by storing
a pointer to the struct mipi_dsi_device. That's exactly what .attach_new
aims at removing, so store a copy of the format parameters instead of the
struct mipi_dsi_device pointer.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 4 ++--
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 18 +++++++++---------
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 16 ++++++++--------
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 2 +-
include/drm/bridge/dw_mipi_dsi.h | 3 ++-
5 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c
index bea8346515b8c8ce150040f58d288ac564eeb563..7bd48952cee571709a39fdf969f05ac61422862a 100644
--- a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c
@@ -816,11 +816,11 @@ static const struct dw_mipi_dsi_phy_ops imx93_dsi_phy_ops = {
.get_timing = imx93_dsi_phy_get_timing,
};
-static int imx93_dsi_host_attach(void *priv_data, struct mipi_dsi_device *device)
+static int imx93_dsi_host_attach(void *priv_data, const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct imx93_dsi *dsi = priv_data;
- dsi->format = device->format;
+ dsi->format = bus_fmt->format;
return 0;
}
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index 8fc2e282ff114db363a6cf0fe085684449b26438..ee84e773215c106651dad30de36e76a5be480553 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -315,23 +315,23 @@ static inline u32 dsi_read(struct dw_mipi_dsi *dsi, u32 reg)
}
static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct dw_mipi_dsi *dsi = host_to_dsi(host);
const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data;
struct drm_bridge *bridge;
int ret;
- if (device->lanes > dsi->plat_data->max_data_lanes) {
+ if (bus_fmt->lanes > dsi->plat_data->max_data_lanes) {
dev_err(dsi->dev, "the number of data lanes(%u) is too many\n",
- device->lanes);
+ bus_fmt->lanes);
return -EINVAL;
}
- dsi->lanes = device->lanes;
- dsi->channel = device->channel;
- dsi->format = device->format;
- dsi->mode_flags = device->mode_flags;
+ dsi->lanes = bus_fmt->lanes;
+ dsi->channel = bus_fmt->channel;
+ dsi->format = bus_fmt->format;
+ dsi->mode_flags = bus_fmt->mode_flags;
bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
if (IS_ERR(bridge))
@@ -343,7 +343,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
drm_bridge_add(&dsi->bridge);
if (pdata->host_ops && pdata->host_ops->attach) {
- ret = pdata->host_ops->attach(pdata->priv_data, device);
+ ret = pdata->host_ops->attach(pdata->priv_data, bus_fmt);
if (ret < 0)
return ret;
}
@@ -537,7 +537,7 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = {
- .attach = dw_mipi_dsi_host_attach,
+ .attach_new = dw_mipi_dsi_host_attach,
.detach = dw_mipi_dsi_host_detach,
.transfer = dw_mipi_dsi_host_transfer,
};
diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
index 4dc726cef5455075def7927a469ae23020ebfec7..b3354243a5b22d46f1cf3d8f75e602f4fc26081f 100644
--- a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
+++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
@@ -41,7 +41,7 @@ struct meson_dw_mipi_dsi {
union phy_configure_opts phy_opts;
struct dw_mipi_dsi *dmd;
struct dw_mipi_dsi_plat_data pdata;
- struct mipi_dsi_device *dsi_device;
+ struct mipi_dsi_bus_fmt bus_fmt;
const struct drm_display_mode *mode;
struct clk *bit_clk;
struct clk *px_clk;
@@ -110,7 +110,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
return ret;
}
- switch (mipi_dsi->dsi_device->format) {
+ switch (mipi_dsi->bus_fmt.format) {
case MIPI_DSI_FMT_RGB888:
dpi_data_format = DPI_COLOR_24BIT;
venc_data_width = VENC_IN_COLOR_24B;
@@ -164,10 +164,10 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
mipi_dsi->mode = mode;
- bpp = mipi_dsi_pixel_format_to_bpp(mipi_dsi->dsi_device->format);
+ bpp = mipi_dsi_pixel_format_to_bpp(mipi_dsi->bus_fmt.format);
phy_mipi_dphy_get_default_config(mode->clock * 1000,
- bpp, mipi_dsi->dsi_device->lanes,
+ bpp, mipi_dsi->bus_fmt.lanes,
&mipi_dsi->phy_opts.mipi_dphy);
*lane_mbps = DIV_ROUND_UP(mipi_dsi->phy_opts.mipi_dphy.hs_clk_rate, USEC_PER_SEC);
@@ -220,21 +220,21 @@ static const struct dw_mipi_dsi_phy_ops meson_dw_mipi_dsi_phy_ops = {
};
static int meson_dw_mipi_dsi_host_attach(void *priv_data,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct meson_dw_mipi_dsi *mipi_dsi = priv_data;
int ret;
- mipi_dsi->dsi_device = device;
+ mipi_dsi->bus_fmt = *bus_fmt;
- switch (device->format) {
+ switch (bus_fmt->format) {
case MIPI_DSI_FMT_RGB888:
break;
case MIPI_DSI_FMT_RGB666:
break;
case MIPI_DSI_FMT_RGB666_PACKED:
case MIPI_DSI_FMT_RGB565:
- dev_err(mipi_dsi->dev, "invalid pixel format %d\n", device->format);
+ dev_err(mipi_dsi->dev, "invalid pixel format %d\n", bus_fmt->format);
return -EINVAL;
}
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
index 3398160ad75e4a9629082bc47491eab473caecc0..5d360d7bea9b4a6663133b440dd70cc19abee2f0 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
@@ -1030,7 +1030,7 @@ static const struct component_ops dw_mipi_dsi_rockchip_ops = {
};
static int dw_mipi_dsi_rockchip_host_attach(void *priv_data,
- struct mipi_dsi_device *device)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct dw_mipi_dsi_rockchip *dsi = priv_data;
struct device *second;
diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h
index 65d5e68065e3d8bd38986b993653c467a18e3a58..452218cb03d91fa4cdc9cd67004395bd20a9a748 100644
--- a/include/drm/bridge/dw_mipi_dsi.h
+++ b/include/drm/bridge/dw_mipi_dsi.h
@@ -15,6 +15,7 @@
#include <drm/drm_bridge.h>
#include <drm/drm_connector.h>
#include <drm/drm_crtc.h>
+#include <drm/drm_mipi_dsi.h>
#include <drm/drm_modes.h>
struct drm_display_mode;
@@ -45,7 +46,7 @@ struct dw_mipi_dsi_phy_ops {
struct dw_mipi_dsi_host_ops {
int (*attach)(void *priv_data,
- struct mipi_dsi_device *dsi);
+ const struct mipi_dsi_bus_fmt *bus_fmt);
int (*detach)(void *priv_data,
struct mipi_dsi_device *dsi);
};
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 30/32] drm/mcde: store a pointer to mipi_dsi_host to perform TE requests
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (28 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 29/32] drm/bridge: synopsys: dw-mipi-dsi: " Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 31/32] drm/mcde: use the DSI host pointer in mcde_dsi_irq Luca Ceresoli
` (2 subsequent siblings)
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
The MCDE driver stores a struct mipi_dsi_device pointer in struct mcde for
two uses: sending commands via mcde_dsi_te_request() and accessing the DSI
bus format parameters (lanes, channel etc).
We want to get rid of mipi_dsi_device pointers in host drivers. This patch
removes the first usage by additionally storing a pointer to the struct
mipi_dsi_host, and using it in host_to_mcde_dsi().
The second usage is removed in a following patch.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/mcde/mcde_display.c | 2 +-
drivers/gpu/drm/mcde/mcde_drm.h | 3 ++-
drivers/gpu/drm/mcde/mcde_dsi.c | 9 ++++++---
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c
index 52043a12a2e8e5ae2f0d6d279b2314ba31c98b5b..18b8ed1456d436dc8e7b7778461d76a251509ecf 100644
--- a/drivers/gpu/drm/mcde/mcde_display.c
+++ b/drivers/gpu/drm/mcde/mcde_display.c
@@ -1339,7 +1339,7 @@ static void mcde_start_flow(struct mcde *mcde)
{
/* Request a TE ACK only in TE+BTA mode */
if (mcde->flow_mode == MCDE_COMMAND_BTA_TE_FLOW)
- mcde_dsi_te_request(mcde->mdsi);
+ mcde_dsi_te_request(mcde);
/* Enable FIFO A flow */
mcde_enable_fifo(mcde, MCDE_FIFO_A);
diff --git a/drivers/gpu/drm/mcde/mcde_drm.h b/drivers/gpu/drm/mcde/mcde_drm.h
index ecb70b4b737c0e74b93c6f3e81f1170774303f78..4ae32e92d7f36707dfd91adb2cc9c76ec32a677e 100644
--- a/drivers/gpu/drm/mcde/mcde_drm.h
+++ b/drivers/gpu/drm/mcde/mcde_drm.h
@@ -73,6 +73,7 @@ struct mcde {
struct drm_bridge *bridge;
struct drm_connector *connector;
struct drm_simple_display_pipe pipe;
+ struct mipi_dsi_host *dsi_host;
struct mipi_dsi_device *mdsi;
bool dpi_output;
s16 stride;
@@ -104,7 +105,7 @@ static inline bool mcde_flow_is_video(struct mcde *mcde)
}
bool mcde_dsi_irq(struct mipi_dsi_device *mdsi);
-void mcde_dsi_te_request(struct mipi_dsi_device *mdsi);
+void mcde_dsi_te_request(struct mcde *mcde);
void mcde_dsi_enable(struct drm_bridge *bridge);
void mcde_dsi_disable(struct drm_bridge *bridge);
extern struct platform_driver mcde_dsi_driver;
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 04041ad9231bd53cf4bfa18ad41caa19df3b838a..2df2fdf45bd7d6259c631f1c402191db49336cd0 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -148,6 +148,7 @@ bool mcde_dsi_irq(struct mipi_dsi_device *mdsi)
static void mcde_dsi_attach_to_mcde(struct mcde_dsi *d)
{
d->mcde->mdsi = d->mdsi;
+ d->mcde->dsi_host = &d->dsi_host;
/*
* Select the way the DSI data flow is pushing to the display:
@@ -190,8 +191,10 @@ static int mcde_dsi_host_detach(struct mipi_dsi_host *host,
struct mcde_dsi *d = host_to_mcde_dsi(host);
d->mdsi = NULL;
- if (d->mcde)
+ if (d->mcde) {
d->mcde->mdsi = NULL;
+ d->mcde->dsi_host = NULL;
+ }
return 0;
}
@@ -381,12 +384,12 @@ static const struct mipi_dsi_host_ops mcde_dsi_host_ops = {
};
/* This sends a direct (short) command to request TE */
-void mcde_dsi_te_request(struct mipi_dsi_device *mdsi)
+void mcde_dsi_te_request(struct mcde *mcde)
{
struct mcde_dsi *d;
u32 val;
- d = host_to_mcde_dsi(mdsi->host);
+ d = host_to_mcde_dsi(mcde->dsi_host);
/* Command "nature" TE request */
val = DSI_DIRECT_CMD_MAIN_SETTINGS_CMD_NAT_TE_REQ;
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 31/32] drm/mcde: use the DSI host pointer in mcde_dsi_irq
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (29 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 30/32] drm/mcde: store a pointer to mipi_dsi_host to perform TE requests Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-06-25 16:45 ` [PATCH 32/32] drm/mcde: convert to the .attach_new op Luca Ceresoli
2025-07-07 6:16 ` [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Maxime Ripard
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
mcde_dsi_irq() takes a struct mipi_dsi_device which it uses solely to get
the struct mipi_dsi_host pointer.
We want to get rid of mipi_dsi_device pointers in host drivers, so use
directly the struct dsi_host pointer which is now stored in struct
mcde.
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/mcde/mcde_display.c | 2 +-
drivers/gpu/drm/mcde/mcde_drm.h | 2 +-
drivers/gpu/drm/mcde/mcde_dsi.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c
index 18b8ed1456d436dc8e7b7778461d76a251509ecf..70f8d92ed23a192f4cdb51c7f68b9973147b2113 100644
--- a/drivers/gpu/drm/mcde/mcde_display.c
+++ b/drivers/gpu/drm/mcde/mcde_display.c
@@ -89,7 +89,7 @@ void mcde_display_irq(struct mcde *mcde)
*
* TODO: Currently only one DSI link is supported.
*/
- if (!mcde->dpi_output && mcde_dsi_irq(mcde->mdsi)) {
+ if (!mcde->dpi_output && mcde_dsi_irq(mcde->dsi_host)) {
u32 val;
/*
diff --git a/drivers/gpu/drm/mcde/mcde_drm.h b/drivers/gpu/drm/mcde/mcde_drm.h
index 4ae32e92d7f36707dfd91adb2cc9c76ec32a677e..23f9a6473d8ac0f91b3e3665f22e52ef8e696a17 100644
--- a/drivers/gpu/drm/mcde/mcde_drm.h
+++ b/drivers/gpu/drm/mcde/mcde_drm.h
@@ -104,7 +104,7 @@ static inline bool mcde_flow_is_video(struct mcde *mcde)
mcde->flow_mode == MCDE_VIDEO_FORMATTER_FLOW);
}
-bool mcde_dsi_irq(struct mipi_dsi_device *mdsi);
+bool mcde_dsi_irq(struct mipi_dsi_host *host);
void mcde_dsi_te_request(struct mcde *mcde);
void mcde_dsi_enable(struct drm_bridge *bridge);
void mcde_dsi_disable(struct drm_bridge *bridge);
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 2df2fdf45bd7d6259c631f1c402191db49336cd0..b97b9541b6277ad3e024845d3bb61c9e73d627f7 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -64,13 +64,13 @@ static inline struct mcde_dsi *host_to_mcde_dsi(struct mipi_dsi_host *h)
return container_of(h, struct mcde_dsi, dsi_host);
}
-bool mcde_dsi_irq(struct mipi_dsi_device *mdsi)
+bool mcde_dsi_irq(struct mipi_dsi_host *host)
{
struct mcde_dsi *d;
u32 val;
bool te_received = false;
- d = host_to_mcde_dsi(mdsi->host);
+ d = host_to_mcde_dsi(host);
dev_dbg(d->dev, "%s called\n", __func__);
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 32/32] drm/mcde: convert to the .attach_new op
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (30 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 31/32] drm/mcde: use the DSI host pointer in mcde_dsi_irq Luca Ceresoli
@ 2025-06-25 16:45 ` Luca Ceresoli
2025-07-07 6:16 ` [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Maxime Ripard
32 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-06-25 16:45 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Inki Dae,
Jagan Teki, Marek Szyprowski, Jani Nikula, Dmitry Baryshkov
Cc: Hui Pu, Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Luca Ceresoli
This op does not pass any pointer to the DSI device, so the DSI host driver
cannot store it.
This driver uses the DSI device format parameters in various places outside
the .attach op, and currently it does so by storing a pointer to the struct
mipi_dsi_device in two places: struct mcde and struct mcde_dsi. That's
exactly what .attach_new aims at removing.
Instead of the struct mipi_dsi_device, store:
* a copy of the format parameters in struct mcde_dsi
* a pointer to it in struct mcde
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
drivers/gpu/drm/mcde/mcde_display.c | 14 +++----
drivers/gpu/drm/mcde/mcde_drm.h | 3 +-
drivers/gpu/drm/mcde/mcde_dsi.c | 78 ++++++++++++++++++-------------------
3 files changed, 48 insertions(+), 47 deletions(-)
diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c
index 70f8d92ed23a192f4cdb51c7f68b9973147b2113..6898353e944479b4fe8cdaa632ef87e062299c57 100644
--- a/drivers/gpu/drm/mcde/mcde_display.c
+++ b/drivers/gpu/drm/mcde/mcde_display.c
@@ -796,9 +796,9 @@ static void mcde_configure_dsi_formatter(struct mcde *mcde,
* 8 bit commands and DCS commands (notgen = not generic)
*/
val = MCDE_DSICONF0_CMD8 | MCDE_DSICONF0_DCSVID_NOTGEN;
- if (mcde->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO)
+ if (mcde->bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO)
val |= MCDE_DSICONF0_VID_MODE_VID;
- switch (mcde->mdsi->format) {
+ switch (mcde->bus_fmt->format) {
case MIPI_DSI_FMT_RGB888:
val |= MCDE_DSICONF0_PACKING_RGB888 <<
MCDE_DSICONF0_PACKING_SHIFT;
@@ -1081,11 +1081,11 @@ static void mcde_setup_dsi(struct mcde *mcde, const struct drm_display_mode *mod
u32 val;
dev_info(mcde->dev, "output in %s mode, format %dbpp\n",
- (mcde->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO) ?
+ (mcde->bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO) ?
"VIDEO" : "CMD",
- mipi_dsi_pixel_format_to_bpp(mcde->mdsi->format));
+ mipi_dsi_pixel_format_to_bpp(mcde->bus_fmt->format));
formatter_cpp =
- mipi_dsi_pixel_format_to_bpp(mcde->mdsi->format) / 8;
+ mipi_dsi_pixel_format_to_bpp(mcde->bus_fmt->format) / 8;
dev_info(mcde->dev, "Overlay CPP: %d bytes, DSI formatter CPP %d bytes\n",
cpp, formatter_cpp);
@@ -1117,7 +1117,7 @@ static void mcde_setup_dsi(struct mcde *mcde, const struct drm_display_mode *mod
* 192 for HDMI 16bpp
*/
fifo_wtrmrk = mode->hdisplay;
- if (mcde->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO) {
+ if (mcde->bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO) {
fifo_wtrmrk = min(fifo_wtrmrk, 128);
pkt_div = 1;
} else {
@@ -1132,7 +1132,7 @@ static void mcde_setup_dsi(struct mcde *mcde, const struct drm_display_mode *mod
/* NOTE: pkt_div is 1 for video mode */
pkt_size = (formatter_ppl * formatter_cpp) / pkt_div;
/* Commands CMD8 need one extra byte */
- if (!(mcde->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO))
+ if (!(mcde->bus_fmt->mode_flags & MIPI_DSI_MODE_VIDEO))
pkt_size++;
dev_dbg(mcde->dev, "DSI packet size: %d * %d bytes per line\n",
diff --git a/drivers/gpu/drm/mcde/mcde_drm.h b/drivers/gpu/drm/mcde/mcde_drm.h
index 23f9a6473d8ac0f91b3e3665f22e52ef8e696a17..842ca58543da7a075976cc33df707d78e096e82e 100644
--- a/drivers/gpu/drm/mcde/mcde_drm.h
+++ b/drivers/gpu/drm/mcde/mcde_drm.h
@@ -5,6 +5,7 @@
* (C) ST-Ericsson SA 2013
*/
#include <drm/drm_simple_kms_helper.h>
+#include <drm/drm_mipi_dsi.h>
#ifndef _MCDE_DRM_H_
#define _MCDE_DRM_H_
@@ -74,7 +75,7 @@ struct mcde {
struct drm_connector *connector;
struct drm_simple_display_pipe pipe;
struct mipi_dsi_host *dsi_host;
- struct mipi_dsi_device *mdsi;
+ struct mipi_dsi_bus_fmt *bus_fmt;
bool dpi_output;
s16 stride;
enum mcde_flow_mode flow_mode;
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index b97b9541b6277ad3e024845d3bb61c9e73d627f7..c4225875b04ab440e3e926c976dd981f46dd3461 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -42,7 +42,7 @@ struct mcde_dsi {
struct drm_panel *panel;
struct drm_bridge *bridge_out;
struct mipi_dsi_host dsi_host;
- struct mipi_dsi_device *mdsi;
+ struct mipi_dsi_bus_fmt bus_fmt;
const struct drm_display_mode *mode;
struct clk *hs_clk;
struct clk *lp_clk;
@@ -147,8 +147,8 @@ bool mcde_dsi_irq(struct mipi_dsi_host *host)
static void mcde_dsi_attach_to_mcde(struct mcde_dsi *d)
{
- d->mcde->mdsi = d->mdsi;
d->mcde->dsi_host = &d->dsi_host;
+ d->mcde->bus_fmt = &d->bus_fmt;
/*
* Select the way the DSI data flow is pushing to the display:
@@ -162,23 +162,23 @@ static void mcde_dsi_attach_to_mcde(struct mcde_dsi *d)
* single frame on-demand updates with DRM for command mode
* displays (MCDE_COMMAND_ONESHOT_FLOW).
*/
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO)
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO)
d->mcde->flow_mode = MCDE_VIDEO_FORMATTER_FLOW;
else
d->mcde->flow_mode = MCDE_COMMAND_TE_FLOW;
}
static int mcde_dsi_host_attach(struct mipi_dsi_host *host,
- struct mipi_dsi_device *mdsi)
+ const struct mipi_dsi_bus_fmt *bus_fmt)
{
struct mcde_dsi *d = host_to_mcde_dsi(host);
- if (mdsi->lanes > 2) {
+ if (bus_fmt->lanes > 2) {
DRM_ERROR("dsi device params invalid, 1 or 2 lanes supported\n");
return -EINVAL;
}
- d->mdsi = mdsi;
+ d->bus_fmt = *bus_fmt;
if (d->mcde)
mcde_dsi_attach_to_mcde(d);
@@ -190,10 +190,10 @@ static int mcde_dsi_host_detach(struct mipi_dsi_host *host,
{
struct mcde_dsi *d = host_to_mcde_dsi(host);
- d->mdsi = NULL;
+ memset(&d->mcde->bus_fmt, 0, sizeof(d->mcde->bus_fmt));
if (d->mcde) {
- d->mcde->mdsi = NULL;
d->mcde->dsi_host = NULL;
+ d->mcde->bus_fmt = NULL;
}
return 0;
@@ -378,7 +378,7 @@ static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
}
static const struct mipi_dsi_host_ops mcde_dsi_host_ops = {
- .attach = mcde_dsi_host_attach,
+ .attach_new = mcde_dsi_host_attach,
.detach = mcde_dsi_host_detach,
.transfer = mcde_dsi_host_transfer,
};
@@ -426,7 +426,7 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d,
const struct drm_display_mode *mode)
{
/* cpp, characters per pixel, number of bytes per pixel */
- u8 cpp = mipi_dsi_pixel_format_to_bpp(d->mdsi->format) / 8;
+ u8 cpp = mipi_dsi_pixel_format_to_bpp(d->bus_fmt.format) / 8;
u64 pclk;
u64 bpl;
int hfp;
@@ -436,14 +436,14 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d,
u32 val;
val = 0;
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
val |= DSI_VID_MAIN_CTL_BURST_MODE;
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
val |= DSI_VID_MAIN_CTL_SYNC_PULSE_ACTIVE;
val |= DSI_VID_MAIN_CTL_SYNC_PULSE_HORIZONTAL;
}
/* RGB header and pixel mode */
- switch (d->mdsi->format) {
+ switch (d->bus_fmt.format) {
case MIPI_DSI_FMT_RGB565:
val |= MIPI_DSI_PACKED_PIXEL_STREAM_16 <<
DSI_VID_MAIN_CTL_HEADER_SHIFT;
@@ -516,7 +516,7 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d,
* 6 + 2 is HFP header + checksum
*/
hfp = (mode->hsync_start - mode->hdisplay) * cpp - 6 - 2;
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
/*
* Use sync pulse for sync: explicit HSA time
* 6 is HBP header + checksum
@@ -596,21 +596,21 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d,
bpl = pclk * mode->htotal; /* (1) picoseconds per line */
dev_dbg(d->dev, "picoseconds per line: %llu\n", bpl);
/* Multiply with bytes per second (3) */
- bpl *= (d->mdsi->hs_rate / 8);
+ bpl *= (d->bus_fmt.hs_rate / 8);
/* Pixels per second (2) */
bpl = DIV_ROUND_DOWN_ULL(bpl, 1000000); /* microseconds */
bpl = DIV_ROUND_DOWN_ULL(bpl, 1000000); /* seconds */
/* parallel transactions in all lanes */
- bpl *= d->mdsi->lanes;
+ bpl *= d->bus_fmt.lanes;
dev_dbg(d->dev,
"calculated bytes per line: %llu @ %d Hz with HS %lu Hz\n",
- bpl, drm_mode_vrefresh(mode), d->mdsi->hs_rate);
+ bpl, drm_mode_vrefresh(mode), d->bus_fmt.hs_rate);
/*
* 6 is header + checksum, header = 4 bytes, checksum = 2 bytes
* 4 is short packet for vsync/hsync
*/
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) {
/* Set the event packet size to 0 (not used) */
writel(0, d->regs + DSI_VID_BLKSIZE1);
/*
@@ -646,10 +646,10 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d,
* the line duration by 1 under very specific circumstances.
* Here we also imply that LP is used during burst EOL.
*/
- if (d->mdsi->lanes == 2 && (hsa & 0x01) && (hfp & 0x01)
- && (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST))
+ if (d->bus_fmt.lanes == 2 && (hsa & 0x01) && (hfp & 0x01)
+ && (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_BURST))
line_duration--;
- line_duration = DIV_ROUND_CLOSEST(line_duration, d->mdsi->lanes);
+ line_duration = DIV_ROUND_CLOSEST(line_duration, d->bus_fmt.lanes);
dev_dbg(d->dev, "line duration %u bytes\n", line_duration);
val = line_duration << DSI_VID_DPHY_TIME_REG_LINE_DURATION_SHIFT;
/*
@@ -665,7 +665,7 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d,
* See the manual figure 657 page 2203 for understanding the impact
* of the different burst mode settings.
*/
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
int blkeol_pck, blkeol_duration;
/*
* Packet size at EOL for burst mode, this is only used
@@ -716,7 +716,7 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d,
* according to figure 565 page 2202?
*/
blkeol_duration = DIV_ROUND_CLOSEST(blkeol_pck + 6,
- d->mdsi->lanes);
+ d->bus_fmt.lanes);
dev_dbg(d->dev, "BLKEOL duration: %d clock cycles\n",
blkeol_duration);
@@ -757,7 +757,7 @@ static void mcde_dsi_start(struct mcde_dsi *d)
DSI_MCTL_MAIN_DATA_CTL_BTA_EN |
DSI_MCTL_MAIN_DATA_CTL_READ_EN |
DSI_MCTL_MAIN_DATA_CTL_REG_TE_EN;
- if (!(d->mdsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET))
+ if (!(d->bus_fmt.mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET))
val |= DSI_MCTL_MAIN_DATA_CTL_HOST_EOT_GEN;
writel(val, d->regs + DSI_MCTL_MAIN_DATA_CTL);
@@ -785,9 +785,9 @@ static void mcde_dsi_start(struct mcde_dsi *d)
* all the lines.
*/
val = 0x0f << DSI_MCTL_MAIN_PHY_CTL_WAIT_BURST_TIME_SHIFT;
- if (d->mdsi->lanes == 2)
+ if (d->bus_fmt.lanes == 2)
val |= DSI_MCTL_MAIN_PHY_CTL_LANE2_EN;
- if (!(d->mdsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS))
+ if (!(d->bus_fmt.mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS))
val |= DSI_MCTL_MAIN_PHY_CTL_CLK_CONTINUOUS;
val |= DSI_MCTL_MAIN_PHY_CTL_CLK_ULPM_EN |
DSI_MCTL_MAIN_PHY_CTL_DAT1_ULPM_EN |
@@ -811,7 +811,7 @@ static void mcde_dsi_start(struct mcde_dsi *d)
DSI_MCTL_MAIN_EN_CKLANE_EN |
DSI_MCTL_MAIN_EN_DAT1_EN |
DSI_MCTL_MAIN_EN_IF1_EN;
- if (d->mdsi->lanes == 2)
+ if (d->bus_fmt.lanes == 2)
val |= DSI_MCTL_MAIN_EN_DAT2_EN;
writel(val, d->regs + DSI_MCTL_MAIN_EN);
@@ -820,7 +820,7 @@ static void mcde_dsi_start(struct mcde_dsi *d)
val = DSI_MCTL_MAIN_STS_PLL_LOCK |
DSI_MCTL_MAIN_STS_CLKLANE_READY |
DSI_MCTL_MAIN_STS_DAT1_READY;
- if (d->mdsi->lanes == 2)
+ if (d->bus_fmt.lanes == 2)
val |= DSI_MCTL_MAIN_STS_DAT2_READY;
while ((readl(d->regs + DSI_MCTL_MAIN_STS) & val) != val) {
/* Sleep for a millisecond */
@@ -839,7 +839,7 @@ static void mcde_dsi_start(struct mcde_dsi *d)
* If we enable low-power mode here,
* then display updates become really slow.
*/
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_LPM)
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_LPM)
val |= DSI_CMD_MODE_CTL_IF1_LP_EN;
val &= ~DSI_CMD_MODE_CTL_IF1_ID_MASK;
writel(val, d->regs + DSI_CMD_MODE_CTL);
@@ -861,12 +861,12 @@ void mcde_dsi_enable(struct drm_bridge *bridge)
int ret;
/* Copy maximum clock frequencies */
- if (d->mdsi->lp_rate)
- lp_freq = d->mdsi->lp_rate;
+ if (d->bus_fmt.lp_rate)
+ lp_freq = d->bus_fmt.lp_rate;
else
lp_freq = DSI_DEFAULT_LP_FREQ_HZ;
- if (d->mdsi->hs_rate)
- hs_freq = d->mdsi->hs_rate;
+ if (d->bus_fmt.hs_rate)
+ hs_freq = d->bus_fmt.hs_rate;
else
hs_freq = DSI_DEFAULT_HS_FREQ_HZ;
@@ -912,7 +912,7 @@ void mcde_dsi_enable(struct drm_bridge *bridge)
/* Start up the hardware */
mcde_dsi_start(d);
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO) {
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO) {
/* Set up the video mode from the DRM mode */
mcde_dsi_setup_video_mode(d, d->mode);
@@ -943,7 +943,7 @@ void mcde_dsi_enable(struct drm_bridge *bridge)
* If we enable low-power mode here
* the display updates become really slow.
*/
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_LPM)
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_LPM)
val |= DSI_CMD_MODE_CTL_IF1_LP_EN;
val &= ~DSI_CMD_MODE_CTL_IF1_ID_MASK;
writel(val, d->regs + DSI_CMD_MODE_CTL);
@@ -958,7 +958,7 @@ static void mcde_dsi_bridge_mode_set(struct drm_bridge *bridge,
{
struct mcde_dsi *d = bridge_to_mcde_dsi(bridge);
- if (!d->mdsi) {
+ if (!d->bus_fmt.lanes) {
dev_err(d->dev, "no DSI device attached to encoder!\n");
return;
}
@@ -967,7 +967,7 @@ static void mcde_dsi_bridge_mode_set(struct drm_bridge *bridge,
dev_info(d->dev, "set DSI master to %dx%d %u Hz %s mode\n",
mode->hdisplay, mode->vdisplay, mode->clock * 1000,
- (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO) ? "VIDEO" : "CMD"
+ (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO) ? "VIDEO" : "CMD"
);
}
@@ -1021,7 +1021,7 @@ void mcde_dsi_disable(struct drm_bridge *bridge)
struct mcde_dsi *d = bridge_to_mcde_dsi(bridge);
u32 val;
- if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO) {
+ if (d->bus_fmt.mode_flags & MIPI_DSI_MODE_VIDEO) {
/* Stop video mode */
val = readl(d->regs + DSI_MCTL_MAIN_DATA_CTL);
val &= ~DSI_MCTL_MAIN_DATA_CTL_VID_EN;
@@ -1082,7 +1082,7 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
}
d->mcde = mcde;
/* If the display attached before binding, set this up */
- if (d->mdsi)
+ if (d->bus_fmt.lanes)
mcde_dsi_attach_to_mcde(d);
/* Obtain the clocks */
--
2.49.0
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices
2025-06-25 16:45 [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Luca Ceresoli
` (31 preceding siblings ...)
2025-06-25 16:45 ` [PATCH 32/32] drm/mcde: convert to the .attach_new op Luca Ceresoli
@ 2025-07-07 6:16 ` Maxime Ripard
2025-07-07 9:58 ` Luca Ceresoli
32 siblings, 1 reply; 42+ messages in thread
From: Maxime Ripard @ 2025-07-07 6:16 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Inki Dae, Jagan Teki,
Marek Szyprowski, Jani Nikula, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, linux-amlogic
[-- Attachment #1: Type: text/plain, Size: 5009 bytes --]
Hi Luca,
On Wed, Jun 25, 2025 at 06:45:04PM +0200, Luca Ceresoli wrote:
> This series is the first attempt at avoiding DSI host drivers to have
> pointers to DSI devices (struct mipi_dsi_device), as discussed during the
> Linux Plumbers Conference 2024 with Maxime and Dmitry.
>
> It is working, but I consider this a draft in order to discuss and
> challenge the proposed approach.
>
> Overall work
> ============
>
> This is part of the work towards removal of bridges from a still existing
> DRM pipeline without use-after-free. The grand plan as discussed in [1].
> Here's the work breakdown (➜ marks the current series):
>
> 1. … add refcounting to DRM bridges (struct drm_bridge)
> (based on devm_drm_bridge_alloc() [0])
> A. ✔ add new alloc API and refcounting (in v6.16-rc1)
> B. ✔ convert all bridge drivers to new API (now in drm-misc-next)
> C. ✔ kunit tests (now in drm-misc-next)
> D. … add get/put to drm_bridge_add/remove() + attach/detach()
> and warn on old allocation pattern (under review)
> E. … add get/put on drm_bridge accessors
> 1. … drm_bridge_chain_get_first_bridge() + add a cleanup action
> 2. … drm_bridge_chain_get_last_bridge()
> 3. drm_bridge_get_prev_bridge()
> 4. drm_bridge_get_next_bridge()
> 5. drm_for_each_bridge_in_chain()
> 6. drm_bridge_connector_init
> 7. of_drm_find_bridge
> 8. drm_of_find_panel_or_bridge, *_of_get_bridge
> F. debugfs improvements
> 2. handle gracefully atomic updates during bridge removal
> 3. ➜ avoid DSI host drivers to have dangling pointers to DSI devices
> (this series)
> 4. finish the hotplug bridge work, removing the "always-disconnected"
> connector, moving code to the core and potentially removing the
> hotplug-bridge itself (this needs to be clarified as points 1-3 are
> developed)
>
> [0] https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0cc6aadd7fc1e629b715ea3d1ba537ef2da95eec
> [1] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/t/#u
>
> Motivation
> ==========
>
> The motivation for this series is that with hot-pluggable hardware a DSI
> device can be disconnected from the DSI host at runtime, and later on
> reconnected, potentially with a different model having different bus
> parameters.
>
> DSI host drivers currently receive a struct mipi_dsi_device pointer in the
> attach callback and some store it permanently for later access to the bur
> format data (lanes, channel, pixel format etc). The stored pointer can
> become dangling if the device is removed, leading to a use-after-free.
>
> Currently the data exchange between DSI host and device happens primarily
> by two means:
>
> * the device requests attach, detach and message transfer to the host by
> calling mipi_dsi_attach/detach/transfer which in turn call the callbacks
> in struct mipi_dsi_host_ops
> - for this to work, struct mipi_dsi_device has a pointer to the host:
> this is OK because the goal is supporting hotplug of the "remote"
> part of the DRM pipeline
> * the host accesses directly the fields of struct mipi_dsi_device, to
> which it receives a pointer in the .attach and .detach callbacks
>
> The second bullet is the problematic one, which we want to remove.
>
> Strategy
> ========
>
> I devised two possible strategies to address it:
>
> 1. change the host ops to not pass a struct mipi_dsi_device, but instead
> to pass only a copy of the needed information (bus format mainly), so
> the host driver does never access any info from the device
>
> 2. let the host get info from the device as needed, but without having a
> pointer to it; this is be based on:
> - storing a __private mipi_dsi_device pointer in struct mipi_dsi_host
> - adding getters to the DSI core for the host to query the needed
> info, e.g. drm_mipi_dsi_host_get_device_lanes(host) (the getters
> would be allowed to dereference the device pointer)
>
> This series implements strategy 1. It does so by adding a .attach_new host
> op, which does not take a mipi_dsi_device pointer, and converting most host
> drivers to it. Once all drivers are converted, the old op can be removed,
> and .attach_new renamed to .attach.
I don't recall discussing this particular aspect at Plumbers, so sorry
if we're coming back to the same discussion we had.
I'm not necessarily opposed to changing the MIPI-DSI bus API, but I
don't think changing the semantics to remove the fact that a particular
device is connected or not is a good idea.
I would have expected to have bus driver (maybe) take a device pointer
at attach, and drop it at detach.
Then, when we detect the hotplug of a DSI device, we detach it from its
parent, and we're done.
What prevents us from using that approach?
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices
2025-07-07 6:16 ` [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices Maxime Ripard
@ 2025-07-07 9:58 ` Luca Ceresoli
2025-07-07 10:13 ` Luca Ceresoli
2025-07-25 15:17 ` Maxime Ripard
0 siblings, 2 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-07-07 9:58 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Inki Dae, Jagan Teki,
Marek Szyprowski, Jani Nikula, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, linux-amlogic
On Mon, 7 Jul 2025 08:16:49 +0200
Maxime Ripard <mripard@kernel.org> wrote:
> Hi Luca,
>
> On Wed, Jun 25, 2025 at 06:45:04PM +0200, Luca Ceresoli wrote:
> > This series is the first attempt at avoiding DSI host drivers to have
> > pointers to DSI devices (struct mipi_dsi_device), as discussed during the
> > Linux Plumbers Conference 2024 with Maxime and Dmitry.
> >
> > It is working, but I consider this a draft in order to discuss and
> > challenge the proposed approach.
> >
> > Overall work
> > ============
> >
> > This is part of the work towards removal of bridges from a still existing
> > DRM pipeline without use-after-free. The grand plan as discussed in [1].
> > Here's the work breakdown (➜ marks the current series):
> >
> > 1. … add refcounting to DRM bridges (struct drm_bridge)
> > (based on devm_drm_bridge_alloc() [0])
> > A. ✔ add new alloc API and refcounting (in v6.16-rc1)
> > B. ✔ convert all bridge drivers to new API (now in drm-misc-next)
> > C. ✔ kunit tests (now in drm-misc-next)
> > D. … add get/put to drm_bridge_add/remove() + attach/detach()
> > and warn on old allocation pattern (under review)
> > E. … add get/put on drm_bridge accessors
> > 1. … drm_bridge_chain_get_first_bridge() + add a cleanup action
> > 2. … drm_bridge_chain_get_last_bridge()
> > 3. drm_bridge_get_prev_bridge()
> > 4. drm_bridge_get_next_bridge()
> > 5. drm_for_each_bridge_in_chain()
> > 6. drm_bridge_connector_init
> > 7. of_drm_find_bridge
> > 8. drm_of_find_panel_or_bridge, *_of_get_bridge
> > F. debugfs improvements
> > 2. handle gracefully atomic updates during bridge removal
> > 3. ➜ avoid DSI host drivers to have dangling pointers to DSI devices
> > (this series)
> > 4. finish the hotplug bridge work, removing the "always-disconnected"
> > connector, moving code to the core and potentially removing the
> > hotplug-bridge itself (this needs to be clarified as points 1-3 are
> > developed)
> >
> > [0] https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0cc6aadd7fc1e629b715ea3d1ba537ef2da95eec
> > [1] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/t/#u
> >
> > Motivation
> > ==========
> >
> > The motivation for this series is that with hot-pluggable hardware a DSI
> > device can be disconnected from the DSI host at runtime, and later on
> > reconnected, potentially with a different model having different bus
> > parameters.
> >
> > DSI host drivers currently receive a struct mipi_dsi_device pointer in the
> > attach callback and some store it permanently for later access to the bur
> > format data (lanes, channel, pixel format etc). The stored pointer can
> > become dangling if the device is removed, leading to a use-after-free.
> >
> > Currently the data exchange between DSI host and device happens primarily
> > by two means:
> >
> > * the device requests attach, detach and message transfer to the host by
> > calling mipi_dsi_attach/detach/transfer which in turn call the callbacks
> > in struct mipi_dsi_host_ops
> > - for this to work, struct mipi_dsi_device has a pointer to the host:
> > this is OK because the goal is supporting hotplug of the "remote"
> > part of the DRM pipeline
> > * the host accesses directly the fields of struct mipi_dsi_device, to
> > which it receives a pointer in the .attach and .detach callbacks
> >
> > The second bullet is the problematic one, which we want to remove.
> >
> > Strategy
> > ========
> >
> > I devised two possible strategies to address it:
> >
> > 1. change the host ops to not pass a struct mipi_dsi_device, but instead
> > to pass only a copy of the needed information (bus format mainly), so
> > the host driver does never access any info from the device
> >
> > 2. let the host get info from the device as needed, but without having a
> > pointer to it; this is be based on:
> > - storing a __private mipi_dsi_device pointer in struct mipi_dsi_host
> > - adding getters to the DSI core for the host to query the needed
> > info, e.g. drm_mipi_dsi_host_get_device_lanes(host) (the getters
> > would be allowed to dereference the device pointer)
> >
> > This series implements strategy 1. It does so by adding a .attach_new host
> > op, which does not take a mipi_dsi_device pointer, and converting most host
> > drivers to it. Once all drivers are converted, the old op can be removed,
> > and .attach_new renamed to .attach.
>
> I don't recall discussing this particular aspect at Plumbers, so sorry
> if we're coming back to the same discussion we had.
>
> I'm not necessarily opposed to changing the MIPI-DSI bus API, but I
> don't think changing the semantics to remove the fact that a particular
> device is connected or not is a good idea.
>
> I would have expected to have bus driver (maybe) take a device pointer
> at attach, and drop it at detach.
>
> Then, when we detect the hotplug of a DSI device, we detach it from its
> parent, and we're done.
>
> What prevents us from using that approach?
I probably should have done a recap of the whole discussion, so let me
do it now.
It all starts with one fact: a DSI device can be disconnected and then
a different one connected later on, having a different DSI bus format
(lanes, channel, mode flags, whatever). A detach/attach sequence would
handle that, but only in the simple case when there is a host/device
pair. Let's how consider this topology:
┌──────────────────┐
│ DSI bridge │
┌─────────┐ A │ │ B ┌───────────┐
│ DSI host├────►│device host├────►│DSI device │
└─────────┘ └──────────────────┘ └───────────┘
Here link A is always connected, link B is hot-pluggable. When the tail
device is removed and a different one plugged, a detach/attach sequence
can update the bus format on the DSI bridge, but then the DSI bridge
cannot update the format on the first host without faking a
detach/attach that does not map a real event.
The above topology is probably not common, but it is exactly what the
hotplug-bridge introduces [0]. Whether the hotplug-bridge will have to
eventually exist or not to support hotplug is still to be defined, but
regardless there is another problematic aspect.
The second problematic aspect is that several DSI host drivers will not
even drm_bridge_add() until they have an attached DSI device. One such
example is samsung-dsim, which calls drm_bridge_add()
in samsung_dsim_host_attach(). When such a driver implements the first
DSI host, the DSI bridge must register a DSI device before the DRM card
can be instantiated. See the lengthy comment before
hotplug_bridge_dsi_attach() in [0] for more gory details, but the
outcome is that the hotplug-bridge needs to attach a DSI device with
a fake format once initially just to let the DRM card probe, and the
detach and reattach with the correct format once an actual DSI device
is connected at the tail.
[0] https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-4-bc4dfee61be6@bootlin.com/
The above would be improved if the DSI host API provided a way to
notify to the host about a bus format change, which is however not
present currently.
The naive solution would be adding a new DSI host op:
struct mipi_dsi_host_ops {
int (*attach)(struct mipi_dsi_host *host,
struct mipi_dsi_device *dsi);
int (*detach)(struct mipi_dsi_host *host,
struct mipi_dsi_device *dsi);
+ int (*bus_fmt_changed)(struct mipi_dsi_host *host,
+ struct mipi_dsi_device *dsi);
ssize_t (*transfer)(struct mipi_dsi_host *host,
const struct mipi_dsi_msg *msg);
};
This would allow reduce the current sequence:
1. attach with dummy format (no tail device yet)
2. fake detach
3. attach
with:
1. attach with dummy format (no tail device yet)
2. update format
Adding such a new op would be part of chapter 4 of this work, being it
quite useless without hotplug.
However while reasoning about this I noticed the DSI host drivers peek
into the struct mipi_dsi_device fields to read the format, so there is
no sort of isolation between host and device. Introducing a struct to
contain all the format fields looked like a good improvement in terms
of code organization.
Yet another aspect is that several host drivers keep a pointer to the
device, and thus in case of format change in the DSI device they might
be reading different fields at different moments, ending up with an
inconsistent format.
The above considerations, which are all partially overlapped, led me to
the idea of introducing a struct to exchange a DSI bus format, to be
exchanged as a whole ("atomically") between host and device. What's
your opinion about introducing such a struct?
The second aspect of this series is not passing pointers, and that's
the core topic you questioned. I realize it is not strictly necessary
to reach the various goals discussed in this e-mail. The work I'm doing
on the drm_bridge struct is actually a way to store a pointer while
avoiding use-after-free, so that can obviously be done for a simpler
scenario such as DSI host-device. However I thought not passing a
pointer would be a more radical solution: if a driver receives no
pointer, then it cannot by mistake keep it stored when it shouldn't,
maybe in a rare case within a complex driver where it is hard to spot.
I'll be OK to change the approach and keep the pointer passed in the
attach/detach ops, if that is the best option. However I'd like to have
your opinion about the above topics before working towards that
direction, and ensure I fully grasp the usefulness of keeping the
pointer.
Post scriptum. The very initial issue that led to all this discussion
when writing the hotplug-bridge driver is that the samsung-dsim driver
will not drm_bridge_add() until a DSI device does .attach to it. Again,
see the comments before hotplug_bridge_dsi_attach() in [0] for details.
However by re-examining the driver for the N-th time now from a new
POV, I _think_ this is not correct and potentially easy to solve. But this leads to one fundamental question:
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices
2025-07-07 9:58 ` Luca Ceresoli
@ 2025-07-07 10:13 ` Luca Ceresoli
2025-07-14 15:28 ` Luca Ceresoli
2025-07-25 15:22 ` Maxime Ripard
2025-07-25 15:17 ` Maxime Ripard
1 sibling, 2 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-07-07 10:13 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Inki Dae, Jagan Teki,
Marek Szyprowski, Jani Nikula, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, linux-amlogic
Hi Maxime,
ouch, e-mail sent by mistake unfinished and without proof-reading...
well, let me continue it below.
On Mon, 7 Jul 2025 11:58:53 +0200
Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
> On Mon, 7 Jul 2025 08:16:49 +0200
> Maxime Ripard <mripard@kernel.org> wrote:
>
> > Hi Luca,
> >
> > On Wed, Jun 25, 2025 at 06:45:04PM +0200, Luca Ceresoli wrote:
> > > This series is the first attempt at avoiding DSI host drivers to have
> > > pointers to DSI devices (struct mipi_dsi_device), as discussed during the
> > > Linux Plumbers Conference 2024 with Maxime and Dmitry.
> > >
> > > It is working, but I consider this a draft in order to discuss and
> > > challenge the proposed approach.
> > >
> > > Overall work
> > > ============
> > >
> > > This is part of the work towards removal of bridges from a still existing
> > > DRM pipeline without use-after-free. The grand plan as discussed in [1].
> > > Here's the work breakdown (➜ marks the current series):
> > >
> > > 1. … add refcounting to DRM bridges (struct drm_bridge)
> > > (based on devm_drm_bridge_alloc() [0])
> > > A. ✔ add new alloc API and refcounting (in v6.16-rc1)
> > > B. ✔ convert all bridge drivers to new API (now in drm-misc-next)
> > > C. ✔ kunit tests (now in drm-misc-next)
> > > D. … add get/put to drm_bridge_add/remove() + attach/detach()
> > > and warn on old allocation pattern (under review)
> > > E. … add get/put on drm_bridge accessors
> > > 1. … drm_bridge_chain_get_first_bridge() + add a cleanup action
> > > 2. … drm_bridge_chain_get_last_bridge()
> > > 3. drm_bridge_get_prev_bridge()
> > > 4. drm_bridge_get_next_bridge()
> > > 5. drm_for_each_bridge_in_chain()
> > > 6. drm_bridge_connector_init
> > > 7. of_drm_find_bridge
> > > 8. drm_of_find_panel_or_bridge, *_of_get_bridge
> > > F. debugfs improvements
> > > 2. handle gracefully atomic updates during bridge removal
> > > 3. ➜ avoid DSI host drivers to have dangling pointers to DSI devices
> > > (this series)
> > > 4. finish the hotplug bridge work, removing the "always-disconnected"
> > > connector, moving code to the core and potentially removing the
> > > hotplug-bridge itself (this needs to be clarified as points 1-3 are
> > > developed)
> > >
> > > [0] https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0cc6aadd7fc1e629b715ea3d1ba537ef2da95eec
> > > [1] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/t/#u
> > >
> > > Motivation
> > > ==========
> > >
> > > The motivation for this series is that with hot-pluggable hardware a DSI
> > > device can be disconnected from the DSI host at runtime, and later on
> > > reconnected, potentially with a different model having different bus
> > > parameters.
> > >
> > > DSI host drivers currently receive a struct mipi_dsi_device pointer in the
> > > attach callback and some store it permanently for later access to the bur
> > > format data (lanes, channel, pixel format etc). The stored pointer can
> > > become dangling if the device is removed, leading to a use-after-free.
> > >
> > > Currently the data exchange between DSI host and device happens primarily
> > > by two means:
> > >
> > > * the device requests attach, detach and message transfer to the host by
> > > calling mipi_dsi_attach/detach/transfer which in turn call the callbacks
> > > in struct mipi_dsi_host_ops
> > > - for this to work, struct mipi_dsi_device has a pointer to the host:
> > > this is OK because the goal is supporting hotplug of the "remote"
> > > part of the DRM pipeline
> > > * the host accesses directly the fields of struct mipi_dsi_device, to
> > > which it receives a pointer in the .attach and .detach callbacks
> > >
> > > The second bullet is the problematic one, which we want to remove.
> > >
> > > Strategy
> > > ========
> > >
> > > I devised two possible strategies to address it:
> > >
> > > 1. change the host ops to not pass a struct mipi_dsi_device, but instead
> > > to pass only a copy of the needed information (bus format mainly), so
> > > the host driver does never access any info from the device
> > >
> > > 2. let the host get info from the device as needed, but without having a
> > > pointer to it; this is be based on:
> > > - storing a __private mipi_dsi_device pointer in struct mipi_dsi_host
> > > - adding getters to the DSI core for the host to query the needed
> > > info, e.g. drm_mipi_dsi_host_get_device_lanes(host) (the getters
> > > would be allowed to dereference the device pointer)
> > >
> > > This series implements strategy 1. It does so by adding a .attach_new host
> > > op, which does not take a mipi_dsi_device pointer, and converting most host
> > > drivers to it. Once all drivers are converted, the old op can be removed,
> > > and .attach_new renamed to .attach.
> >
> > I don't recall discussing this particular aspect at Plumbers, so sorry
> > if we're coming back to the same discussion we had.
> >
> > I'm not necessarily opposed to changing the MIPI-DSI bus API, but I
> > don't think changing the semantics to remove the fact that a particular
> > device is connected or not is a good idea.
> >
> > I would have expected to have bus driver (maybe) take a device pointer
> > at attach, and drop it at detach.
> >
> > Then, when we detect the hotplug of a DSI device, we detach it from its
> > parent, and we're done.
> >
> > What prevents us from using that approach?
>
> I probably should have done a recap of the whole discussion, so let me
> do it now.
>
> It all starts with one fact: a DSI device can be disconnected and then
> a different one connected later on, having a different DSI bus format
> (lanes, channel, mode flags, whatever). A detach/attach sequence would
> handle that, but only in the simple case when there is a host/device
> pair. Let's how consider this topology:
>
> ┌──────────────────┐
> │ DSI bridge │
> ┌─────────┐ A │ │ B ┌───────────┐
> │ DSI host├────►│device host├────►│DSI device │
> └─────────┘ └──────────────────┘ └───────────┘
>
> Here link A is always connected, link B is hot-pluggable. When the tail
> device is removed and a different one plugged, a detach/attach sequence
> can update the bus format on the DSI bridge, but then the DSI bridge
> cannot update the format on the first host without faking a
> detach/attach that does not map a real event.
>
> The above topology is probably not common, but it is exactly what the
> hotplug-bridge introduces [0]. Whether the hotplug-bridge will have to
> eventually exist or not to support hotplug is still to be defined, but
> regardless there is another problematic aspect.
>
> The second problematic aspect is that several DSI host drivers will not
> even drm_bridge_add() until they have an attached DSI device. One such
> example is samsung-dsim, which calls drm_bridge_add()
> in samsung_dsim_host_attach(). When such a driver implements the first
> DSI host, the DSI bridge must register a DSI device before the DRM card
> can be instantiated. See the lengthy comment before
> hotplug_bridge_dsi_attach() in [0] for more gory details, but the
> outcome is that the hotplug-bridge needs to attach a DSI device with
> a fake format once initially just to let the DRM card probe, and the
> detach and reattach with the correct format once an actual DSI device
> is connected at the tail.
>
> [0] https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-4-bc4dfee61be6@bootlin.com/
>
> The above would be improved if the DSI host API provided a way to
> notify to the host about a bus format change, which is however not
> present currently.
>
> The naive solution would be adding a new DSI host op:
>
> struct mipi_dsi_host_ops {
> int (*attach)(struct mipi_dsi_host *host,
> struct mipi_dsi_device *dsi);
> int (*detach)(struct mipi_dsi_host *host,
> struct mipi_dsi_device *dsi);
> + int (*bus_fmt_changed)(struct mipi_dsi_host *host,
> + struct mipi_dsi_device *dsi);
> ssize_t (*transfer)(struct mipi_dsi_host *host,
> const struct mipi_dsi_msg *msg);
> };
>
> This would allow reduce the current sequence:
> 1. attach with dummy format (no tail device yet)
> 2. fake detach
> 3. attach
>
> with:
> 1. attach with dummy format (no tail device yet)
> 2. update format
>
> Adding such a new op would be part of chapter 4 of this work, being it
> quite useless without hotplug.
>
> However while reasoning about this I noticed the DSI host drivers peek
> into the struct mipi_dsi_device fields to read the format, so there is
> no sort of isolation between host and device. Introducing a struct to
> contain all the format fields looked like a good improvement in terms
> of code organization.
>
> Yet another aspect is that several host drivers keep a pointer to the
> device, and thus in case of format change in the DSI device they might
> be reading different fields at different moments, ending up with an
> inconsistent format.
>
> The above considerations, which are all partially overlapped, led me to
> the idea of introducing a struct to exchange a DSI bus format, to be
> exchanged as a whole ("atomically") between host and device. What's
> your opinion about introducing such a struct?
>
> The second aspect of this series is not passing pointers, and that's
> the core topic you questioned. I realize it is not strictly necessary
> to reach the various goals discussed in this e-mail. The work I'm doing
> on the drm_bridge struct is actually a way to store a pointer while
> avoiding use-after-free, so that can obviously be done for a simpler
> scenario such as DSI host-device. However I thought not passing a
> pointer would be a more radical solution: if a driver receives no
> pointer, then it cannot by mistake keep it stored when it shouldn't,
> maybe in a rare case within a complex driver where it is hard to spot.
>
> I'll be OK to change the approach and keep the pointer passed in the
> attach/detach ops, if that is the best option. However I'd like to have
> your opinion about the above topics before working towards that
> direction, and ensure I fully grasp the usefulness of keeping the
> pointer.
>
> Post scriptum. The very initial issue that led to all this discussion
> when writing the hotplug-bridge driver is that the samsung-dsim driver
> will not drm_bridge_add() until a DSI device does .attach to it. Again,
> see the comments before hotplug_bridge_dsi_attach() in [0] for details.
> However by re-examining the driver for the N-th time now from a new
> POV, I _think_ this is not correct and potentially easy to solve. But this leads to one fundamental question:
The question is: should a DSI host bridge driver:
A) wait for a DSI device to .attach before drm_bridge_add()ing itself,
or
B) drm_bridge_add() itself unconditionally, and let the DSI device
.attach whenever it happens?
A) is what many drivers (IIRC the majority) does. It implies the card
will not be populated until .attach, which in the hotplug case could
happen very late
B) is done by a few drivers and allows the card to appear in the
hotplug case without the device, which is needed for hotplug.
I had tried simply moving drm_bridge_add() from .attach to probe in
the samsung-dsim driver in the pase but that would not work. Now I did
yet another check at the code and I suspect it can be done with a small
additional change, but cannot access the hardware to test it currently.
Answering this last question might change and simplify the requirements
discussed in the (very lengthy, sorry about that) discussion above.
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices
2025-07-07 10:13 ` Luca Ceresoli
@ 2025-07-14 15:28 ` Luca Ceresoli
2025-07-25 15:22 ` Maxime Ripard
1 sibling, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-07-14 15:28 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Inki Dae, Jagan Teki,
Marek Szyprowski, Jani Nikula, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, linux-amlogic
Hi Maxime,
On Mon, 7 Jul 2025 12:13:19 +0200
Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
...
> > Post scriptum. The very initial issue that led to all this discussion
> > when writing the hotplug-bridge driver is that the samsung-dsim driver
> > will not drm_bridge_add() until a DSI device does .attach to it. Again,
> > see the comments before hotplug_bridge_dsi_attach() in [0] for details.
> > However by re-examining the driver for the N-th time now from a new
> > POV, I _think_ this is not correct and potentially easy to solve. But this leads to one fundamental question:
>
> The question is: should a DSI host bridge driver:
>
> A) wait for a DSI device to .attach before drm_bridge_add()ing itself,
> or
> B) drm_bridge_add() itself unconditionally, and let the DSI device
> .attach whenever it happens?
>
> A) is what many drivers (IIRC the majority) does. It implies the card
> will not be populated until .attach, which in the hotplug case could
> happen very late
>
> B) is done by a few drivers and allows the card to appear in the
> hotplug case without the device, which is needed for hotplug.
I haven't received any reply to this e-mail. Should this be due to the
fuzzyness of what I wrote, you're perfectly understood. :-)
Let me try to start cleaner, and focus only on the question quoted here
above. It is very relevant to the hotplug work, so I'd like any informed
opinions about it in the first place. Many other things depend on it.
The samsung-dsim driver, which is in the hardware I'm working on, falls
in the A) case, and this is problematic.
> I had tried simply moving drm_bridge_add() from .attach to probe in
> the samsung-dsim driver in the pase but that would not work. Now I did
> yet another check at the code and I suspect it can be done with a small
> additional change, but cannot access the hardware to test it currently.
I managed to try today and test on hardware, and I can confirm that the
samsung-dsim driver can be moved from A) to B). In other words the
drm_bridge_add() call to add the samsung-dsim bridge can be moved from
the mipi_dsi_host_ops.attach op to the probe function, but this
requires an additional change, at least when using the imx8mp LCDIF:
@@ -1645,6 +1645,9 @@ static int samsung_dsim_attach(struct drm_bridge *bridge,
{
struct samsung_dsim *dsi = bridge_to_dsi(bridge);
+ if (!dsi->out_bridge)
+ return -EPROBE_DEFER;
+
return drm_bridge_attach(encoder, dsi->out_bridge, bridge,
flags);
}
Without the above change, the mxsfb driver will hard-fail because
mxsfb_attach_bridge() [0] finds the next bridge (the samsung-dsim
bridge, which is now added earlier, in probe) but cannot attach it to
the encoder chain (the samsung-dsim bridge still hasn't got an
out_bridge).
I have a working draft of the above samsung-dsim changes working with
the hotplug-bridge, and it makes the hotplug code one relevant step
simpler.
Your opinion would be appreciated before I proceed to cleaning up and
sending such change.
[0] https://elixir.bootlin.com/linux/v6.16-rc5/source/drivers/gpu/drm/mxsfb/mxsfb_drv.c#L128-L145
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices
2025-07-07 10:13 ` Luca Ceresoli
2025-07-14 15:28 ` Luca Ceresoli
@ 2025-07-25 15:22 ` Maxime Ripard
2025-07-25 15:32 ` Luca Ceresoli
1 sibling, 1 reply; 42+ messages in thread
From: Maxime Ripard @ 2025-07-25 15:22 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Inki Dae, Jagan Teki,
Marek Szyprowski, Jani Nikula, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, linux-amlogic
[-- Attachment #1: Type: text/plain, Size: 13401 bytes --]
On Mon, Jul 07, 2025 at 12:13:19PM +0200, Luca Ceresoli wrote:
> Hi Maxime,
>
> ouch, e-mail sent by mistake unfinished and without proof-reading...
> well, let me continue it below.
>
> On Mon, 7 Jul 2025 11:58:53 +0200
> Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
>
> > On Mon, 7 Jul 2025 08:16:49 +0200
> > Maxime Ripard <mripard@kernel.org> wrote:
> >
> > > Hi Luca,
> > >
> > > On Wed, Jun 25, 2025 at 06:45:04PM +0200, Luca Ceresoli wrote:
> > > > This series is the first attempt at avoiding DSI host drivers to have
> > > > pointers to DSI devices (struct mipi_dsi_device), as discussed during the
> > > > Linux Plumbers Conference 2024 with Maxime and Dmitry.
> > > >
> > > > It is working, but I consider this a draft in order to discuss and
> > > > challenge the proposed approach.
> > > >
> > > > Overall work
> > > > ============
> > > >
> > > > This is part of the work towards removal of bridges from a still existing
> > > > DRM pipeline without use-after-free. The grand plan as discussed in [1].
> > > > Here's the work breakdown (➜ marks the current series):
> > > >
> > > > 1. … add refcounting to DRM bridges (struct drm_bridge)
> > > > (based on devm_drm_bridge_alloc() [0])
> > > > A. ✔ add new alloc API and refcounting (in v6.16-rc1)
> > > > B. ✔ convert all bridge drivers to new API (now in drm-misc-next)
> > > > C. ✔ kunit tests (now in drm-misc-next)
> > > > D. … add get/put to drm_bridge_add/remove() + attach/detach()
> > > > and warn on old allocation pattern (under review)
> > > > E. … add get/put on drm_bridge accessors
> > > > 1. … drm_bridge_chain_get_first_bridge() + add a cleanup action
> > > > 2. … drm_bridge_chain_get_last_bridge()
> > > > 3. drm_bridge_get_prev_bridge()
> > > > 4. drm_bridge_get_next_bridge()
> > > > 5. drm_for_each_bridge_in_chain()
> > > > 6. drm_bridge_connector_init
> > > > 7. of_drm_find_bridge
> > > > 8. drm_of_find_panel_or_bridge, *_of_get_bridge
> > > > F. debugfs improvements
> > > > 2. handle gracefully atomic updates during bridge removal
> > > > 3. ➜ avoid DSI host drivers to have dangling pointers to DSI devices
> > > > (this series)
> > > > 4. finish the hotplug bridge work, removing the "always-disconnected"
> > > > connector, moving code to the core and potentially removing the
> > > > hotplug-bridge itself (this needs to be clarified as points 1-3 are
> > > > developed)
> > > >
> > > > [0] https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0cc6aadd7fc1e629b715ea3d1ba537ef2da95eec
> > > > [1] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/t/#u
> > > >
> > > > Motivation
> > > > ==========
> > > >
> > > > The motivation for this series is that with hot-pluggable hardware a DSI
> > > > device can be disconnected from the DSI host at runtime, and later on
> > > > reconnected, potentially with a different model having different bus
> > > > parameters.
> > > >
> > > > DSI host drivers currently receive a struct mipi_dsi_device pointer in the
> > > > attach callback and some store it permanently for later access to the bur
> > > > format data (lanes, channel, pixel format etc). The stored pointer can
> > > > become dangling if the device is removed, leading to a use-after-free.
> > > >
> > > > Currently the data exchange between DSI host and device happens primarily
> > > > by two means:
> > > >
> > > > * the device requests attach, detach and message transfer to the host by
> > > > calling mipi_dsi_attach/detach/transfer which in turn call the callbacks
> > > > in struct mipi_dsi_host_ops
> > > > - for this to work, struct mipi_dsi_device has a pointer to the host:
> > > > this is OK because the goal is supporting hotplug of the "remote"
> > > > part of the DRM pipeline
> > > > * the host accesses directly the fields of struct mipi_dsi_device, to
> > > > which it receives a pointer in the .attach and .detach callbacks
> > > >
> > > > The second bullet is the problematic one, which we want to remove.
> > > >
> > > > Strategy
> > > > ========
> > > >
> > > > I devised two possible strategies to address it:
> > > >
> > > > 1. change the host ops to not pass a struct mipi_dsi_device, but instead
> > > > to pass only a copy of the needed information (bus format mainly), so
> > > > the host driver does never access any info from the device
> > > >
> > > > 2. let the host get info from the device as needed, but without having a
> > > > pointer to it; this is be based on:
> > > > - storing a __private mipi_dsi_device pointer in struct mipi_dsi_host
> > > > - adding getters to the DSI core for the host to query the needed
> > > > info, e.g. drm_mipi_dsi_host_get_device_lanes(host) (the getters
> > > > would be allowed to dereference the device pointer)
> > > >
> > > > This series implements strategy 1. It does so by adding a .attach_new host
> > > > op, which does not take a mipi_dsi_device pointer, and converting most host
> > > > drivers to it. Once all drivers are converted, the old op can be removed,
> > > > and .attach_new renamed to .attach.
> > >
> > > I don't recall discussing this particular aspect at Plumbers, so sorry
> > > if we're coming back to the same discussion we had.
> > >
> > > I'm not necessarily opposed to changing the MIPI-DSI bus API, but I
> > > don't think changing the semantics to remove the fact that a particular
> > > device is connected or not is a good idea.
> > >
> > > I would have expected to have bus driver (maybe) take a device pointer
> > > at attach, and drop it at detach.
> > >
> > > Then, when we detect the hotplug of a DSI device, we detach it from its
> > > parent, and we're done.
> > >
> > > What prevents us from using that approach?
> >
> > I probably should have done a recap of the whole discussion, so let me
> > do it now.
> >
> > It all starts with one fact: a DSI device can be disconnected and then
> > a different one connected later on, having a different DSI bus format
> > (lanes, channel, mode flags, whatever). A detach/attach sequence would
> > handle that, but only in the simple case when there is a host/device
> > pair. Let's how consider this topology:
> >
> > ┌──────────────────┐
> > │ DSI bridge │
> > ┌─────────┐ A │ │ B ┌───────────┐
> > │ DSI host├────►│device host├────►│DSI device │
> > └─────────┘ └──────────────────┘ └───────────┘
> >
> > Here link A is always connected, link B is hot-pluggable. When the tail
> > device is removed and a different one plugged, a detach/attach sequence
> > can update the bus format on the DSI bridge, but then the DSI bridge
> > cannot update the format on the first host without faking a
> > detach/attach that does not map a real event.
> >
> > The above topology is probably not common, but it is exactly what the
> > hotplug-bridge introduces [0]. Whether the hotplug-bridge will have to
> > eventually exist or not to support hotplug is still to be defined, but
> > regardless there is another problematic aspect.
> >
> > The second problematic aspect is that several DSI host drivers will not
> > even drm_bridge_add() until they have an attached DSI device. One such
> > example is samsung-dsim, which calls drm_bridge_add()
> > in samsung_dsim_host_attach(). When such a driver implements the first
> > DSI host, the DSI bridge must register a DSI device before the DRM card
> > can be instantiated. See the lengthy comment before
> > hotplug_bridge_dsi_attach() in [0] for more gory details, but the
> > outcome is that the hotplug-bridge needs to attach a DSI device with
> > a fake format once initially just to let the DRM card probe, and the
> > detach and reattach with the correct format once an actual DSI device
> > is connected at the tail.
> >
> > [0] https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-4-bc4dfee61be6@bootlin.com/
> >
> > The above would be improved if the DSI host API provided a way to
> > notify to the host about a bus format change, which is however not
> > present currently.
> >
> > The naive solution would be adding a new DSI host op:
> >
> > struct mipi_dsi_host_ops {
> > int (*attach)(struct mipi_dsi_host *host,
> > struct mipi_dsi_device *dsi);
> > int (*detach)(struct mipi_dsi_host *host,
> > struct mipi_dsi_device *dsi);
> > + int (*bus_fmt_changed)(struct mipi_dsi_host *host,
> > + struct mipi_dsi_device *dsi);
> > ssize_t (*transfer)(struct mipi_dsi_host *host,
> > const struct mipi_dsi_msg *msg);
> > };
> >
> > This would allow reduce the current sequence:
> > 1. attach with dummy format (no tail device yet)
> > 2. fake detach
> > 3. attach
> >
> > with:
> > 1. attach with dummy format (no tail device yet)
> > 2. update format
> >
> > Adding such a new op would be part of chapter 4 of this work, being it
> > quite useless without hotplug.
> >
> > However while reasoning about this I noticed the DSI host drivers peek
> > into the struct mipi_dsi_device fields to read the format, so there is
> > no sort of isolation between host and device. Introducing a struct to
> > contain all the format fields looked like a good improvement in terms
> > of code organization.
> >
> > Yet another aspect is that several host drivers keep a pointer to the
> > device, and thus in case of format change in the DSI device they might
> > be reading different fields at different moments, ending up with an
> > inconsistent format.
> >
> > The above considerations, which are all partially overlapped, led me to
> > the idea of introducing a struct to exchange a DSI bus format, to be
> > exchanged as a whole ("atomically") between host and device. What's
> > your opinion about introducing such a struct?
> >
> > The second aspect of this series is not passing pointers, and that's
> > the core topic you questioned. I realize it is not strictly necessary
> > to reach the various goals discussed in this e-mail. The work I'm doing
> > on the drm_bridge struct is actually a way to store a pointer while
> > avoiding use-after-free, so that can obviously be done for a simpler
> > scenario such as DSI host-device. However I thought not passing a
> > pointer would be a more radical solution: if a driver receives no
> > pointer, then it cannot by mistake keep it stored when it shouldn't,
> > maybe in a rare case within a complex driver where it is hard to spot.
> >
> > I'll be OK to change the approach and keep the pointer passed in the
> > attach/detach ops, if that is the best option. However I'd like to have
> > your opinion about the above topics before working towards that
> > direction, and ensure I fully grasp the usefulness of keeping the
> > pointer.
> >
> > Post scriptum. The very initial issue that led to all this discussion
> > when writing the hotplug-bridge driver is that the samsung-dsim driver
> > will not drm_bridge_add() until a DSI device does .attach to it. Again,
> > see the comments before hotplug_bridge_dsi_attach() in [0] for details.
> > However by re-examining the driver for the N-th time now from a new
> > POV, I _think_ this is not correct and potentially easy to solve. But this leads to one fundamental question:
>
> The question is: should a DSI host bridge driver:
>
> A) wait for a DSI device to .attach before drm_bridge_add()ing itself,
> or
> B) drm_bridge_add() itself unconditionally, and let the DSI device
> .attach whenever it happens?
>
> A) is what many drivers (IIRC the majority) does. It implies the card
> will not be populated until .attach, which in the hotplug case could
> happen very late
>
> B) is done by a few drivers and allows the card to appear in the
> hotplug case without the device, which is needed for hotplug.
>
> I had tried simply moving drm_bridge_add() from .attach to probe in
> the samsung-dsim driver in the pase but that would not work. Now I did
> yet another check at the code and I suspect it can be done with a small
> additional change, but cannot access the hardware to test it currently.
>
> Answering this last question might change and simplify the requirements
> discussed in the (very lengthy, sorry about that) discussion above.
You're not going to like the answer too much, but I think that it is
that "nobody knows".
The bad news is that I can't give you an answer, but the good one is
that it gives us some leeway.
As I said in my previous mail, we should probably figure it out,
document it, and then make it work for your drivers. Once we have a
documentation we can point to, the rest will fall in line.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices
2025-07-25 15:22 ` Maxime Ripard
@ 2025-07-25 15:32 ` Luca Ceresoli
0 siblings, 0 replies; 42+ messages in thread
From: Luca Ceresoli @ 2025-07-25 15:32 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Inki Dae, Jagan Teki,
Marek Szyprowski, Jani Nikula, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, linux-amlogic
Hi Maxime,
On Fri, 25 Jul 2025 17:22:47 +0200
Maxime Ripard <mripard@kernel.org> wrote:
...
> > The question is: should a DSI host bridge driver:
> >
> > A) wait for a DSI device to .attach before drm_bridge_add()ing itself,
> > or
> > B) drm_bridge_add() itself unconditionally, and let the DSI device
> > .attach whenever it happens?
> >
> > A) is what many drivers (IIRC the majority) does. It implies the card
> > will not be populated until .attach, which in the hotplug case could
> > happen very late
> >
> > B) is done by a few drivers and allows the card to appear in the
> > hotplug case without the device, which is needed for hotplug.
> >
> > I had tried simply moving drm_bridge_add() from .attach to probe in
> > the samsung-dsim driver in the pase but that would not work. Now I did
> > yet another check at the code and I suspect it can be done with a small
> > additional change, but cannot access the hardware to test it currently.
> >
> > Answering this last question might change and simplify the requirements
> > discussed in the (very lengthy, sorry about that) discussion above.
>
> You're not going to like the answer too much, but I think that it is
> that "nobody knows".
>
> The bad news is that I can't give you an answer, but the good one is
> that it gives us some leeway.
>
> As I said in my previous mail, we should probably figure it out,
> document it, and then make it work for your drivers. Once we have a
> documentation we can point to, the rest will fall in line.
Thanks for taking time to reply this!
I just sent a patch to do the mentioned change in samsung-dsim [0] to
start discussion on real code. I'd appreciate if you could prioritize
that patch over all other patches I have sent.
[0] https://lore.kernel.org/all/20250725-drm-bridge-samsung-dsim-add-in-probe-v1-1-b23d29c23fbd@bootlin.com/
Best regards,
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 00/32] drm/mipi-dsi: avoid DSI host drivers to have pointers to DSI devices
2025-07-07 9:58 ` Luca Ceresoli
2025-07-07 10:13 ` Luca Ceresoli
@ 2025-07-25 15:17 ` Maxime Ripard
1 sibling, 0 replies; 42+ messages in thread
From: Maxime Ripard @ 2025-07-25 15:17 UTC (permalink / raw)
To: Luca Ceresoli
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Inki Dae, Jagan Teki,
Marek Szyprowski, Jani Nikula, Dmitry Baryshkov, Hui Pu,
Thomas Petazzoni, dri-devel, linux-kernel, linux-sunxi,
Kevin Hilman, Jerome Brunet, Martin Blumenstingl, linux-amlogic
[-- Attachment #1: Type: text/plain, Size: 13518 bytes --]
Hi Luca,
On Mon, Jul 07, 2025 at 11:58:53AM +0200, Luca Ceresoli wrote:
> On Mon, 7 Jul 2025 08:16:49 +0200
> Maxime Ripard <mripard@kernel.org> wrote:
> > On Wed, Jun 25, 2025 at 06:45:04PM +0200, Luca Ceresoli wrote:
> > > This series is the first attempt at avoiding DSI host drivers to have
> > > pointers to DSI devices (struct mipi_dsi_device), as discussed during the
> > > Linux Plumbers Conference 2024 with Maxime and Dmitry.
> > >
> > > It is working, but I consider this a draft in order to discuss and
> > > challenge the proposed approach.
> > >
> > > Overall work
> > > ============
> > >
> > > This is part of the work towards removal of bridges from a still existing
> > > DRM pipeline without use-after-free. The grand plan as discussed in [1].
> > > Here's the work breakdown (➜ marks the current series):
> > >
> > > 1. … add refcounting to DRM bridges (struct drm_bridge)
> > > (based on devm_drm_bridge_alloc() [0])
> > > A. ✔ add new alloc API and refcounting (in v6.16-rc1)
> > > B. ✔ convert all bridge drivers to new API (now in drm-misc-next)
> > > C. ✔ kunit tests (now in drm-misc-next)
> > > D. … add get/put to drm_bridge_add/remove() + attach/detach()
> > > and warn on old allocation pattern (under review)
> > > E. … add get/put on drm_bridge accessors
> > > 1. … drm_bridge_chain_get_first_bridge() + add a cleanup action
> > > 2. … drm_bridge_chain_get_last_bridge()
> > > 3. drm_bridge_get_prev_bridge()
> > > 4. drm_bridge_get_next_bridge()
> > > 5. drm_for_each_bridge_in_chain()
> > > 6. drm_bridge_connector_init
> > > 7. of_drm_find_bridge
> > > 8. drm_of_find_panel_or_bridge, *_of_get_bridge
> > > F. debugfs improvements
> > > 2. handle gracefully atomic updates during bridge removal
> > > 3. ➜ avoid DSI host drivers to have dangling pointers to DSI devices
> > > (this series)
> > > 4. finish the hotplug bridge work, removing the "always-disconnected"
> > > connector, moving code to the core and potentially removing the
> > > hotplug-bridge itself (this needs to be clarified as points 1-3 are
> > > developed)
> > >
> > > [0] https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0cc6aadd7fc1e629b715ea3d1ba537ef2da95eec
> > > [1] https://lore.kernel.org/lkml/20250206-hotplug-drm-bridge-v6-0-9d6f2c9c3058@bootlin.com/t/#u
> > >
> > > Motivation
> > > ==========
> > >
> > > The motivation for this series is that with hot-pluggable hardware a DSI
> > > device can be disconnected from the DSI host at runtime, and later on
> > > reconnected, potentially with a different model having different bus
> > > parameters.
> > >
> > > DSI host drivers currently receive a struct mipi_dsi_device pointer in the
> > > attach callback and some store it permanently for later access to the bur
> > > format data (lanes, channel, pixel format etc). The stored pointer can
> > > become dangling if the device is removed, leading to a use-after-free.
> > >
> > > Currently the data exchange between DSI host and device happens primarily
> > > by two means:
> > >
> > > * the device requests attach, detach and message transfer to the host by
> > > calling mipi_dsi_attach/detach/transfer which in turn call the callbacks
> > > in struct mipi_dsi_host_ops
> > > - for this to work, struct mipi_dsi_device has a pointer to the host:
> > > this is OK because the goal is supporting hotplug of the "remote"
> > > part of the DRM pipeline
> > > * the host accesses directly the fields of struct mipi_dsi_device, to
> > > which it receives a pointer in the .attach and .detach callbacks
> > >
> > > The second bullet is the problematic one, which we want to remove.
> > >
> > > Strategy
> > > ========
> > >
> > > I devised two possible strategies to address it:
> > >
> > > 1. change the host ops to not pass a struct mipi_dsi_device, but instead
> > > to pass only a copy of the needed information (bus format mainly), so
> > > the host driver does never access any info from the device
> > >
> > > 2. let the host get info from the device as needed, but without having a
> > > pointer to it; this is be based on:
> > > - storing a __private mipi_dsi_device pointer in struct mipi_dsi_host
> > > - adding getters to the DSI core for the host to query the needed
> > > info, e.g. drm_mipi_dsi_host_get_device_lanes(host) (the getters
> > > would be allowed to dereference the device pointer)
> > >
> > > This series implements strategy 1. It does so by adding a .attach_new host
> > > op, which does not take a mipi_dsi_device pointer, and converting most host
> > > drivers to it. Once all drivers are converted, the old op can be removed,
> > > and .attach_new renamed to .attach.
> >
> > I don't recall discussing this particular aspect at Plumbers, so sorry
> > if we're coming back to the same discussion we had.
> >
> > I'm not necessarily opposed to changing the MIPI-DSI bus API, but I
> > don't think changing the semantics to remove the fact that a particular
> > device is connected or not is a good idea.
> >
> > I would have expected to have bus driver (maybe) take a device pointer
> > at attach, and drop it at detach.
> >
> > Then, when we detect the hotplug of a DSI device, we detach it from its
> > parent, and we're done.
> >
> > What prevents us from using that approach?
>
> I probably should have done a recap of the whole discussion, so let me
> do it now.
>
> It all starts with one fact: a DSI device can be disconnected and then
> a different one connected later on, having a different DSI bus format
> (lanes, channel, mode flags, whatever).
So, I know that you're not going to be super happy about it, but some
parts of mipi_dsi_device shouldn't really belong in mipi_dsi_device at
the moment.
The virtual channel definitely belongs there, but formats for example
aren't really fixed by the hardware itself. If we're looking at bridges
as a whole, it would make much more sense for formats to be exposed
through the bus format API bridges provide.
Lanes are kind of like that too, since they somewhat depend on the rate.
> A detach/attach sequence would handle that, but only in the simple
> case when there is a host/device pair. Let's how consider this
> topology:
>
> ┌──────────────────┐
> │ DSI bridge │
> ┌─────────┐ A │ │ B ┌───────────┐
> │ DSI host├────►│device host├────►│DSI device │
> └─────────┘ └──────────────────┘ └───────────┘
So, in this case, the DSI bridge is both a DSI device on bus A, and a
DSI host on bus B?
Do we have hardware like that?
> Here link A is always connected, link B is hot-pluggable. When the tail
> device is removed and a different one plugged, a detach/attach sequence
> can update the bus format on the DSI bridge, but then the DSI bridge
> cannot update the format on the first host without faking a
> detach/attach that does not map a real event.
>
> The above topology is probably not common, but it is exactly what the
> hotplug-bridge introduces [0]. Whether the hotplug-bridge will have to
> eventually exist or not to support hotplug is still to be defined, but
> regardless there is another problematic aspect.
Another way out would be to evaluate a different solution to that
problem that wouldn't involve creating an intermediate bridge.
> The second problematic aspect is that several DSI host drivers will not
> even drm_bridge_add() until they have an attached DSI device. One such
> example is samsung-dsim, which calls drm_bridge_add()
> in samsung_dsim_host_attach().
I guess in this case, you mean a DSI host that is a device of a !DSI
bus, right?
> When such a driver implements the first DSI host, the DSI bridge must
> register a DSI device before the DRM card can be instantiated. See the
> lengthy comment before hotplug_bridge_dsi_attach() in [0] for more
> gory details, but the outcome is that the hotplug-bridge needs to
> attach a DSI device with a fake format once initially just to let the
> DRM card probe, and the detach and reattach with the correct format
> once an actual DSI device is connected at the tail.
I guess that's one thing that would be solved by moving the formats out
of mipi_dsi_device. The other bridges compute this at atomic_check time,
so way after the bridge has been attached, and thus this wouldn't be a
worry anymore.
> [0] https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-4-bc4dfee61be6@bootlin.com/
>
> The above would be improved if the DSI host API provided a way to
> notify to the host about a bus format change, which is however not
> present currently.
>
> The naive solution would be adding a new DSI host op:
>
> struct mipi_dsi_host_ops {
> int (*attach)(struct mipi_dsi_host *host,
> struct mipi_dsi_device *dsi);
> int (*detach)(struct mipi_dsi_host *host,
> struct mipi_dsi_device *dsi);
> + int (*bus_fmt_changed)(struct mipi_dsi_host *host,
> + struct mipi_dsi_device *dsi);
> ssize_t (*transfer)(struct mipi_dsi_host *host,
> const struct mipi_dsi_msg *msg);
> };
>
> This would allow reduce the current sequence:
> 1. attach with dummy format (no tail device yet)
> 2. fake detach
> 3. attach
>
> with:
> 1. attach with dummy format (no tail device yet)
> 2. update format
>
> Adding such a new op would be part of chapter 4 of this work, being it
> quite useless without hotplug.
>
> However while reasoning about this I noticed the DSI host drivers peek
> into the struct mipi_dsi_device fields to read the format, so there is
> no sort of isolation between host and device. Introducing a struct to
> contain all the format fields looked like a good improvement in terms
> of code organization.
Most importantly, looking at a couple of DSI drivers, it doesn't look
like any use the format outside of atomic_pre_enable / atomic_enable, so
if the format was provided in the bridge state, it would work fine.
> Yet another aspect is that several host drivers keep a pointer to the
> device, and thus in case of format change in the DSI device they might
> be reading different fields at different moments, ending up with an
> inconsistent format.
>
> The above considerations, which are all partially overlapped, led me to
> the idea of introducing a struct to exchange a DSI bus format, to be
> exchanged as a whole ("atomically") between host and device. What's
> your opinion about introducing such a struct?
>
> The second aspect of this series is not passing pointers, and that's
> the core topic you questioned. I realize it is not strictly necessary
> to reach the various goals discussed in this e-mail. The work I'm doing
> on the drm_bridge struct is actually a way to store a pointer while
> avoiding use-after-free, so that can obviously be done for a simpler
> scenario such as DSI host-device. However I thought not passing a
> pointer would be a more radical solution: if a driver receives no
> pointer, then it cannot by mistake keep it stored when it shouldn't,
> maybe in a rare case within a complex driver where it is hard to spot.
I'm not too worried about pointers. I mean, yes, it's a footgun, yes,
you can create unsafe behaviors with them, but as long as we have some
kind of mechanism to essentially give you a pointer and revoke it, which
attach / detach is, it's fine.
We'll catch the rest during review, just like access to freed pointers,
or pointers stored without taking a reference.
> I'll be OK to change the approach and keep the pointer passed in the
> attach/detach ops, if that is the best option. However I'd like to have
> your opinion about the above topics before working towards that
> direction, and ensure I fully grasp the usefulness of keeping the
> pointer.
>
> Post scriptum. The very initial issue that led to all this discussion
> when writing the hotplug-bridge driver is that the samsung-dsim driver
> will not drm_bridge_add() until a DSI device does .attach to it. Again,
> see the comments before hotplug_bridge_dsi_attach() in [0] for details.
> However by re-examining the driver for the N-th time now from a new
> POV, I _think_ this is not correct and potentially easy to solve. But this leads to one fundamental question:
That's certainly surprising to me, but I know that the DSI setup can be
a pain. I struggled in the past with the ordering with the component
framework, and I wouldn't be too surprised if those were attempts to
work around some of these issues.
vc4_dsi seems to have a similar construct. Understanding why they both
do something like this, and updating the doc[1] to reflect it would be a
good idea I think, so we can frame the problem properly, and then try to
find a solution for it.
Maxime
1: https://docs.kernel.org/gpu/drm-kms-helpers.html#special-care-with-mipi-dsi-bridges
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread