Commit ec97f371 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dsi: do not store internal bridge pointer

Since the driver was switched to devm_drm_bridge_add(), there is no need
anymore to store the created bridge instance in struct msm_dsi. Drop
this field and pass data directly.
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/561693/
Link: https://lore.kernel.org/r/20231009205727.2781802-2-dmitry.baryshkov@linaro.org
parent 41c177cf
...@@ -216,6 +216,7 @@ void __exit msm_dsi_unregister(void) ...@@ -216,6 +216,7 @@ void __exit msm_dsi_unregister(void)
int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct drm_bridge *bridge;
int ret; int ret;
msm_dsi->dev = dev; msm_dsi->dev = dev;
...@@ -237,13 +238,14 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, ...@@ -237,13 +238,14 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
msm_dsi->encoder = encoder; msm_dsi->encoder = encoder;
ret = msm_dsi_manager_bridge_init(msm_dsi); bridge = msm_dsi_manager_bridge_init(msm_dsi);
if (ret) { if (IS_ERR(bridge)) {
ret = PTR_ERR(bridge);
DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret); DRM_DEV_ERROR(dev->dev, "failed to create dsi bridge: %d\n", ret);
return ret; return ret;
} }
ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id); ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id, bridge);
if (ret) { if (ret) {
DRM_DEV_ERROR(dev->dev, DRM_DEV_ERROR(dev->dev,
"failed to create dsi connector: %d\n", ret); "failed to create dsi connector: %d\n", ret);
......
...@@ -35,9 +35,6 @@ struct msm_dsi { ...@@ -35,9 +35,6 @@ struct msm_dsi {
struct drm_device *dev; struct drm_device *dev;
struct platform_device *pdev; struct platform_device *pdev;
/* internal dsi bridge attached to MDP interface */
struct drm_bridge *bridge;
struct mipi_dsi_host *host; struct mipi_dsi_host *host;
struct msm_dsi_phy *phy; struct msm_dsi_phy *phy;
...@@ -56,8 +53,8 @@ struct msm_dsi { ...@@ -56,8 +53,8 @@ struct msm_dsi {
}; };
/* dsi manager */ /* dsi manager */
int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi); struct drm_bridge *msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi);
int msm_dsi_manager_ext_bridge_init(u8 id); int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge);
int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg);
bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len);
int msm_dsi_manager_register(struct msm_dsi *msm_dsi); int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
......
...@@ -466,9 +466,9 @@ static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = { ...@@ -466,9 +466,9 @@ static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = {
}; };
/* initialize bridge */ /* initialize bridge */
int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi) struct drm_bridge *msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi)
{ {
struct drm_bridge *bridge = NULL; struct drm_bridge *bridge;
struct dsi_bridge *dsi_bridge; struct dsi_bridge *dsi_bridge;
struct drm_encoder *encoder; struct drm_encoder *encoder;
int ret; int ret;
...@@ -476,7 +476,7 @@ int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi) ...@@ -476,7 +476,7 @@ int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi)
dsi_bridge = devm_kzalloc(msm_dsi->dev->dev, dsi_bridge = devm_kzalloc(msm_dsi->dev->dev,
sizeof(*dsi_bridge), GFP_KERNEL); sizeof(*dsi_bridge), GFP_KERNEL);
if (!dsi_bridge) if (!dsi_bridge)
return -ENOMEM; return ERR_PTR(-ENOMEM);
dsi_bridge->id = msm_dsi->id; dsi_bridge->id = msm_dsi->id;
...@@ -487,26 +487,23 @@ int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi) ...@@ -487,26 +487,23 @@ int msm_dsi_manager_bridge_init(struct msm_dsi *msm_dsi)
ret = devm_drm_bridge_add(msm_dsi->dev->dev, bridge); ret = devm_drm_bridge_add(msm_dsi->dev->dev, bridge);
if (ret) if (ret)
return ret; return ERR_PTR(ret);
ret = drm_bridge_attach(encoder, bridge, NULL, 0); ret = drm_bridge_attach(encoder, bridge, NULL, 0);
if (ret) if (ret)
return ret; return ERR_PTR(ret);
msm_dsi->bridge = bridge; return bridge;
return 0;
} }
int msm_dsi_manager_ext_bridge_init(u8 id) int msm_dsi_manager_ext_bridge_init(u8 id, struct drm_bridge *int_bridge)
{ {
struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
struct drm_device *dev = msm_dsi->dev; struct drm_device *dev = msm_dsi->dev;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_bridge *int_bridge, *ext_bridge; struct drm_bridge *ext_bridge;
int ret; int ret;
int_bridge = msm_dsi->bridge;
ext_bridge = devm_drm_of_get_bridge(&msm_dsi->pdev->dev, ext_bridge = devm_drm_of_get_bridge(&msm_dsi->pdev->dev,
msm_dsi->pdev->dev.of_node, 1, 0); msm_dsi->pdev->dev.of_node, 1, 0);
if (IS_ERR(ext_bridge)) if (IS_ERR(ext_bridge))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment