From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E59D5C433EF for ; Thu, 9 Jun 2022 17:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345072AbiFIRpm (ORCPT ); Thu, 9 Jun 2022 13:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344498AbiFIRpi (ORCPT ); Thu, 9 Jun 2022 13:45:38 -0400 X-Greylist: delayed 166901 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 09 Jun 2022 10:45:36 PDT Received: from 8.mo584.mail-out.ovh.net (8.mo584.mail-out.ovh.net [188.165.33.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 832BE2A1D4B for ; Thu, 9 Jun 2022 10:45:33 -0700 (PDT) Received: from player714.ha.ovh.net (unknown [10.108.20.161]) by mo584.mail-out.ovh.net (Postfix) with ESMTP id C37CE251D3 for ; Thu, 9 Jun 2022 17:45:31 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player714.ha.ovh.net (Postfix) with ESMTPSA id CA8942B5D8553; Thu, 9 Jun 2022 17:45:18 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-107S0019894c42d-17cc-460a-bd58-8972ad9d0d06, FB82ABC7E83112E23A0D9558C7043BAE976A9334) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 Date: Thu, 9 Jun 2022 19:45:11 +0200 From: Stephen Kitt To: Sam Ravnborg Cc: Daniel Thompson , linux-fbdev@vger.kernel.org, Alexandre Belloni , Helge Deller , Nicolas Ferre , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Claudiu Beznea , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] fbdev: atmel_lcdfb: Rework backlight status updates Message-ID: <20220609194511.4e0bc3e6@heffalump.sk2.org> In-Reply-To: References: <20220608205623.2106113-1-steve@sk2.org> <20220609095412.fccofr2e2kpzhw4t@maple.lan> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/EP0pO67BNhj61Y43uRPbrz_"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Ovh-Tracer-Id: 3583457929091712646 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddtledgudduvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfgjfhfogggtsehgtderreertdejnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeiheevvdeugeejffefteffvefhieegjeevhfekjeejvdelgfefkeehhfdufffhjeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejudegrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekge Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/EP0pO67BNhj61Y43uRPbrz_ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Sam, Daniel, On Thu, 9 Jun 2022 19:30:57 +0200, Sam Ravnborg wrote: > thanks for taking care of all these backlight simplifications - this > really helps to make the code simpler and more readable. You=E2=80=99re welcome! I noticed fb_blank was deprecated and near enough u= nused, and started digging... > On Thu, Jun 09, 2022 at 10:54:12AM +0100, Daniel Thompson wrote: > > On Wed, Jun 08, 2022 at 10:56:23PM +0200, Stephen Kitt wrote: =20 > > > Instead of checking the state of various backlight_properties fields > > > against the memorised state in atmel_lcdfb_info.bl_power, > > > atmel_bl_update_status() should retrieve the desired state using > > > backlight_get_brightness (which takes into account the power state, > > > blanking etc.). This means the explicit checks using props.fb_blank > > > and props.power can be dropped. > > >=20 > > > Then brightness can only be negative if the backlight is on but > > > props.brightness is negative, so the test before reading the > > > brightness value from the hardware can be simplified to > > > (brightness < 0). =20 > >=20 > > props.brightness should always be in the interval 0..max_brightness. > >=20 > > This is enforced by the main backlight code (and APIs to set the > > brightness use unsigned values). Thus props.brightness could only be > > negative is the driver explicitly sets a negative value as some kind of > > placeholder (which this driver does not do). > >=20 > > I don't think there is any need to keep this logic. =20 >=20 > Daniel is right - please drop the "if (brightness < 0)" logic. > I have looked a bit on the datasheet in my attempt to do a drm version > of this driver - something that I am yet to succeed and the backlight > core avoid any negative values. Thanks for the reviews! I=E2=80=99ve prepared a v2 without the (brightness < 0) logic, I=E2=80=99m = about to submit it. Regards, Stephen --Sig_/EP0pO67BNhj61Y43uRPbrz_ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmKiMacACgkQgNMC9Yht g5wQqA/+MORCtyNvu5ifk0jvdn5LxEz8JNduQREG75KZo5vuDLlEtsc+PmZtFJxL uIDoVjfAwRpEkg0kw5JV7hIRg2XwkvioUC/7pTueOFQQyRvnS5gwP0NEQkPBvYyy cQ5njUzoFibUOTWg1DDNwjuKk5x5KfCeVwTt2EVNnWQg3n+5v9c8DnZZAnNn39PU ufwwmd9ZZ7NzEieSqtTqv1rd+YfBkQ9jE1Fk9cB143fWGMtQYbs0YXPCPsE7rclD g+xN73lzFUDtQyHebSEiMwVu9n1OHuR9ZBXI87TjT/f7gNBFzlYzc7jDzg4RWLt7 We0YQs1pDQTFzYjgdMLrKoSNU35ZFuSge2RhZz0/Rm0cYY1CbSpLxIW2d3LDumNM hFqRo5wIYPlZK5NW6HvTv1OeGFb7J7TI5r7zdbBtLXtnrHXK6TJ+OYp/wqldPKRx tShQcSBb0mPXzCjhEFzM4Hovb9/JkBL0BLRlXztbsnoYPGRgebsaq9GisNEJiXjZ ro/4Na1NzKfPijkWS9VXH9vpE5w3Xo7P7qJ43QnipRB00/Cfqup4IXPlAeoc2Z0O r6WzrI8Ue4umFico2lazistZ1qNIgiDfRcQQRK/Brsui6U0J3WJNn+I6PS2yRiN4 TxoRbATKZXeUgX5rf4LMP/bOTxk62XRTfDfaL4qWmaJ6miTugxI= =w0I1 -----END PGP SIGNATURE----- --Sig_/EP0pO67BNhj61Y43uRPbrz_-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9ADA6C433EF for ; Thu, 9 Jun 2022 17:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OaN+/aUaUkceSFLgheZtax50r9a31hnszJTCMEhQxHA=; b=XUS+ZlzYsNPIblTo6iQfFUdV89 OaJfNGvOhyS1vNYVGeCNC3PmGH9xYb1vVJwesljZN/JClD4qB9OzIqlpDlbXav2zWG4507RYXY0mV HhqeLJQtYtwynbWBPcmh+QMmAAOwpsy8cylqucJnnder5Mq9i17JJx0//l5SvunfhT7SgwPdCDSTm JZsiovnZlgAxc5SwDznyk42OYouW2yk0WIgdn3ruMiyoDlX8oYKiWfsWC+dHWUuuP6xq6QdWbmmj/ L1rbaRJbJc8XCcKhagfysI1N520Okg+ORIts3vQS5YErRxH6I7qiI5OP/od6FdYIJhK0x4MdjAJaK NYIO6dXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzMEB-003Ho1-T8; Thu, 09 Jun 2022 17:45:52 +0000 Received: from 3.mo550.mail-out.ovh.net ([46.105.60.232]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzMDy-003Heu-Nr for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2022 17:45:41 +0000 Received: from player714.ha.ovh.net (unknown [10.109.156.62]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id C991F250D0 for ; Thu, 9 Jun 2022 17:45:32 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player714.ha.ovh.net (Postfix) with ESMTPSA id CA8942B5D8553; Thu, 9 Jun 2022 17:45:18 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-107S0019894c42d-17cc-460a-bd58-8972ad9d0d06, FB82ABC7E83112E23A0D9558C7043BAE976A9334) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 Date: Thu, 9 Jun 2022 19:45:11 +0200 From: Stephen Kitt To: Sam Ravnborg Subject: Re: [PATCH] fbdev: atmel_lcdfb: Rework backlight status updates Message-ID: <20220609194511.4e0bc3e6@heffalump.sk2.org> In-Reply-To: References: <20220608205623.2106113-1-steve@sk2.org> <20220609095412.fccofr2e2kpzhw4t@maple.lan> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Ovh-Tracer-Id: 3583457929091712646 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddtledgudduvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfgjfhfogggtsehgtderreertdejnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeiheevvdeugeejffefteffvefhieegjeevhfekjeejvdelgfefkeehhfdufffhjeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejudegrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdgrrhhmqdhkvghrnhgvlheslhhishhtshdrihhnfhhrrgguvggrugdrohhrghdpoffvtefjohhsthepmhhoheehtd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220609_104539_151120_E5985839 X-CRM114-Status: GOOD ( 31.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Thompson , Alexandre Belloni , Helge Deller , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Claudiu Beznea , linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============8136639998412867418==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============8136639998412867418== Content-Type: multipart/signed; boundary="Sig_/EP0pO67BNhj61Y43uRPbrz_"; protocol="application/pgp-signature"; micalg=pgp-sha512 --Sig_/EP0pO67BNhj61Y43uRPbrz_ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Sam, Daniel, On Thu, 9 Jun 2022 19:30:57 +0200, Sam Ravnborg wrote: > thanks for taking care of all these backlight simplifications - this > really helps to make the code simpler and more readable. You=E2=80=99re welcome! I noticed fb_blank was deprecated and near enough u= nused, and started digging... > On Thu, Jun 09, 2022 at 10:54:12AM +0100, Daniel Thompson wrote: > > On Wed, Jun 08, 2022 at 10:56:23PM +0200, Stephen Kitt wrote: =20 > > > Instead of checking the state of various backlight_properties fields > > > against the memorised state in atmel_lcdfb_info.bl_power, > > > atmel_bl_update_status() should retrieve the desired state using > > > backlight_get_brightness (which takes into account the power state, > > > blanking etc.). This means the explicit checks using props.fb_blank > > > and props.power can be dropped. > > >=20 > > > Then brightness can only be negative if the backlight is on but > > > props.brightness is negative, so the test before reading the > > > brightness value from the hardware can be simplified to > > > (brightness < 0). =20 > >=20 > > props.brightness should always be in the interval 0..max_brightness. > >=20 > > This is enforced by the main backlight code (and APIs to set the > > brightness use unsigned values). Thus props.brightness could only be > > negative is the driver explicitly sets a negative value as some kind of > > placeholder (which this driver does not do). > >=20 > > I don't think there is any need to keep this logic. =20 >=20 > Daniel is right - please drop the "if (brightness < 0)" logic. > I have looked a bit on the datasheet in my attempt to do a drm version > of this driver - something that I am yet to succeed and the backlight > core avoid any negative values. Thanks for the reviews! I=E2=80=99ve prepared a v2 without the (brightness < 0) logic, I=E2=80=99m = about to submit it. Regards, Stephen --Sig_/EP0pO67BNhj61Y43uRPbrz_ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmKiMacACgkQgNMC9Yht g5wQqA/+MORCtyNvu5ifk0jvdn5LxEz8JNduQREG75KZo5vuDLlEtsc+PmZtFJxL uIDoVjfAwRpEkg0kw5JV7hIRg2XwkvioUC/7pTueOFQQyRvnS5gwP0NEQkPBvYyy cQ5njUzoFibUOTWg1DDNwjuKk5x5KfCeVwTt2EVNnWQg3n+5v9c8DnZZAnNn39PU ufwwmd9ZZ7NzEieSqtTqv1rd+YfBkQ9jE1Fk9cB143fWGMtQYbs0YXPCPsE7rclD g+xN73lzFUDtQyHebSEiMwVu9n1OHuR9ZBXI87TjT/f7gNBFzlYzc7jDzg4RWLt7 We0YQs1pDQTFzYjgdMLrKoSNU35ZFuSge2RhZz0/Rm0cYY1CbSpLxIW2d3LDumNM hFqRo5wIYPlZK5NW6HvTv1OeGFb7J7TI5r7zdbBtLXtnrHXK6TJ+OYp/wqldPKRx tShQcSBb0mPXzCjhEFzM4Hovb9/JkBL0BLRlXztbsnoYPGRgebsaq9GisNEJiXjZ ro/4Na1NzKfPijkWS9VXH9vpE5w3Xo7P7qJ43QnipRB00/Cfqup4IXPlAeoc2Z0O r6WzrI8Ue4umFico2lazistZ1qNIgiDfRcQQRK/Brsui6U0J3WJNn+I6PS2yRiN4 TxoRbATKZXeUgX5rf4LMP/bOTxk62XRTfDfaL4qWmaJ6miTugxI= =w0I1 -----END PGP SIGNATURE----- --Sig_/EP0pO67BNhj61Y43uRPbrz_-- --===============8136639998412867418== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============8136639998412867418==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7AC0AC433EF for ; Thu, 9 Jun 2022 17:53:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C414612B3F1; Thu, 9 Jun 2022 17:53:07 +0000 (UTC) Received: from 9.mo581.mail-out.ovh.net (9.mo581.mail-out.ovh.net [46.105.60.248]) by gabe.freedesktop.org (Postfix) with ESMTPS id A31EB12B3E7 for ; Thu, 9 Jun 2022 17:53:06 +0000 (UTC) Received: from player714.ha.ovh.net (unknown [10.109.138.54]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id C4273235EF for ; Thu, 9 Jun 2022 17:45:31 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player714.ha.ovh.net (Postfix) with ESMTPSA id CA8942B5D8553; Thu, 9 Jun 2022 17:45:18 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-107S0019894c42d-17cc-460a-bd58-8972ad9d0d06, FB82ABC7E83112E23A0D9558C7043BAE976A9334) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 Date: Thu, 9 Jun 2022 19:45:11 +0200 From: Stephen Kitt To: Sam Ravnborg Subject: Re: [PATCH] fbdev: atmel_lcdfb: Rework backlight status updates Message-ID: <20220609194511.4e0bc3e6@heffalump.sk2.org> In-Reply-To: References: <20220608205623.2106113-1-steve@sk2.org> <20220609095412.fccofr2e2kpzhw4t@maple.lan> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/EP0pO67BNhj61Y43uRPbrz_"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Ovh-Tracer-Id: 3583457929091712646 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddtledgudduvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfgjfhfogggtsehgtderreertdejnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeiheevvdeugeejffefteffvefhieegjeevhfekjeejvdelgfefkeehhfdufffhjeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejudegrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopegurhhiqdguvghvvghlsehlihhsthhsrdhfrhgvvgguvghskhhtohhprdhorhhgpdfovfetjfhoshhtpehmohehkedu 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: Daniel Thompson , Alexandre Belloni , Helge Deller , Nicolas Ferre , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Claudiu Beznea , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --Sig_/EP0pO67BNhj61Y43uRPbrz_ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Sam, Daniel, On Thu, 9 Jun 2022 19:30:57 +0200, Sam Ravnborg wrote: > thanks for taking care of all these backlight simplifications - this > really helps to make the code simpler and more readable. You=E2=80=99re welcome! I noticed fb_blank was deprecated and near enough u= nused, and started digging... > On Thu, Jun 09, 2022 at 10:54:12AM +0100, Daniel Thompson wrote: > > On Wed, Jun 08, 2022 at 10:56:23PM +0200, Stephen Kitt wrote: =20 > > > Instead of checking the state of various backlight_properties fields > > > against the memorised state in atmel_lcdfb_info.bl_power, > > > atmel_bl_update_status() should retrieve the desired state using > > > backlight_get_brightness (which takes into account the power state, > > > blanking etc.). This means the explicit checks using props.fb_blank > > > and props.power can be dropped. > > >=20 > > > Then brightness can only be negative if the backlight is on but > > > props.brightness is negative, so the test before reading the > > > brightness value from the hardware can be simplified to > > > (brightness < 0). =20 > >=20 > > props.brightness should always be in the interval 0..max_brightness. > >=20 > > This is enforced by the main backlight code (and APIs to set the > > brightness use unsigned values). Thus props.brightness could only be > > negative is the driver explicitly sets a negative value as some kind of > > placeholder (which this driver does not do). > >=20 > > I don't think there is any need to keep this logic. =20 >=20 > Daniel is right - please drop the "if (brightness < 0)" logic. > I have looked a bit on the datasheet in my attempt to do a drm version > of this driver - something that I am yet to succeed and the backlight > core avoid any negative values. Thanks for the reviews! I=E2=80=99ve prepared a v2 without the (brightness < 0) logic, I=E2=80=99m = about to submit it. Regards, Stephen --Sig_/EP0pO67BNhj61Y43uRPbrz_ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAmKiMacACgkQgNMC9Yht g5wQqA/+MORCtyNvu5ifk0jvdn5LxEz8JNduQREG75KZo5vuDLlEtsc+PmZtFJxL uIDoVjfAwRpEkg0kw5JV7hIRg2XwkvioUC/7pTueOFQQyRvnS5gwP0NEQkPBvYyy cQ5njUzoFibUOTWg1DDNwjuKk5x5KfCeVwTt2EVNnWQg3n+5v9c8DnZZAnNn39PU ufwwmd9ZZ7NzEieSqtTqv1rd+YfBkQ9jE1Fk9cB143fWGMtQYbs0YXPCPsE7rclD g+xN73lzFUDtQyHebSEiMwVu9n1OHuR9ZBXI87TjT/f7gNBFzlYzc7jDzg4RWLt7 We0YQs1pDQTFzYjgdMLrKoSNU35ZFuSge2RhZz0/Rm0cYY1CbSpLxIW2d3LDumNM hFqRo5wIYPlZK5NW6HvTv1OeGFb7J7TI5r7zdbBtLXtnrHXK6TJ+OYp/wqldPKRx tShQcSBb0mPXzCjhEFzM4Hovb9/JkBL0BLRlXztbsnoYPGRgebsaq9GisNEJiXjZ ro/4Na1NzKfPijkWS9VXH9vpE5w3Xo7P7qJ43QnipRB00/Cfqup4IXPlAeoc2Z0O r6WzrI8Ue4umFico2lazistZ1qNIgiDfRcQQRK/Brsui6U0J3WJNn+I6PS2yRiN4 TxoRbATKZXeUgX5rf4LMP/bOTxk62XRTfDfaL4qWmaJ6miTugxI= =w0I1 -----END PGP SIGNATURE----- --Sig_/EP0pO67BNhj61Y43uRPbrz_--