From patchwork Thu Jul 16 12:37:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11669305 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D08A0159A for ; Fri, 17 Jul 2020 07:22:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACADD2076A for ; Fri, 17 Jul 2020 07:22:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="X089cgNO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACADD2076A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 55BB16ECEB; Fri, 17 Jul 2020 07:22:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5969D89AEE for ; Thu, 16 Jul 2020 12:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1594903092; bh=dSbyi6wULGgN5LmJysYayv3TsF8wkvs/olfr2qRV6H0=; h=From:To:Cc:Subject:Date:References:From; b=X089cgNO00tj2xzQgTQefrTAbp/6POIMBW/ZM8iMbezzHouqiZwooLtWgP8t4invr RT2Jc4b96uw7wXyao4O7bMHH9/Bma+eGeWcv3qk6skTfZgPblpJoppIeMvYx/dC6xU kSgoCiq1L4O8uGB5sCz0UpLnWRArqFx5eUA0aFPg= From: Ondrej Jirman To: David Airlie , Daniel Vetter , Thierry Reding , Sam Ravnborg , Fabio Estevam , =?utf-8?q?Guido_G=C3=BCnther?= , Robert Chiras Subject: [PATCH 1/2] drm/panel: st7703: Make the sleep exit timing match the spec Date: Thu, 16 Jul 2020 14:37:52 +0200 Message-Id: <20200716123753.3552425-2-megous@megous.com> In-Reply-To: <20200716123753.3552425-1-megous@megous.com> References: <20200716123753.3552425-1-megous@megous.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 17 Jul 2020 07:22:00 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Samuel Holland Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The driver seemed to try to make the total cumulative time of all delays across the whole power up sequence to sum up to 120ms. The datasheet on the other hand specifies that there needs to be 120ms delay after the sleep out command, not after reset as the driver assumes. Lastly, the delay between init commands and the sleep exit command is not necessary. (not specified anywhere) Reported-by: Samuel Holland Signed-off-by: Ondrej Jirman --- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index 8996ced2b721..45833e6a0f4f 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -291,7 +291,6 @@ static int xbd599_init_sequence(struct st7703 *ctx) dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP, 0x07, /* VREF_SEL = 4.2V */ 0x07 /* NVREF_SEL = 4.2V */); - msleep(20); dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM, 0x2C, /* VCOMDC_F = -0.67V */ @@ -369,16 +368,14 @@ static int st7703_enable(struct drm_panel *panel) return ret; } - msleep(20); - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); if (ret < 0) { DRM_DEV_ERROR(ctx->dev, "Failed to exit sleep mode: %d\n", ret); return ret; } - /* Panel is operational 120 msec after reset */ - msleep(60); + /* Dsiplay on can be issued 120 msec after sleep out */ + msleep(120); ret = mipi_dsi_dcs_set_display_on(dsi); if (ret) From patchwork Thu Jul 16 12:37:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11669371 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B67F114E3 for ; Fri, 17 Jul 2020 07:22:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93B612074B for ; Fri, 17 Jul 2020 07:22:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="jWD2nsWA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93B612074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F1046ED3A; Fri, 17 Jul 2020 07:22:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) by gabe.freedesktop.org (Postfix) with ESMTPS id 61AEE89B27 for ; Thu, 16 Jul 2020 12:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1594903092; bh=QEjTMk4ZzDSZ6Jx5V1yWHh4jwwChWuP75ep9d/rMANQ=; h=From:To:Cc:Subject:Date:References:From; b=jWD2nsWAo4QoTnAKgwVif+Nqr3TV5kn/AplnCLQtSKz8rl5trI1YUH6t1AZfhdbLL 7MjBD0eUbu0G75x3fE5Qpqq2I2G+9/0NF0Nwj5C4X284U/EarsUyAmOd8UXct61Vqq n2PvsVhjvcG7Zo9m9UHT/lhhEU6pNgfj0YRY2xJs= From: Ondrej Jirman To: David Airlie , Daniel Vetter , Thierry Reding , Sam Ravnborg , Fabio Estevam , =?utf-8?q?Guido_G=C3=BCnther?= , Robert Chiras Subject: [PATCH 2/2] drm/panel: st7703: Fix the power up sequence of the panel Date: Thu, 16 Jul 2020 14:37:53 +0200 Message-Id: <20200716123753.3552425-3-megous@megous.com> In-Reply-To: <20200716123753.3552425-1-megous@megous.com> References: <20200716123753.3552425-1-megous@megous.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 17 Jul 2020 07:22:00 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Samuel Holland Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The datasheet specifies that it's better to keep reset asserted while powering up the supplies, and that IOVCC should be enabled first. There also needs to be a delay after enabling the supplies and before deasserting the reset. The datasheet specifies 1ms after the supplies reach the required voltage. Use 10-20ms to also give the power supplies some time to reach the required voltage, too. This fixes intermittent panel initialization failures and screen corruption during resume from sleep on PinePhone. Reported-by: Samuel Holland Signed-off-by: Ondrej Jirman --- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index 45833e6a0f4f..48569a8688f6 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -429,12 +429,8 @@ static int st7703_prepare(struct drm_panel *panel) return 0; DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n"); - ret = regulator_enable(ctx->vcc); - if (ret < 0) { - DRM_DEV_ERROR(ctx->dev, - "Failed to enable vcc supply: %d\n", ret); - return ret; - } + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + ret = regulator_enable(ctx->iovcc); if (ret < 0) { DRM_DEV_ERROR(ctx->dev, @@ -442,10 +438,18 @@ static int st7703_prepare(struct drm_panel *panel) goto disable_vcc; } - gpiod_set_value_cansleep(ctx->reset_gpio, 1); - usleep_range(20, 40); + ret = regulator_enable(ctx->vcc); + if (ret < 0) { + DRM_DEV_ERROR(ctx->dev, + "Failed to enable vcc supply: %d\n", ret); + return ret; + } + + /* Give power supplies time to stabilize before deasserting reset. */ + usleep_range(10000, 20000); + gpiod_set_value_cansleep(ctx->reset_gpio, 0); - msleep(20); + usleep_range(15000, 20000); ctx->prepared = true;