From patchwork Sat Oct 16 22:18:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515902 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279583imp; Sat, 16 Oct 2021 15:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1/LhtAe/3O0O3Qb6FELaVpHNEsLzeyh8CtSoCEofQU4j8FNgLwpc3hnZuBFglcNBqwY+x X-Received: by 2002:a17:903:1c7:b0:13e:d05b:ed09 with SMTP id e7-20020a17090301c700b0013ed05bed09mr18486759plh.52.1634422638490; Sat, 16 Oct 2021 15:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422638; cv=none; d=google.com; s=arc-20160816; b=GvQjrKsqIyLhfxT5Vvjoiq17HiSzcnZR18KkGLpbtKF+UQNZjlUxAfC+k7dmpYA/Yo xKGbx9jvihUGLdDwiBaPSubtu7q+YgkwjEYcWajZ7TJtr9sYRbASl0WPBo07QhwAOytX cNm+RTYdBaR206PUeAiMdR9aAuHIEUUjykSB2/TQGvISdDW5ioUUdo8qlL2pfBrv+XQH OPLNpPXYcl9zmXDT6JtFpBOl4T1hCoUCwiz6ZHaaM7jtwuKaeFikmBESWfUDD3wMQHto jLe2kCNvCsGYBdUbcXI3HBmRvRscf1pmKd8f0FLW/vtzsgRrIGMpgUU4t7Fr0zidFc1r GkXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=Y3JSg0yjBHrIT9e1qqj+dh8glMv7U4JrsszeYJgzm9Q=; b=fkBQdposgTBxUgd+a5IdIC+wjJ9I6jZT4eXu1D80xblkZFuV6kAT34GgqQ823Vj3JE lTtgYkjHBrFO+x0hDzTGdd932UI92q8XcvSJbZjWn5oLreRHY+8RadapuCeS7m8qnxrh s8q36OlOLs06aslTHrk0p++ilEFoAjRDSZrp/leGFH7Ze3+exBB9X624/JRx+2G38wfD XId0FP2z/qepsOnpOLD/DqiKtsMJJze7FQS9w4EY5NYCm1JtBA89NkuZcV7K0fxvhjCn 0+3N9iK3tOhsQm9MuLHMlUnqJk8Tf/7qR10F2aP6b62m35e/hl5GNpwXBtWjoJFdtkYd 4FHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YrmKUcV7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id o14si12402328pll.87.2021.10.16.15.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YrmKUcV7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7678A6E8EC; Sat, 16 Oct 2021 22:17:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by gabe.freedesktop.org (Postfix) with ESMTPS id A41806E8E8 for ; Sat, 16 Oct 2021 22:16:58 +0000 (UTC) Received: by mail-ot1-x32a.google.com with SMTP id w12-20020a056830410c00b0054e7ceecd88so584579ott.2 for ; Sat, 16 Oct 2021 15:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y3JSg0yjBHrIT9e1qqj+dh8glMv7U4JrsszeYJgzm9Q=; b=YrmKUcV7WuxXB+t/OZ4842VQRF3FlgSqUZUl5VqT9vxRkAXHbyF0ffYQ5T/1Itw8oS mjIhwyWIhnfHmtNhg6bSefMQr6gMLGEnDKEmT3o1G2T9O9VPdM2yWm8MQlHGOM9X+50D MU4UWk4kEEAKfcH7MQv489gEi2MEJt0iAh3NQAlDI6xeqc7yrG6NOMsNrAkkNfLi/CdP eTfci3BxSdxGra+jkaKHhfUrn9XsLlBjPDcETUjKii1hErQ6pDqbfpV4d1QxPmPLnk0d GmNuE5Ow/cP38eqchf7fXogHkhWnJZImo4iribnAkuQE3ux2T7jZkQVje3LfUzOYEFvE UW2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y3JSg0yjBHrIT9e1qqj+dh8glMv7U4JrsszeYJgzm9Q=; b=gq3JcDckN7H4bc3jezdYHQlJ800qaAiQ7K8oHZDDLCQMf7dkFaO03oZ5+DIq1q1oCo Y9LA7DSZeiwaRygCYTzswf4BoyCymz4C+kuyZRk4ZYF8r4TaM9m/9hrV/MqKX8gukbOA ZTMWrgMymLFQDUgIJTOxeHpXKy4rsvqNYFJS30hk5oAhBI4bB9392ad1uispI6YhlK8y GLOyzmeD7Oh3dWVmHdrvDxY6vPqVj515GsL104fKKp7VdPnFk0mcCelObZEDsKpFwqxR g9J1VXoatJJl1F7DrnXrb0M7XSgeQnO7ESo9qQO7daVa+gBgl1P+B1pQmyp4UfGMgJK4 hipw== X-Gm-Message-State: AOAM533ZqDcsnnYAihV++2rkAraCLH90FNwY467ldSomxHVDJ6zLcyVU nYoVjwhPMRuHDf2X6YtxLE01vw== X-Received: by 2002:a9d:60d9:: with SMTP id b25mr15175971otk.378.1634422617920; Sat, 16 Oct 2021 15:16:57 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:16:57 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/7] drm/msm/dp: Allow specifying connector_type per controller Date: Sat, 16 Oct 2021 15:18:39 -0700 Message-Id: <20211016221843.2167329-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As the following patches introduced support for multiple DP blocks in a platform and some of those block might be eDP it becomes useful to be able to specify the connector type per block. Although there's only a single block at this point, the array of descs and the search in dp_display_get_desc() are introduced here to simplify the next patch, that does introduce support for multiple DP blocks. Signed-off-by: Bjorn Andersson --- Changes since v4: - const the various struct msm_dp_desc instances - unsigned the connector_type The references to DRM_MODE_CONNECTOR_DisplayPort in dp_debug.c, that was highligted in the review of v4 has been removed in a separate patch. drivers/gpu/drm/msm/dp/dp_display.c | 43 ++++++++++++++++++++++++++++- drivers/gpu/drm/msm/dp/dp_display.h | 1 + drivers/gpu/drm/msm/dp/dp_drm.c | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) -- 2.29.2 Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 5d3ee5ef07c2..6913970c8cf9 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; + unsigned int connector_type; +}; + +struct msm_dp_config { + const struct msm_dp_desc *descs; + size_t num_descs; +}; + +static const struct msm_dp_config sc7180_dp_cfg = { + .descs = (const struct msm_dp_desc[]) { + { .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 const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pdev) +{ + 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; + const struct msm_dp_desc *desc; 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) { diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 8b47cdabb67e..75fcabcfbbdd 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -18,6 +18,7 @@ struct msm_dp { bool is_connected; bool audio_enabled; bool power_on; + unsigned int connector_type; hdmi_codec_plugged_cb plugged_cb; diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 764f4b81017e..f33e31523f56 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -147,7 +147,7 @@ struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display) ret = drm_connector_init(dp_display->drm_dev, connector, &dp_connector_funcs, - DRM_MODE_CONNECTOR_DisplayPort); + dp_display->connector_type); if (ret) return ERR_PTR(ret);