Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2839437pxa; Mon, 17 Aug 2020 22:15:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCneAUI38T4NnuOpZYNOa8Eo3YNjRmx3vmnGO9yszq6/4l5+4y4FywLr3A8nLuv3LM2hE4 X-Received: by 2002:a05:6402:8cb:: with SMTP id d11mr18749207edz.100.1597727710550; Mon, 17 Aug 2020 22:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597727710; cv=none; d=google.com; s=arc-20160816; b=mbUljrfATyYNBULPo4/M2uMj2GtRUbnODNMoqxUYGIz9QoDC3smNFf/amBGdL9AVYn 0h0VyrAGV4NfSr06deYAsJ25o+nz0WQ1CyQlGRkQNYXtAHqQrIuCVdtRo0sL/E3ljqtq Dc+IocDBTcc0wrkVgLDjINwQ2A2V0Rk8q0gFV4eeaoyBG1K0oeGXqqSdb6jTR+3+ne5p XYdgKlbQ2r66m+KB14XMtcrW54Udabu/4rCvUXmwq7F5Zw/oO+HQ+xYpdTLIdhMG6fS1 eCz1vfF8FwlO1EqMoi0zvPznGfDCQSD88MKQMEt5aYSX9eLHZk0Nk4Sa/hOONbC+2G+y 0CjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=n1Y61WkQg7cBziVdmHLygNO9WfRRX8uTW1qGmcj4XvM=; b=xGFHijUhTQ+ukD/O4hViEPi+IzYvdfkRla496O8Qx+Kc3nXESnfs/vK1ZcoR8oq1zQ K6paROXGMLQJKKeBdyvY88iV+zSp6Tx13x9UcNc71s624vHGISl1fjw9OM7zqu6QBmWM Uid3VURCL+dM4L5QLYJrTo2tlPtJu3h6nT9sKXuEUsHTivPW/EICOboLjkTIvvYRN3BX GDxwElNa2b0pAVNklabRB3nT9lznnDpllAitbetttP254UliJLAgZ+T1bH0fRoKqDkaq gemfkvBgSl4dnhZW58Xhtn8XZTC1hQ915E3Z/Nsi8z0ShQkcHVbJXNVbLUd7dm73EWMx Y0vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=LA10BvEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si879502ejo.605.2020.08.17.22.14.46; Mon, 17 Aug 2020 22:15:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=LA10BvEv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726676AbgHRFNS (ORCPT + 99 others); Tue, 18 Aug 2020 01:13:18 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:56275 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbgHRFNS (ORCPT ); Tue, 18 Aug 2020 01:13:18 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597727597; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=n1Y61WkQg7cBziVdmHLygNO9WfRRX8uTW1qGmcj4XvM=; b=LA10BvEvLrqL9mAFUt8BX65CHmEpkqevkvWr/+KiiowI/wzUNggyx1ohYb0NapE0oZBoBd4F NZntPZ/IFnfsfT+JXeMfb47xrIEe8hR1Xq2ixCUbXbLSHlgnS86jsqYLkzJlyWzTWH92cxs6 ZNlsEhp0IA1naTkWCuFvGCjLeyI= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n10.prod.us-east-1.postgun.com with SMTP id 5f3b633991f8def8b20c2c23 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 18 Aug 2020 05:12:25 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 89B4AC43387; Tue, 18 Aug 2020 05:12:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from linuxdisplay-lab-04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tanmay) by smtp.codeaurora.org (Postfix) with ESMTPSA id E5244C43387; Tue, 18 Aug 2020 05:12:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E5244C43387 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=tanmay@codeaurora.org From: Tanmay Shah To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, robdclark@gmail.com Cc: swboyd@chromium.org, linux-arm-msm@vger.kernel.org, seanpaul@chromium.org, daniel@ffwll.ch, airlied@linux.ie, aravindh@codeaurora.org, abhinavk@codeaurora.org, khsieh@codeaurora.org, Jeykumar Sankaran , Chandan Uddaraju , Vara Reddy , Tanmay Shah Subject: [PATCH v11 4/5] drm/msm/dpu: add display port support in DPU Date: Mon, 17 Aug 2020 22:11:36 -0700 Message-Id: <20200818051137.21478-5-tanmay@codeaurora.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200818051137.21478-1-tanmay@codeaurora.org> References: <20200818051137.21478-1-tanmay@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeykumar Sankaran Add display port support in DPU by creating hooks for DP encoder enumeration and encoder mode initialization. changes in v2: - rebase on [2] (Sean Paul) - remove unwanted error checks and switch cases (Jordan Crouse) [1] https://lwn.net/Articles/768265/ [2] https://lkml.org/lkml/2018/11/17/87 changes in V3: -- Moved this change as part of the DP driver changes. -- Addressed compilation issues on the latest code base. Changes in v6: -- Fix checkpatch.pl warning Changes in v7: Remove depends-on tag from commit message. Changes in v8: None Changes in v9: None Signed-off-by: Jeykumar Sankaran Signed-off-by: Chandan Uddaraju Signed-off-by: Vara Reddy Signed-off-by: Tanmay Shah --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 8 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 65 +++++++++++++++++---- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 8b14d7c42f37..6a9e257d2fe6 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -2025,7 +2025,7 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, { int ret = 0; int i = 0; - enum dpu_intf_type intf_type; + enum dpu_intf_type intf_type = INTF_NONE; struct dpu_enc_phys_init_params phys_params; if (!dpu_enc) { @@ -2047,9 +2047,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, case DRM_MODE_ENCODER_DSI: intf_type = INTF_DSI; break; - default: - DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n"); - return -EINVAL; + case DRM_MODE_ENCODER_TMDS: + intf_type = INTF_DP; + break; } WARN_ON(disp_info->num_of_h_tiles < 1); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index c0a4d4e16d82..62bc33cb0d3a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -479,6 +479,33 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev, return rc; } +static int _dpu_kms_initialize_displayport(struct drm_device *dev, + struct msm_drm_private *priv, + struct dpu_kms *dpu_kms) +{ + struct drm_encoder *encoder = NULL; + int rc = 0; + + if (!priv->dp) + return rc; + + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS); + if (IS_ERR(encoder)) { + DPU_ERROR("encoder init failed for dsi display\n"); + return PTR_ERR(encoder); + } + + rc = msm_dp_modeset_init(priv->dp, dev, encoder); + if (rc) { + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc); + drm_encoder_cleanup(encoder); + return rc; + } + + priv->encoders[priv->num_encoders++] = encoder; + return rc; +} + /** * _dpu_kms_setup_displays - create encoders, bridges and connectors * for underlying displays @@ -491,12 +518,21 @@ static int _dpu_kms_setup_displays(struct drm_device *dev, struct msm_drm_private *priv, struct dpu_kms *dpu_kms) { - /** - * Extend this function to initialize other - * types of displays - */ + int rc = 0; + + rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms); + if (rc) { + DPU_ERROR("initialize_dsi failed, rc = %d\n", rc); + return rc; + } - return _dpu_kms_initialize_dsi(dev, priv, dpu_kms); + rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms); + if (rc) { + DPU_ERROR("initialize_DP failed, rc = %d\n", rc); + return rc; + } + + return rc; } static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) @@ -681,13 +717,20 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms *kms, info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE : MSM_DISPLAY_CAP_VID_MODE; - /* TODO: No support for DSI swap */ - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { - if (priv->dsi[i]) { - info.h_tile_instance[info.num_of_h_tiles] = i; - info.num_of_h_tiles++; + switch (info.intf_type) { + case DRM_MODE_ENCODER_DSI: + /* TODO: No support for DSI swap */ + for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { + if (priv->dsi[i]) { + info.h_tile_instance[info.num_of_h_tiles] = i; + info.num_of_h_tiles++; + } } - } + break; + case DRM_MODE_ENCODER_TMDS: + info.num_of_h_tiles = 1; + break; + }; rc = dpu_encoder_setup(encoder->dev, encoder, &info); if (rc) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project