[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <553AE999-CAF1-4E59-9F3F-68591ED192DE@sk2.org>
Date: Sat, 07 Jan 2023 21:36:47 +0100
From: Stephen Kitt <steve@....org>
To: sam@...nborg.org,
Sam Ravnborg via B4 Submission Endpoint
<devnull+sam.ravnborg.org@...nel.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Helge Deller <deller@....de>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Beznea <claudiu.beznea@...rochip.com>,
Antonino Daplas <adaplas@...il.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Robin van der Gracht <robin@...tonic.nl>,
Miguel Ojeda <ojeda@...nel.org>, Lee Jones <lee@...nel.org>,
Daniel Thompson <daniel.thompson@...aro.org>,
Jingoo Han <jingoohan1@...il.com>
CC: linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-omap@...r.kernel.org, linux-staging@...ts.linux.dev,
linuxppc-dev@...ts.ozlabs.org, Sam Ravnborg <sam@...nborg.org>,
Ludovic Desroches <ludovic.desroches@...rochip.com>
Subject: Re: [PATCH 01/15] video: fbdev: atmel_lcdfb: Rework backlight handling
On 7 January 2023 19:26:15 CET, Sam Ravnborg via B4 Submission Endpoint <devnull+sam.ravnborg.org@...nel.org> wrote:
>From: Sam Ravnborg <sam@...nborg.org>
>
>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 <sam@...nborg.org>
>Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>
>Cc: Alexandre Belloni <alexandre.belloni@...tlin.com>
>Cc: Ludovic Desroches <ludovic.desroches@...rochip.com>
>Cc: linux-fbdev@...r.kernel.org
>Cc: linux-arm-kernel@...ts.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
Powered by blists - more mailing lists