From patchwork Fri Jan 6 16:48:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Kitt X-Patchwork-Id: 13091639 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 47ADEC54E76 for ; Fri, 6 Jan 2023 17:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231638AbjAFRHF (ORCPT ); Fri, 6 Jan 2023 12:07:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235707AbjAFRGo (ORCPT ); Fri, 6 Jan 2023 12:06:44 -0500 X-Greylist: delayed 597 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 06 Jan 2023 09:06:25 PST Received: from 7.mo560.mail-out.ovh.net (7.mo560.mail-out.ovh.net [188.165.48.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382B72006 for ; Fri, 6 Jan 2023 09:06:24 -0800 (PST) Received: from director9.ghost.mail-out.ovh.net (unknown [10.108.20.161]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id AB02726112 for ; Fri, 6 Jan 2023 16:49:58 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-dkv5l (unknown [10.110.171.46]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C0B041FF00; Fri, 6 Jan 2023 16:49:57 +0000 (UTC) Received: from sk2.org ([37.59.142.107]) by ghost-submission-6684bf9d7b-dkv5l with ESMTPSA id KI4TJzVRuGOnAQEAwhnnFg (envelope-from ); Fri, 06 Jan 2023 16:49:57 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S0018fb2c2a3-f80b-4d71-80ed-2036c37f7c47, 9FE29456621203A27B372E1E0503D45BE0167874) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Lee Jones , Daniel Thompson , Jingoo Han Cc: Sam Ravnborg , Stephen Kitt , Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper Date: Fri, 6 Jan 2023 17:48:52 +0100 Message-Id: <20230106164856.1453819-2-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 5851864767681496795 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrkedtgdelgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeelgeetueejffejfeejvefhtddufeejgfetleegtddukeelieelvddvteduveejtdenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhfsgguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehiedtpdhmohguvgepshhmthhpohhuth Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Instead of retrieving the backlight brightness in struct backlight_properties manually, and then checking whether the backlight should be on at all, use backlight_get_brightness() which does all this and insulates this from future changes. Signed-off-by: Stephen Kitt Reviewed-by: Sam Ravnborg Reviewed-by: Daniel Thompson --- drivers/video/backlight/aat2870_bl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c index a7af9adafad6..1cbb303e9c88 100644 --- a/drivers/video/backlight/aat2870_bl.c +++ b/drivers/video/backlight/aat2870_bl.c @@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd) struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd); struct aat2870_data *aat2870 = dev_get_drvdata(aat2870_bl->pdev->dev.parent); - int brightness = bd->props.brightness; + int brightness = backlight_get_brightness(bd); int ret; if ((brightness < 0) || (bd->props.max_brightness < brightness)) { @@ -70,11 +70,6 @@ static int aat2870_bl_update_status(struct backlight_device *bd) dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n", bd->props.brightness, bd->props.power, bd->props.state); - if ((bd->props.power != FB_BLANK_UNBLANK) || - (bd->props.state & BL_CORE_FBBLANK) || - (bd->props.state & BL_CORE_SUSPENDED)) - brightness = 0; - ret = aat2870->write(aat2870, AAT2870_BLM, (u8)aat2870_brightness(aat2870_bl, brightness)); if (ret < 0) From patchwork Fri Jan 6 16:48:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Kitt X-Patchwork-Id: 13091638 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 954FBC54EBD for ; Fri, 6 Jan 2023 17:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230442AbjAFRHI (ORCPT ); Fri, 6 Jan 2023 12:07:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbjAFRGo (ORCPT ); Fri, 6 Jan 2023 12:06:44 -0500 X-Greylist: delayed 984 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 06 Jan 2023 09:06:26 PST Received: from 2.mo560.mail-out.ovh.net (2.mo560.mail-out.ovh.net [188.165.53.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 383DF3882 for ; Fri, 6 Jan 2023 09:06:25 -0800 (PST) Received: from director9.ghost.mail-out.ovh.net (unknown [10.108.20.161]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id AD938260F7 for ; Fri, 6 Jan 2023 16:49:59 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-dkv5l (unknown [10.110.171.46]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 0C2171FE9B; Fri, 6 Jan 2023 16:49:59 +0000 (UTC) Received: from sk2.org ([37.59.142.107]) by ghost-submission-6684bf9d7b-dkv5l with ESMTPSA id eB+zADdRuGOnAQEAwhnnFg (envelope-from ); Fri, 06 Jan 2023 16:49:59 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S00109038e94-ae10-4a84-be5c-29fce71eaa6f, 9FE29456621203A27B372E1E0503D45BE0167874) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Lee Jones , Daniel Thompson , Jingoo Han Cc: Sam Ravnborg , Stephen Kitt , Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 2/4] backlight: arcxcnn: Use backlight helper Date: Fri, 6 Jan 2023 17:48:53 +0100 Message-Id: <20230106164856.1453819-3-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 5852146243471509211 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrkedtgdelgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeelgeetueejffejfeejvefhtddufeejgfetleegtddukeelieelvddvteduveejtdenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhfsgguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehiedtpdhmohguvgepshhmthhpohhuth Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Instead of retrieving the backlight brightness in struct backlight_properties manually, and then checking whether the backlight should be on at all, use backlight_get_brightness() which does all this and insulates this from future changes. Signed-off-by: Stephen Kitt Reviewed-by: Sam Ravnborg Reviewed-by: Daniel Thompson --- drivers/video/backlight/arcxcnn_bl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/video/backlight/arcxcnn_bl.c b/drivers/video/backlight/arcxcnn_bl.c index 555b036643fb..e610d7a1d13d 100644 --- a/drivers/video/backlight/arcxcnn_bl.c +++ b/drivers/video/backlight/arcxcnn_bl.c @@ -130,12 +130,9 @@ static int arcxcnn_set_brightness(struct arcxcnn *lp, u32 brightness) static int arcxcnn_bl_update_status(struct backlight_device *bl) { struct arcxcnn *lp = bl_get_data(bl); - u32 brightness = bl->props.brightness; + u32 brightness = backlight_get_brightness(bl); int ret; - if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) - brightness = 0; - ret = arcxcnn_set_brightness(lp, brightness); if (ret) return ret; From patchwork Fri Jan 6 16:48:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Kitt X-Patchwork-Id: 13091654 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 38F40C3DA7A for ; Fri, 6 Jan 2023 17:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235562AbjAFR1I (ORCPT ); Fri, 6 Jan 2023 12:27:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235129AbjAFR1B (ORCPT ); Fri, 6 Jan 2023 12:27:01 -0500 Received: from 20.mo583.mail-out.ovh.net (20.mo583.mail-out.ovh.net [91.121.55.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6A17D9D6 for ; Fri, 6 Jan 2023 09:26:52 -0800 (PST) Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.143.136]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id D021A2661D for ; Fri, 6 Jan 2023 16:50:00 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-dkv5l (unknown [10.110.171.46]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 130501FEBF; Fri, 6 Jan 2023 16:50:00 +0000 (UTC) Received: from sk2.org ([37.59.142.107]) by ghost-submission-6684bf9d7b-dkv5l with ESMTPSA id 6P5cAjhRuGOnAQEAwhnnFg (envelope-from ); Fri, 06 Jan 2023 16:50:00 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S0011a1aef4d-84f6-4e9b-be06-f9755663a738, 9FE29456621203A27B372E1E0503D45BE0167874) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Lee Jones , Daniel Thompson , Jingoo Han Cc: Sam Ravnborg , Stephen Kitt , Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 3/4] backlight: ipaq_micro: Use backlight helper Date: Fri, 6 Jan 2023 17:48:54 +0100 Message-Id: <20230106164856.1453819-4-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 5852427716709222107 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrkedtgdelgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeelgeetueejffejfeejvefhtddufeejgfetleegtddukeelieelvddvteduveejtdenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhfsgguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Instead of retrieving the backlight brightness in struct backlight_properties manually, and then checking whether the backlight should be on at all, use backlight_get_brightness() which does all this and insulates this from future changes. Signed-off-by: Stephen Kitt Reviewed-by: Sam Ravnborg Reviewed-by: Daniel Thompson --- drivers/video/backlight/ipaq_micro_bl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c index 85b16cc82878..f595b8c8cbb2 100644 --- a/drivers/video/backlight/ipaq_micro_bl.c +++ b/drivers/video/backlight/ipaq_micro_bl.c @@ -16,17 +16,12 @@ static int micro_bl_update_status(struct backlight_device *bd) { struct ipaq_micro *micro = dev_get_drvdata(&bd->dev); - int intensity = bd->props.brightness; + int intensity = backlight_get_brightness(bd); struct ipaq_micro_msg msg = { .id = MSG_BACKLIGHT, .tx_len = 3, }; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.state & (BL_CORE_FBBLANK | BL_CORE_SUSPENDED)) - intensity = 0; - /* * Message format: * Byte 0: backlight instance (usually 1) From patchwork Fri Jan 6 16:48:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Kitt X-Patchwork-Id: 13091640 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 9B9FDC3DA7A for ; Fri, 6 Jan 2023 17:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229568AbjAFRHI (ORCPT ); Fri, 6 Jan 2023 12:07:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbjAFRGv (ORCPT ); Fri, 6 Jan 2023 12:06:51 -0500 X-Greylist: delayed 597 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 06 Jan 2023 09:06:49 PST Received: from 20.mo583.mail-out.ovh.net (20.mo583.mail-out.ovh.net [91.121.55.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC082A2 for ; Fri, 6 Jan 2023 09:06:49 -0800 (PST) Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.143.136]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 02DB526641 for ; Fri, 6 Jan 2023 16:50:01 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-dkv5l (unknown [10.110.171.46]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 34F0B1FE9B; Fri, 6 Jan 2023 16:50:01 +0000 (UTC) Received: from sk2.org ([37.59.142.107]) by ghost-submission-6684bf9d7b-dkv5l with ESMTPSA id 4GNNCjlRuGOnAQEAwhnnFg (envelope-from ); Fri, 06 Jan 2023 16:50:01 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S00126819975-9ec8-4c29-9bdd-5acdba6470ab, 9FE29456621203A27B372E1E0503D45BE0167874) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Lee Jones , Daniel Thompson , Jingoo Han Cc: Sam Ravnborg , Stephen Kitt , Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 4/4] backlight: tosa: Use backlight helper Date: Fri, 6 Jan 2023 17:48:55 +0100 Message-Id: <20230106164856.1453819-5-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 5852709192662877915 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrkedtgdelgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeelgeetueejffejfeejvefhtddufeejgfetleegtddukeelieelvddvteduveejtdenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhfsgguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Instead of retrieving the backlight brightness in struct backlight_properties manually, and then checking whether the backlight should be on at all, use backlight_get_brightness() which does all this and insulates this from future changes. Signed-off-by: Stephen Kitt Reviewed-by: Sam Ravnborg Reviewed-by: Daniel Thompson --- drivers/video/backlight/tosa_bl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index 77b71f6c19b5..e338b1f00f6a 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c @@ -50,13 +50,8 @@ static void tosa_bl_set_backlight(struct tosa_bl_data *data, int brightness) static int tosa_bl_update_status(struct backlight_device *dev) { - struct backlight_properties *props = &dev->props; struct tosa_bl_data *data = bl_get_data(dev); - int power = max(props->power, props->fb_blank); - int brightness = props->brightness; - - if (power) - brightness = 0; + int brightness = backlight_get_brightness(dev); tosa_bl_set_backlight(data, brightness);