Message ID | 20230211171748.36692-2-frank@oltmanns.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1603602wrn; Sat, 11 Feb 2023 10:19:12 -0800 (PST) X-Google-Smtp-Source: AK7set8ctc8uOC3lGy4hB3Lyf0G7hIursE1QVAJfB/RcJqJhw2xyF8YrAVXMF2wZG08IvG62aBaE X-Received: by 2002:a17:90a:58:b0:231:10da:59fc with SMTP id 24-20020a17090a005800b0023110da59fcmr15285797pjb.2.1676139552650; Sat, 11 Feb 2023 10:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676139552; cv=none; d=google.com; s=arc-20160816; b=MQNRCFMf6bXx6oirQZNFkntTgIhq0kHwnUHbwE+1xhShG0LQ5yoxyAVZoMX0qPUkNO IfyxLYv0CSlPmig48jALJ6Ap39Rwc6h/kygXK4Okbfu6Q0yY1mEgNWDGZFGGXnga66qW x9kMuh0PRMNVkCTdYSe8kKcm7gw4ni1DmPrqXsh4mBTYI45SFsCUj3FVopY83RZ39j+g IfhCwIDrM8Cs3NIwgPlJTB0hWOvkI9tNzGNitTCArdzzUH1UXINkvUCX49eCr1YQIFEH 6f8Pr1T2x87sxNNnz9KZyCgLxb2ceAdYoDnazSW8sy1CCMydJd00m7Vad1U0auxbODPE KejQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lmPdZlycIN75f7vuovHWz+/2BHjIn41XrnOla1taexs=; b=YRwdk9GAZ2ceBfhDKlrH2dhRHSkfT+XtGq9EEG8h4W+Mnu4j5HCofyUp9BggxT74fz SLK9O/9fhrBxWDolx3hjtZxdPwzDVOpeh70Od9i6vMAkMbjJx6sUR5U3aRBjXtyDDuI2 Nx8jYXNoMv561KcGBgn38pkV6zq465oNM708tWYB3ZaYSiBBzzuypPK8YYbXlD0F5x9S 534tw/XeOpHfzw69I/EPngV7lGq1OevvgIePhs3Q+ZyErWBavqhjS9hWc8Vf6E7w5Qie w3cHdefN++etO8CAqeDvzsR5naC7xQfGN2+/fcxlDZo1/mkcnK1RZjlS4lQZnCHf7WvO 9hSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=GYrpv1AU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i1-20020a17090a974100b00233a9c98466si4621352pjw.189.2023.02.11.10.19.00; Sat, 11 Feb 2023 10:19:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oltmanns.dev header.s=MBO0001 header.b=GYrpv1AU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oltmanns.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbjBKRSS (ORCPT <rfc822;olliecheer@gmail.com> + 99 others); Sat, 11 Feb 2023 12:18:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjBKRSR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 11 Feb 2023 12:18:17 -0500 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050:0:465::101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08655193E0 for <linux-kernel@vger.kernel.org>; Sat, 11 Feb 2023 09:18:15 -0800 (PST) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4PDckT72HJz9sTR; Sat, 11 Feb 2023 18:18:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1676135890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lmPdZlycIN75f7vuovHWz+/2BHjIn41XrnOla1taexs=; b=GYrpv1AUe7sTIk2cvOrNsK752yR8v7HrvOlN92yTHSCSc4EWa5UIJD34xk7rbZRrW8bfIY yuBpn1D1QwG3+CAzHienzwaJa7T0GbfQ4WDub7xedHFxOqDO+ROJbhIT3JBzozZSK1TcCQ 7uhgTQaMqcdq3Fs5E8JuR0wzTzR6owIkT3di5jZU6WFH+YnWQDC3JBRsa1v1R0EsJ3pe+H FE14BzPb4sesD1iZDRXNiUwxlWTin5aeyDQic6aEu+NJ6GDR0FwPZfoZWHG/bgbg9doNZm YmjL2ZjU75t12b5UgiYz8zxSPPshHHoh0U3L2ct4lC2iF1nToBb2M/sDMNJ0bw== From: Frank Oltmanns <frank@oltmanns.dev> To: =?utf-8?q?Guido_G=C3=BCnther?= <agx@sigxcpu.org>, Purism Kernel Team <kernel@puri.sm>, Ondrej Jirman <megous@megous.com>, Thierry Reding <thierry.reding@gmail.com>, Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, dri-devel@lists.freedesktop.org (open list:DRM PANEL DRIVERS), linux-kernel@vger.kernel.org (open list) Cc: Ondrej Jirman <megi@xff.cz>, Frank Oltmanns <frank@oltmanns.dev>, Samuel Holland <samuel@sholland.org> Subject: [PATCH 1/1] drm/panel: st7703: Pick different reset sequence Date: Sat, 11 Feb 2023 18:17:48 +0100 Message-Id: <20230211171748.36692-2-frank@oltmanns.dev> In-Reply-To: <20230211171748.36692-1-frank@oltmanns.dev> References: <20230211171748.36692-1-frank@oltmanns.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4PDckT72HJz9sTR X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757559707424798930?= X-GMAIL-MSGID: =?utf-8?q?1757559707424798930?= |
Series |
drm/panel: st7703: Fix initialization failures on Xingbangda XBD599
|
|
Commit Message
Frank Oltmanns
Feb. 11, 2023, 5:17 p.m. UTC
From: Ondrej Jirman <megi@xff.cz> Switching to a different reset sequence, enabling IOVCC before enabling VCC. 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 panel xingbangda,xbd599 (e.g. used in PinePhone). Signed-off-by: Ondrej Jirman <megi@xff.cz> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> Reported-by: Samuel Holland <samuel@sholland.org> --- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-)
Comments
Hi, On Sat, Feb 11, 2023 at 06:17:48PM +0100, Frank Oltmanns wrote: > From: Ondrej Jirman <megi@xff.cz> > > Switching to a different reset sequence, enabling IOVCC before enabling > VCC. > > 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 panel xingbangda,xbd599 (e.g. > used in PinePhone). > > Signed-off-by: Ondrej Jirman <megi@xff.cz> > Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> > Reported-by: Samuel Holland <samuel@sholland.org> > --- > drivers/gpu/drm/panel/panel-sitronix-st7703.c | 25 ++++++++++--------- > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > index 6747ca237ced..45695aa51f62 100644 > --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c > +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > @@ -411,29 +411,30 @@ static int st7703_prepare(struct drm_panel *panel) > return 0; > > dev_dbg(ctx->dev, "Resetting the panel\n"); > - ret = regulator_enable(ctx->vcc); > + gpiod_set_value_cansleep(ctx->reset_gpio, 1); > + > + ret = regulator_enable(ctx->iovcc); > if (ret < 0) { > - dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); > + dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); > return ret; > } > - ret = regulator_enable(ctx->iovcc); > + > + ret = regulator_enable(ctx->vcc); > if (ret < 0) { > - dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); > - goto disable_vcc; > + dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); > + regulator_disable(ctx->iovcc); > + return ret; > } > > - gpiod_set_value_cansleep(ctx->reset_gpio, 1); > - usleep_range(20, 40); > + /* 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; > > return 0; > - > -disable_vcc: > - regulator_disable(ctx->vcc); > - return ret; > } > > static const u32 mantix_bus_formats[] = { Reviewed-by: Guido Günther <agx@sigxcpu.org> Cheers, -- Guido > -- > 2.39.1 >
Hi, On Sat, Feb 11, 2023 at 06:17:48PM +0100, Frank Oltmanns wrote: > From: Ondrej Jirman <megi@xff.cz> > > Switching to a different reset sequence, enabling IOVCC before enabling > VCC. > > 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 panel xingbangda,xbd599 (e.g. > used in PinePhone). Thanks, applied to drm-misc-next. Cheers, -- Guido > > Signed-off-by: Ondrej Jirman <megi@xff.cz> > Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> > Reported-by: Samuel Holland <samuel@sholland.org> > --- > drivers/gpu/drm/panel/panel-sitronix-st7703.c | 25 ++++++++++--------- > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > index 6747ca237ced..45695aa51f62 100644 > --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c > +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > @@ -411,29 +411,30 @@ static int st7703_prepare(struct drm_panel *panel) > return 0; > > dev_dbg(ctx->dev, "Resetting the panel\n"); > - ret = regulator_enable(ctx->vcc); > + gpiod_set_value_cansleep(ctx->reset_gpio, 1); > + > + ret = regulator_enable(ctx->iovcc); > if (ret < 0) { > - dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); > + dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); > return ret; > } > - ret = regulator_enable(ctx->iovcc); > + > + ret = regulator_enable(ctx->vcc); > if (ret < 0) { > - dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); > - goto disable_vcc; > + dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); > + regulator_disable(ctx->iovcc); > + return ret; > } > > - gpiod_set_value_cansleep(ctx->reset_gpio, 1); > - usleep_range(20, 40); > + /* 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; > > return 0; > - > -disable_vcc: > - regulator_disable(ctx->vcc); > - return ret; > } > > static const u32 mantix_bus_formats[] = { > -- > 2.39.1 >
On Sun, Oct 15, 2023 at 02:49:20PM +0200, Guido Günther wrote: > Hi, > On Sat, Feb 11, 2023 at 06:17:48PM +0100, Frank Oltmanns wrote: > > From: Ondrej Jirman <megi@xff.cz> > > > > Switching to a different reset sequence, enabling IOVCC before enabling > > VCC. > > > > 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 panel xingbangda,xbd599 (e.g. > > used in PinePhone). > > Thanks, applied to drm-misc-next. > Cheers, > -- Guido Thank you. Probably too late, but this fixes problems I have with a different ST7703 based panel. Tested-by: Chris Morgan <macromorgan@hotmail.com> > > > > > Signed-off-by: Ondrej Jirman <megi@xff.cz> > > Signed-off-by: Frank Oltmanns <frank@oltmanns.dev> > > Reported-by: Samuel Holland <samuel@sholland.org> > > --- > > drivers/gpu/drm/panel/panel-sitronix-st7703.c | 25 ++++++++++--------- > > 1 file changed, 13 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > > index 6747ca237ced..45695aa51f62 100644 > > --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c > > +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c > > @@ -411,29 +411,30 @@ static int st7703_prepare(struct drm_panel *panel) > > return 0; > > > > dev_dbg(ctx->dev, "Resetting the panel\n"); > > - ret = regulator_enable(ctx->vcc); > > + gpiod_set_value_cansleep(ctx->reset_gpio, 1); > > + > > + ret = regulator_enable(ctx->iovcc); > > if (ret < 0) { > > - dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); > > + dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); > > return ret; > > } > > - ret = regulator_enable(ctx->iovcc); > > + > > + ret = regulator_enable(ctx->vcc); > > if (ret < 0) { > > - dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); > > - goto disable_vcc; > > + dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); > > + regulator_disable(ctx->iovcc); > > + return ret; > > } > > > > - gpiod_set_value_cansleep(ctx->reset_gpio, 1); > > - usleep_range(20, 40); > > + /* 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; > > > > return 0; > > - > > -disable_vcc: > > - regulator_disable(ctx->vcc); > > - return ret; > > } > > > > static const u32 mantix_bus_formats[] = { > > -- > > 2.39.1 > >
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index 6747ca237ced..45695aa51f62 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -411,29 +411,30 @@ static int st7703_prepare(struct drm_panel *panel) return 0; dev_dbg(ctx->dev, "Resetting the panel\n"); - ret = regulator_enable(ctx->vcc); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + + ret = regulator_enable(ctx->iovcc); if (ret < 0) { - dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); + dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); return ret; } - ret = regulator_enable(ctx->iovcc); + + ret = regulator_enable(ctx->vcc); if (ret < 0) { - dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); - goto disable_vcc; + dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); + regulator_disable(ctx->iovcc); + return ret; } - gpiod_set_value_cansleep(ctx->reset_gpio, 1); - usleep_range(20, 40); + /* 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; return 0; - -disable_vcc: - regulator_disable(ctx->vcc); - return ret; } static const u32 mantix_bus_formats[] = {