Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp16990ybt; Tue, 30 Jun 2020 13:53:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybVyqVabt9gNDYDdPLjdc/SvYT8X9LZmtZmRrSvLeU4i4mvE/PjqpS4edwPPtUi/S4Uqej X-Received: by 2002:a17:906:4c2:: with SMTP id g2mr18925364eja.299.1593550026095; Tue, 30 Jun 2020 13:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593550026; cv=none; d=google.com; s=arc-20160816; b=TLvzAuDpgTzz2ohWaCL8PNfhnw1U/zRv1hnjNlpyjkuK34azpbX7lntKR1ScqJkurK CnxB4UY8RE/aW7kbLajrrcp5X4J9BcXHFOf4Jb/G+tsPTAdSx9KszzlCAWwIl9q2IbZ1 CGmVylwl8phkdhYB3oQ8qQ+N3c1ZsbpfMevw/MWEC1uqKnGphS9whfL9ChUDtrvI9gIB bQFlqXHJa4skeZ/exWlH8v1hVPt+qq78sOEelz6+OTbqBMiQz9no6Dy7WpJ96JaFPPjs CVAXJ3PHL9vmmh8kIf8UheCZYsftT4O1ZRbcR6ykcNs4haYYImWt9Rm+VwSHHlomuiOi 2QIQ== 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=lZK/1sJ7giMB71ltvhZxZ8UDrH68vc4Q/d6owJrWIiM=; b=G2agzpdWvyU4wGPdx/EpG4ksFdAYy0VK0udmNna3FkqpeEHR/7xs7WBvC1AZOSBaqM yzScyouWP2Xx2TGO7uYqSPbbIEqVJx44/ZJ0Fy6oDstomnqoAFD5loCOndeKtKMdxd19 /69ITAjS8aGxqGuvpAzoFHHDuoEI94m7tG3VNcz6HytuymVztNMAx+iS94tXzqisWjNP s+AhG+rUAqnyxtaa2F3nm6frCWMfuDdM2bkxNFGR4udkZDCJakZwgWVdRMet3ctKv2c5 JtTIws8vLa+cN9sJ/5zwRJBz+5ttHao9mUdMHqU9bQNFQ7MoPwyoF31eQ3lIzMinkx64 9AmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=qtdlhazw; 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 ds16si3259929ejc.112.2020.06.30.13.46.41; Tue, 30 Jun 2020 13:47:06 -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=qtdlhazw; 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 S1726241AbgF3Sqy (ORCPT + 99 others); Tue, 30 Jun 2020 14:46:54 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:41302 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726775AbgF3Sqx (ORCPT ); Tue, 30 Jun 2020 14:46:53 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1593542811; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=lZK/1sJ7giMB71ltvhZxZ8UDrH68vc4Q/d6owJrWIiM=; b=qtdlhazw7jYThz43RWorpO7Ekq+oBs/Y3ZWSUhKbwIicznDnOosjoOD20tG+RUruPWMZXIKQ +3yFq0LcVmRCnzpH8xXqCJsekFZ9hfM1XlRu9frq+Aa0p+YaKSneTufeDWT3NA+1TwZfxE1r TaMQBs8Ef6mR4CDZz1vzTOagJl8= X-Mailgun-Sending-Ip: 69.72.43.7 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-n01.prod.us-west-2.postgun.com with SMTP id 5efb88993a8a8b20b8268e1f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 30 Jun 2020 18:46:49 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 578A2C433C8; Tue, 30 Jun 2020 18:46:48 +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 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 19FF6C433C8; Tue, 30 Jun 2020 18:46:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 19FF6C433C8 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: robh+dt@kernel.org, swboyd@chromium.org, sam@ravnborg.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, seanpaul@chromium.org, robdclark@gmail.com, daniel@ffwll.ch, airlied@linux.ie, aravindh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, varar@codeaurora.org, Jeykumar Sankaran , Tanmay Shah Subject: [PATCH v8 5/6] drm/msm/dpu: add display port support in DPU Date: Tue, 30 Jun 2020 11:45:06 -0700 Message-Id: <20200630184507.15589-6-tanmay@codeaurora.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200630184507.15589-1-tanmay@codeaurora.org> References: <20200630184507.15589-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 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 753cc2fcf916..b439e482fc80 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1994,7 +1994,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) { @@ -2016,9 +2016,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 b8615d4fe8a3..f6c219f875db 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -492,6 +492,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 @@ -504,12 +531,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) @@ -694,13 +730,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