mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
drm/bridge: Move legacy bridge driver out of imx directory for multi-platform use
As suggested by Dmitry, the DRM legacy bridge driver can be pulled out of imx/ subdir for multi-platform use. The driver is also renamed to make it more generic and suitable for platforms other than i.MX. Signed-off-by: Damon Ding <damon.ding@rock-chips.com> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Heiko Stuebner <heiko@sntech.de> # rk3588 Link: https://patch.msgid.link/20260409065301.446670-3-damon.ding@rock-chips.com Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
parent
d842ed8f34
commit
ba2db93cf3
|
|
@ -262,6 +262,16 @@ config DRM_NXP_PTN3460
|
||||||
help
|
help
|
||||||
NXP PTN3460 eDP-LVDS bridge chip driver.
|
NXP PTN3460 eDP-LVDS bridge chip driver.
|
||||||
|
|
||||||
|
config DRM_OF_DISPLAY_MODE_BRIDGE
|
||||||
|
tristate
|
||||||
|
depends on DRM_BRIDGE && OF
|
||||||
|
help
|
||||||
|
This is a DRM bridge implementation that uses of_get_drm_display_mode
|
||||||
|
to acquire display mode.
|
||||||
|
|
||||||
|
It exists for compatibility with legacy display mode parsing, in order
|
||||||
|
to conform to the panel-bridge framework.
|
||||||
|
|
||||||
config DRM_PARADE_PS8622
|
config DRM_PARADE_PS8622
|
||||||
tristate "Parade eDP/LVDS bridge"
|
tristate "Parade eDP/LVDS bridge"
|
||||||
depends on OF
|
depends on OF
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
|
||||||
obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o
|
obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o
|
||||||
obj-$(CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER) += microchip-lvds.o
|
obj-$(CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER) += microchip-lvds.o
|
||||||
obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
|
obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
|
||||||
|
obj-$(CONFIG_DRM_OF_DISPLAY_MODE_BRIDGE) += of-display-mode-bridge.o
|
||||||
obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
|
obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
|
||||||
obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
|
obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o
|
||||||
obj-$(CONFIG_DRM_SAMSUNG_DSIM) += samsung-dsim.o
|
obj-$(CONFIG_DRM_SAMSUNG_DSIM) += samsung-dsim.o
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,6 @@ if ARCH_MXC || COMPILE_TEST
|
||||||
config DRM_IMX_LDB_HELPER
|
config DRM_IMX_LDB_HELPER
|
||||||
tristate
|
tristate
|
||||||
|
|
||||||
config DRM_IMX_LEGACY_BRIDGE
|
|
||||||
tristate
|
|
||||||
depends on DRM_IMX
|
|
||||||
help
|
|
||||||
This is a DRM bridge implementation for the DRM i.MX IPUv3 driver,
|
|
||||||
that uses of_get_drm_display_mode to acquire display mode.
|
|
||||||
|
|
||||||
Newer designs should not use this bridge and should use proper panel
|
|
||||||
driver instead.
|
|
||||||
|
|
||||||
config DRM_IMX8MP_DW_HDMI_BRIDGE
|
config DRM_IMX8MP_DW_HDMI_BRIDGE
|
||||||
tristate "Freescale i.MX8MP HDMI-TX bridge support"
|
tristate "Freescale i.MX8MP HDMI-TX bridge support"
|
||||||
depends on OF
|
depends on OF
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
|
obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
|
||||||
obj-$(CONFIG_DRM_IMX_LEGACY_BRIDGE) += imx-legacy-bridge.o
|
|
||||||
obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
|
obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
|
||||||
obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) += imx8mp-hdmi-pai.o
|
obj-$(CONFIG_DRM_IMX8MP_HDMI_PAI) += imx8mp-hdmi-pai.o
|
||||||
obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
|
obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
|
||||||
|
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0+
|
|
||||||
/*
|
|
||||||
* Freescale i.MX drm driver
|
|
||||||
*
|
|
||||||
* bridge driver for legacy DT bindings, utilizing display-timings node
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <linux/export.h>
|
|
||||||
|
|
||||||
#include <drm/drm_bridge.h>
|
|
||||||
#include <drm/drm_modes.h>
|
|
||||||
#include <drm/drm_probe_helper.h>
|
|
||||||
#include <drm/bridge/imx.h>
|
|
||||||
|
|
||||||
#include <video/of_display_timing.h>
|
|
||||||
#include <video/of_videomode.h>
|
|
||||||
|
|
||||||
struct imx_legacy_bridge {
|
|
||||||
struct drm_bridge base;
|
|
||||||
|
|
||||||
struct drm_display_mode mode;
|
|
||||||
u32 bus_flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define to_imx_legacy_bridge(bridge) container_of(bridge, struct imx_legacy_bridge, base)
|
|
||||||
|
|
||||||
static int imx_legacy_bridge_attach(struct drm_bridge *bridge,
|
|
||||||
struct drm_encoder *encoder,
|
|
||||||
enum drm_bridge_attach_flags flags)
|
|
||||||
{
|
|
||||||
if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int imx_legacy_bridge_get_modes(struct drm_bridge *bridge,
|
|
||||||
struct drm_connector *connector)
|
|
||||||
{
|
|
||||||
struct imx_legacy_bridge *imx_bridge = to_imx_legacy_bridge(bridge);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = drm_connector_helper_get_modes_fixed(connector, &imx_bridge->mode);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
connector->display_info.bus_flags = imx_bridge->bus_flags;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct drm_bridge_funcs imx_legacy_bridge_funcs = {
|
|
||||||
.attach = imx_legacy_bridge_attach,
|
|
||||||
.get_modes = imx_legacy_bridge_get_modes,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct drm_bridge *devm_imx_drm_legacy_bridge(struct device *dev,
|
|
||||||
struct device_node *np,
|
|
||||||
int type)
|
|
||||||
{
|
|
||||||
struct imx_legacy_bridge *imx_bridge;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
imx_bridge = devm_drm_bridge_alloc(dev, struct imx_legacy_bridge,
|
|
||||||
base, &imx_legacy_bridge_funcs);
|
|
||||||
if (IS_ERR(imx_bridge))
|
|
||||||
return ERR_CAST(imx_bridge);
|
|
||||||
|
|
||||||
ret = of_get_drm_display_mode(np,
|
|
||||||
&imx_bridge->mode,
|
|
||||||
&imx_bridge->bus_flags,
|
|
||||||
OF_USE_NATIVE_MODE);
|
|
||||||
if (ret)
|
|
||||||
return ERR_PTR(ret);
|
|
||||||
|
|
||||||
imx_bridge->mode.type |= DRM_MODE_TYPE_DRIVER;
|
|
||||||
|
|
||||||
imx_bridge->base.of_node = np;
|
|
||||||
imx_bridge->base.ops = DRM_BRIDGE_OP_MODES;
|
|
||||||
imx_bridge->base.type = type;
|
|
||||||
|
|
||||||
ret = devm_drm_bridge_add(dev, &imx_bridge->base);
|
|
||||||
if (ret)
|
|
||||||
return ERR_PTR(ret);
|
|
||||||
|
|
||||||
return &imx_bridge->base;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(devm_imx_drm_legacy_bridge);
|
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
|
||||||
MODULE_DESCRIPTION("Freescale i.MX DRM bridge driver for legacy DT bindings");
|
|
||||||
93
drivers/gpu/drm/bridge/of-display-mode-bridge.c
Normal file
93
drivers/gpu/drm/bridge/of-display-mode-bridge.c
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 Sascha Hauer, Pengutronix
|
||||||
|
*
|
||||||
|
* bridge driver for legacy DT bindings, utilizing display-timings node
|
||||||
|
*
|
||||||
|
* Author: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/export.h>
|
||||||
|
|
||||||
|
#include <drm/drm_bridge.h>
|
||||||
|
#include <drm/drm_modes.h>
|
||||||
|
#include <drm/drm_probe_helper.h>
|
||||||
|
#include <drm/bridge/of-display-mode-bridge.h>
|
||||||
|
|
||||||
|
#include <video/of_display_timing.h>
|
||||||
|
#include <video/of_videomode.h>
|
||||||
|
|
||||||
|
struct of_display_mode_bridge {
|
||||||
|
struct drm_bridge base;
|
||||||
|
|
||||||
|
struct drm_display_mode mode;
|
||||||
|
u32 bus_flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define to_of_display_mode_bridge(bridge) container_of(bridge, struct of_display_mode_bridge, base)
|
||||||
|
|
||||||
|
static int of_display_mode_bridge_attach(struct drm_bridge *bridge,
|
||||||
|
struct drm_encoder *encoder,
|
||||||
|
enum drm_bridge_attach_flags flags)
|
||||||
|
{
|
||||||
|
if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int of_display_mode_bridge_get_modes(struct drm_bridge *bridge,
|
||||||
|
struct drm_connector *connector)
|
||||||
|
{
|
||||||
|
struct of_display_mode_bridge *of_bridge = to_of_display_mode_bridge(bridge);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = drm_connector_helper_get_modes_fixed(connector, &of_bridge->mode);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
connector->display_info.bus_flags = of_bridge->bus_flags;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct drm_bridge_funcs of_display_mode_bridge_funcs = {
|
||||||
|
.attach = of_display_mode_bridge_attach,
|
||||||
|
.get_modes = of_display_mode_bridge_get_modes,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct drm_bridge *devm_drm_of_display_mode_bridge(struct device *dev,
|
||||||
|
struct device_node *np,
|
||||||
|
int type)
|
||||||
|
{
|
||||||
|
struct of_display_mode_bridge *of_bridge;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
of_bridge = devm_drm_bridge_alloc(dev, struct of_display_mode_bridge,
|
||||||
|
base, &of_display_mode_bridge_funcs);
|
||||||
|
if (IS_ERR(of_bridge))
|
||||||
|
return ERR_CAST(of_bridge);
|
||||||
|
|
||||||
|
ret = of_get_drm_display_mode(np,
|
||||||
|
&of_bridge->mode,
|
||||||
|
&of_bridge->bus_flags,
|
||||||
|
OF_USE_NATIVE_MODE);
|
||||||
|
if (ret)
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
|
||||||
|
of_bridge->mode.type |= DRM_MODE_TYPE_DRIVER;
|
||||||
|
|
||||||
|
of_bridge->base.of_node = np;
|
||||||
|
of_bridge->base.ops = DRM_BRIDGE_OP_MODES;
|
||||||
|
of_bridge->base.type = type;
|
||||||
|
|
||||||
|
ret = devm_drm_bridge_add(dev, &of_bridge->base);
|
||||||
|
if (ret)
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
|
||||||
|
return &of_bridge->base;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(devm_drm_of_display_mode_bridge);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_DESCRIPTION("DRM bridge driver for legacy DT bindings");
|
||||||
|
|
@ -16,7 +16,7 @@ config DRM_IMX_PARALLEL_DISPLAY
|
||||||
select DRM_BRIDGE
|
select DRM_BRIDGE
|
||||||
select DRM_BRIDGE_CONNECTOR
|
select DRM_BRIDGE_CONNECTOR
|
||||||
select DRM_DISPLAY_HELPER
|
select DRM_DISPLAY_HELPER
|
||||||
select DRM_IMX_LEGACY_BRIDGE
|
select DRM_OF_DISPLAY_MODE_BRIDGE
|
||||||
select DRM_PANEL_BRIDGE
|
select DRM_PANEL_BRIDGE
|
||||||
select VIDEOMODE_HELPERS
|
select VIDEOMODE_HELPERS
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ config DRM_IMX_LDB
|
||||||
select DRM_BRIDGE
|
select DRM_BRIDGE
|
||||||
select DRM_BRIDGE_CONNECTOR
|
select DRM_BRIDGE_CONNECTOR
|
||||||
select DRM_PANEL_BRIDGE
|
select DRM_PANEL_BRIDGE
|
||||||
select DRM_IMX_LEGACY_BRIDGE
|
select DRM_OF_DISPLAY_MODE_BRIDGE
|
||||||
help
|
help
|
||||||
Choose this to enable the internal LVDS Display Bridge (LDB)
|
Choose this to enable the internal LVDS Display Bridge (LDB)
|
||||||
found on i.MX53 and i.MX6 processors.
|
found on i.MX53 and i.MX6 processors.
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <drm/drm_print.h>
|
#include <drm/drm_print.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>
|
||||||
#include <drm/bridge/imx.h>
|
#include <drm/bridge/of-display-mode-bridge.h>
|
||||||
|
|
||||||
#include "imx-drm.h"
|
#include "imx-drm.h"
|
||||||
|
|
||||||
|
|
@ -605,8 +605,8 @@ static int imx_ldb_probe(struct platform_device *pdev)
|
||||||
* checking the bus_format property.
|
* checking the bus_format property.
|
||||||
*/
|
*/
|
||||||
if (!channel->bridge) {
|
if (!channel->bridge) {
|
||||||
channel->bridge = devm_imx_drm_legacy_bridge(dev, child,
|
channel->bridge = devm_drm_of_display_mode_bridge(dev, child,
|
||||||
DRM_MODE_CONNECTOR_LVDS);
|
DRM_MODE_CONNECTOR_LVDS);
|
||||||
if (IS_ERR(channel->bridge)) {
|
if (IS_ERR(channel->bridge)) {
|
||||||
ret = PTR_ERR(channel->bridge);
|
ret = PTR_ERR(channel->bridge);
|
||||||
goto free_child;
|
goto free_child;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include <drm/drm_of.h>
|
#include <drm/drm_of.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>
|
||||||
#include <drm/bridge/imx.h>
|
#include <drm/bridge/of-display-mode-bridge.h>
|
||||||
|
|
||||||
#include "imx-drm.h"
|
#include "imx-drm.h"
|
||||||
|
|
||||||
|
|
@ -242,7 +242,8 @@ static int imx_pd_probe(struct platform_device *pdev)
|
||||||
/* port@1 is the output port */
|
/* port@1 is the output port */
|
||||||
imxpd->next_bridge = devm_drm_of_get_bridge(dev, np, 1, 0);
|
imxpd->next_bridge = devm_drm_of_get_bridge(dev, np, 1, 0);
|
||||||
if (imxpd->next_bridge == ERR_PTR(-ENODEV))
|
if (imxpd->next_bridge == ERR_PTR(-ENODEV))
|
||||||
imxpd->next_bridge = devm_imx_drm_legacy_bridge(dev, np, DRM_MODE_CONNECTOR_DPI);
|
imxpd->next_bridge = devm_drm_of_display_mode_bridge(dev, np,
|
||||||
|
DRM_MODE_CONNECTOR_DPI);
|
||||||
if (IS_ERR(imxpd->next_bridge)) {
|
if (IS_ERR(imxpd->next_bridge)) {
|
||||||
ret = PTR_ERR(imxpd->next_bridge);
|
ret = PTR_ERR(imxpd->next_bridge);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0+
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2012 Sascha Hauer, Pengutronix
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DRM_IMX_BRIDGE_H
|
|
||||||
#define DRM_IMX_BRIDGE_H
|
|
||||||
|
|
||||||
struct device;
|
|
||||||
struct device_node;
|
|
||||||
struct drm_bridge;
|
|
||||||
|
|
||||||
struct drm_bridge *devm_imx_drm_legacy_bridge(struct device *dev,
|
|
||||||
struct device_node *np,
|
|
||||||
int type);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
17
include/drm/bridge/of-display-mode-bridge.h
Normal file
17
include/drm/bridge/of-display-mode-bridge.h
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 Sascha Hauer, Pengutronix
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DRM_OF_DISPLAY_MODE_BRIDGE_H
|
||||||
|
#define DRM_OF_DISPLAY_MODE_BRIDGE_H
|
||||||
|
|
||||||
|
struct device;
|
||||||
|
struct device_node;
|
||||||
|
struct drm_bridge;
|
||||||
|
|
||||||
|
struct drm_bridge *devm_drm_of_display_mode_bridge(struct device *dev,
|
||||||
|
struct device_node *np,
|
||||||
|
int type);
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user