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: 247885 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp2991641ilo; Mon, 17 Aug 2020 14:39:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsLy/1nY3j/ihUBF15qzwoLk+FEv1Kkhl1KWL0AbewSYGi/XIocnVNBywnToVhaKjjmQTe X-Received: by 2002:a63:5d3:: with SMTP id 202mr8719093pgf.344.1597700356431; Mon, 17 Aug 2020 14:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597700356; cv=none; d=google.com; s=arc-20160816; b=QJA0UXSsRDd/l2ccfolpGL86iVu+RqTjg48j1EjOO4a8xxVzg5aBjlKz1WyEj/7Gba ++Trc3msmAzwrtBpRifgYj0MLvLo6nky9CzRWaoWK9uiNCEI/02ywpB3D1vs6UZ6P03I NQgQFhsd0wtGoID/Mc1Pk6XAyY62PXo01ITj4mDcNg3WnTgUmFF+cv+3Gr4lljMBhJhy womx9kv899n8Dsq2ekOIIIvxfQU3yrM+LKugaGldAtQDciD5jlw1iVu8okMBqckcVjM2 rBjcHcPwVaREospCuK63mLlgaqC1+eZh8hg/06gRNjMoZMRRWnjouNsi72krVVcoTFp8 jreg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=rNMSyAuCW+5YvL3ccsuicbKY6w8EanZp4FjoayvRlXE=; b=Hq1keu237xVgEbXaUCfHcE+4xxTNHHEjYTqAcY+J0lz8i5/JdCqfh6PGa4xpc+9Vz7 GiqzDjYejUGEa0Bdd1S0Kqr5VF2sUBRj3goJ23WuNWSaoS0UU0hE3VW0/uJYpVJtfPys fmEEtS6hbtSySvLIvfjc/7vsEkdbdMIuQ6DsEiweQMoYT08LF/yEsrSKLFAL2TMLiCmv x9YRfnsRWkVO8PSRFlpPCju1dmhdxdpWdTU0MxC/rThzFXFV+dQHxDXVbhfq+F5XX7kq 1ra/x9ILEKeVKXTislNJXeCCb67ctASq/HL11N9DtmnLSG5LkmskKjc9XMJlDaA2+pFU X8Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=oog6rrca; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id y10si13821539pjf.156.2020.08.17.14.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 14:39:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=oog6rrca; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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-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);