From patchwork Sun Feb 5 07:55:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 9555993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D87F604DA for ; Sun, 5 Feb 2017 07:57:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E47523E64 for ; Sun, 5 Feb 2017 07:57:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 112D926CFF; Sun, 5 Feb 2017 07:57:54 +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=-1.4 required=2.0 tests=BAYES_00, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C6C723E64 for ; Sun, 5 Feb 2017 07:57:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1caHhl-0005Jb-Db; Sun, 05 Feb 2017 07:57:49 +0000 Received: from mail-pg0-f66.google.com ([74.125.83.66]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1caHgw-0003vd-Av; Sun, 05 Feb 2017 07:57:03 +0000 Received: by mail-pg0-f66.google.com with SMTP id 204so6098832pge.2; Sat, 04 Feb 2017 23:56:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tB8Mwv94pXzd6nbnt4zUWhNTegvJVokh5nL4CSkOb5k=; b=QPIyTCLLKs7l1qvEK1OfKdZhH0oty4ijee1xRoOJGBy0/wiRFPk1q15FDe+QwY/PbX pHNXz12MTh/sYg0VeayAivUef5g+AxtFOtHchWzRaTavPfSXya6u3lARJRd6smdg/RxJ BL691wL50j3Obi3TcavWn3acpyphKYsaJsvr/CcNPbb5/u3dmFMRcZ2fRD6KzPI+kVid uAHZ0N0NrYj7jiUPV03Xp5Pq7OdfSfCqDxFbah7jYQLg85URec5CEXCPo2RYpB+AshVp wjtc3WEnIxssAWJTHF/GYTUxkvL+uQxZDBP36gHPd3fXT/Mxt+ov3jm4LwXLKUYINySP MKuQ== X-Gm-Message-State: AIkVDXIdIRcjBJe+XqNptaTBPK5O1U6CdQo13dubnkVE0tK2RMLsApcIIZf7NiFzQk4ezA== X-Received: by 10.99.51.76 with SMTP id z73mr6631524pgz.137.1486281399167; Sat, 04 Feb 2017 23:56:39 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id o18sm80321582pgn.36.2017.02.04.23.56.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 04 Feb 2017 23:56:38 -0800 (PST) From: Chris Zhong To: dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Subject: [PATCH v17 7/7] drm/rockchip: cdn-dp: don't configure hardware in mode_set Date: Sun, 5 Feb 2017 15:55:02 +0800 Message-Id: <1486281302-28200-8-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1486281302-28200-1-git-send-email-zyw@rock-chips.com> References: <1486281302-28200-1-git-send-email-zyw@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170204_235658_849092_33229EEA X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , David Airlie , linux-kernel@vger.kernel.org, zyw@rock-chips.com, seanpaul@chromium.org, groeck@chromium.org, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP With atomic modesetting the hardware will be powered off when the mode_set function is called. We should configure the hardware in the enable function. Signed-off-by: Chris Zhong --- Changes in v17: None drivers/gpu/drm/rockchip/cdn-dp-core.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index a630b0d..9ab67a6 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -568,9 +568,7 @@ static void cdn_dp_encoder_mode_set(struct drm_encoder *encoder, { struct cdn_dp_device *dp = encoder_to_dp(encoder); struct drm_display_info *display_info = &dp->connector.display_info; - struct rockchip_crtc_state *state; struct video_info *video = &dp->video_info; - int ret, val; switch (display_info->bpc) { case 10: @@ -585,31 +583,9 @@ static void cdn_dp_encoder_mode_set(struct drm_encoder *encoder, } video->color_fmt = PXL_RGB; - video->v_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NVSYNC); video->h_sync_polarity = !!(mode->flags & DRM_MODE_FLAG_NHSYNC); - ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, encoder); - if (ret < 0) { - DRM_DEV_ERROR(dp->dev, "Could not get vop id, %d", ret); - return; - } - - DRM_DEV_DEBUG_KMS(dp->dev, "vop %s output to cdn-dp\n", - (ret) ? "LIT" : "BIG"); - state = to_rockchip_crtc_state(encoder->crtc->state); - if (ret) { - val = DP_SEL_VOP_LIT | (DP_SEL_VOP_LIT << 16); - state->output_mode = ROCKCHIP_OUT_MODE_P888; - } else { - val = DP_SEL_VOP_LIT << 16; - state->output_mode = ROCKCHIP_OUT_MODE_AAAA; - } - - ret = cdn_dp_grf_write(dp, GRF_SOC_CON9, val); - if (ret) - return; - memcpy(&dp->mode, adjusted, sizeof(*mode)); } @@ -635,9 +611,32 @@ static bool cdn_dp_check_link_status(struct cdn_dp_device *dp) static void cdn_dp_encoder_enable(struct drm_encoder *encoder) { struct cdn_dp_device *dp = encoder_to_dp(encoder); - int ret; + int ret, val; + struct rockchip_crtc_state *state; + + ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, encoder); + if (ret < 0) { + DRM_DEV_ERROR(dp->dev, "Could not get vop id, %d", ret); + return; + } + + DRM_DEV_DEBUG_KMS(dp->dev, "vop %s output to cdn-dp\n", + (ret) ? "LIT" : "BIG"); + state = to_rockchip_crtc_state(encoder->crtc->state); + if (ret) { + val = DP_SEL_VOP_LIT | (DP_SEL_VOP_LIT << 16); + state->output_mode = ROCKCHIP_OUT_MODE_P888; + } else { + val = DP_SEL_VOP_LIT << 16; + state->output_mode = ROCKCHIP_OUT_MODE_AAAA; + } + + ret = cdn_dp_grf_write(dp, GRF_SOC_CON9, val); + if (ret) + return; mutex_lock(&dp->lock); + ret = cdn_dp_enable(dp); if (ret) { DRM_DEV_ERROR(dp->dev, "Failed to enable encoder %d\n",