Commit d9702b2a authored by Thomas Zimmermann's avatar Thomas Zimmermann

fbdev/simplefb: Do not use struct fb_info.apertures

Acquire ownership of the firmware scanout buffer by calling Linux'
aperture helpers. Remove the use of struct fb_info.apertures and do
not set FBINFO_MISC_FIRMWARE; both of which previously configured
buffer ownership.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221219160516.23436-15-tzimmermann@suse.de
parent ef3c9fa9
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* Copyright (C) 1996 Paul Mackerras * Copyright (C) 1996 Paul Mackerras
*/ */
#include <linux/aperture.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -68,6 +69,8 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, ...@@ -68,6 +69,8 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
struct simplefb_par { struct simplefb_par {
u32 palette[PSEUDO_PALETTE_SIZE]; u32 palette[PSEUDO_PALETTE_SIZE];
resource_size_t base;
resource_size_t size;
struct resource *mem; struct resource *mem;
#if defined CONFIG_OF && defined CONFIG_COMMON_CLK #if defined CONFIG_OF && defined CONFIG_COMMON_CLK
bool clks_enabled; bool clks_enabled;
...@@ -472,16 +475,11 @@ static int simplefb_probe(struct platform_device *pdev) ...@@ -472,16 +475,11 @@ static int simplefb_probe(struct platform_device *pdev)
info->var.blue = params.format->blue; info->var.blue = params.format->blue;
info->var.transp = params.format->transp; info->var.transp = params.format->transp;
info->apertures = alloc_apertures(1); par->base = info->fix.smem_start;
if (!info->apertures) { par->size = info->fix.smem_len;
ret = -ENOMEM;
goto error_fb_release;
}
info->apertures->ranges[0].base = info->fix.smem_start;
info->apertures->ranges[0].size = info->fix.smem_len;
info->fbops = &simplefb_ops; info->fbops = &simplefb_ops;
info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE; info->flags = FBINFO_DEFAULT;
info->screen_base = ioremap_wc(info->fix.smem_start, info->screen_base = ioremap_wc(info->fix.smem_start,
info->fix.smem_len); info->fix.smem_len);
if (!info->screen_base) { if (!info->screen_base) {
...@@ -511,6 +509,11 @@ static int simplefb_probe(struct platform_device *pdev) ...@@ -511,6 +509,11 @@ static int simplefb_probe(struct platform_device *pdev)
if (mem != res) if (mem != res)
par->mem = mem; /* release in clean-up handler */ par->mem = mem; /* release in clean-up handler */
ret = devm_aperture_acquire_for_platform_device(pdev, par->base, par->size);
if (ret) {
dev_err(&pdev->dev, "Unable to acquire aperture: %d\n", ret);
goto error_regulators;
}
ret = register_framebuffer(info); ret = register_framebuffer(info);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);
......
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