mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
drm/rockchip: analogix_dp: Add support for external bridge
The current output code only supports connection to drm panels. Add code to support drm bridge, to support connections to external connectors. Change-Id: I775244b7183692f07b74123fa43c8bb958525087 Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
This commit is contained in:
@@ -65,6 +65,7 @@ struct rockchip_dp_device {
|
||||
struct drm_device *drm_dev;
|
||||
struct device *dev;
|
||||
struct drm_encoder encoder;
|
||||
struct drm_bridge *bridge;
|
||||
struct drm_display_mode mode;
|
||||
|
||||
struct regmap *grf;
|
||||
@@ -165,6 +166,24 @@ static int rockchip_dp_get_modes(struct analogix_dp_plat_data *plat_data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rockchip_dp_bridge_attach(struct analogix_dp_plat_data *plat_data,
|
||||
struct drm_bridge *bridge,
|
||||
struct drm_connector *connector)
|
||||
{
|
||||
struct rockchip_dp_device *dp = to_dp(plat_data);
|
||||
int ret;
|
||||
|
||||
if (dp->bridge) {
|
||||
ret = drm_bridge_attach(&dp->encoder, dp->bridge, bridge, 0);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to attach bridge to drm: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
rockchip_dp_drm_encoder_mode_fixup(struct drm_encoder *encoder,
|
||||
const struct drm_display_mode *mode,
|
||||
@@ -418,6 +437,7 @@ static int rockchip_dp_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct rockchip_dp_chip_data *dp_data;
|
||||
struct drm_panel *panel = NULL;
|
||||
struct drm_bridge *bridge = NULL;
|
||||
struct rockchip_dp_device *dp;
|
||||
int ret;
|
||||
|
||||
@@ -425,7 +445,7 @@ static int rockchip_dp_probe(struct platform_device *pdev)
|
||||
if (!dp_data)
|
||||
return -ENODEV;
|
||||
|
||||
ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL);
|
||||
ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, &bridge);
|
||||
if (ret < 0 && ret != -ENODEV)
|
||||
return ret;
|
||||
|
||||
@@ -442,6 +462,9 @@ static int rockchip_dp_probe(struct platform_device *pdev)
|
||||
dp->plat_data.power_on_start = rockchip_dp_poweron_start;
|
||||
dp->plat_data.power_off = rockchip_dp_powerdown;
|
||||
dp->plat_data.get_modes = rockchip_dp_get_modes;
|
||||
dp->plat_data.attach = rockchip_dp_bridge_attach;
|
||||
dp->plat_data.skip_connector = !!bridge;
|
||||
dp->bridge = bridge;
|
||||
|
||||
ret = rockchip_dp_of_probe(dp);
|
||||
if (ret < 0)
|
||||
|
||||
Reference in New Issue
Block a user