Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2586653ybl; Mon, 20 Jan 2020 05:48:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzDcBoDT4EIIMFEdH87DiAcIaCQHG4jWfHDMDocYLlA4WXCdMoBbklC9C+PcnBc0T24hLcQ X-Received: by 2002:a05:6830:612:: with SMTP id w18mr16181281oti.264.1579528108343; Mon, 20 Jan 2020 05:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579528108; cv=none; d=google.com; s=arc-20160816; b=UIumtupcRDHolMbHkUu/fVRhRY5rz9k3J5ko7Et8lnchUnFpnaefMoNS5tQ0JMNdGu LFO0JbuGsTaKu2kheKAKOhFrGQR31LXWR9ppvcM3fWDbAU4qioktHqu6wPFnGLbxVKGl ddU7Z3/XTivnHHMx1UXkn7UxCFC6i/b4Zugje9rhNeW2Q2YXtOVkmMPDvIFvx/0U4lN+ fEDo1kLgf/JBiTNQL6tSYZUOg2X4REgvthOoO29M1zuzaDsalOLxUz2r0Z9NhKYFFr/Q HBEjVqnuYo7a12I0VimIwHGy/t5yg+RjN/+lZ4NPbMdUL3304fiqoxW2PpI28/Ni3Pg8 Qt9w== 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 :message-id:date:subject:to:from:dkim-signature; bh=RQpTI3zFQW+ChdmHDDySJ08NSVtL9lOc5ZIv6JMCj74=; b=p5Xo/9lmBoz0XtLyBXwacvC073a8r6JxE0Zd5nkCN2nHjn9PQxtpaMw9dJOg5TmJ7C liqFrAq2t/loAMFhrrJwNwD+QFYeKfIFi+RugSOXD7WplKT+XmZCSvDPS7QxUHBfxbQk 6Z+rvPBaRhuccvqx0fEg0J5YrVdKit86jmVRdJeOcnTOsL5lnpsj0vaG1LfdTvBwpsdM 8thDj2LUN/KTz3YS8Go2ODlmaSaD4cFRkQ6yasRz74h6g0soTxgmqNSsF5j7fuQbJ3gW 87TKClflZdVnc0dd2M0o5qgqpds3bScfScKv2Gs0ajhTBAZtCnI10DIyn4f5TTyzdD+H 3C6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=gj+P8sv4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x20si20287182otq.222.2020.01.20.05.48.15; Mon, 20 Jan 2020 05:48:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=gj+P8sv4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbgATNrU (ORCPT + 99 others); Mon, 20 Jan 2020 08:47:20 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:60876 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726738AbgATNrU (ORCPT ); Mon, 20 Jan 2020 08:47:20 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00KDbQJC019186; Mon, 20 Jan 2020 14:47:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=STMicroelectronics; bh=RQpTI3zFQW+ChdmHDDySJ08NSVtL9lOc5ZIv6JMCj74=; b=gj+P8sv4Kh+ikTblV4bXosCD65PqoiQrtdSjmKPqhDTn9Famk0YKrnA5y9NbgGK4AgdB 5LUwZgXMEyEQGIGWjY7HQhZvgLnifjWudJFodUW5bv0F0gR1FJSDA2etBRn3jutiq5zn q1kLb+ahj90oshPM/IUOpXMWP0TPWkZuhWzx11JOoUNcEefAE4slkoxsVH7vDrfUdCOK WBgbOJ5raNdUAtk/hjIypmiNSZsU8pblgD9dYRDUFHPBlnqZmfWZZ4J7J9AaKoraRgGP uKvNxHrMvOuXg9skKPOeZmj8W0eqycQdYGyMS3DquZPfoDbyKTTJnQxiNAk2T2AjidYt UA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2xkssnsg0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jan 2020 14:47:05 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C7356100034; Mon, 20 Jan 2020 14:47:00 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 916642BF9A8; Mon, 20 Jan 2020 14:47:00 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 20 Jan 2020 14:47:00 +0100 From: Yannick Fertre To: Yannick Fertre , Philippe Cornu , Benjamin Gaignard , David Airlie , Daniel Vetter , Maxime Coquelin , Alexandre Torgue , , , , Subject: [PATCH] drm/stm: ltdc: enable/disable depends on encoder Date: Mon, 20 Jan 2020 14:46:53 +0100 Message-ID: <1579528013-28445-1-git-send-email-yannick.fertre@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG3NODE3.st.com (10.75.127.9) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-20_02:2020-01-20,2020-01-20 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yannick Fertré When connected to a dsi host, the ltdc display controller must send frames only after the end of the dsi panel initialization to avoid errors when the dsi host sends commands to the dsi panel (dsi px fifo full). To avoid this issue, the display controller must be enabled/disabled when the encoder is enabled/disabled. Signed-off-by: Yannick Fertré --- drivers/gpu/drm/stm/ltdc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 719dfc5..9ef125d 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -437,9 +437,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, /* Commit shadow registers = update planes at next vblank */ reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR); - /* Enable LTDC */ - reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); - drm_crtc_vblank_on(crtc); } @@ -453,9 +450,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc, drm_crtc_vblank_off(crtc); - /* disable LTDC */ - reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); - /* disable IRQ */ reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); @@ -1058,9 +1052,13 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = { static void ltdc_encoder_disable(struct drm_encoder *encoder) { struct drm_device *ddev = encoder->dev; + struct ltdc_device *ldev = ddev->dev_private; DRM_DEBUG_DRIVER("\n"); + /* Disable LTDC */ + reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); + /* Set to sleep state the pinctrl whatever type of encoder */ pinctrl_pm_select_sleep_state(ddev->dev); } @@ -1068,6 +1066,7 @@ static void ltdc_encoder_disable(struct drm_encoder *encoder) static void ltdc_encoder_enable(struct drm_encoder *encoder) { struct drm_device *ddev = encoder->dev; + struct ltdc_device *ldev = ddev->dev_private; DRM_DEBUG_DRIVER("\n"); @@ -1078,6 +1077,9 @@ static void ltdc_encoder_enable(struct drm_encoder *encoder) */ if (encoder->encoder_type == DRM_MODE_ENCODER_DPI) pinctrl_pm_select_default_state(ddev->dev); + + /* Enable LTDC */ + reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); } static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = { -- 2.7.4