From patchwork Mon Aug 17 21:39:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11719245 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 93F6713B1 for ; Mon, 17 Aug 2020 21:39:16 +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 71D002065D for ; Mon, 17 Aug 2020 21:39:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oog6rrca" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71D002065D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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 772986E037; Mon, 17 Aug 2020 21:39:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EB576E037 for ; Mon, 17 Aug 2020 21:39:11 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id s9so9139306lfs.4 for ; Mon, 17 Aug 2020 14:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zzn6R0+MnQqUQo/SeuVfFP5EanHkyE2BgE8d+snk88Q=; b=oog6rrcaPrPvQF327SfCX2uMjwdeGnEg4mDQq5hA90CrfoP4+pD/hRcAI4sZLbvQF9 K9dxyFK7dST4MxzJV1SjNtM4OxVXJ14ZFVpEZtFBuCNuaL77x28FTs3Du5BKQ6T7ytZf yBWsTl31LgpLAEAfQH/yyj4HJXZnYFc9cl8j6hFQoT8mFt+1fKHugQv1mmUZ4cb79KP8 HAvA5M6vP4uNDMhBssHzNaT2xZ6B+E6vOXTtd/Y0IXojCt78fBa6SKEqHxElYDZYS/eq 10I6KeNI0C6/Ls9bIRFIIFYusM5kmxh24AdBybziF9CnL79rBokPGXtl4LbaiEIV9Y8o 4a6w== 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:mime-version :content-transfer-encoding; bh=zzn6R0+MnQqUQo/SeuVfFP5EanHkyE2BgE8d+snk88Q=; b=leDg1wey72l1yyOrGmKc+K0Bjst5CAyEou/NZzexrzjY5blZec7Z44v3L/bKhEOnzR 35Ta4iyRN6pZ+9HPYvc87lKUriTNKzd4F++EwjWLBdG1PiXNtJqQCIaoGEMyVSwgS+kz nUG7jM79ZQcrVhLzzjnQfY3k0r4rYHz43trcGsIE2xyTJoBF3I5K+pVMkVgEbKagkEYU /KkY40gC4aTmrXy6OvAv79H5YKOZsFyBRO06szPpTubO0LvyTTbJkwuh4E7Mnn8mHZhc 7NkLDCeCh4IidWsvGEusMr2HijW6uUmOXui7XbmsO8f2d7Zhjh0GTZbGwlCp4kESWG+i kXIg== X-Gm-Message-State: AOAM532u0D45rHqMfnqV6SYfRVKSrfIVxXCy5JY6MRHNsP884rRexoDJ RSc3j3e+TyNOn4R4TkoFp/+bL1XnL/54RA== X-Google-Smtp-Source: ABdhPJxpvm8+T4nwwhXe2b9PxAXgHlo2lUirts9147+liubg2GIVbCCGNkWD9EWWweGraN0JyPQEiQ== X-Received: by 2002:a05:6512:358c:: with SMTP id m12mr8216889lfr.18.1597700349754; Mon, 17 Aug 2020 14:39:09 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id a30sm5813655lfo.1.2020.08.17.14.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 14:39:09 -0700 (PDT) From: Linus Walleij To: dri-devel@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Sean Paul Subject: [PATCH] drm/panel: s6e63m0: Order enable/disable sequence Date: Mon, 17 Aug 2020 23:39:06 +0200 Message-Id: <20200817213906.88207-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 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: Stephan Gerhold , linux-arm-kernel@lists.infradead.org, =?utf-8?q?Pawe=C5=82_Chmiel?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The upstream S6E63M0 driver has some pecularities around the prepare/enable disable/unprepare sequence: the screen is taken out of sleep in prepare() as part of s6e63m0_init() the put to on with MIPI_DCS_SET_DISPLAY_ON in enable(). However it is just put into sleep mode directly in disable(). As disable()/enable() can be called without unprepare()/prepare() being called, this is unbalanced, we should take the display out of sleep in enable() then turn it off(). Further MIPI_DCS_SET_DISPLAY_OFF is never called balanced with MIPI_DCS_SET_DISPLAY_ON. The vendor driver for Samsung GT-I8190 (Golden) does all of these things in strict order. Augment the driver to do exit sleep/set display on in enable() and set display off/enter sleep in disable(). Further send an explict reset pulse in power_on() so we come up in a known state, and issue the MCS_ERROR_CHECK command after setting display on like the vendor driver does. Also use the timings from the vendor driver in the sequence. Doing all of these things makes the display much more stable on the Samsung GT-I8190 when enabling/disabling the display pipeline. Cc: Paweł Chmiel Cc: Stephan Gerhold Signed-off-by: Linus Walleij Acked-by: Sam Ravnborg --- This is based on top of the earlier patches for s6e63m0. --- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c index f1d96ec3b57f..49b0470bcccd 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c @@ -26,6 +26,7 @@ #define MCS_ELVSS_ON 0xb1 #define MCS_MIECTL1 0xc0 #define MCS_BCMODE 0xc1 +#define MCS_ERROR_CHECK 0xd5 #define MCS_READ_ID1 0xda #define MCS_READ_ID2 0xdb #define MCS_READ_ID3 0xdc @@ -281,8 +282,6 @@ static void s6e63m0_init(struct s6e63m0 *ctx) s6e63m0_dcs_write_seq_static(ctx, MCS_ELVSS_ON, 0x0b); - - s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_EXIT_SLEEP_MODE); } static int s6e63m0_power_on(struct s6e63m0 *ctx) @@ -295,6 +294,9 @@ static int s6e63m0_power_on(struct s6e63m0 *ctx) msleep(25); + /* Be sure to send a reset pulse */ + gpiod_set_value(ctx->reset_gpio, 1); + msleep(5); gpiod_set_value(ctx->reset_gpio, 0); msleep(120); @@ -324,8 +326,10 @@ static int s6e63m0_disable(struct drm_panel *panel) backlight_disable(ctx->bl_dev); + s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_OFF); + msleep(10); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_ENTER_SLEEP_MODE); - msleep(200); + msleep(120); ctx->enabled = false; @@ -391,7 +395,15 @@ static int s6e63m0_enable(struct drm_panel *panel) if (ctx->enabled) return 0; + s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_EXIT_SLEEP_MODE); + msleep(120); s6e63m0_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_ON); + msleep(10); + + s6e63m0_dcs_write_seq_static(ctx, MCS_ERROR_CHECK, + 0xE7, 0x14, 0x60, 0x17, 0x0A, 0x49, 0xC3, + 0x8F, 0x19, 0x64, 0x91, 0x84, 0x76, 0x20, + 0x0F, 0x00); backlight_enable(ctx->bl_dev);