From: Stephen Kitt <steve@sk2.org>
To: Sam Ravnborg via B4 Submission Endpoint
<devnull+sam.ravnborg.org@kernel.org>
Cc: <sam@ravnborg.org>, Nicolas Ferre <nicolas.ferre@microchip.com>,
Helge Deller <deller@gmx.de>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
Antonino Daplas <adaplas@gmail.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Robin van der Gracht <robin@protonic.nl>,
Miguel Ojeda <ojeda@kernel.org>, Lee Jones <lee@kernel.org>,
Daniel Thompson <daniel.thompson@linaro.org>,
Jingoo Han <jingoohan1@gmail.com>,
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
Subject: Re: [PATCH 13/15] backlight: omap1: Use backlight helpers
Date: Sun, 8 Jan 2023 20:32:15 +0100 [thread overview]
Message-ID: <20230108203215.30037a70@heffalump.sk2.org> (raw)
In-Reply-To: <20230107-sam-video-backlight-drop-fb_blank-v1-13-1bd9bafb351f@ravnborg.org>
[-- Attachment #1: Type: text/plain, Size: 4324 bytes --]
On Sat, 07 Jan 2023 19:26:27 +0100, Sam Ravnborg via B4 Submission Endpoint
<devnull+sam.ravnborg.org@kernel.org> wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
>
> Rework backlight handling to avoid access to the deprecated
> backlight_properties.fb_blank member.
>
> The rework includes removal of get_brightness() operation,
> because there was no read back from HW so no use for it.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Lee Jones <lee@kernel.org>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> ---
> drivers/video/backlight/omap1_bl.c | 67
> +++++--------------------------------- 1 file changed, 9 insertions(+), 58
> deletions(-)
>
> diff --git a/drivers/video/backlight/omap1_bl.c
> b/drivers/video/backlight/omap1_bl.c index 69a49384b3de..49f37da857e7 100644
> --- a/drivers/video/backlight/omap1_bl.c
> +++ b/drivers/video/backlight/omap1_bl.c
> @@ -20,9 +20,6 @@
> #define OMAPBL_MAX_INTENSITY 0xff
>
> struct omap_backlight {
> - int powermode;
> - int current_intensity;
> -
> struct device *dev;
> struct omap_backlight_config *pdata;
> };
> @@ -37,82 +34,40 @@ static inline void omapbl_send_enable(int enable)
> omap_writeb(enable, OMAP_PWL_CLK_ENABLE);
> }
>
> -static void omapbl_blank(struct omap_backlight *bl, int mode)
> -{
> - if (bl->pdata->set_power)
> - bl->pdata->set_power(bl->dev, mode);
> -
> - switch (mode) {
> - case FB_BLANK_NORMAL:
> - case FB_BLANK_VSYNC_SUSPEND:
> - case FB_BLANK_HSYNC_SUSPEND:
> - case FB_BLANK_POWERDOWN:
> - omapbl_send_intensity(0);
> - omapbl_send_enable(0);
> - break;
> -
> - case FB_BLANK_UNBLANK:
> - omapbl_send_intensity(bl->current_intensity);
> - omapbl_send_enable(1);
> - break;
> - }
> -}
> -
> #ifdef CONFIG_PM_SLEEP
> static int omapbl_suspend(struct device *dev)
> {
> struct backlight_device *bl_dev = dev_get_drvdata(dev);
> - struct omap_backlight *bl = bl_get_data(bl_dev);
>
> - omapbl_blank(bl, FB_BLANK_POWERDOWN);
> + backlight_disable(bl_dev);
> return 0;
> }
>
> static int omapbl_resume(struct device *dev)
> {
> struct backlight_device *bl_dev = dev_get_drvdata(dev);
> - struct omap_backlight *bl = bl_get_data(bl_dev);
>
> - omapbl_blank(bl, bl->powermode);
> + backlight_enable(bl_dev);
> return 0;
> }
> #endif
>
> -static int omapbl_set_power(struct backlight_device *dev, int state)
> -{
> - struct omap_backlight *bl = bl_get_data(dev);
> -
> - omapbl_blank(bl, state);
> - bl->powermode = state;
> -
> - return 0;
> -}
> -
> static int omapbl_update_status(struct backlight_device *dev)
> {
> - struct omap_backlight *bl = bl_get_data(dev);
> + int brightness = backlight_get_brightness(dev);
>
> - if (bl->current_intensity != dev->props.brightness) {
> - if (bl->powermode == FB_BLANK_UNBLANK)
> - omapbl_send_intensity(dev->props.brightness);
> - bl->current_intensity = dev->props.brightness;
> + if (brightness > 0) {
> + omapbl_send_intensity(dev->props.brightness);
> + omapbl_send_enable(1);
> + } else {
> + omapbl_send_intensity(0);
> + omapbl_send_enable(0);
> }
>
> - if (dev->props.fb_blank != bl->powermode)
> - omapbl_set_power(dev, dev->props.fb_blank);
> -
> return 0;
> }
>
> -static int omapbl_get_intensity(struct backlight_device *dev)
> -{
> - struct omap_backlight *bl = bl_get_data(dev);
> -
> - return bl->current_intensity;
> -}
> -
> static const struct backlight_ops omapbl_ops = {
> - .get_brightness = omapbl_get_intensity,
> .update_status = omapbl_update_status,
> };
>
> @@ -139,9 +94,6 @@ static int omapbl_probe(struct platform_device *pdev)
> if (IS_ERR(dev))
> return PTR_ERR(dev);
>
> - bl->powermode = FB_BLANK_POWERDOWN;
> - bl->current_intensity = 0;
> -
> bl->pdata = pdata;
> bl->dev = &pdev->dev;
>
> @@ -149,7 +101,6 @@ static int omapbl_probe(struct platform_device *pdev)
>
> omap_cfg_reg(PWL); /* Conflicts with UART3 */
>
> - dev->props.fb_blank = FB_BLANK_UNBLANK;
> dev->props.brightness = pdata->default_intensity;
> omapbl_update_status(dev);
>
>
> --
> 2.34.1
Wow that gets rid of a lot of unnecessary code!
Reviewed-by: Stephen Kitt <steve@sk2.org>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-01-08 20:07 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 18:26 [PATCH 00/15] backlight: Drop use of deprecated fb_blank property Sam Ravnborg via B4 Submission Endpoint
2023-01-07 18:26 ` [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling Sam Ravnborg via B4 Submission Endpoint
2023-01-07 20:36 ` Stephen Kitt
2023-01-07 20:53 ` Sam Ravnborg
2023-01-08 7:45 ` Stephen Kitt
2023-01-08 7:47 ` Stephen Kitt
2023-01-08 20:24 ` Sam Ravnborg
2023-01-09 19:53 ` Stephen Kitt
2023-01-09 20:03 ` Stephen Kitt
2023-01-08 17:26 ` Helge Deller
2023-01-08 20:26 ` Sam Ravnborg
2023-01-09 20:18 ` Stephen Kitt
2023-01-09 20:34 ` Helge Deller
2023-01-09 9:14 ` Jani Nikula
2023-01-07 18:26 ` [PATCH 02/15] video: fbdev: atyfb: Introduce backlight_get_brightness() Sam Ravnborg via B4 Submission Endpoint
2023-01-09 17:44 ` Christophe Leroy
2023-01-09 18:21 ` Sam Ravnborg
2023-01-07 18:26 ` [PATCH 03/15] video: fbdev: nvidia: " Sam Ravnborg via B4 Submission Endpoint
2023-01-07 18:26 ` [PATCH 04/15] video: fbdev: radeon: " Sam Ravnborg via B4 Submission Endpoint
2023-01-07 18:26 ` [PATCH 05/15] video: fbdev: riva: " Sam Ravnborg via B4 Submission Endpoint
2023-01-07 18:26 ` [PATCH 06/15] video: fbdev: aty128fb: " Sam Ravnborg via B4 Submission Endpoint
2023-01-07 18:26 ` [PATCH 07/15] video: fbdev: mx3fb: " Sam Ravnborg via B4 Submission Endpoint
2023-01-07 18:26 ` [PATCH 08/15] video: fbdev: omap2: " Sam Ravnborg via B4 Submission Endpoint
2023-01-07 18:26 ` [PATCH 09/15] staging: fbtft: fb_ssd1351.c: Introduce backlight_is_blank() Sam Ravnborg via B4 Submission Endpoint
2023-01-08 19:28 ` Stephen Kitt
2023-01-08 20:29 ` Sam Ravnborg
2023-01-09 7:04 ` Stephen Kitt
2023-01-09 11:16 ` Daniel Thompson
2023-01-09 11:13 ` Andy Shevchenko
2023-01-07 18:26 ` [PATCH 10/15] staging: fbtft: core: " Sam Ravnborg via B4 Submission Endpoint
2023-01-08 19:29 ` Stephen Kitt
2023-01-09 11:15 ` Andy Shevchenko
2023-01-07 18:26 ` [PATCH 11/15] powerpc: via-pmu-backlight: Introduce backlight_get_brightness() Sam Ravnborg via B4 Submission Endpoint
2023-01-08 19:36 ` Stephen Kitt
2023-01-07 18:26 ` [PATCH 12/15] auxdisplay: ht16k33: " Sam Ravnborg via B4 Submission Endpoint
2023-01-07 21:02 ` Miguel Ojeda
2023-01-08 9:29 ` Sam Ravnborg
2023-01-09 10:12 ` Robin van der Gracht
2023-03-19 13:44 ` Stephen Kitt
2023-03-19 18:44 ` Sam Ravnborg
2023-01-07 18:26 ` [PATCH 13/15] backlight: omap1: Use backlight helpers Sam Ravnborg via B4 Submission Endpoint
2023-01-08 19:32 ` Stephen Kitt [this message]
2023-01-09 11:02 ` Daniel Thompson
2023-01-07 18:26 ` [PATCH 14/15] backlight: tosa: Use backlight helper Sam Ravnborg via B4 Submission Endpoint
2023-01-09 11:04 ` Daniel Thompson
2023-01-07 18:26 ` [PATCH 15/15] backlight: backlight: Drop the deprecated fb_blank property Sam Ravnborg via B4 Submission Endpoint
2023-01-08 19:32 ` Stephen Kitt
2023-01-09 11:06 ` Daniel Thompson
2023-01-09 16:27 ` Sam Ravnborg
2023-01-10 10:09 ` Lee Jones
2023-01-26 14:27 ` Lee Jones
2023-01-26 16:11 ` Sam Ravnborg
2023-01-26 16:30 ` Lee Jones
2023-01-09 11:18 ` [PATCH 00/15] backlight: Drop use of " Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230108203215.30037a70@heffalump.sk2.org \
--to=steve@sk2.org \
--cc=adaplas@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=benh@kernel.crashing.org \
--cc=claudiu.beznea@microchip.com \
--cc=daniel.thompson@linaro.org \
--cc=deller@gmx.de \
--cc=devnull+sam.ravnborg.org@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=jingoohan1@gmail.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicolas.ferre@microchip.com \
--cc=ojeda@kernel.org \
--cc=paulus@samba.org \
--cc=robin@protonic.nl \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).