Commit 007ac026 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Rob Clark

drm/msm/dsi: switch to DRM_PANEL_BRIDGE

Currently the DSI driver has two separate paths: one if the next device
in a chain is a bridge and another one if the panel is connected
directly to the DSI host. Simplify the code path by using panel-bridge
driver (already selected in Kconfig) and dropping support for
handling the panel 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/493608/
Link: https://lore.kernel.org/r/20220712132258.671263-1-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 549eae27
...@@ -6,14 +6,6 @@ ...@@ -6,14 +6,6 @@
#include "dsi.h" #include "dsi.h"
#include "dsi_cfg.h" #include "dsi_cfg.h"
struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi)
{
if (!msm_dsi || !msm_dsi_device_connected(msm_dsi))
return NULL;
return msm_dsi->encoder;
}
bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi) bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
{ {
unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host);
...@@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, ...@@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct msm_drm_private *priv; struct msm_drm_private *priv;
struct drm_bridge *ext_bridge;
int ret; int ret;
if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev)) if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev))
...@@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, ...@@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
goto fail; goto fail;
} }
/* ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id);
* check if the dsi encoder output is connected to a panel or an if (ret) {
* external bridge. We create a connector only if we're connected to a
* drm_panel device. When we're connected to an external bridge, we
* assume that the drm_bridge driver will create the connector itself.
*/
ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host);
if (ext_bridge)
msm_dsi->connector =
msm_dsi_manager_ext_bridge_init(msm_dsi->id);
else
msm_dsi->connector =
msm_dsi_manager_connector_init(msm_dsi->id);
if (IS_ERR(msm_dsi->connector)) {
ret = PTR_ERR(msm_dsi->connector);
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);
msm_dsi->connector = NULL;
goto fail; goto fail;
} }
...@@ -287,12 +262,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, ...@@ -287,12 +262,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
msm_dsi->bridge = NULL; msm_dsi->bridge = NULL;
} }
/* don't destroy connector if we didn't make it */
if (msm_dsi->connector && !msm_dsi->external_bridge)
msm_dsi->connector->funcs->destroy(msm_dsi->connector);
msm_dsi->connector = NULL;
return ret; return ret;
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <drm/drm_bridge.h> #include <drm/drm_bridge.h>
#include <drm/drm_crtc.h> #include <drm/drm_crtc.h>
#include <drm/drm_mipi_dsi.h> #include <drm/drm_mipi_dsi.h>
#include <drm/drm_panel.h>
#include "msm_drv.h" #include "msm_drv.h"
#include "disp/msm_disp_snapshot.h" #include "disp/msm_disp_snapshot.h"
...@@ -36,8 +35,6 @@ struct msm_dsi { ...@@ -36,8 +35,6 @@ struct msm_dsi {
struct drm_device *dev; struct drm_device *dev;
struct platform_device *pdev; struct platform_device *pdev;
/* connector managed by us when we're connected to a drm_panel */
struct drm_connector *connector;
/* internal dsi bridge attached to MDP interface */ /* internal dsi bridge attached to MDP interface */
struct drm_bridge *bridge; struct drm_bridge *bridge;
...@@ -45,10 +42,8 @@ struct msm_dsi { ...@@ -45,10 +42,8 @@ struct msm_dsi {
struct msm_dsi_phy *phy; struct msm_dsi_phy *phy;
/* /*
* panel/external_bridge connected to dsi bridge output, only one of the * external_bridge connected to dsi bridge output
* two can be valid at a time
*/ */
struct drm_panel *panel;
struct drm_bridge *external_bridge; struct drm_bridge *external_bridge;
struct device *phy_dev; struct device *phy_dev;
...@@ -63,8 +58,7 @@ struct msm_dsi { ...@@ -63,8 +58,7 @@ struct msm_dsi {
/* dsi manager */ /* dsi manager */
struct drm_bridge *msm_dsi_manager_bridge_init(u8 id); struct drm_bridge *msm_dsi_manager_bridge_init(u8 id);
void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge); void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge);
struct drm_connector *msm_dsi_manager_connector_init(u8 id); int msm_dsi_manager_ext_bridge_init(u8 id);
struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id);
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);
...@@ -74,11 +68,9 @@ void msm_dsi_manager_tpg_enable(void); ...@@ -74,11 +68,9 @@ void msm_dsi_manager_tpg_enable(void);
/* msm dsi */ /* msm dsi */
static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi) static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi)
{ {
return msm_dsi->panel || msm_dsi->external_bridge; return msm_dsi->external_bridge;
} }
struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi);
/* dsi host */ /* dsi host */
struct msm_dsi_host; struct msm_dsi_host;
int msm_dsi_host_xfer_prepare(struct mipi_dsi_host *host, int msm_dsi_host_xfer_prepare(struct mipi_dsi_host *host,
...@@ -103,9 +95,7 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, ...@@ -103,9 +95,7 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
const struct drm_display_mode *mode); const struct drm_display_mode *mode);
enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host, enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,
const struct drm_display_mode *mode); const struct drm_display_mode *mode);
struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host);
unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host); unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host);
struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host);
int msm_dsi_host_register(struct mipi_dsi_host *host); int msm_dsi_host_register(struct mipi_dsi_host *host);
void msm_dsi_host_unregister(struct mipi_dsi_host *host); void msm_dsi_host_unregister(struct mipi_dsi_host *host);
void msm_dsi_host_set_phy_mode(struct mipi_dsi_host *host, void msm_dsi_host_set_phy_mode(struct mipi_dsi_host *host,
......
...@@ -163,7 +163,6 @@ struct msm_dsi_host { ...@@ -163,7 +163,6 @@ struct msm_dsi_host {
struct drm_dsc_config *dsc; struct drm_dsc_config *dsc;
/* connected device info */ /* connected device info */
struct device_node *device_node;
unsigned int channel; unsigned int channel;
unsigned int lanes; unsigned int lanes;
enum mipi_dsi_pixel_format format; enum mipi_dsi_pixel_format format;
...@@ -1628,8 +1627,6 @@ static int dsi_host_detach(struct mipi_dsi_host *host, ...@@ -1628,8 +1627,6 @@ static int dsi_host_detach(struct mipi_dsi_host *host,
dsi_dev_detach(msm_host->pdev); dsi_dev_detach(msm_host->pdev);
msm_host->device_node = NULL;
DBG("id=%d", msm_host->id); DBG("id=%d", msm_host->id);
return 0; return 0;
...@@ -1893,16 +1890,6 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host) ...@@ -1893,16 +1890,6 @@ static int dsi_host_parse_dt(struct msm_dsi_host *msm_host)
goto err; goto err;
} }
/* Get panel node from the output port's endpoint data */
device_node = of_graph_get_remote_node(np, 1, 0);
if (!device_node) {
DRM_DEV_DEBUG(dev, "%s: no valid device\n", __func__);
ret = -ENODEV;
goto err;
}
msm_host->device_node = device_node;
if (of_property_read_bool(np, "syscon-sfpb")) { if (of_property_read_bool(np, "syscon-sfpb")) {
msm_host->sfpb = syscon_regmap_lookup_by_phandle(np, msm_host->sfpb = syscon_regmap_lookup_by_phandle(np,
"syscon-sfpb"); "syscon-sfpb");
...@@ -2587,23 +2574,11 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host, ...@@ -2587,23 +2574,11 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host,
return MODE_OK; return MODE_OK;
} }
struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host)
{
return of_drm_find_panel(to_msm_dsi_host(host)->device_node);
}
unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host) unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host)
{ {
return to_msm_dsi_host(host)->mode_flags; return to_msm_dsi_host(host)->mode_flags;
} }
struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host)
{
struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
return of_drm_find_bridge(msm_host->device_node);
}
void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host) void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_host *host)
{ {
struct msm_dsi_host *msm_host = to_msm_dsi_host(host); struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
......
This diff is collapsed.
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