Linux-fbdev Archive mirror
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com,
	deller@gmx.de
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-input@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH 01/10] backlight: Match backlight device against struct fb_info.bl_dev
Date: Tue, 20 Feb 2024 10:46:21 +0100	[thread overview]
Message-ID: <87edd7ii36.fsf@minerva.mail-host-address-is-not-set> (raw)
In-Reply-To: <a5b9a2d8-f305-4b68-9086-76d5f1b985c7@suse.de>

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Hi
>
> Am 20.02.24 um 10:17 schrieb Javier Martinez Canillas:
>> Thomas Zimmermann <tzimmermann@suse.de> writes:
>>
>> Hello Thomas,
>>
>>> Framebuffer drivers for devices with dedicated backlight are supposed
>>> to set struct fb_info.bl_dev to the backlight's respective device. Use
>>> the value to match backlight and framebuffer in the backlight core code.
>>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>   drivers/video/backlight/backlight.c | 9 +++++++--
>>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
>>> index 86e1cdc8e3697..48844a4f28ad3 100644
>>> --- a/drivers/video/backlight/backlight.c
>>> +++ b/drivers/video/backlight/backlight.c
>>> @@ -98,7 +98,8 @@ static int fb_notifier_callback(struct notifier_block *self,
>>>   {
>>>   	struct backlight_device *bd;
>>>   	struct fb_event *evdata = data;
>>> -	int node = evdata->info->node;
>>> +	struct fb_info *info = evdata->info;
>>> +	int node = info->node;
>>>   	int fb_blank = 0;
>>>   
>>>   	/* If we aren't interested in this event, skip it immediately ... */
>>> @@ -110,8 +111,12 @@ static int fb_notifier_callback(struct notifier_block *self,
>>>   
>>>   	if (!bd->ops)
>>>   		goto out;
>>> -	if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info))
>>> +	else if (bd->ops->check_fb && !bd->ops->check_fb(bd, info))
>>>   		goto out;
>>> +#if IS_ENABLED(CONFIG_FB_BACKLIGHT)
>>> +	else if (info->bl_dev && info->bl_dev != bd)
>> If the driver doesn't provide a struct backlight_ops .check_fb callback, I
>> think that having an info->bl_dev should be mandatory ? Or at least maybe
>> there should be a warning if info->bl_dev isn't set ?
>
> bl_dev can only be used for display drivers that set an explicit 
> backlight device; otherwise it's NULL. There seem to be systems where 
> backlight and display are distinct. And the docs for check_fb say that 
> by default the backlight matches against any display. I tried to keep 
> this semantics by silently succeeding if neither check_fb nor bl_dev 
> have bene set.
>
>>
>> The would be a driver bug, right ?
>
> I assume that some systems create the backlight instance from platform 
> data or DT and the display driver has no means of knowing about it.
>

Ok. I thought that in that case a (platform specific) .check_fb callback
would have to be provided then. But if the semantic is that none could be
missing, then I guess is OK to silently succeeding.

I wonder if at least a debug printout is worth it. But maybe a follow-up.

> Best regards
> Thomas
>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


  reply	other threads:[~2024-02-20  9:46 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 16:16 [PATCH 00/10] backlight: Replace struct fb_info in interfaces Thomas Zimmermann
2024-02-12 16:16 ` [PATCH 01/10] backlight: Match backlight device against struct fb_info.bl_dev Thomas Zimmermann
2024-02-15 12:02   ` Daniel Thompson
2024-02-20  9:17   ` Javier Martinez Canillas
2024-02-20  9:37     ` Thomas Zimmermann
2024-02-20  9:46       ` Javier Martinez Canillas [this message]
2024-02-12 16:16 ` [PATCH 02/10] auxdisplay/ht16k33: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-13 13:17   ` Robin van der Gracht
2024-02-20  9:18   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 03/10] hid/hid-picolcd: Fix initialization order Thomas Zimmermann
2024-02-20  9:19   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 04/10] hid/hid-picolcd: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-13 14:53   ` kernel test robot
2024-02-13 21:57   ` kernel test robot
2024-02-15 12:06   ` Daniel Thompson
2024-02-15 12:19     ` Thomas Zimmermann
2024-02-20  9:24   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 05/10] backlight/aat2870-backlight: Remove struct backlight.check_fb Thomas Zimmermann
2024-02-15 12:06   ` Daniel Thompson
2024-02-20  9:26   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 06/10] backlight/pwm-backlight: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-12 17:25   ` Uwe Kleine-König
2024-02-15 12:08   ` Daniel Thompson
2024-02-20  9:27   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 07/10] fbdev/sh_mobile_lcdc_fb: " Thomas Zimmermann
2024-02-20  9:27   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 08/10] fbdev/ssd1307fb: Init backlight before registering framebuffer Thomas Zimmermann
2024-02-20  9:32   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 09/10] fbdev/ssd1307fb: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-20  9:32   ` Javier Martinez Canillas
2024-02-12 16:16 ` [PATCH 10/10] backlight: Add controls_device callback to struct backlight_ops Thomas Zimmermann
2024-02-15 12:09   ` Daniel Thompson
2024-02-20  9:35   ` Javier Martinez Canillas
2024-02-15 12:13 ` [PATCH 00/10] backlight: Replace struct fb_info in interfaces Daniel Thompson
2024-02-15 12:23   ` Thomas Zimmermann
2024-02-19 15:02     ` Lee Jones
2024-02-21  9:23       ` Thomas Zimmermann

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=87edd7ii36.fsf@minerva.mail-host-address-is-not-set \
    --to=javierm@redhat.com \
    --cc=daniel.thompson@linaro.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).