Re: [PATCH v4 3/7] drm/msm/dp: Allow specifying connector_type per controller

From: Stephen Boyd
Date: Tue Oct 05 2021 - 20:15:37 EST


Quoting Bjorn Andersson (2021-10-05 16:13:19)
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 5d3ee5ef07c2..eaf08f9e7d87 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -115,8 +115,25 @@ struct dp_display_private {
> struct dp_audio *audio;
> };
>
> +struct msm_dp_desc {
> + phys_addr_t io_start;
> + int connector_type;
> +};
> +
> +struct msm_dp_config {
> + struct msm_dp_desc *descs;

const?

> + size_t num_descs;
> +};
> +
> +static const struct msm_dp_config sc7180_dp_cfg = {
> + .descs = (struct msm_dp_desc[]) {

const?

> + { .io_start = 0x0ae90000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort },
> + },
> + .num_descs = 1,
> +};
> +
> static const struct of_device_id dp_dt_match[] = {
> - {.compatible = "qcom,sc7180-dp"},
> + { .compatible = "qcom,sc7180-dp", .data = &sc7180_dp_cfg },
> {}
> };
>
> @@ -1180,10 +1197,29 @@ int dp_display_request_irq(struct msm_dp *dp_display)
> return 0;
> }
>
> +static struct msm_dp_desc *dp_display_get_desc(struct platform_device *pdev)

const msm_dp_desc?

> +{
> + const struct msm_dp_config *cfg = of_device_get_match_data(&pdev->dev);
> + struct resource *res;
> + int i;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> + return NULL;
> +
> + for (i = 0; i < cfg->num_descs; i++)
> + if (cfg->descs[i].io_start == res->start)
> + return &cfg->descs[i];
> +
> + dev_err(&pdev->dev, "unknown displayport instance\n");
> + return NULL;
> +}
> +
> static int dp_display_probe(struct platform_device *pdev)
> {
> int rc = 0;
> struct dp_display_private *dp;
> + struct msm_dp_desc *desc;

const?

>
> if (!pdev || !pdev->dev.of_node) {
> DRM_ERROR("pdev not found\n");
> @@ -1194,8 +1230,13 @@ static int dp_display_probe(struct platform_device *pdev)
> if (!dp)
> return -ENOMEM;
>
> + desc = dp_display_get_desc(pdev);
> + if (!desc)
> + return -EINVAL;
> +
> dp->pdev = pdev;
> dp->name = "drm_dp";
> + dp->dp_display.connector_type = desc->connector_type;
>
> rc = dp_init_sub_modules(dp);
> if (rc) {