* [PATCH v2 2/8] drm: bridge: nwl-dsi: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 [PATCH v2 1/8] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Jagan Teki
@ 2022-03-01 14:12 ` Jagan Teki
2022-03-02 11:22 ` Guido Günther
2022-03-01 14:12 ` [PATCH v2 3/8] drm: mediatek: mtk_dsi: " Jagan Teki
` (5 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Jagan Teki @ 2022-03-01 14:12 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss
Cc: Guido Günther, linux-amarula, Jagan Teki, dri-devel
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.
Replace explicit finding calls with devm_drm_of_get_bridge.
Cc: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch
drivers/gpu/drm/bridge/nwl-dsi.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 30aacd939dc3..c9e108a7eca2 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -916,22 +916,10 @@ static int nwl_dsi_bridge_attach(struct drm_bridge *bridge,
{
struct nwl_dsi *dsi = bridge_to_dsi(bridge);
struct drm_bridge *panel_bridge;
- struct drm_panel *panel;
- int ret;
-
- ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0, &panel,
- &panel_bridge);
- if (ret)
- return ret;
-
- if (panel) {
- panel_bridge = drm_panel_bridge_add(panel);
- if (IS_ERR(panel_bridge))
- return PTR_ERR(panel_bridge);
- }
- if (!panel_bridge)
- return -EPROBE_DEFER;
+ panel_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
+ if (IS_ERR(panel_bridge))
+ return PTR_ERR(panel_bridge);
return drm_bridge_attach(bridge->encoder, panel_bridge, bridge, flags);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/8] drm: bridge: nwl-dsi: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 ` [PATCH v2 2/8] drm: bridge: nwl-dsi: Switch to devm_drm_of_get_bridge Jagan Teki
@ 2022-03-02 11:22 ` Guido Günther
0 siblings, 0 replies; 14+ messages in thread
From: Guido Günther @ 2022-03-02 11:22 UTC (permalink / raw)
To: Jagan Teki
Cc: dri-devel, linux-amarula, Robert Foss, Andrzej Hajda, Neil Armstrong
Hi,
On Tue, Mar 01, 2022 at 07:42:41PM +0530, Jagan Teki wrote:
> devm_drm_of_get_bridge is capable of looking up the downstream
> bridge and panel and trying to add a panel bridge if the panel
> is found.
>
> Replace explicit finding calls with devm_drm_of_get_bridge.
>
> Cc: Guido Günther <agx@sigxcpu.org>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v2:
> - split the patch
>
> drivers/gpu/drm/bridge/nwl-dsi.c | 18 +++---------------
> 1 file changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 30aacd939dc3..c9e108a7eca2 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -916,22 +916,10 @@ static int nwl_dsi_bridge_attach(struct drm_bridge *bridge,
> {
> struct nwl_dsi *dsi = bridge_to_dsi(bridge);
> struct drm_bridge *panel_bridge;
> - struct drm_panel *panel;
> - int ret;
> -
> - ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0, &panel,
> - &panel_bridge);
> - if (ret)
> - return ret;
> -
> - if (panel) {
> - panel_bridge = drm_panel_bridge_add(panel);
> - if (IS_ERR(panel_bridge))
> - return PTR_ERR(panel_bridge);
> - }
>
> - if (!panel_bridge)
> - return -EPROBE_DEFER;
> + panel_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
> + if (IS_ERR(panel_bridge))
> + return PTR_ERR(panel_bridge);
>
> return drm_bridge_attach(bridge->encoder, panel_bridge, bridge, flags);
> }
Reviewed-by: Guido Günther <agx@sigxcpu.org>
Thanks,
-- Guido
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 3/8] drm: mediatek: mtk_dsi: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 [PATCH v2 1/8] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Jagan Teki
2022-03-01 14:12 ` [PATCH v2 2/8] drm: bridge: nwl-dsi: Switch to devm_drm_of_get_bridge Jagan Teki
@ 2022-03-01 14:12 ` Jagan Teki
2022-03-01 14:12 ` [PATCH v2 4/8] drm: bridge: dw-mipi-dsi: " Jagan Teki
` (4 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Jagan Teki @ 2022-03-01 14:12 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss
Cc: Chun-Kuang Hu, linux-amarula, Jagan Teki, dri-devel
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.
Replace explicit finding calls with devm_drm_of_get_bridge.
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch
drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 5d90d2eb0019..a1b3e1f4b497 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1004,7 +1004,6 @@ static int mtk_dsi_probe(struct platform_device *pdev)
{
struct mtk_dsi *dsi;
struct device *dev = &pdev->dev;
- struct drm_panel *panel;
struct resource *regs;
int irq_num;
int ret;
@@ -1021,17 +1020,10 @@ static int mtk_dsi_probe(struct platform_device *pdev)
return ret;
}
- ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
- &panel, &dsi->next_bridge);
- if (ret)
+ dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
+ if (IS_ERR(dsi->next_bridge)) {
+ ret = PTR_ERR(dsi->next_bridge);
goto err_unregister_host;
-
- if (panel) {
- dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
- if (IS_ERR(dsi->next_bridge)) {
- ret = PTR_ERR(dsi->next_bridge);
- goto err_unregister_host;
- }
}
dsi->driver_data = of_device_get_match_data(dev);
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/8] drm: bridge: dw-mipi-dsi: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 [PATCH v2 1/8] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Jagan Teki
2022-03-01 14:12 ` [PATCH v2 2/8] drm: bridge: nwl-dsi: Switch to devm_drm_of_get_bridge Jagan Teki
2022-03-01 14:12 ` [PATCH v2 3/8] drm: mediatek: mtk_dsi: " Jagan Teki
@ 2022-03-01 14:12 ` Jagan Teki
2022-03-01 14:12 ` [PATCH v2 5/8] drm: bridge: nxp-ptn3460: " Jagan Teki
` (3 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Jagan Teki @ 2022-03-01 14:12 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss
Cc: linux-amarula, Jagan Teki, dri-devel
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.
Replace explicit finding calls with devm_drm_of_get_bridge.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index 1cc912b6e1f8..b2efecf7d160 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -315,7 +315,6 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
struct dw_mipi_dsi *dsi = host_to_dsi(host);
const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data;
struct drm_bridge *bridge;
- struct drm_panel *panel;
int ret;
if (device->lanes > dsi->plat_data->max_data_lanes) {
@@ -329,17 +328,9 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
dsi->format = device->format;
dsi->mode_flags = device->mode_flags;
- ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0,
- &panel, &bridge);
- if (ret)
- return ret;
-
- if (panel) {
- bridge = drm_panel_bridge_add_typed(panel,
- DRM_MODE_CONNECTOR_DSI);
- if (IS_ERR(bridge))
- return PTR_ERR(bridge);
- }
+ bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
+ if (IS_ERR(bridge))
+ return PTR_ERR(bridge);
dsi->panel_bridge = bridge;
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 5/8] drm: bridge: nxp-ptn3460: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 [PATCH v2 1/8] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Jagan Teki
` (2 preceding siblings ...)
2022-03-01 14:12 ` [PATCH v2 4/8] drm: bridge: dw-mipi-dsi: " Jagan Teki
@ 2022-03-01 14:12 ` Jagan Teki
2022-03-01 14:12 ` [PATCH v2 6/8] drm: bridge: parade-ps8622: " Jagan Teki
` (2 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Jagan Teki @ 2022-03-01 14:12 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss
Cc: linux-amarula, Jagan Teki, dri-devel
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.
Replace explicit finding calls with devm_drm_of_get_bridge.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch
drivers/gpu/drm/bridge/nxp-ptn3460.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/nxp-ptn3460.c b/drivers/gpu/drm/bridge/nxp-ptn3460.c
index e941c1132598..1ab91f4e057b 100644
--- a/drivers/gpu/drm/bridge/nxp-ptn3460.c
+++ b/drivers/gpu/drm/bridge/nxp-ptn3460.c
@@ -263,7 +263,6 @@ static int ptn3460_probe(struct i2c_client *client,
struct device *dev = &client->dev;
struct ptn3460_bridge *ptn_bridge;
struct drm_bridge *panel_bridge;
- struct drm_panel *panel;
int ret;
ptn_bridge = devm_kzalloc(dev, sizeof(*ptn_bridge), GFP_KERNEL);
@@ -271,11 +270,7 @@ static int ptn3460_probe(struct i2c_client *client,
return -ENOMEM;
}
- ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &panel, NULL);
- if (ret)
- return ret;
-
- panel_bridge = devm_drm_panel_bridge_add(dev, panel);
+ panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
if (IS_ERR(panel_bridge))
return PTR_ERR(panel_bridge);
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 6/8] drm: bridge: parade-ps8622: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 [PATCH v2 1/8] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Jagan Teki
` (3 preceding siblings ...)
2022-03-01 14:12 ` [PATCH v2 5/8] drm: bridge: nxp-ptn3460: " Jagan Teki
@ 2022-03-01 14:12 ` Jagan Teki
2022-03-01 14:12 ` [PATCH v2 7/8] drm: bridge: anx7625: " Jagan Teki
2022-03-01 14:12 ` [PATCH v2 8/8] " Jagan Teki
6 siblings, 0 replies; 14+ messages in thread
From: Jagan Teki @ 2022-03-01 14:12 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss
Cc: linux-amarula, Jagan Teki, dri-devel
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.
Replace explicit finding calls with devm_drm_of_get_bridge.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch
drivers/gpu/drm/bridge/parade-ps8622.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/bridge/parade-ps8622.c b/drivers/gpu/drm/bridge/parade-ps8622.c
index 614b19f0f1b7..37b308850b4e 100644
--- a/drivers/gpu/drm/bridge/parade-ps8622.c
+++ b/drivers/gpu/drm/bridge/parade-ps8622.c
@@ -452,18 +452,13 @@ static int ps8622_probe(struct i2c_client *client,
struct device *dev = &client->dev;
struct ps8622_bridge *ps8622;
struct drm_bridge *panel_bridge;
- struct drm_panel *panel;
int ret;
ps8622 = devm_kzalloc(dev, sizeof(*ps8622), GFP_KERNEL);
if (!ps8622)
return -ENOMEM;
- ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &panel, NULL);
- if (ret)
- return ret;
-
- panel_bridge = devm_drm_panel_bridge_add(dev, panel);
+ panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
if (IS_ERR(panel_bridge))
return PTR_ERR(panel_bridge);
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 7/8] drm: bridge: anx7625: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 [PATCH v2 1/8] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Jagan Teki
` (4 preceding siblings ...)
2022-03-01 14:12 ` [PATCH v2 6/8] drm: bridge: parade-ps8622: " Jagan Teki
@ 2022-03-01 14:12 ` Jagan Teki
2022-03-01 14:12 ` [PATCH v2 8/8] " Jagan Teki
6 siblings, 0 replies; 14+ messages in thread
From: Jagan Teki @ 2022-03-01 14:12 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss
Cc: linux-amarula, Jagan Teki, dri-devel
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.
Replace explicit finding calls with devm_drm_of_get_bridge.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch
drivers/gpu/drm/bridge/analogix/anx7625.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 9aab879a8851..f7c911104464 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1606,8 +1606,6 @@ static int anx7625_parse_dt(struct device *dev,
struct anx7625_platform_data *pdata)
{
struct device_node *np = dev->of_node, *ep0;
- struct drm_panel *panel;
- int ret;
int bus_type, mipi_lanes;
anx7625_get_swing_setting(dev, pdata);
@@ -1644,16 +1642,7 @@ static int anx7625_parse_dt(struct device *dev,
if (of_property_read_bool(np, "analogix,audio-enable"))
pdata->audio_en = 1;
- ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL);
- if (ret < 0) {
- if (ret == -ENODEV)
- return 0;
- return ret;
- }
- if (!panel)
- return -ENODEV;
-
- pdata->panel_bridge = devm_drm_panel_bridge_add(dev, panel);
+ pdata->panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
if (IS_ERR(pdata->panel_bridge))
return PTR_ERR(pdata->panel_bridge);
DRM_DEV_DEBUG_DRIVER(dev, "get panel node.\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 8/8] drm: bridge: anx7625: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 [PATCH v2 1/8] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" Jagan Teki
` (5 preceding siblings ...)
2022-03-01 14:12 ` [PATCH v2 7/8] drm: bridge: anx7625: " Jagan Teki
@ 2022-03-01 14:12 ` Jagan Teki
2022-03-01 23:12 ` Linus Walleij
2022-03-01 23:20 ` Linus Walleij
6 siblings, 2 replies; 14+ messages in thread
From: Jagan Teki @ 2022-03-01 14:12 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong, Robert Foss
Cc: linux-amarula, Jagan Teki, dri-devel
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.
Replace explicit finding calls with devm_drm_of_get_bridge.
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch
drivers/gpu/drm/mcde/mcde_dsi.c | 39 +++++----------------------------
1 file changed, 5 insertions(+), 34 deletions(-)
diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 5651734ce977..9371349b8b25 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -1073,9 +1073,7 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
struct drm_device *drm = data;
struct mcde *mcde = to_mcde(drm);
struct mcde_dsi *d = dev_get_drvdata(dev);
- struct device_node *child;
- struct drm_panel *panel = NULL;
- struct drm_bridge *bridge = NULL;
+ struct drm_bridge *bridge;
if (!of_get_available_child_count(dev->of_node)) {
dev_info(dev, "unused DSI interface\n");
@@ -1100,37 +1098,10 @@ static int mcde_dsi_bind(struct device *dev, struct device *master,
return PTR_ERR(d->lp_clk);
}
- /* Look for a panel as a child to this node */
- for_each_available_child_of_node(dev->of_node, child) {
- panel = of_drm_find_panel(child);
- if (IS_ERR(panel)) {
- dev_err(dev, "failed to find panel try bridge (%ld)\n",
- PTR_ERR(panel));
- panel = NULL;
-
- bridge = of_drm_find_bridge(child);
- if (!bridge) {
- dev_err(dev, "failed to find bridge\n");
- return -EINVAL;
- }
- }
- }
- if (panel) {
- bridge = drm_panel_bridge_add_typed(panel,
- DRM_MODE_CONNECTOR_DSI);
- if (IS_ERR(bridge)) {
- dev_err(dev, "error adding panel bridge\n");
- return PTR_ERR(bridge);
- }
- dev_info(dev, "connected to panel\n");
- d->panel = panel;
- } else if (bridge) {
- /* TODO: AV8100 HDMI encoder goes here for example */
- dev_info(dev, "connected to non-panel bridge (unsupported)\n");
- return -ENODEV;
- } else {
- dev_err(dev, "no panel or bridge\n");
- return -ENODEV;
+ bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
+ if (IS_ERR(bridge)) {
+ dev_err(dev, "error to get bridge\n");
+ return PTR_ERR(bridge);
}
d->bridge_out = bridge;
--
2.25.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 8/8] drm: bridge: anx7625: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 ` [PATCH v2 8/8] " Jagan Teki
@ 2022-03-01 23:12 ` Linus Walleij
2022-03-02 4:23 ` Jagan Teki
2022-03-01 23:20 ` Linus Walleij
1 sibling, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2022-03-01 23:12 UTC (permalink / raw)
To: Jagan Teki
Cc: dri-devel, linux-amarula, Robert Foss, Andrzej Hajda, Neil Armstrong
On Tue, Mar 1, 2022 at 3:13 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
> devm_drm_of_get_bridge is capable of looking up the downstream
> bridge and panel and trying to add a panel bridge if the panel
> is found.
>
> Replace explicit finding calls with devm_drm_of_get_bridge.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v2:
> - split the patch
This will be nice code reduction when it works!
> - struct drm_panel *panel = NULL;
> - struct drm_bridge *bridge = NULL;
> + struct drm_bridge *bridge;
OK... and then you delete the code that uses panel. But:
static void mcde_dsi_unbind(struct device *dev, struct device *master,
void *data)
{
struct mcde_dsi *d = dev_get_drvdata(dev);
if (d->panel)
drm_panel_bridge_remove(d->bridge_out);
regmap_update_bits(d->prcmu, PRCM_DSI_SW_RESET,
PRCM_DSI_SW_RESET_DSI0_SW_RESETN, 0);
}
So this will not even compile.
I suppose you have a solution for removing the panel bridge automatically
as well?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 8/8] drm: bridge: anx7625: Switch to devm_drm_of_get_bridge
2022-03-01 23:12 ` Linus Walleij
@ 2022-03-02 4:23 ` Jagan Teki
0 siblings, 0 replies; 14+ messages in thread
From: Jagan Teki @ 2022-03-02 4:23 UTC (permalink / raw)
To: Linus Walleij
Cc: dri-devel, linux-amarula, Robert Foss, Andrzej Hajda, Neil Armstrong
On Wed, Mar 2, 2022 at 4:43 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Tue, Mar 1, 2022 at 3:13 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> > devm_drm_of_get_bridge is capable of looking up the downstream
> > bridge and panel and trying to add a panel bridge if the panel
> > is found.
> >
> > Replace explicit finding calls with devm_drm_of_get_bridge.
> >
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> > Changes for v2:
> > - split the patch
>
> This will be nice code reduction when it works!
>
> > - struct drm_panel *panel = NULL;
> > - struct drm_bridge *bridge = NULL;
> > + struct drm_bridge *bridge;
>
> OK... and then you delete the code that uses panel. But:
>
> static void mcde_dsi_unbind(struct device *dev, struct device *master,
> void *data)
> {
> struct mcde_dsi *d = dev_get_drvdata(dev);
>
> if (d->panel)
> drm_panel_bridge_remove(d->bridge_out);
I think using drm_bridge_remove(d->bridge_out); will directly remove
the bridge whether it is the next bridge or panel bridge as bridge_out
is already found the relevant downstream.
Jagan.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 8/8] drm: bridge: anx7625: Switch to devm_drm_of_get_bridge
2022-03-01 14:12 ` [PATCH v2 8/8] " Jagan Teki
2022-03-01 23:12 ` Linus Walleij
@ 2022-03-01 23:20 ` Linus Walleij
2022-03-02 4:37 ` Jagan Teki
1 sibling, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2022-03-01 23:20 UTC (permalink / raw)
To: Jagan Teki
Cc: dri-devel, linux-amarula, Robert Foss, Andrzej Hajda, Neil Armstrong
On Tue, Mar 1, 2022 at 3:13 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
> + bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
> + if (IS_ERR(bridge)) {
> + dev_err(dev, "error to get bridge\n");
> + return PTR_ERR(bridge);
> }
>
> d->bridge_out = bridge;
Also notice how this bridge gets used in other places:
struct drm_connector *connector = drm_panel_bridge_connector(mcde->bridge);
Since you deleted:
- } else if (bridge) {
- /* TODO: AV8100 HDMI encoder goes here for example */
- dev_info(dev, "connected to non-panel bridge (unsupported)\n");
- return -ENODEV;
This will now have "interesting" effects. I think.
I don't know if there is a way to solve this though?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 8/8] drm: bridge: anx7625: Switch to devm_drm_of_get_bridge
2022-03-01 23:20 ` Linus Walleij
@ 2022-03-02 4:37 ` Jagan Teki
2022-03-02 11:57 ` Linus Walleij
0 siblings, 1 reply; 14+ messages in thread
From: Jagan Teki @ 2022-03-02 4:37 UTC (permalink / raw)
To: Linus Walleij
Cc: dri-devel, linux-amarula, Robert Foss, Andrzej Hajda, Neil Armstrong
On Wed, Mar 2, 2022 at 4:50 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Tue, Mar 1, 2022 at 3:13 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> > + bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
> > + if (IS_ERR(bridge)) {
> > + dev_err(dev, "error to get bridge\n");
> > + return PTR_ERR(bridge);
> > }
> >
> > d->bridge_out = bridge;
>
> Also notice how this bridge gets used in other places:
>
> struct drm_connector *connector = drm_panel_bridge_connector(mcde->bridge);
mcde->bridge bridge is the current bridge pointer it cannot affect
this change. d->bridge_out is what we are finding of the downstream
bridge.
>
> Since you deleted:
>
> - } else if (bridge) {
> - /* TODO: AV8100 HDMI encoder goes here for example */
> - dev_info(dev, "connected to non-panel bridge (unsupported)\n");
> - return -ENODEV;
So, this means mcde dsi can support if the downstream bridge is the
panel not if the downstream bridge is the next bridge. With
devm_drm_of_get_bridge we cannot find that diff. Identifying the
panel-bridge with some name pointer during panel_bridge_add might
solve this, not sure that is proper way to do that?
Thanks,
Jagan.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 8/8] drm: bridge: anx7625: Switch to devm_drm_of_get_bridge
2022-03-02 4:37 ` Jagan Teki
@ 2022-03-02 11:57 ` Linus Walleij
0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2022-03-02 11:57 UTC (permalink / raw)
To: Jagan Teki
Cc: dri-devel, linux-amarula, Robert Foss, Andrzej Hajda, Neil Armstrong
On Wed, Mar 2, 2022 at 5:37 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> On Wed, Mar 2, 2022 at 4:50 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Tue, Mar 1, 2022 at 3:13 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > > + bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
> > > + if (IS_ERR(bridge)) {
> > > + dev_err(dev, "error to get bridge\n");
> > > + return PTR_ERR(bridge);
> > > }
> > >
> > > d->bridge_out = bridge;
> >
> > Also notice how this bridge gets used in other places:
> >
> > struct drm_connector *connector = drm_panel_bridge_connector(mcde->bridge);
>
> mcde->bridge bridge is the current bridge pointer it cannot affect
> this change. d->bridge_out is what we are finding of the downstream
> bridge.
Sorry I confused things.
Got lost in my own code :/
The bridge in the other file is for DPI obviously...
I should rename it dpi_panel_bridge.
> > Since you deleted:
> >
> > - } else if (bridge) {
> > - /* TODO: AV8100 HDMI encoder goes here for example */
> > - dev_info(dev, "connected to non-panel bridge (unsupported)\n");
> > - return -ENODEV;
>
> So, this means mcde dsi can support if the downstream bridge is the
> panel not if the downstream bridge is the next bridge. With
> devm_drm_of_get_bridge we cannot find that diff. Identifying the
> panel-bridge with some name pointer during panel_bridge_add might
> solve this, not sure that is proper way to do that?
I'd say leave it, as the DSI bridge (bridge_out) doesn't really care
about this being a panel or not. A further bridge down the chain
should "just work" (famous last words).
Just make sure we properly remove bridge_out in unbind call.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 14+ messages in thread