Skip to content

Commit 5c5843b

Browse files
committed
drm/imx: ldb: switch to drm_panel_bridge
Defer panel handling to drm_panel_bridge, unifying codepaths for the panel and bridge cases. The MFD_SYSCON symbol is moved to select to prevent Kconfig symbol loops. Reviewed-by: Philipp Zabel <[email protected]> Tested-by: Chris Healy <[email protected]> Tested-by: Philipp Zabel <[email protected]> # on imx6q-nitrogen6x Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent b2f3418 commit 5c5843b

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

drivers/gpu/drm/imx/ipuv3/Kconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ config DRM_IMX_TVE
2626

2727
config DRM_IMX_LDB
2828
tristate "Support for LVDS displays"
29-
depends on DRM_IMX && MFD_SYSCON
29+
depends on DRM_IMX
3030
depends on COMMON_CLK
31-
select DRM_PANEL
31+
select MFD_SYSCON
32+
select DRM_BRIDGE
33+
select DRM_PANEL_BRIDGE
3234
help
3335
Choose this to enable the internal LVDS Display Bridge (LDB)
3436
found on i.MX53 and i.MX6 processors.

drivers/gpu/drm/imx/ipuv3/imx-ldb.c

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <drm/drm_bridge.h>
2828
#include <drm/drm_managed.h>
2929
#include <drm/drm_of.h>
30-
#include <drm/drm_panel.h>
3130
#include <drm/drm_print.h>
3231
#include <drm/drm_probe_helper.h>
3332
#include <drm/drm_simple_kms_helper.h>
@@ -64,8 +63,6 @@ struct imx_ldb;
6463
struct imx_ldb_channel {
6564
struct imx_ldb *ldb;
6665

67-
/* Defines what is connected to the ldb, only one at a time */
68-
struct drm_panel *panel;
6966
struct drm_bridge *bridge;
7067

7168
struct device_node *child;
@@ -135,10 +132,6 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
135132
struct imx_ldb_channel *imx_ldb_ch = con_to_imx_ldb_ch(connector);
136133
int num_modes;
137134

138-
num_modes = drm_panel_get_modes(imx_ldb_ch->panel, connector);
139-
if (num_modes > 0)
140-
return num_modes;
141-
142135
if (imx_ldb_ch->mode_valid) {
143136
struct drm_display_mode *mode;
144137

@@ -193,8 +186,6 @@ static void imx_ldb_encoder_enable(struct drm_encoder *encoder)
193186
return;
194187
}
195188

196-
drm_panel_prepare(imx_ldb_ch->panel);
197-
198189
if (dual) {
199190
clk_set_parent(ldb->clk_sel[mux], ldb->clk[0]);
200191
clk_set_parent(ldb->clk_sel[mux], ldb->clk[1]);
@@ -233,8 +224,6 @@ static void imx_ldb_encoder_enable(struct drm_encoder *encoder)
233224
}
234225

235226
regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl);
236-
237-
drm_panel_enable(imx_ldb_ch->panel);
238227
}
239228

240229
static void
@@ -311,8 +300,6 @@ static void imx_ldb_encoder_disable(struct drm_encoder *encoder)
311300
int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
312301
int mux, ret;
313302

314-
drm_panel_disable(imx_ldb_ch->panel);
315-
316303
if (imx_ldb_ch == &ldb->channel[0] || dual)
317304
ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK;
318305
if (imx_ldb_ch == &ldb->channel[1] || dual)
@@ -346,8 +333,6 @@ static void imx_ldb_encoder_disable(struct drm_encoder *encoder)
346333
dev_err(ldb->dev,
347334
"unable to set di%d parent clock to original parent\n",
348335
mux);
349-
350-
drm_panel_unprepare(imx_ldb_ch->panel);
351336
}
352337

353338
static int imx_ldb_encoder_atomic_check(struct drm_encoder *encoder,
@@ -640,13 +625,15 @@ static int imx_ldb_probe(struct platform_device *pdev)
640625
* The output port is port@4 with an external 4-port mux or
641626
* port@2 with the internal 2-port mux.
642627
*/
643-
ret = drm_of_find_panel_or_bridge(child,
644-
imx_ldb->lvds_mux ? 4 : 2, 0,
645-
&channel->panel, &channel->bridge);
646-
if (ret && ret != -ENODEV)
647-
goto free_child;
628+
channel->bridge = devm_drm_of_get_bridge(dev, child,
629+
imx_ldb->lvds_mux ? 4 : 2, 0);
630+
if (IS_ERR(channel->bridge)) {
631+
ret = PTR_ERR(channel->bridge);
632+
if (ret != -ENODEV)
633+
goto free_child;
634+
635+
channel->bridge = NULL;
648636

649-
if (!channel->bridge && !channel->panel) {
650637
ret = of_get_drm_display_mode(child,
651638
&channel->mode,
652639
&channel->bus_flags,
@@ -658,15 +645,12 @@ static int imx_ldb_probe(struct platform_device *pdev)
658645
}
659646

660647
bus_format = of_get_bus_format(dev, child);
661-
if (bus_format == -EINVAL) {
662-
/*
663-
* If no bus format was specified in the device tree,
664-
* we can still get it from the connected panel later.
665-
*/
666-
if (channel->panel && channel->panel->funcs &&
667-
channel->panel->funcs->get_modes)
668-
bus_format = 0;
669-
}
648+
/*
649+
* If no bus format was specified in the device tree,
650+
* we can still get it from the connected panel later.
651+
*/
652+
if (bus_format == -EINVAL && channel->bridge)
653+
bus_format = 0;
670654
if (bus_format < 0) {
671655
dev_err(dev, "could not determine data mapping: %d\n",
672656
bus_format);

0 commit comments

Comments
 (0)