Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4197801rwl; Sat, 7 Jan 2023 13:03:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuljfDAWXy/FXczHQiVHMKyluoX89NkmhCwU45wH6F8ycJhf0qXp2CYunKFRYDFSKlbgf4A X-Received: by 2002:a17:906:9c96:b0:7c1:1c5:c7cd with SMTP id fj22-20020a1709069c9600b007c101c5c7cdmr54744673ejc.5.1673125387899; Sat, 07 Jan 2023 13:03:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673125387; cv=none; d=google.com; s=arc-20160816; b=EPZX0jqrC5j5DUlwHSXOqVLtt0ZBDdvkYLraEFO2vPuS0SAVqC0X73IphgOLIcnSln SBH3ZZJX9GktOQ7EPqzys7Uj3QYm1Olchb/kxUfVbLd5WSAW3bqM+W1UJoY2Hr6XP8L9 DB699NxpGqoiB7EEl46OfFtvG67nGvIbiHPBQth8Co9Ab3qPhozQ5A53mBSvXypW8VQN UGrLu09c8BUyjeY8EFPZJI44yKrjT2Yo0Fw5UgeNULVUfR2xPZl3RidtEcXSMA5fhshO X6TS0/FLiAtxgvAcD+0aUa8LUikTC6q8o22iKTqvJBbPkz9DZTxP3MBiel2DGipwxlPw ubjw== 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 :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date; bh=ef6mrc0t42x0coQA5r515g2UqckJvdTJABm1prqSAEk=; b=HQKfn7IRqGEhochyst5LBGBlUa3Eui5oyWLfr04k8e7+09hnKEJanUQPOBtcjYAitX hcuqAtK8EaDK147XuEdTUxHr0hTa4XsFud6NEBhnj+dUyDWy2ZJrjJOx3HsbjgqIZunU TeTGfRGgSpwhXlwu9VuJqOIvoEP8VaeVy5c9Hvzj4X2Q+dhs3yq8U8bF+oZYv8tzwGaf SE6n3/wCr2GgAwGHIkvm4mL7cKjI6QdlqrNrh95aR+sij4xPKUP5Q/BzVnJHA9Eo/SC+ 48uDdviLsBNyGVV3u30UiuQWC//cVLbk67gGeHvcF5Ck6KPSOD1MfyDIWkfJwCVWQrTM OtsA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb13-20020a170907070d00b0084d1310711dsi4985025ejb.315.2023.01.07.13.02.54; Sat, 07 Jan 2023 13:03:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232880AbjAGUhC convert rfc822-to-8bit (ORCPT + 55 others); Sat, 7 Jan 2023 15:37:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbjAGUg7 (ORCPT ); Sat, 7 Jan 2023 15:36:59 -0500 X-Greylist: delayed 86859 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 07 Jan 2023 12:36:57 PST Received: from 3.mo583.mail-out.ovh.net (3.mo583.mail-out.ovh.net [46.105.40.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 481156324 for ; Sat, 7 Jan 2023 12:36:57 -0800 (PST) Received: from director2.ghost.mail-out.ovh.net (unknown [10.108.16.31]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 4149D20A90 for ; Sat, 7 Jan 2023 20:36:55 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-lxtls (unknown [10.110.115.90]) by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id BD8F71FE98; Sat, 7 Jan 2023 20:36:50 +0000 (UTC) Received: from sk2.org ([37.59.142.105]) by ghost-submission-6684bf9d7b-lxtls with ESMTPSA id eSsCKuLXuWPI3wUAubRvvA (envelope-from ); Sat, 07 Jan 2023 20:36:50 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-105G0067839b063-0764-4415-809e-52a6ec1d72ef, DAE31E0ADBCC733EDB52157E78EF0D9B49FF90DC) smtp.auth=steve@sk2.org X-OVh-ClientIp: 37.167.110.121 Date: Sat, 07 Jan 2023 21:36:47 +0100 From: Stephen Kitt To: sam@ravnborg.org, Sam Ravnborg via B4 Submission Endpoint , Nicolas Ferre , Helge Deller , Alexandre Belloni , Claudiu Beznea , Antonino Daplas , Benjamin Herrenschmidt , Paul Mackerras , Greg Kroah-Hartman , Robin van der Gracht , Miguel Ojeda , Lee Jones , Daniel Thompson , Jingoo Han CC: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, Sam Ravnborg , Ludovic Desroches Subject: =?US-ASCII?Q?Re=3A_=5BPATCH_01/15=5D_video=3A_fbdev=3A_atm?= =?US-ASCII?Q?el=5Flcdfb=3A_Rework_backlight_handling?= User-Agent: K-9 Mail for Android In-Reply-To: <20230107-sam-video-backlight-drop-fb_blank-v1-1-1bd9bafb351f@ravnborg.org> References: <20230107-sam-video-backlight-drop-fb_blank-v1-0-1bd9bafb351f@ravnborg.org> <20230107-sam-video-backlight-drop-fb_blank-v1-1-1bd9bafb351f@ravnborg.org> Message-ID: <553AE999-CAF1-4E59-9F3F-68591ED192DE@sk2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Ovh-Tracer-Id: 15557403441115072134 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrkedvgddufeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvfevufgfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeekvddvteekgedtkefgueefheetheefffdtfeeuveettdejjeeutdetkefggeegleenucffohhmrghinheplhhkmhhlrdhorhhgnecukfhppeduvdejrddtrddtrddupdefjedrheelrddugedvrddutdehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeoshhtvghvvgesshhkvddrohhrgheqpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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: X-Mailing-List: linux-kernel@vger.kernel.org On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint wrote: >From: Sam Ravnborg > >The atmel_lcdfb had code to save/restore power state. >This is not needed so drop it. > >Introduce backlight_is_brightness() to make logic simpler. > >Signed-off-by: Sam Ravnborg >Cc: Nicolas Ferre >Cc: Alexandre Belloni >Cc: Ludovic Desroches >Cc: linux-fbdev@vger.kernel.org >Cc: linux-arm-kernel@lists.infradead.org >--- > drivers/video/fbdev/atmel_lcdfb.c | 24 +++--------------------- > 1 file changed, 3 insertions(+), 21 deletions(-) > >diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c >index 1fc8de4ecbeb..d297b3892637 100644 >--- a/drivers/video/fbdev/atmel_lcdfb.c >+++ b/drivers/video/fbdev/atmel_lcdfb.c >@@ -49,7 +49,6 @@ struct atmel_lcdfb_info { > struct clk *lcdc_clk; > > struct backlight_device *backlight; >- u8 bl_power; > u8 saved_lcdcon; > > u32 pseudo_palette[16]; >@@ -109,32 +108,18 @@ static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8 > static int atmel_bl_update_status(struct backlight_device *bl) > { > struct atmel_lcdfb_info *sinfo = bl_get_data(bl); >- int power = sinfo->bl_power; >- int brightness = bl->props.brightness; >+ int brightness; > >- /* REVISIT there may be a meaningful difference between >- * fb_blank and power ... there seem to be some cases >- * this doesn't handle correctly. >- */ >- if (bl->props.fb_blank != sinfo->bl_power) >- power = bl->props.fb_blank; >- else if (bl->props.power != sinfo->bl_power) >- power = bl->props.power; >- >- if (brightness < 0 && power == FB_BLANK_UNBLANK) >- brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); >- else if (power != FB_BLANK_UNBLANK) >- brightness = 0; >+ brightness = backlight_get_brightness(bl); > > lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness); >+ > if (contrast_ctr & ATMEL_LCDC_POL_POSITIVE) > lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, > brightness ? contrast_ctr : 0); > else > lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr); > >- bl->props.fb_blank = bl->props.power = sinfo->bl_power = power; >- > return 0; > } > >@@ -155,8 +140,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) > struct backlight_properties props; > struct backlight_device *bl; > >- sinfo->bl_power = FB_BLANK_UNBLANK; >- > if (sinfo->backlight) > return; > >@@ -173,7 +156,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) > sinfo->backlight = bl; > > bl->props.power = FB_BLANK_UNBLANK; >- bl->props.fb_blank = FB_BLANK_UNBLANK; > bl->props.brightness = atmel_bl_get_brightness(bl); > } > > Hi Sam, I’d submitted quite a few more of these previously (and you’d reviewed them), see e.g. the thread starting at https://lkml.org/lkml/2022/6/7/4365, and yesterday, https://lkml.org/lkml/2023/1/6/520, https://lkml.org/lkml/2023/1/6/656, https://lkml.org/lkml/2023/1/6/970, https://lkml.org/lkml/2023/1/6/643, and https://lkml.org/lkml/2023/1/6/680. There are a few more, I can find them if it’s any use. Regards, Stephen