Commit a3671bd8 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fbdev-for-6.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev

Pull fbdev fixes from Helge Deller:
 "The majority of lines changed is due to a code style cleanup in the
  pnmtologo helper program.

  Arnd removed the omap1 osk driver and the SIS fb driver is now
  orphaned.

  Other than that it's the usual bunch of small fixes and cleanups, e.g.
  prevent possible divide-by-zero in various fb drivers if the pixclock
  is zero and various conversions to devm_platform*() and of_property*()
  functions:

   - Drop omap1 osk driver

   - Various potential divide by zero pixclock fixes

   - Add pixelclock and fb_check_var() to stifb

   - Code style cleanups and indenting fixes"

* tag 'fbdev-for-6.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
  fbdev: Use of_property_present() for testing DT property presence
  fbdev: au1200fb: Fix potential divide by zero
  fbdev: lxfb: Fix potential divide by zero
  fbdev: intelfb: Fix potential divide by zero
  fbdev: nvidia: Fix potential divide by zero
  fbdev: stifb: Provide valid pixelclock and add fb_check_var() checks
  fbdev: omapfb: remove omap1 osk driver
  fbdev: xilinxfb: Use devm_platform_get_and_ioremap_resource()
  fbdev: wm8505fb: Use devm_platform_ioremap_resource()
  fbdev: pxa3xx-gcu: Use devm_platform_get_and_ioremap_resource()
  fbdev: Use of_property_read_bool() for boolean properties
  fbdev: clps711x-fb: Use devm_platform_get_and_ioremap_resource()
  fbdev: tgafb: Fix potential divide by zero
  MAINTAINERS: orphan SIS FRAMEBUFFER DRIVER
  fbdev: omapfb: cleanup inconsistent indentation
  drivers: video: logo: add SPDX comment, remove GPL notice in pnmtologo.c
  drivers: video: logo: fix code style issues in pnmtologo.c
parents 53429336 29413f05
...@@ -19150,9 +19150,7 @@ W: http://www.brownhat.org/sis900.html ...@@ -19150,9 +19150,7 @@ W: http://www.brownhat.org/sis900.html
F: drivers/net/ethernet/sis/sis900.* F: drivers/net/ethernet/sis/sis900.*
SIS FRAMEBUFFER DRIVER SIS FRAMEBUFFER DRIVER
M: Thomas Winischhofer <thomas@winischhofer.net> S: Orphan
S: Maintained
W: http://www.winischhofer.net/linuxsisvga.shtml
F: Documentation/fb/sisfb.rst F: Documentation/fb/sisfb.rst
F: drivers/video/fbdev/sis/ F: drivers/video/fbdev/sis/
F: include/video/sisfb.h F: include/video/sisfb.h
......
...@@ -854,7 +854,7 @@ static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev) ...@@ -854,7 +854,7 @@ static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
board->caps = CLCD_CAP_ALL; board->caps = CLCD_CAP_ALL;
board->check = clcdfb_check; board->check = clcdfb_check;
board->decode = clcdfb_decode; board->decode = clcdfb_decode;
if (of_find_property(node, "memory-region", NULL)) { if (of_property_present(node, "memory-region")) {
board->setup = clcdfb_of_vram_setup; board->setup = clcdfb_of_vram_setup;
board->mmap = clcdfb_of_vram_mmap; board->mmap = clcdfb_of_vram_mmap;
board->remove = clcdfb_of_vram_remove; board->remove = clcdfb_of_vram_remove;
......
...@@ -1040,6 +1040,9 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var, ...@@ -1040,6 +1040,9 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,
u32 pixclock; u32 pixclock;
int screen_size, plane; int screen_size, plane;
if (!var->pixclock)
return -EINVAL;
plane = fbdev->plane; plane = fbdev->plane;
/* Make sure that the mode respect all LCD controller and /* Make sure that the mode respect all LCD controller and
......
...@@ -306,7 +306,7 @@ static int bw2_probe(struct platform_device *op) ...@@ -306,7 +306,7 @@ static int bw2_probe(struct platform_device *op)
if (!par->regs) if (!par->regs)
goto out_release_fb; goto out_release_fb;
if (!of_find_property(dp, "width", NULL)) { if (!of_property_present(dp, "width")) {
err = bw2_do_default_mode(par, info, &linebytes); err = bw2_do_default_mode(par, info, &linebytes);
if (err) if (err)
goto out_unmap_regs; goto out_unmap_regs;
......
...@@ -393,7 +393,7 @@ static int cg3_probe(struct platform_device *op) ...@@ -393,7 +393,7 @@ static int cg3_probe(struct platform_device *op)
cg3_blank(FB_BLANK_UNBLANK, info); cg3_blank(FB_BLANK_UNBLANK, info);
if (!of_find_property(dp, "width", NULL)) { if (!of_property_present(dp, "width")) {
err = cg3_do_default_mode(par); err = cg3_do_default_mode(par);
if (err) if (err)
goto out_unmap_screen; goto out_unmap_screen;
......
...@@ -238,8 +238,7 @@ static int clps711x_fb_probe(struct platform_device *pdev) ...@@ -238,8 +238,7 @@ static int clps711x_fb_probe(struct platform_device *pdev)
info->fix.mmio_start = res->start; info->fix.mmio_start = res->start;
info->fix.mmio_len = resource_size(res); info->fix.mmio_len = resource_size(res);
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); info->screen_base = devm_platform_get_and_ioremap_resource(pdev, 1, &res);
info->screen_base = devm_ioremap_resource(dev, res);
if (IS_ERR(info->screen_base)) { if (IS_ERR(info->screen_base)) {
ret = PTR_ERR(info->screen_base); ret = PTR_ERR(info->screen_base);
goto out_fb_release; goto out_fb_release;
......
...@@ -235,6 +235,9 @@ static void get_modedb(struct fb_videomode **modedb, unsigned int *size) ...@@ -235,6 +235,9 @@ static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{ {
if (!var->pixclock)
return -EINVAL;
if (var->xres > 1920 || var->yres > 1440) if (var->xres > 1920 || var->yres > 1440)
return -EINVAL; return -EINVAL;
......
...@@ -1222,6 +1222,9 @@ static int intelfb_check_var(struct fb_var_screeninfo *var, ...@@ -1222,6 +1222,9 @@ static int intelfb_check_var(struct fb_var_screeninfo *var,
dinfo = GET_DINFO(info); dinfo = GET_DINFO(info);
if (!var->pixclock)
return -EINVAL;
/* update the pitch */ /* update the pitch */
if (intelfbhw_validate_mode(dinfo, var) != 0) if (intelfbhw_validate_mode(dinfo, var) != 0)
return -EINVAL; return -EINVAL;
......
...@@ -764,6 +764,8 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var, ...@@ -764,6 +764,8 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
int pitch, err = 0; int pitch, err = 0;
NVTRACE_ENTER(); NVTRACE_ENTER();
if (!var->pixclock)
return -EINVAL;
var->transp.offset = 0; var->transp.offset = 0;
var->transp.length = 0; var->transp.length = 0;
......
...@@ -549,10 +549,10 @@ static void offb_init_nodriver(struct platform_device *parent, struct device_nod ...@@ -549,10 +549,10 @@ static void offb_init_nodriver(struct platform_device *parent, struct device_nod
int foreign_endian = 0; int foreign_endian = 0;
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
if (of_get_property(dp, "little-endian", NULL)) if (of_property_read_bool(dp, "little-endian"))
foreign_endian = FBINFO_FOREIGN_ENDIAN; foreign_endian = FBINFO_FOREIGN_ENDIAN;
#else #else
if (of_get_property(dp, "big-endian", NULL)) if (of_property_read_bool(dp, "big-endian"))
foreign_endian = FBINFO_FOREIGN_ENDIAN; foreign_endian = FBINFO_FOREIGN_ENDIAN;
#endif #endif
......
...@@ -18,7 +18,6 @@ objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o ...@@ -18,7 +18,6 @@ objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o
lcds-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o lcds-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o
lcds-y$(CONFIG_MACH_OMAP_PALMTE) += lcd_palmte.o lcds-y$(CONFIG_MACH_OMAP_PALMTE) += lcd_palmte.o
lcds-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o
lcds-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o lcds-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o
......
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* LCD panel support for the TI OMAP OSK board
*
* Copyright (C) 2004 Nokia Corporation
* Author: Imre Deak <imre.deak@nokia.com>
* Adapted for OSK by <dirk.behme@de.bosch.com>
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/soc/ti/omap1-io.h>
#include <linux/soc/ti/omap1-mux.h>
#include "omapfb.h"
static int osk_panel_enable(struct lcd_panel *panel)
{
/* configure PWL pin */
omap_cfg_reg(PWL);
/* Enable PWL unit */
omap_writeb(0x01, OMAP_PWL_CLK_ENABLE);
/* Set PWL level */
omap_writeb(0xFF, OMAP_PWL_ENABLE);
/* set GPIO2 high (lcd power enabled) */
gpio_set_value(2, 1);
return 0;
}
static void osk_panel_disable(struct lcd_panel *panel)
{
/* Set PWL level to zero */
omap_writeb(0x00, OMAP_PWL_ENABLE);
/* Disable PWL unit */
omap_writeb(0x00, OMAP_PWL_CLK_ENABLE);
/* set GPIO2 low */
gpio_set_value(2, 0);
}
static struct lcd_panel osk_panel = {
.name = "osk",
.config = OMAP_LCDC_PANEL_TFT,
.bpp = 16,
.data_lines = 16,
.x_res = 240,
.y_res = 320,
.pixel_clock = 12500,
.hsw = 40,
.hfp = 40,
.hbp = 72,
.vsw = 1,
.vfp = 1,
.vbp = 0,
.pcd = 12,
.enable = osk_panel_enable,
.disable = osk_panel_disable,
};
static int osk_panel_probe(struct platform_device *pdev)
{
omapfb_register_panel(&osk_panel);
return 0;
}
static struct platform_driver osk_panel_driver = {
.probe = osk_panel_probe,
.driver = {
.name = "lcd_osk",
},
};
module_platform_driver(osk_panel_driver);
MODULE_AUTHOR("Imre Deak");
MODULE_DESCRIPTION("LCD panel support for the TI OMAP OSK board");
MODULE_LICENSE("GPL");
...@@ -544,19 +544,25 @@ static int set_fb_var(struct fb_info *fbi, ...@@ -544,19 +544,25 @@ static int set_fb_var(struct fb_info *fbi,
var->yoffset = var->yres_virtual - var->yres; var->yoffset = var->yres_virtual - var->yres;
if (plane->color_mode == OMAPFB_COLOR_RGB444) { if (plane->color_mode == OMAPFB_COLOR_RGB444) {
var->red.offset = 8; var->red.length = 4; var->red.offset = 8;
var->red.msb_right = 0; var->red.length = 4;
var->green.offset = 4; var->green.length = 4; var->red.msb_right = 0;
var->green.msb_right = 0; var->green.offset = 4;
var->blue.offset = 0; var->blue.length = 4; var->green.length = 4;
var->blue.msb_right = 0; var->green.msb_right = 0;
var->blue.offset = 0;
var->blue.length = 4;
var->blue.msb_right = 0;
} else { } else {
var->red.offset = 11; var->red.length = 5; var->red.offset = 11;
var->red.msb_right = 0; var->red.length = 5;
var->green.offset = 5; var->green.length = 6; var->red.msb_right = 0;
var->green.msb_right = 0; var->green.offset = 5;
var->blue.offset = 0; var->blue.length = 5; var->green.length = 6;
var->blue.msb_right = 0; var->green.msb_right = 0;
var->blue.offset = 0;
var->blue.length = 5;
var->blue.msb_right = 0;
} }
var->height = -1; var->height = -1;
......
...@@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void) ...@@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void)
omapdss_walk_device(dss, true); omapdss_walk_device(dss, true);
for_each_available_child_of_node(dss, child) { for_each_available_child_of_node(dss, child) {
if (!of_find_property(child, "compatible", NULL)) if (!of_property_present(child, "compatible"))
continue; continue;
omapdss_walk_device(child, true); omapdss_walk_device(child, true);
......
...@@ -599,8 +599,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) ...@@ -599,8 +599,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
priv->misc_dev.fops = &pxa3xx_gcu_miscdev_fops; priv->misc_dev.fops = &pxa3xx_gcu_miscdev_fops;
/* handle IO resources */ /* handle IO resources */
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->mmio_base = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
priv->mmio_base = devm_ioremap_resource(dev, r);
if (IS_ERR(priv->mmio_base)) if (IS_ERR(priv->mmio_base))
return PTR_ERR(priv->mmio_base); return PTR_ERR(priv->mmio_base);
......
...@@ -1737,10 +1737,10 @@ static int sm501fb_init_fb(struct fb_info *fb, enum sm501_controller head, ...@@ -1737,10 +1737,10 @@ static int sm501fb_init_fb(struct fb_info *fb, enum sm501_controller head,
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
if (of_get_property(info->dev->parent->of_node, "little-endian", NULL)) if (of_property_read_bool(info->dev->parent->of_node, "little-endian"))
fb->flags |= FBINFO_FOREIGN_ENDIAN; fb->flags |= FBINFO_FOREIGN_ENDIAN;
#else #else
if (of_get_property(info->dev->parent->of_node, "big-endian", NULL)) if (of_property_read_bool(info->dev->parent->of_node, "big-endian"))
fb->flags |= FBINFO_FOREIGN_ENDIAN; fb->flags |= FBINFO_FOREIGN_ENDIAN;
#endif #endif
#endif #endif
......
...@@ -921,6 +921,28 @@ SETUP_HCRX(struct stifb_info *fb) ...@@ -921,6 +921,28 @@ SETUP_HCRX(struct stifb_info *fb)
/* ------------------- driver specific functions --------------------------- */ /* ------------------- driver specific functions --------------------------- */
static int
stifb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
struct stifb_info *fb = container_of(info, struct stifb_info, info);
if (var->xres != fb->info.var.xres ||
var->yres != fb->info.var.yres ||
var->bits_per_pixel != fb->info.var.bits_per_pixel)
return -EINVAL;
var->xres_virtual = var->xres;
var->yres_virtual = var->yres;
var->xoffset = 0;
var->yoffset = 0;
var->grayscale = fb->info.var.grayscale;
var->red.length = fb->info.var.red.length;
var->green.length = fb->info.var.green.length;
var->blue.length = fb->info.var.blue.length;
return 0;
}
static int static int
stifb_setcolreg(u_int regno, u_int red, u_int green, stifb_setcolreg(u_int regno, u_int red, u_int green,
u_int blue, u_int transp, struct fb_info *info) u_int blue, u_int transp, struct fb_info *info)
...@@ -1145,6 +1167,7 @@ stifb_init_display(struct stifb_info *fb) ...@@ -1145,6 +1167,7 @@ stifb_init_display(struct stifb_info *fb)
static const struct fb_ops stifb_ops = { static const struct fb_ops stifb_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.fb_check_var = stifb_check_var,
.fb_setcolreg = stifb_setcolreg, .fb_setcolreg = stifb_setcolreg,
.fb_blank = stifb_blank, .fb_blank = stifb_blank,
.fb_fillrect = stifb_fillrect, .fb_fillrect = stifb_fillrect,
...@@ -1164,6 +1187,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) ...@@ -1164,6 +1187,7 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
struct stifb_info *fb; struct stifb_info *fb;
struct fb_info *info; struct fb_info *info;
unsigned long sti_rom_address; unsigned long sti_rom_address;
char modestr[32];
char *dev_name; char *dev_name;
int bpp, xres, yres; int bpp, xres, yres;
...@@ -1342,6 +1366,9 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) ...@@ -1342,6 +1366,9 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
info->flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT; info->flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
info->pseudo_palette = &fb->pseudo_palette; info->pseudo_palette = &fb->pseudo_palette;
scnprintf(modestr, sizeof(modestr), "%dx%d-%d", xres, yres, bpp);
fb_find_mode(&info->var, info, modestr, NULL, 0, NULL, bpp);
/* This has to be done !!! */ /* This has to be done !!! */
if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0)) if (fb_alloc_cmap(&info->cmap, NR_PALETTE, 0))
goto out_err1; goto out_err1;
......
...@@ -379,8 +379,7 @@ static int tcx_probe(struct platform_device *op) ...@@ -379,8 +379,7 @@ static int tcx_probe(struct platform_device *op)
spin_lock_init(&par->lock); spin_lock_init(&par->lock);
par->lowdepth = par->lowdepth = of_property_read_bool(dp, "tcx-8-bit");
(of_find_property(dp, "tcx-8-bit", NULL) != NULL);
sbusfb_fill_var(&info->var, dp, 8); sbusfb_fill_var(&info->var, dp, 8);
info->var.red.length = 8; info->var.red.length = 8;
......
...@@ -173,6 +173,9 @@ tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -173,6 +173,9 @@ tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{ {
struct tga_par *par = (struct tga_par *)info->par; struct tga_par *par = (struct tga_par *)info->par;
if (!var->pixclock)
return -EINVAL;
if (par->tga_type == TGA_TYPE_8PLANE) { if (par->tga_type == TGA_TYPE_8PLANE) {
if (var->bits_per_pixel != 8) if (var->bits_per_pixel != 8)
return -EINVAL; return -EINVAL;
......
...@@ -261,7 +261,6 @@ static const struct fb_ops wm8505fb_ops = { ...@@ -261,7 +261,6 @@ static const struct fb_ops wm8505fb_ops = {
static int wm8505fb_probe(struct platform_device *pdev) static int wm8505fb_probe(struct platform_device *pdev)
{ {
struct wm8505fb_info *fbi; struct wm8505fb_info *fbi;
struct resource *res;
struct display_timings *disp_timing; struct display_timings *disp_timing;
void *addr; void *addr;
int ret; int ret;
...@@ -299,8 +298,7 @@ static int wm8505fb_probe(struct platform_device *pdev) ...@@ -299,8 +298,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
addr = addr + sizeof(struct wm8505fb_info); addr = addr + sizeof(struct wm8505fb_info);
fbi->fb.pseudo_palette = addr; fbi->fb.pseudo_palette = addr;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); fbi->regbase = devm_platform_ioremap_resource(pdev, 0);
fbi->regbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(fbi->regbase)) if (IS_ERR(fbi->regbase))
return PTR_ERR(fbi->regbase); return PTR_ERR(fbi->regbase);
......
...@@ -273,8 +273,7 @@ static int xilinxfb_assign(struct platform_device *pdev, ...@@ -273,8 +273,7 @@ static int xilinxfb_assign(struct platform_device *pdev,
if (drvdata->flags & BUS_ACCESS_FLAG) { if (drvdata->flags & BUS_ACCESS_FLAG) {
struct resource *res; struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); drvdata->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
drvdata->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(drvdata->regs)) if (IS_ERR(drvdata->regs))
return PTR_ERR(drvdata->regs); return PTR_ERR(drvdata->regs);
...@@ -469,8 +468,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev) ...@@ -469,8 +468,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev)
pdata.yvirt = prop[1]; pdata.yvirt = prop[1];
} }
if (of_find_property(pdev->dev.of_node, "rotate-display", NULL)) pdata.rotate_screen = of_property_read_bool(pdev->dev.of_node, "rotate-display");
pdata.rotate_screen = 1;
platform_set_drvdata(pdev, drvdata); platform_set_drvdata(pdev, drvdata);
return xilinxfb_assign(pdev, drvdata, &pdata); return xilinxfb_assign(pdev, drvdata, &pdata);
......
This diff is collapsed.
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