mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
drm/imx: parallel-display: switch to drm_panel_bridge
Defer panel handling to drm_panel_bridge, unifying codepaths for the panel and bridge cases. Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Tested-by: Chris Healy <cphealy@gmail.com> Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # on imx6q-nitrogen6x Link: https://patchwork.freedesktop.org/patch/msgid/20240602-drm-imx-cleanup-v3-8-e549e2a43100@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
parent
5c5843b20b
commit
5f6e56d331
|
|
@ -11,8 +11,9 @@ config DRM_IMX
|
||||||
|
|
||||||
config DRM_IMX_PARALLEL_DISPLAY
|
config DRM_IMX_PARALLEL_DISPLAY
|
||||||
tristate "Support for parallel displays"
|
tristate "Support for parallel displays"
|
||||||
select DRM_PANEL
|
|
||||||
depends on DRM_IMX
|
depends on DRM_IMX
|
||||||
|
select DRM_BRIDGE
|
||||||
|
select DRM_PANEL_BRIDGE
|
||||||
select VIDEOMODE_HELPERS
|
select VIDEOMODE_HELPERS
|
||||||
|
|
||||||
config DRM_IMX_TVE
|
config DRM_IMX_TVE
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
#include <drm/drm_bridge.h>
|
#include <drm/drm_bridge.h>
|
||||||
#include <drm/drm_managed.h>
|
#include <drm/drm_managed.h>
|
||||||
#include <drm/drm_of.h>
|
#include <drm/drm_of.h>
|
||||||
#include <drm/drm_panel.h>
|
|
||||||
#include <drm/drm_probe_helper.h>
|
#include <drm/drm_probe_helper.h>
|
||||||
#include <drm/drm_simple_kms_helper.h>
|
#include <drm/drm_simple_kms_helper.h>
|
||||||
|
|
||||||
|
|
@ -36,7 +35,6 @@ struct imx_parallel_display {
|
||||||
u32 bus_format;
|
u32 bus_format;
|
||||||
u32 bus_flags;
|
u32 bus_flags;
|
||||||
struct drm_display_mode mode;
|
struct drm_display_mode mode;
|
||||||
struct drm_panel *panel;
|
|
||||||
struct drm_bridge *next_bridge;
|
struct drm_bridge *next_bridge;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -56,10 +54,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
|
||||||
struct device_node *np = imxpd->dev->of_node;
|
struct device_node *np = imxpd->dev->of_node;
|
||||||
int num_modes;
|
int num_modes;
|
||||||
|
|
||||||
num_modes = drm_panel_get_modes(imxpd->panel, connector);
|
|
||||||
if (num_modes > 0)
|
|
||||||
return num_modes;
|
|
||||||
|
|
||||||
if (np) {
|
if (np) {
|
||||||
struct drm_display_mode *mode = drm_mode_create(connector->dev);
|
struct drm_display_mode *mode = drm_mode_create(connector->dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -84,22 +78,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
|
||||||
return num_modes;
|
return num_modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void imx_pd_bridge_enable(struct drm_bridge *bridge)
|
|
||||||
{
|
|
||||||
struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge);
|
|
||||||
|
|
||||||
drm_panel_prepare(imxpd->panel);
|
|
||||||
drm_panel_enable(imxpd->panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void imx_pd_bridge_disable(struct drm_bridge *bridge)
|
|
||||||
{
|
|
||||||
struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge);
|
|
||||||
|
|
||||||
drm_panel_disable(imxpd->panel);
|
|
||||||
drm_panel_unprepare(imxpd->panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const u32 imx_pd_bus_fmts[] = {
|
static const u32 imx_pd_bus_fmts[] = {
|
||||||
MEDIA_BUS_FMT_RGB888_1X24,
|
MEDIA_BUS_FMT_RGB888_1X24,
|
||||||
MEDIA_BUS_FMT_BGR888_1X24,
|
MEDIA_BUS_FMT_BGR888_1X24,
|
||||||
|
|
@ -237,8 +215,6 @@ static const struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct drm_bridge_funcs imx_pd_bridge_funcs = {
|
static const struct drm_bridge_funcs imx_pd_bridge_funcs = {
|
||||||
.enable = imx_pd_bridge_enable,
|
|
||||||
.disable = imx_pd_bridge_disable,
|
|
||||||
.atomic_reset = drm_atomic_helper_bridge_reset,
|
.atomic_reset = drm_atomic_helper_bridge_reset,
|
||||||
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
|
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
|
||||||
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
|
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
|
||||||
|
|
@ -315,10 +291,14 @@ static int imx_pd_probe(struct platform_device *pdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* port@1 is the output port */
|
/* port@1 is the output port */
|
||||||
ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel,
|
imxpd->next_bridge = devm_drm_of_get_bridge(dev, np, 1, 0);
|
||||||
&imxpd->next_bridge);
|
if (IS_ERR(imxpd->next_bridge)) {
|
||||||
if (ret && ret != -ENODEV)
|
ret = PTR_ERR(imxpd->next_bridge);
|
||||||
return ret;
|
if (ret != -ENODEV)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
imxpd->next_bridge = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ret = of_property_read_string(np, "interface-pix-fmt", &fmt);
|
ret = of_property_read_string(np, "interface-pix-fmt", &fmt);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user