Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp177566pxa; Tue, 11 Aug 2020 21:45:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2AorA9f6LQ7139fsT+uGF81cfDebJoKl22xR+Ae+iWrrojEV+m1ewGksml50k4YldqN87 X-Received: by 2002:a17:906:b6d5:: with SMTP id ec21mr3575891ejb.396.1597207504480; Tue, 11 Aug 2020 21:45:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597207504; cv=none; d=google.com; s=arc-20160816; b=TRvC9+L+QWbUtgmQVcONwZPdJzzUzQ5pmnHXmyoZn1UA9y20LCgIwvBF8u9AaUPv0F xe7nehqkpzLVCIfqOOfm3l5RogutPLMxWOCldfrQJUQiBCw27NpvoeIYUoF13P6Rexjg 0wqRvZOUivIDI+OX2+o5O9KyiTI8k13tEUtF8phpLiFIOlGudxWyrNyg2tp8FjrkACX7 eQmdIx549nwptFi44gQKI5cwevo9sEaHl4DMsF4LmytDciTwxvYxRdNOe5mfrPN7sbAY S2X+vE74b5VZvm4pp6/iSpXT0yXKq7YBpOjdw0Xm0j3dimlD6tgpD6RTZ+w1pNgqi4x1 HbRw== 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=KaWk27BcEsDbHddOwfGWVM2ietASUDfQtXKPbumdtiU=; b=0bfdjYtQI22ARnvoeSYnE5hBv1IIASURuFLuB62FviS1eHTyiP33QAL6iE8nSIMyrQ SX1yINvtZ9bNWjLvExdIDKbNh7T8GGSpgDgayqxXV4hpC9yZJxx6dhqSzZGN3h8IHcib uC0Kn0Ss1FCE98bIDvUnHb2E/ONd7cebKS0qrLc4ZSqOLCoEUP01UL0Z3EDoNqOwabm1 L7jOVzFmOqNULN1l++2UWJQdxi4GsaxwKeNqRwVMNTMzDZ+UNuC5qYClS4cVEy0RoHg/ qfFoR+OctP4/hGMEaF91t6OUJZqhYCFocAp/7CTYydW9f1gGTWbvEkQbVkbTQQHfXQe6 ZvIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=k6wVgros; 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 j19si377594eja.495.2020.08.11.21.44.41; Tue, 11 Aug 2020 21:45:04 -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=k6wVgros; 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 S1726657AbgHLEnm (ORCPT + 99 others); Wed, 12 Aug 2020 00:43:42 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:58908 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726567AbgHLEnl (ORCPT ); Wed, 12 Aug 2020 00:43:41 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597207420; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=KaWk27BcEsDbHddOwfGWVM2ietASUDfQtXKPbumdtiU=; b=k6wVgrosDR1YofflBeYKUPYxdNyFOwYyV4Hcd0YHYyzvIuGwTOKDaQXsfiuKhtUJ3iwgaDj2 fIEiXyKDYY12udSpBqkANW+pfyUt2Cqw7BSLtoHQHJaVuiPxirCxoWvKfxvoaCFw4maae/G3 7rnjaknFaLaGq16ZmalymKHk1w8= 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-n04.prod.us-east-1.postgun.com with SMTP id 5f33737c91f8def8b29c2ebd (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 12 Aug 2020 04:43:40 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0BE55C433A0; Wed, 12 Aug 2020 04:43:38 +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 E5E66C433CB; Wed, 12 Aug 2020 04:43:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E5E66C433CB 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: swboyd@chromium.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, robdclark@gmail.com Cc: linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.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 v10 4/5] drm/msm/dpu: add display port support in DPU Date: Tue, 11 Aug 2020 21:42:22 -0700 Message-Id: <20200812044223.19279-5-tanmay@codeaurora.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200812044223.19279-1-tanmay@codeaurora.org> References: <20200812044223.19279-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 0a5ad6a9e609..fe0d538099f9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1992,7 +1992,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) { @@ -2014,9 +2014,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 680527e28d09..fe86d760ed01 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