Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp4069820rdg; Wed, 18 Oct 2023 14:08:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhfDe7rl+5v589zRsKPxhJ6cNtfjY/CAOfYMPXFFoowDuz191XmORwQhUPgYuCNNHDSqyH X-Received: by 2002:a05:6a21:7985:b0:16b:e89b:fb18 with SMTP id bh5-20020a056a21798500b0016be89bfb18mr333364pzc.26.1697663292085; Wed, 18 Oct 2023 14:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697663292; cv=none; d=google.com; s=arc-20160816; b=RxFoFq6Yr9z6vw0t83iFSmTZP0zTUrsWLlHkPrLfAe0L5GVsDnwbx2q6H7paZQc8EP xwpiv87Ldw9zKxC9nVA4li5AKqQ0pwRSrQ0PvEldb5Q4SrEHPsBiguGl/eageiaf0xUR ay6EkKpVe8giKY7rQijDEl8JqA9Lncbnbgi6bLkzlnQSfd3GS1ZqV+jttw75d+fzidIZ YEytHmHT4+9E0ixlyrZPY1OMU3Wx0/3hFGtlmctzakO21HlFOhM6q8IQJWg1yets8i9q aSou8D9+IH64Mj3aIomTzvMmGiZGYpUpPTg9jYFxR4arkw7Rw57xwCsdmbpDU8kGHrZh PwMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mQtvkowDr4bLjWtu7CtPMWJzK9SAncrdIe2qtTOm+vs=; fh=e/0burUwaTZw/WV3D7geD3JRy+xIxVBr7e7izbspwLg=; b=JQU3waoUK/rv6wSrBxOjODxtaUwheb1T7YAwNS/Syu6iXOjBNR7s3WYf0c99H8+Q4U OazTnLBypR65W5t8Sc1238Gqa1Agy+zIV6hych6xWJ5KJHU78yOhtNNz6XG91edVojRF 1XesTYLFlaQTulXk6HZ2AlXE1p+IBT8ah47b2Sh+itK6ceG9CwFTtAFVIwd87qcYwxnV m3OjSZpkWlMG4niXFdeh1Ecde4I8VWdT5Yst0VBdetcyNMUsLVjWWFzWeJxJms8RYVt0 GpkmroWGRinZfmiMrDFUKMyFVk1sf2PDT/mCAYeIsUdRVZgtDrSWIIOk7eFszvckNLcO Hy7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id h6-20020a636c06000000b005af7c6a2212si2906632pgc.648.2023.10.18.14.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 14:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3618C80DA99C; Wed, 18 Oct 2023 14:08:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231254AbjJRVHy (ORCPT + 99 others); Wed, 18 Oct 2023 17:07:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbjJRVHx (ORCPT ); Wed, 18 Oct 2023 17:07:53 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35ECFAB for ; Wed, 18 Oct 2023 14:07:51 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qtDlW-0006yC-NC; Wed, 18 Oct 2023 23:07:42 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtDlV-002dWq-Uy; Wed, 18 Oct 2023 23:07:41 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qtDlV-001Fj5-L5; Wed, 18 Oct 2023 23:07:41 +0200 Date: Wed, 18 Oct 2023 23:07:41 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Philipp Zabel Cc: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] backlight: pwm_bl: Avoid backlight flicker applying initial PWM state Message-ID: <20231018210741.6t3yfj6qgmpwhhlo@pengutronix.de> References: <20230608-backlight-pwm-avoid-flicker-v1-1-afd380d50174@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uwavnvilwrar6zje" Content-Disposition: inline In-Reply-To: <20230608-backlight-pwm-avoid-flicker-v1-1-afd380d50174@pengutronix.de> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 14:08:08 -0700 (PDT) --uwavnvilwrar6zje Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Philipp, On Thu, Jun 08, 2023 at 04:11:14PM +0200, Philipp Zabel wrote: > The initial PWM state returned by pwm_init_state() has a duty cycle > of 0 ns. This is only true for drivers without a .get_state() callback, isn't it? > To avoid backlight flicker when taking over an enabled > display from the bootloader, skip the initial pwm_apply_state() > and leave the PWM be until backlight_update_state() will apply the > state with the desired brightness. >=20 > Signed-off-by: Philipp Zabel > --- > With a PWM driver that allows to inherit PWM state from the bootloader, > postponing the initial pwm_apply_state() with 0 ns duty cycle allows to > set the desired duty cycle before the PWM is set, avoiding a short flicker > if the backlight was previously enabled and will be enabled again. > --- > drivers/video/backlight/pwm_bl.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/p= wm_bl.c > index fce412234d10..47a917038f58 100644 > --- a/drivers/video/backlight/pwm_bl.c > +++ b/drivers/video/backlight/pwm_bl.c > @@ -531,12 +531,10 @@ static int pwm_backlight_probe(struct platform_devi= ce *pdev) > if (!state.period && (data->pwm_period_ns > 0)) > state.period =3D data->pwm_period_ns; > =20 > - ret =3D pwm_apply_state(pb->pwm, &state); > - if (ret) { > - dev_err(&pdev->dev, "failed to apply initial PWM state: %d\n", > - ret); > - goto err_alloc; > - } > + /* > + * No need to apply initial state, except in the error path. Why do you want to modify the PWM in the error path? I would have expected not touching it at all in .probe() is fine?! > + * State will be applied by backlight_update_status() on success. > + */ > =20 > memset(&props, 0, sizeof(struct backlight_properties)); > =20 Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --uwavnvilwrar6zje Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmUwSRwACgkQj4D7WH0S /k4IYQgAqdMfaMxID6OyAlObAmlCPzwo9zZSaixG39XE1UfAxDEGF29uEKbIY5Uz 9c48ihdHh++fpxWt7xKhA4KXjtEoSPwWUCnaXCUJ0KVfXDh/xA0+IzDEtr1Z6Lyx NoyUwxiH40HE2XcxVVSl3GqHh1WZJeEcL2UbPhqE9NS/gE75N4EZbP7I+ysmRZeD fbM0KLMfTpUi+uPaujjQxKJRG+z0GpQ8sHrOv2kfdcnKRRqy80Uua1/QRgo12NFr 50BVmVIlqMsa/N4YtulbGIipw67/u5i2TvBZzyinZg2MlENQgbbS62RLy9eqf/Su 0W9LfKkRn2M5ZBr97rt15Opoa/ejYw== =IXwW -----END PGP SIGNATURE----- --uwavnvilwrar6zje--