Commit bb3de286 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Rob Clark

drm/msm/dp: Support up to 3 DP controllers

Based on the removal of the g_dp_display and the movement of the
priv->dp lookup into the DP code it's now possible to have multiple
DP instances.

In line with the other controllers in the MSM driver, introduce a
per-compatible list of base addresses which is used to resolve the
"instance id" for the given DP controller. This instance id is used as
index in the priv->dp[] array.

Then extend the initialization code to initialize struct drm_encoder for
each of the registered priv->dp[] and update the logic for associating
each struct msm_dp with the struct dpu_encoder_virt.

A new enum is introduced to document the connection between the
instances referenced in the dpu_intf_cfg array and the controllers in
the DP driver and sc7180 is updated.

Lastly, bump the number of struct msm_dp instances carries by priv->dp
to 3, the currently known maximum number of controllers found in a
Qualcomm SoC.
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20211016221843.2167329-6-bjorn.andersson@linaro.orgSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 4b296d15
...@@ -2165,7 +2165,7 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, ...@@ -2165,7 +2165,7 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc,
dpu_encoder_vsync_event_handler, dpu_encoder_vsync_event_handler,
0); 0);
else if (disp_info->intf_type == DRM_MODE_ENCODER_TMDS) else if (disp_info->intf_type == DRM_MODE_ENCODER_TMDS)
dpu_enc->dp = priv->dp; dpu_enc->dp = priv->dp[disp_info->h_tile_instance[0]];
INIT_DELAYED_WORK(&dpu_enc->delayed_off_work, INIT_DELAYED_WORK(&dpu_enc->delayed_off_work,
dpu_encoder_off_work); dpu_encoder_off_work);
......
...@@ -844,7 +844,7 @@ static const struct dpu_intf_cfg sdm845_intf[] = { ...@@ -844,7 +844,7 @@ static const struct dpu_intf_cfg sdm845_intf[] = {
}; };
static const struct dpu_intf_cfg sc7180_intf[] = { static const struct dpu_intf_cfg sc7180_intf[] = {
INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 24, 25), INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, MSM_DP_CONTROLLER_0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 24, 25),
INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 26, 27), INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 26, 27),
}; };
......
...@@ -188,6 +188,7 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) ...@@ -188,6 +188,7 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
struct dentry *entry; struct dentry *entry;
struct drm_device *dev; struct drm_device *dev;
struct msm_drm_private *priv; struct msm_drm_private *priv;
int i;
if (!p) if (!p)
return -EINVAL; return -EINVAL;
...@@ -203,8 +204,10 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) ...@@ -203,8 +204,10 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
dpu_debugfs_vbif_init(dpu_kms, entry); dpu_debugfs_vbif_init(dpu_kms, entry);
dpu_debugfs_core_irq_init(dpu_kms, entry); dpu_debugfs_core_irq_init(dpu_kms, entry);
if (priv->dp) for (i = 0; i < ARRAY_SIZE(priv->dp); i++) {
msm_dp_debugfs_init(priv->dp, minor); if (priv->dp[i])
msm_dp_debugfs_init(priv->dp[i], minor);
}
return dpu_core_perf_debugfs_init(dpu_kms, entry); return dpu_core_perf_debugfs_init(dpu_kms, entry);
} }
...@@ -544,10 +547,12 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, ...@@ -544,10 +547,12 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,
{ {
struct drm_encoder *encoder = NULL; struct drm_encoder *encoder = NULL;
struct msm_display_info info; struct msm_display_info info;
int rc = 0; int rc;
int i;
if (!priv->dp) for (i = 0; i < ARRAY_SIZE(priv->dp); i++) {
return rc; if (!priv->dp[i])
continue;
encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS); encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
if (IS_ERR(encoder)) { if (IS_ERR(encoder)) {
...@@ -556,7 +561,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, ...@@ -556,7 +561,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,
} }
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
rc = msm_dp_modeset_init(priv->dp, dev, encoder); rc = msm_dp_modeset_init(priv->dp[i], dev, encoder);
if (rc) { if (rc) {
DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc); DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
...@@ -566,13 +571,18 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, ...@@ -566,13 +571,18 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,
priv->encoders[priv->num_encoders++] = encoder; priv->encoders[priv->num_encoders++] = encoder;
info.num_of_h_tiles = 1; info.num_of_h_tiles = 1;
info.h_tile_instance[0] = i;
info.capabilities = MSM_DISPLAY_CAP_VID_MODE; info.capabilities = MSM_DISPLAY_CAP_VID_MODE;
info.intf_type = encoder->encoder_type; info.intf_type = encoder->encoder_type;
rc = dpu_encoder_setup(dev, encoder, &info); rc = dpu_encoder_setup(dev, encoder, &info);
if (rc) if (rc) {
DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
encoder->base.id, rc); encoder->base.id, rc);
return rc; return rc;
}
}
return 0;
} }
/** /**
...@@ -792,6 +802,7 @@ static int dpu_irq_postinstall(struct msm_kms *kms) ...@@ -792,6 +802,7 @@ static int dpu_irq_postinstall(struct msm_kms *kms)
{ {
struct msm_drm_private *priv; struct msm_drm_private *priv;
struct dpu_kms *dpu_kms = to_dpu_kms(kms); struct dpu_kms *dpu_kms = to_dpu_kms(kms);
int i;
if (!dpu_kms || !dpu_kms->dev) if (!dpu_kms || !dpu_kms->dev)
return -EINVAL; return -EINVAL;
...@@ -800,7 +811,8 @@ static int dpu_irq_postinstall(struct msm_kms *kms) ...@@ -800,7 +811,8 @@ static int dpu_irq_postinstall(struct msm_kms *kms)
if (!priv) if (!priv)
return -EINVAL; return -EINVAL;
msm_dp_irq_postinstall(priv->dp); for (i = 0; i < ARRAY_SIZE(priv->dp); i++)
msm_dp_irq_postinstall(priv->dp[i]);
return 0; return 0;
} }
......
...@@ -126,8 +126,12 @@ void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state) ...@@ -126,8 +126,12 @@ void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state)
priv = drm_dev->dev_private; priv = drm_dev->dev_private;
kms = priv->kms; kms = priv->kms;
if (priv->dp) for (i = 0; i < ARRAY_SIZE(priv->dp); i++) {
msm_dp_snapshot(disp_state, priv->dp); if (!priv->dp[i])
continue;
msm_dp_snapshot(disp_state, priv->dp[i]);
}
for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
if (!priv->dsi[i]) if (!priv->dsi[i])
......
...@@ -79,6 +79,8 @@ struct dp_display_private { ...@@ -79,6 +79,8 @@ struct dp_display_private {
char *name; char *name;
int irq; int irq;
unsigned int id;
/* state variables */ /* state variables */
bool core_initialized; bool core_initialized;
bool hpd_irq_on; bool hpd_irq_on;
...@@ -128,7 +130,7 @@ struct msm_dp_config { ...@@ -128,7 +130,7 @@ struct msm_dp_config {
static const struct msm_dp_config sc7180_dp_cfg = { static const struct msm_dp_config sc7180_dp_cfg = {
.descs = (const struct msm_dp_desc[]) { .descs = (const struct msm_dp_desc[]) {
{ .io_start = 0x0ae90000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, [MSM_DP_CONTROLLER_0] = { .io_start = 0x0ae90000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort },
}, },
.num_descs = 1, .num_descs = 1,
}; };
...@@ -229,7 +231,7 @@ static int dp_display_bind(struct device *dev, struct device *master, ...@@ -229,7 +231,7 @@ static int dp_display_bind(struct device *dev, struct device *master,
dp->dp_display.drm_dev = drm; dp->dp_display.drm_dev = drm;
priv = drm->dev_private; priv = drm->dev_private;
priv->dp = &(dp->dp_display); priv->dp[dp->id] = &dp->dp_display;
rc = dp->parser->parse(dp->parser, dp->dp_display.connector_type); rc = dp->parser->parse(dp->parser, dp->dp_display.connector_type);
if (rc) { if (rc) {
...@@ -269,7 +271,7 @@ static void dp_display_unbind(struct device *dev, struct device *master, ...@@ -269,7 +271,7 @@ static void dp_display_unbind(struct device *dev, struct device *master,
dp_power_client_deinit(dp->power); dp_power_client_deinit(dp->power);
dp_aux_unregister(dp->aux); dp_aux_unregister(dp->aux);
priv->dp = NULL; priv->dp[dp->id] = NULL;
} }
static const struct component_ops dp_display_comp_ops = { static const struct component_ops dp_display_comp_ops = {
...@@ -1200,7 +1202,8 @@ int dp_display_request_irq(struct msm_dp *dp_display) ...@@ -1200,7 +1202,8 @@ int dp_display_request_irq(struct msm_dp *dp_display)
return 0; return 0;
} }
static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pdev) static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pdev,
unsigned int *id)
{ {
const struct msm_dp_config *cfg = of_device_get_match_data(&pdev->dev); const struct msm_dp_config *cfg = of_device_get_match_data(&pdev->dev);
struct resource *res; struct resource *res;
...@@ -1210,9 +1213,12 @@ static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pde ...@@ -1210,9 +1213,12 @@ static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pde
if (!res) if (!res)
return NULL; return NULL;
for (i = 0; i < cfg->num_descs; i++) for (i = 0; i < cfg->num_descs; i++) {
if (cfg->descs[i].io_start == res->start) if (cfg->descs[i].io_start == res->start) {
*id = i;
return &cfg->descs[i]; return &cfg->descs[i];
}
}
dev_err(&pdev->dev, "unknown displayport instance\n"); dev_err(&pdev->dev, "unknown displayport instance\n");
return NULL; return NULL;
...@@ -1233,7 +1239,7 @@ static int dp_display_probe(struct platform_device *pdev) ...@@ -1233,7 +1239,7 @@ static int dp_display_probe(struct platform_device *pdev)
if (!dp) if (!dp)
return -ENOMEM; return -ENOMEM;
desc = dp_display_get_desc(pdev); desc = dp_display_get_desc(pdev, &dp->id);
if (!desc) if (!desc)
return -EINVAL; return -EINVAL;
......
...@@ -60,6 +60,13 @@ enum msm_mdp_plane_property { ...@@ -60,6 +60,13 @@ enum msm_mdp_plane_property {
PLANE_PROP_MAX_NUM PLANE_PROP_MAX_NUM
}; };
enum msm_dp_controller {
MSM_DP_CONTROLLER_0,
MSM_DP_CONTROLLER_1,
MSM_DP_CONTROLLER_2,
MSM_DP_CONTROLLER_COUNT,
};
#define MSM_GPU_MAX_RINGS 4 #define MSM_GPU_MAX_RINGS 4
#define MAX_H_TILES_PER_DISPLAY 2 #define MAX_H_TILES_PER_DISPLAY 2
...@@ -153,7 +160,7 @@ struct msm_drm_private { ...@@ -153,7 +160,7 @@ struct msm_drm_private {
/* DSI is shared by mdp4 and mdp5 */ /* DSI is shared by mdp4 and mdp5 */
struct msm_dsi *dsi[2]; struct msm_dsi *dsi[2];
struct msm_dp *dp; struct msm_dp *dp[MSM_DP_CONTROLLER_COUNT];
/* when we have more than one 'msm_gpu' these need to be an array: */ /* when we have more than one 'msm_gpu' these need to be an array: */
struct msm_gpu *gpu; struct msm_gpu *gpu;
......
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