From nobody Tue Apr 28 02:28:06 2026 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 76100CCA482 for ; Tue, 7 Jun 2022 22:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355602AbiFGW1W (ORCPT ); Tue, 7 Jun 2022 18:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381552AbiFGVRv (ORCPT ); Tue, 7 Jun 2022 17:17:51 -0400 X-Greylist: delayed 1803 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 07 Jun 2022 11:59:13 PDT Received: from 3.mo550.mail-out.ovh.net (3.mo550.mail-out.ovh.net [46.105.60.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F00F223BCB for ; Tue, 7 Jun 2022 11:59:12 -0700 (PDT) Received: from player728.ha.ovh.net (unknown [10.110.103.121]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id 766B0247EF for ; Tue, 7 Jun 2022 18:21:03 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player728.ha.ovh.net (Postfix) with ESMTPSA id B1FF62B3FFB41; Tue, 7 Jun 2022 18:20:55 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-103G0056567a39d-9727-4b83-b825-c40a253e5342, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 1/3] drm/panel: Use backlight helper Date: Tue, 7 Jun 2022 20:20:24 +0200 Message-Id: <20220607182026.1121992-2-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607182026.1121992-1-steve@sk2.org> References: <20220607182026.1121992-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10884918828013553286 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedguddvgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejvdekrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheehtd Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Cc: Thierry Reding Cc: Sam Ravnborg Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c b/drivers= /gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c index 44674ebedf59..174ff434bd71 100644 --- a/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c +++ b/drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c @@ -215,14 +215,9 @@ static const struct drm_panel_funcs tm5p5_nt35596_pane= l_funcs =3D { static int tm5p5_nt35596_bl_update_status(struct backlight_device *bl) { struct mipi_dsi_device *dsi =3D bl_get_data(bl); - u16 brightness =3D bl->props.brightness; + u16 brightness =3D backlight_get_brightness(bl); int ret; =20 - if (bl->props.power !=3D FB_BLANK_UNBLANK || - bl->props.fb_blank !=3D FB_BLANK_UNBLANK || - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) - brightness =3D 0; - dsi->mode_flags &=3D ~MIPI_DSI_MODE_LPM; =20 ret =3D mipi_dsi_dcs_set_display_brightness(dsi, brightness); --=20 2.30.2 From nobody Tue Apr 28 02:28:06 2026 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 7F1EDC43334 for ; Tue, 7 Jun 2022 20:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378478AbiFGUwJ (ORCPT ); Tue, 7 Jun 2022 16:52:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358594AbiFGTwo (ORCPT ); Tue, 7 Jun 2022 15:52:44 -0400 X-Greylist: delayed 179 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 07 Jun 2022 11:21:13 PDT Received: from 9.mo576.mail-out.ovh.net (9.mo576.mail-out.ovh.net [46.105.56.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED7625DA for ; Tue, 7 Jun 2022 11:21:13 -0700 (PDT) Received: from player728.ha.ovh.net (unknown [10.111.172.36]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id CD860241BC for ; Tue, 7 Jun 2022 18:21:11 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player728.ha.ovh.net (Postfix) with ESMTPSA id 83A8D2B3FFBBD; Tue, 7 Jun 2022 18:21:03 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-103G005c1a5820f-bbd6-4097-a39f-86f090581fe2, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 2/3] drm/panel: panel-dsi-cm: Use backlight helpers Date: Tue, 7 Jun 2022 20:20:25 +0200 Message-Id: <20220607182026.1121992-3-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607182026.1121992-1-steve@sk2.org> References: <20220607182026.1121992-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10887170627632334470 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedguddvgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejvdekrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheejie Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Instead of setting the power state by manually updating fields in struct backlight_properties, use backlight_enable() and backlight_disable(). These also call backlight_update_status() so the separate call is no longer needed. Signed-off-by: Stephen Kitt Cc: Thierry Reding Cc: Sam Ravnborg Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/panel/panel-dsi-cm.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c b/drivers/gpu/drm/panel/p= anel-dsi-cm.c index b58cb064975f..aa36dc6cedd3 100644 --- a/drivers/gpu/drm/panel/panel-dsi-cm.c +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c @@ -86,16 +86,10 @@ static void dsicm_bl_power(struct panel_drv_data *ddata= , bool enable) return; =20 if (enable) { - backlight->props.fb_blank =3D FB_BLANK_UNBLANK; - backlight->props.state =3D ~(BL_CORE_FBBLANK | BL_CORE_SUSPENDED); - backlight->props.power =3D FB_BLANK_UNBLANK; + backlight_enable(backlight); } else { - backlight->props.fb_blank =3D FB_BLANK_NORMAL; - backlight->props.power =3D FB_BLANK_POWERDOWN; - backlight->props.state |=3D BL_CORE_FBBLANK | BL_CORE_SUSPENDED; + backlight_disable(backlight); } - - backlight_update_status(backlight); } =20 static void hw_guard_start(struct panel_drv_data *ddata, int guard_msec) @@ -196,13 +190,7 @@ static int dsicm_bl_update_status(struct backlight_dev= ice *dev) { struct panel_drv_data *ddata =3D dev_get_drvdata(&dev->dev); int r =3D 0; - int level; - - if (dev->props.fb_blank =3D=3D FB_BLANK_UNBLANK && - dev->props.power =3D=3D FB_BLANK_UNBLANK) - level =3D dev->props.brightness; - else - level =3D 0; + int level =3D backlight_get_brightness(dev); =20 dev_dbg(&ddata->dsi->dev, "update brightness to %d\n", level); =20 @@ -219,11 +207,7 @@ static int dsicm_bl_update_status(struct backlight_dev= ice *dev) =20 static int dsicm_bl_get_intensity(struct backlight_device *dev) { - if (dev->props.fb_blank =3D=3D FB_BLANK_UNBLANK && - dev->props.power =3D=3D FB_BLANK_UNBLANK) - return dev->props.brightness; - - return 0; + return backlight_get_brightness(dev); } =20 static const struct backlight_ops dsicm_bl_ops =3D { --=20 2.30.2 From nobody Tue Apr 28 02:28:06 2026 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 735B0CCA493 for ; Wed, 8 Jun 2022 00:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389076AbiFHAfP (ORCPT ); Tue, 7 Jun 2022 20:35:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387122AbiFGWt5 (ORCPT ); Tue, 7 Jun 2022 18:49:57 -0400 Received: from 1.mo582.mail-out.ovh.net (1.mo582.mail-out.ovh.net [46.105.56.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4CD42AA001 for ; Tue, 7 Jun 2022 12:38:35 -0700 (PDT) Received: from player728.ha.ovh.net (unknown [10.108.4.44]) by mo582.mail-out.ovh.net (Postfix) with ESMTP id 88CC22479F for ; Tue, 7 Jun 2022 18:21:19 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player728.ha.ovh.net (Postfix) with ESMTPSA id CA4DE2B3FFBEF; Tue, 7 Jun 2022 18:21:11 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-103G005316ed421-19f3-47a4-8681-230257df63a6, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 3/3] drm/panel: sony-acx565akm: Use backlight helpers Date: Tue, 7 Jun 2022 20:20:26 +0200 Message-Id: <20220607182026.1121992-4-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607182026.1121992-1-steve@sk2.org> References: <20220607182026.1121992-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 10889422424181868166 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedguddvgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejvdekrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekvd Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Instead of manually checking the power state in struct backlight_properties, use backlight_is_blank(). Signed-off-by: Stephen Kitt Cc: Thierry Reding Cc: Sam Ravnborg Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/panel/panel-sony-acx565akm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm= /panel/panel-sony-acx565akm.c index 0d7541a33f87..a6bc8c8cf6c8 100644 --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c @@ -298,13 +298,7 @@ static void acx565akm_set_brightness(struct acx565akm_= panel *lcd, int level) static int acx565akm_bl_update_status_locked(struct backlight_device *dev) { struct acx565akm_panel *lcd =3D dev_get_drvdata(&dev->dev); - int level; - - if (dev->props.fb_blank =3D=3D FB_BLANK_UNBLANK && - dev->props.power =3D=3D FB_BLANK_UNBLANK) - level =3D dev->props.brightness; - else - level =3D 0; + int level =3D backlight_get_brightness(dev); =20 acx565akm_set_brightness(lcd, level); =20 @@ -330,8 +324,7 @@ static int acx565akm_bl_get_intensity(struct backlight_= device *dev) =20 mutex_lock(&lcd->mutex); =20 - if (dev->props.fb_blank =3D=3D FB_BLANK_UNBLANK && - dev->props.power =3D=3D FB_BLANK_UNBLANK) + if (!backlight_is_blank(dev)) intensity =3D acx565akm_get_actual_brightness(lcd); else intensity =3D 0; --=20 2.30.2