From patchwork Fri Nov 16 19:22:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeykumar Sankaran X-Patchwork-Id: 10686899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64CF213BF for ; Fri, 16 Nov 2018 19:22:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 567FB2D84D for ; Fri, 16 Nov 2018 19:22:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AC8B2D856; Fri, 16 Nov 2018 19:22:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2B482D84D for ; Fri, 16 Nov 2018 19:22:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725824AbeKQFgI (ORCPT ); Sat, 17 Nov 2018 00:36:08 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51580 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725729AbeKQFgI (ORCPT ); Sat, 17 Nov 2018 00:36:08 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F37CD60795; Fri, 16 Nov 2018 19:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1542396148; bh=IFyPStFJ1HLQeaawKbkKOfKR5cJdWrkEuFqXFhJiSqw=; h=From:To:Cc:Subject:Date:From; b=mzK/UhzcqLf+aK5Ycps9SFd07Jc0cQ6/CwhT+OZvuEz0Hhwaf1wbwLs7PBIL0ZGp2 BhdAyt526m5bciApVDe9kXHoBcso1xD6IiD5R5ohk0B+hngAurIu5+xMKcpyVJVd9v hrJ0tco1LWL+HPHtM7co28/9eUdLkiwq198p2N6k= Received: from jeykumar-linux.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: jsanka@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id F34A660764; Fri, 16 Nov 2018 19:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1542396147; bh=IFyPStFJ1HLQeaawKbkKOfKR5cJdWrkEuFqXFhJiSqw=; h=From:To:Cc:Subject:Date:From; b=hxYVsm8ikmy/Bawp3ALnRveHaJoh+JMOy2V+NX3NgThhenv8k5TDfPbQcPeF14gt1 hYr0zPwJidbQm3vQdzzyOcVo8YUPudayGrFEZkIzRDlAZaHVewGyWpiJU0sseTsUh7 WhVRfXeVZEF1MZXgwAGtZTD60J60yxdpI1A8cI6g= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F34A660764 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jsanka@codeaurora.org From: Jeykumar Sankaran To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Jeykumar Sankaran , seanpaul@chromium.org, robdclark@gmail.com, hoegsberg@google.com Subject: [PATCH 1/2] drm/msm/dpu: add dpu encoder uninit Date: Fri, 16 Nov 2018 11:22:21 -0800 Message-Id: <1542396142-19534-1-git-send-email-jsanka@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add encoder interface to release dpu encoder on mode_init failures in kms. Signed-off-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 ++++++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index dd7ab85..b253165 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -422,6 +422,15 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *drm_enc, } } +void dpu_encoder_uninit(struct drm_encoder *drm_enc) +{ + struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); + + drm_encoder_cleanup(drm_enc); + + kfree(dpu_enc); +} + static void dpu_encoder_destroy(struct drm_encoder *drm_enc) { struct dpu_encoder_virt *dpu_enc = NULL; @@ -453,10 +462,9 @@ static void dpu_encoder_destroy(struct drm_encoder *drm_enc) dpu_enc->num_phys_encs = 0; mutex_unlock(&dpu_enc->enc_lock); - drm_encoder_cleanup(drm_enc); mutex_destroy(&dpu_enc->enc_lock); - kfree(dpu_enc); + dpu_encoder_uninit(drm_enc); } void dpu_encoder_helper_split_config( diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h index 9dbf38f..60b88bd 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h @@ -142,6 +142,12 @@ struct drm_encoder *dpu_encoder_init( int drm_enc_mode); /** + * dpu_encoder_uninit - uninitialize virtual encoder object + * @drm_enc: Pointer to drm encoder + */ +void dpu_encoder_uninit(struct drm_encoder *drm_enc); + +/** * dpu_encoder_setup - setup dpu_encoder for the display probed * @dev: Pointer to drm device structure * @enc: Pointer to the drm_encoder From patchwork Fri Nov 16 19:22:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeykumar Sankaran X-Patchwork-Id: 10686901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1324D13BF for ; Fri, 16 Nov 2018 19:22:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 052DC2D84D for ; Fri, 16 Nov 2018 19:22:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED8DA2D856; Fri, 16 Nov 2018 19:22:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 843852D84D for ; Fri, 16 Nov 2018 19:22:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725851AbeKQFgK (ORCPT ); Sat, 17 Nov 2018 00:36:10 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51664 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725729AbeKQFgK (ORCPT ); Sat, 17 Nov 2018 00:36:10 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8367860866; Fri, 16 Nov 2018 19:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1542396149; bh=sI+hPjLFE3fCiX1iFr0Mv43UydB3m0+w/Dk2SOiKtbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VpSr7sYpRh0M6OJmwit0IcA0fUpTw3/kxEIjEw8JFPYh0+Hyto5J5XOSOgXwGE8cw g4dSh04fg+L2o4cww4GUOyAXKfytofmSEcDhT6hh6O/X8pBOQKInrsN+RPHx/MiiN8 MkFRrkksmShpjkEOS+gh9f4XU52C0vVgfAgXTmX0= Received: from jeykumar-linux.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: jsanka@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 491F4607F5; Fri, 16 Nov 2018 19:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1542396148; bh=sI+hPjLFE3fCiX1iFr0Mv43UydB3m0+w/Dk2SOiKtbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BdMTFLFbKSlH1JCvxkGcYkL1kkmlXBmVCB0SOAL6zBYQbpyNOwnNH3rueoeQBstC7 MnO7BtkICU1PZZS5GEJuh5ZTOkQlqTX5XczR1aMww/AVAGDXTzS6kkpeFYLsEeJlGr Q48g1AaMS8GVX5PxtqbvD9o6Vyc4lLsacLs+C0wA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 491F4607F5 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jsanka@codeaurora.org From: Jeykumar Sankaran To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Jeykumar Sankaran , seanpaul@chromium.org, robdclark@gmail.com, hoegsberg@google.com Subject: [PATCH 2/2] drm/msm/dpu: add display port support in DPU Date: Fri, 16 Nov 2018 11:22:22 -0800 Message-Id: <1542396142-19534-2-git-send-email-jsanka@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542396142-19534-1-git-send-email-jsanka@codeaurora.org> References: <1542396142-19534-1-git-send-email-jsanka@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add display port support in DPU by creating hooks for DP encoder enumeration and encoder mode initialization. This change is based on the SDM845 Display port driver changes[1]. [1] https://lwn.net/Articles/768265/ Signed-off-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 ++ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 49 +++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index b253165..e9c7edc6 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -2048,6 +2048,9 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, case DRM_MODE_ENCODER_DSI: intf_type = INTF_DSI; break; + case DRM_MODE_ENCODER_TMDS: + intf_type = INTF_DP; + break; default: DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n"); return -EINVAL; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 985c855..b823a37 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -473,6 +473,31 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev, } } +static void _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; + + if (!priv->dp) + return; + + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS); + if (IS_ERR_OR_NULL(encoder)) { + DPU_ERROR("encoder init failed for dsi display\n"); + return; + } + + priv->encoders[priv->num_encoders++] = encoder; + + rc = msm_dp_modeset_init(priv->dp, dev, encoder); + if (rc) { + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc); + dpu_encoder_uninit(encoder); + } +} + /** * _dpu_kms_setup_displays - create encoders, bridges and connectors * for underlying displays @@ -487,6 +512,8 @@ static void _dpu_kms_setup_displays(struct drm_device *dev, { _dpu_kms_initialize_dsi(dev, priv, dpu_kms); + _dpu_kms_initialize_displayport(dev, priv, dpu_kms); + /** * Extend this function to initialize other * types of displays @@ -723,13 +750,23 @@ 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; + default: + DPU_ERROR("Invalid connector type\n"); + return; + }; rc = dpu_encoder_setup(encoder->dev, encoder, &info); if (rc)