From: Thomas Zimmermann <tzimmermann@suse.de>
To: lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com,
deller@gmx.de, andy@kernel.org, robin@protonic.nl,
javierm@redhat.com
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
linux-input@vger.kernel.org, linux-pwm@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 08/10] fbdev/ssd1307fb: Init backlight before registering framebuffer
Date: Wed, 21 Feb 2024 10:41:35 +0100 [thread overview]
Message-ID: <20240221094324.27436-9-tzimmermann@suse.de> (raw)
In-Reply-To: <20240221094324.27436-1-tzimmermann@suse.de>
For drivers that support backlight, LCD and fbdev devices, fbdev has
to be initialized last. See documentation for struct fbinfo.bl_dev.
The backlight name's index number comes from register_framebuffer(),
which now happens after initializing the backlight device. So like
in all other backlight drivers, we now give the backlight device a
generic name without the fbdev index.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
---
drivers/video/fbdev/ssd1307fb.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 1a4f90ea7d5a8..0d1590c61eb06 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -594,7 +594,6 @@ static int ssd1307fb_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct backlight_device *bl;
- char bl_name[12];
struct fb_info *info;
struct fb_deferred_io *ssd1307fb_defio;
u32 vmem_size;
@@ -733,31 +732,30 @@ static int ssd1307fb_probe(struct i2c_client *client)
if (ret)
goto regulator_enable_error;
- ret = register_framebuffer(info);
- if (ret) {
- dev_err(dev, "Couldn't register the framebuffer\n");
- goto panel_init_error;
- }
-
- snprintf(bl_name, sizeof(bl_name), "ssd1307fb%d", info->node);
- bl = backlight_device_register(bl_name, dev, par, &ssd1307fb_bl_ops,
+ bl = backlight_device_register("ssd1307fb-bl", dev, par, &ssd1307fb_bl_ops,
NULL);
if (IS_ERR(bl)) {
ret = PTR_ERR(bl);
dev_err(dev, "unable to register backlight device: %d\n", ret);
- goto bl_init_error;
+ goto panel_init_error;
+ }
+ info->bl_dev = bl;
+
+ ret = register_framebuffer(info);
+ if (ret) {
+ dev_err(dev, "Couldn't register the framebuffer\n");
+ goto fb_init_error;
}
bl->props.brightness = par->contrast;
bl->props.max_brightness = MAX_CONTRAST;
- info->bl_dev = bl;
dev_info(dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size);
return 0;
-bl_init_error:
- unregister_framebuffer(info);
+fb_init_error:
+ backlight_device_unregister(bl);
panel_init_error:
pwm_disable(par->pwm);
pwm_put(par->pwm);
--
2.43.0
next prev parent reply other threads:[~2024-02-21 9:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 9:41 [PATCH v2 00/10] backlight: Replace struct fb_info in interfaces Thomas Zimmermann
2024-02-21 9:41 ` [PATCH v2 01/10] backlight: Match backlight device against struct fb_info.bl_dev Thomas Zimmermann
2024-02-21 14:34 ` Andy Shevchenko
2024-02-21 15:44 ` Thomas Zimmermann
2024-02-21 16:46 ` Andy Shevchenko
2024-02-23 10:53 ` Lee Jones
2024-02-21 9:41 ` [PATCH v2 02/10] auxdisplay/ht16k33: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-21 14:35 ` Andy Shevchenko
2024-02-21 9:41 ` [PATCH v2 03/10] hid/hid-picolcd: Fix initialization order Thomas Zimmermann
2024-02-21 9:41 ` [PATCH v2 04/10] hid/hid-picolcd: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-21 9:41 ` [PATCH v2 05/10] backlight/aat2870-backlight: Remove struct backlight.check_fb Thomas Zimmermann
2024-02-21 9:41 ` [PATCH v2 06/10] backlight/pwm-backlight: Remove struct backlight_ops.check_fb Thomas Zimmermann
2024-02-21 9:41 ` [PATCH v2 07/10] fbdev/sh_mobile_lcdc_fb: " Thomas Zimmermann
2024-02-21 9:41 ` Thomas Zimmermann [this message]
2024-02-21 9:41 ` [PATCH v2 09/10] fbdev/ssd1307fb: " Thomas Zimmermann
2024-02-21 9:41 ` [PATCH v2 10/10] backlight: Add controls_device callback to struct backlight_ops 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=20240221094324.27436-9-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=andy@kernel.org \
--cc=daniel.thompson@linaro.org \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--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=robin@protonic.nl \
/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).