Commit 870c3a9a authored by Linus Torvalds's avatar Linus Torvalds

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

Pull fbdev fixes from Helge Deller:

 - fix fbcon to prevent fonts bigger than 32x32 pixels to avoid
   overflows reported by syzbot

 - switch omapfb to use kstrtobool()

 - switch some fbdev drivers to use the backlight helpers

* tag 'fbdev-for-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
  fbcon: Check font dimension limits
  fbdev: omapfb: Use kstrtobool() instead of strtobool()
  fbdev: fbmon: fix function name in kernel-doc
  fbdev: atmel_lcdfb: Rework backlight status updates
  fbdev: riva: Use backlight helper
  fbdev: omapfb: panel-dsi-cm: Use backlight helper
  fbdev: nvidia: Use backlight helper
  fbdev: mx3fb: Use backlight helper
  fbdev: radeon: Use backlight helper
  fbdev: atyfb: Use backlight helper
  fbdev: aty128fb: Use backlight helper
parents 9e482602 2b09d5d3
...@@ -49,7 +49,6 @@ struct atmel_lcdfb_info { ...@@ -49,7 +49,6 @@ struct atmel_lcdfb_info {
struct clk *lcdc_clk; struct clk *lcdc_clk;
struct backlight_device *backlight; struct backlight_device *backlight;
u8 bl_power;
u8 saved_lcdcon; u8 saved_lcdcon;
u32 pseudo_palette[16]; u32 pseudo_palette[16];
...@@ -109,22 +108,7 @@ static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8 ...@@ -109,22 +108,7 @@ static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8
static int atmel_bl_update_status(struct backlight_device *bl) static int atmel_bl_update_status(struct backlight_device *bl)
{ {
struct atmel_lcdfb_info *sinfo = bl_get_data(bl); struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
int power = sinfo->bl_power; int brightness = backlight_get_brightness(bl);
int brightness = bl->props.brightness;
/* REVISIT there may be a meaningful difference between
* fb_blank and power ... there seem to be some cases
* this doesn't handle correctly.
*/
if (bl->props.fb_blank != sinfo->bl_power)
power = bl->props.fb_blank;
else if (bl->props.power != sinfo->bl_power)
power = bl->props.power;
if (brightness < 0 && power == FB_BLANK_UNBLANK)
brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
else if (power != FB_BLANK_UNBLANK)
brightness = 0;
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness); lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
if (contrast_ctr & ATMEL_LCDC_POL_POSITIVE) if (contrast_ctr & ATMEL_LCDC_POL_POSITIVE)
...@@ -133,8 +117,6 @@ static int atmel_bl_update_status(struct backlight_device *bl) ...@@ -133,8 +117,6 @@ static int atmel_bl_update_status(struct backlight_device *bl)
else else
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr); lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
return 0; return 0;
} }
...@@ -155,8 +137,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) ...@@ -155,8 +137,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)
struct backlight_properties props; struct backlight_properties props;
struct backlight_device *bl; struct backlight_device *bl;
sinfo->bl_power = FB_BLANK_UNBLANK;
if (sinfo->backlight) if (sinfo->backlight)
return; return;
......
...@@ -1766,12 +1766,10 @@ static int aty128_bl_update_status(struct backlight_device *bd) ...@@ -1766,12 +1766,10 @@ static int aty128_bl_update_status(struct backlight_device *bd)
unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
int level; int level;
if (bd->props.power != FB_BLANK_UNBLANK || if (!par->lcd_on)
bd->props.fb_blank != FB_BLANK_UNBLANK ||
!par->lcd_on)
level = 0; level = 0;
else else
level = bd->props.brightness; level = backlight_get_brightness(bd);
reg |= LVDS_BL_MOD_EN | LVDS_BLON; reg |= LVDS_BL_MOD_EN | LVDS_BLON;
if (level > 0) { if (level > 0) {
......
...@@ -2219,13 +2219,7 @@ static int aty_bl_update_status(struct backlight_device *bd) ...@@ -2219,13 +2219,7 @@ static int aty_bl_update_status(struct backlight_device *bd)
{ {
struct atyfb_par *par = bl_get_data(bd); struct atyfb_par *par = bl_get_data(bd);
unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
int level; int level = backlight_get_brightness(bd);
if (bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
else
level = bd->props.brightness;
reg |= (BLMOD_EN | BIASMOD_EN); reg |= (BLMOD_EN | BIASMOD_EN);
if (level > 0) { if (level > 0) {
......
...@@ -57,11 +57,7 @@ static int radeon_bl_update_status(struct backlight_device *bd) ...@@ -57,11 +57,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
* backlight. This provides some greater power saving and the display * backlight. This provides some greater power saving and the display
* is useless without backlight anyway. * is useless without backlight anyway.
*/ */
if (bd->props.power != FB_BLANK_UNBLANK || level = backlight_get_brightness(bd);
bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
else
level = bd->props.brightness;
del_timer_sync(&rinfo->lvds_timer); del_timer_sync(&rinfo->lvds_timer);
radeon_engine_idle(); radeon_engine_idle();
......
...@@ -2495,9 +2495,12 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, ...@@ -2495,9 +2495,12 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
return -EINVAL; return -EINVAL;
if (font->width > 32 || font->height > 32)
return -EINVAL;
/* Make sure drawing engine can handle the font */ /* Make sure drawing engine can handle the font */
if (!(info->pixmap.blit_x & (1 << (font->width - 1))) || if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
!(info->pixmap.blit_y & (1 << (font->height - 1)))) !(info->pixmap.blit_y & BIT(font->height - 1)))
return -EINVAL; return -EINVAL;
/* Make sure driver can handle the font length */ /* Make sure driver can handle the font length */
......
...@@ -1050,7 +1050,7 @@ static u32 fb_get_vblank(u32 hfreq) ...@@ -1050,7 +1050,7 @@ static u32 fb_get_vblank(u32 hfreq)
} }
/** /**
* fb_get_hblank_by_freq - get horizontal blank time given hfreq * fb_get_hblank_by_hfreq - get horizontal blank time given hfreq
* @hfreq: horizontal freq * @hfreq: horizontal freq
* @xres: horizontal resolution in pixels * @xres: horizontal resolution in pixels
* *
......
...@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl) ...@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl)
static int mx3fb_bl_update_status(struct backlight_device *bl) static int mx3fb_bl_update_status(struct backlight_device *bl)
{ {
struct mx3fb_data *fbd = bl_get_data(bl); struct mx3fb_data *fbd = bl_get_data(bl);
int brightness = bl->props.brightness; int brightness = backlight_get_brightness(bl);
if (bl->props.power != FB_BLANK_UNBLANK)
brightness = 0;
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;
fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness; fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness;
......
...@@ -49,17 +49,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd) ...@@ -49,17 +49,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
{ {
struct nvidia_par *par = bl_get_data(bd); struct nvidia_par *par = bl_get_data(bd);
u32 tmp_pcrt, tmp_pmc, fpcontrol; u32 tmp_pcrt, tmp_pmc, fpcontrol;
int level; int level = backlight_get_brightness(bd);
if (!par->FlatPanel) if (!par->FlatPanel)
return 0; return 0;
if (bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
else
level = bd->props.brightness;
tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF;
tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC; tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC;
fpcontrol = NV_RD32(par->PRAMDAC, 0x0848) & 0xCFFFFFCC; fpcontrol = NV_RD32(par->PRAMDAC, 0x0848) & 0xCFFFFFCC;
......
...@@ -331,13 +331,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev) ...@@ -331,13 +331,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev); struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
struct omap_dss_device *in = ddata->in; struct omap_dss_device *in = ddata->in;
int r; int r;
int level; int level = backlight_get_brightness(dev);
if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
dev->props.power == FB_BLANK_UNBLANK)
level = dev->props.brightness;
else
level = 0;
dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level); dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define DSS_SUBSYS_NAME "DISPLAY" #define DSS_SUBSYS_NAME "DISPLAY"
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kstrtox.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
...@@ -36,7 +37,7 @@ static ssize_t display_enabled_store(struct omap_dss_device *dssdev, ...@@ -36,7 +37,7 @@ static ssize_t display_enabled_store(struct omap_dss_device *dssdev,
int r; int r;
bool enable; bool enable;
r = strtobool(buf, &enable); r = kstrtobool(buf, &enable);
if (r) if (r)
return r; return r;
...@@ -73,7 +74,7 @@ static ssize_t display_tear_store(struct omap_dss_device *dssdev, ...@@ -73,7 +74,7 @@ static ssize_t display_tear_store(struct omap_dss_device *dssdev,
if (!dssdev->driver->enable_te || !dssdev->driver->get_te) if (!dssdev->driver->enable_te || !dssdev->driver->get_te)
return -ENOENT; return -ENOENT;
r = strtobool(buf, &te); r = kstrtobool(buf, &te);
if (r) if (r)
return r; return r;
...@@ -183,7 +184,7 @@ static ssize_t display_mirror_store(struct omap_dss_device *dssdev, ...@@ -183,7 +184,7 @@ static ssize_t display_mirror_store(struct omap_dss_device *dssdev,
if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror) if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror)
return -ENOENT; return -ENOENT;
r = strtobool(buf, &mirror); r = kstrtobool(buf, &mirror);
if (r) if (r)
return r; return r;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#define DSS_SUBSYS_NAME "MANAGER" #define DSS_SUBSYS_NAME "MANAGER"
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kstrtox.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -246,7 +247,7 @@ static ssize_t manager_trans_key_enabled_store(struct omap_overlay_manager *mgr, ...@@ -246,7 +247,7 @@ static ssize_t manager_trans_key_enabled_store(struct omap_overlay_manager *mgr,
bool enable; bool enable;
int r; int r;
r = strtobool(buf, &enable); r = kstrtobool(buf, &enable);
if (r) if (r)
return r; return r;
...@@ -290,7 +291,7 @@ static ssize_t manager_alpha_blending_enabled_store( ...@@ -290,7 +291,7 @@ static ssize_t manager_alpha_blending_enabled_store(
if(!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER)) if(!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER))
return -ENODEV; return -ENODEV;
r = strtobool(buf, &enable); r = kstrtobool(buf, &enable);
if (r) if (r)
return r; return r;
...@@ -329,7 +330,7 @@ static ssize_t manager_cpr_enable_store(struct omap_overlay_manager *mgr, ...@@ -329,7 +330,7 @@ static ssize_t manager_cpr_enable_store(struct omap_overlay_manager *mgr,
if (!dss_has_feature(FEAT_CPR)) if (!dss_has_feature(FEAT_CPR))
return -ENODEV; return -ENODEV;
r = strtobool(buf, &enable); r = kstrtobool(buf, &enable);
if (r) if (r)
return r; return r;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/kstrtox.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <video/omapfb_dss.h> #include <video/omapfb_dss.h>
...@@ -210,7 +211,7 @@ static ssize_t overlay_enabled_store(struct omap_overlay *ovl, const char *buf, ...@@ -210,7 +211,7 @@ static ssize_t overlay_enabled_store(struct omap_overlay *ovl, const char *buf,
int r; int r;
bool enable; bool enable;
r = strtobool(buf, &enable); r = kstrtobool(buf, &enable);
if (r) if (r)
return r; return r;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kstrtox.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/omapfb.h> #include <linux/omapfb.h>
...@@ -96,7 +97,7 @@ static ssize_t store_mirror(struct device *dev, ...@@ -96,7 +97,7 @@ static ssize_t store_mirror(struct device *dev,
int r; int r;
struct fb_var_screeninfo new_var; struct fb_var_screeninfo new_var;
r = strtobool(buf, &mirror); r = kstrtobool(buf, &mirror);
if (r) if (r)
return r; return r;
......
...@@ -293,13 +293,7 @@ static int riva_bl_update_status(struct backlight_device *bd) ...@@ -293,13 +293,7 @@ static int riva_bl_update_status(struct backlight_device *bd)
{ {
struct riva_par *par = bl_get_data(bd); struct riva_par *par = bl_get_data(bd);
U032 tmp_pcrt, tmp_pmc; U032 tmp_pcrt, tmp_pmc;
int level; int level = backlight_get_brightness(bd);
if (bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
else
level = bd->props.brightness;
tmp_pmc = NV_RD32(par->riva.PMC, 0x10F0) & 0x0000FFFF; tmp_pmc = NV_RD32(par->riva.PMC, 0x10F0) & 0x0000FFFF;
tmp_pcrt = NV_RD32(par->riva.PCRTC0, 0x081C) & 0xFFFFFFFC; tmp_pcrt = NV_RD32(par->riva.PCRTC0, 0x081C) & 0xFFFFFFFC;
......
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