Commit 56a6f83f authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Lee Jones

fbdev: ssd1307fb: Init backlight before registering framebuffer

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://lore.kernel.org/r/20240305162425.23845-9-tzimmermann@suse.deSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 8a8e7f84
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment