Commit 06e386a1 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'fbdev-v4.19' of https://github.com/bzolnier/linux

Pull fbdev updates from Bartlomiej Zolnierkiewicz:
 "Mostly small fixes and cleanups for fb drivers (the biggest updates
  are for udlfb and pxafb drivers). This also adds deferred console
  takeover support to the console code and efifb driver.

  Summary:

   - add support for deferred console takeover, when enabled defers
     fbcon taking over the console from the dummy console until the
     first text is displayed on the console - together with the "quiet"
     kernel commandline option this allows fbcon to still be used
     together with a smooth graphical bootup (Hans de Goede)

   - improve console locking debugging code (Thomas Zimmermann)

   - copy the ACPI BGRT boot graphics to the framebuffer when deferred
     console takeover support is used in efifb driver (Hans de Goede)

   - update udlfb driver - fix lost console when the user unplugs a USB
     adapter, fix the screen corruption issue, fix locking and add some
     performance optimizations (Mikulas Patocka)

   - update pxafb driver - fix using uninitialized memory, switch to
     devm_* API, handle initialization errors and add support for
     lcd-supply regulator (Daniel Mack)

   - add support for boards booted with a DeviceTree in pxa3xx_gcu
     driver (Daniel Mack)

   - rename omap2 module to omap2fb.ko to avoid conflicts with omap1
     driver (Arnd Bergmann)

   - enable ACPI-based enumeration for goldfishfb driver (Yu Ning)

   - fix goldfishfb driver to make user space Android code use 60 fps
     (Christoffer Dall)

   - print big fat warning when nomodeset kernel parameter is used in
     vgacon driver (Lyude Paul)

   - remove VLA usage from fsl-diu-fb driver (Kees Cook)

   - misc fixes (Julia Lawall, Geert Uytterhoeven, Fredrik Noring,
     Yisheng Xie, Dan Carpenter, Daniel Vetter, Anton Vasilyev, Randy
     Dunlap, Gustavo A. R. Silva, Colin Ian King, Fengguang Wu)

   - misc cleanups (Roman Kiryanov, Yisheng Xie, Colin Ian King)"

* tag 'fbdev-v4.19' of https://github.com/bzolnier/linux: (54 commits)
  Documentation/fb: corrections for fbcon.txt
  fbcon: Do not takeover the console from atomic context
  dummycon: Stop exporting dummycon_[un]register_output_notifier
  fbcon: Only defer console takeover if the current console driver is the dummycon
  fbcon: Only allow FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER if fbdev is builtin
  fbdev: omap2: omapfb: fix ifnullfree.cocci warnings
  fbdev: omap2: omapfb: fix bugon.cocci warnings
  fbdev: omap2: omapfb: fix boolreturn.cocci warnings
  fb: amifb: fix build warnings when not builtin
  fbdev/core: Disable console-lock warnings when fb.lockless_register_fb is set
  console: Replace #if 0 with atomic var 'ignore_console_lock_warning'
  udlfb: use spin_lock_irq instead of spin_lock_irqsave
  udlfb: avoid prefetch
  udlfb: optimization - test the backing buffer
  udlfb: allow reallocating the framebuffer
  udlfb: set line_length in dlfb_ops_set_par
  udlfb: handle allocation failure
  udlfb: set optimal write delay
  udlfb: make a local copy of fb_ops
  udlfb: don't switch if we are switching to the same videomode
  ...
parents 99897b1e f3968452
...@@ -10,6 +10,9 @@ Required properties: ...@@ -10,6 +10,9 @@ Required properties:
- interrupts : framebuffer controller interrupt. - interrupts : framebuffer controller interrupt.
- clocks: phandle to input clocks - clocks: phandle to input clocks
Optional properties:
- lcd-supply: A phandle to a power regulator that controls the LCD voltage.
Required nodes: Required nodes:
- port: connection to the LCD panel (see video-interfaces.txt) - port: connection to the LCD panel (see video-interfaces.txt)
This node must have its properties bus-width and remote-endpoint set. This node must have its properties bus-width and remote-endpoint set.
......
PXA3xx GCU Controller
---------------------
Required properties:
- compatible : "marvell,pxa300-gcu"
- reg : should contain the register range (address and length).
- interrupts : Controller interrupt.
- clocks: phandle to the PXA specific input clock.
Example for PXA300:
display-controller@54000000 {
compatible = "marvell,pxa300-gcu";
reg = <0x54000000 0x1000>;
interrupts = <39>;
clocks = <&clks CLK_PXA300_GCU>;
};
...@@ -18,9 +18,10 @@ made available by the underlying graphics card are also possible. ...@@ -18,9 +18,10 @@ made available by the underlying graphics card are also possible.
A. Configuration A. Configuration
The framebuffer console can be enabled by using your favorite kernel The framebuffer console can be enabled by using your favorite kernel
configuration tool. It is under Device Drivers->Graphics Support->Support for configuration tool. It is under Device Drivers->Graphics Support->Frame
framebuffer devices->Framebuffer Console Support. Select 'y' to compile buffer Devices->Console display driver support->Framebuffer Console Support.
support statically, or 'm' for module support. The module will be fbcon. Select 'y' to compile support statically or 'm' for module support. The
module will be fbcon.
In order for fbcon to activate, at least one framebuffer driver is In order for fbcon to activate, at least one framebuffer driver is
required, so choose from any of the numerous drivers available. For x86 required, so choose from any of the numerous drivers available. For x86
...@@ -29,10 +30,10 @@ always be available. However, using a chipset-specific driver will give you ...@@ -29,10 +30,10 @@ always be available. However, using a chipset-specific driver will give you
more speed and features, such as the ability to change the video mode more speed and features, such as the ability to change the video mode
dynamically. dynamically.
To display the penguin logo, choose any logo available in Logo To display the penguin logo, choose any logo available in Graphics
Configuration->Boot up logo. support->Bootup logo.
Also, you will need to select at least one compiled-in fonts, but if Also, you will need to select at least one compiled-in font, but if
you don't do anything, the kernel configuration tool will select one for you, you don't do anything, the kernel configuration tool will select one for you,
usually an 8x16 font. usually an 8x16 font.
...@@ -135,16 +136,16 @@ C. Boot options ...@@ -135,16 +136,16 @@ C. Boot options
The angle can be changed anytime afterwards by 'echoing' the same The angle can be changed anytime afterwards by 'echoing' the same
numbers to any one of the 2 attributes found in numbers to any one of the 2 attributes found in
/sys/class/graphics/fbcon /sys/class/graphics/fbcon:
rotate - rotate the display of the active console rotate - rotate the display of the active console
rotate_all - rotate the display of all consoles rotate_all - rotate the display of all consoles
Console rotation will only become available if Console Rotation Console rotation will only become available if Framebuffer Console
Support is compiled in your kernel. Rotation support is compiled in your kernel.
NOTE: This is purely console rotation. Any other applications that NOTE: This is purely console rotation. Any other applications that
use the framebuffer will remain at their 'normal'orientation. use the framebuffer will remain at their 'normal' orientation.
Actually, the underlying fb driver is totally ignorant of console Actually, the underlying fb driver is totally ignorant of console
rotation. rotation.
...@@ -164,7 +165,7 @@ C. Boot options ...@@ -164,7 +165,7 @@ C. Boot options
C. Attaching, Detaching and Unloading C. Attaching, Detaching and Unloading
Before going on how to attach, detach and unload the framebuffer console, an Before going on to how to attach, detach and unload the framebuffer console, an
illustration of the dependencies may help. illustration of the dependencies may help.
The console layer, as with most subsystems, needs a driver that interfaces with The console layer, as with most subsystems, needs a driver that interfaces with
...@@ -182,7 +183,7 @@ because fbcon is an intermediate layer between the console and the drivers: ...@@ -182,7 +183,7 @@ because fbcon is an intermediate layer between the console and the drivers:
console ---> fbcon ---> fbdev drivers ---> hardware console ---> fbcon ---> fbdev drivers ---> hardware
The fbdev drivers cannot be unloaded if it's bound to fbcon, and fbcon cannot The fbdev drivers cannot be unloaded if bound to fbcon, and fbcon cannot
be unloaded if it's bound to the console layer. be unloaded if it's bound to the console layer.
So to unload the fbdev drivers, one must first unbind fbcon from the console, So to unload the fbdev drivers, one must first unbind fbcon from the console,
...@@ -232,7 +233,7 @@ restored properly. The following is one of the several methods that you can do: ...@@ -232,7 +233,7 @@ restored properly. The following is one of the several methods that you can do:
echo 0 > /sys/class/vtconsole/vtcon1/bind echo 0 > /sys/class/vtconsole/vtcon1/bind
6. That's it, you're back to VGA mode. And if you compiled fbcon as a module, 6. That's it, you're back to VGA mode. And if you compiled fbcon as a module,
you can unload it by 'rmmod fbcon' you can unload it by 'rmmod fbcon'.
7. To reattach fbcon: 7. To reattach fbcon:
...@@ -290,7 +291,7 @@ Samples: ...@@ -290,7 +291,7 @@ Samples:
======== ========
Here are 2 sample bash scripts that you can use to bind or unbind the Here are 2 sample bash scripts that you can use to bind or unbind the
framebuffer console driver if you are in an X86 box: framebuffer console driver if you are on an X86 box:
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
#!/bin/bash #!/bin/bash
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/efi-bgrt.h> #include <linux/efi-bgrt.h>
struct acpi_table_bgrt bgrt_tab; struct acpi_table_bgrt bgrt_tab;
size_t __initdata bgrt_image_size; size_t bgrt_image_size;
struct bmp_header { struct bmp_header {
u16 id; u16 id;
......
...@@ -152,7 +152,7 @@ config FRAMEBUFFER_CONSOLE_ROTATION ...@@ -152,7 +152,7 @@ config FRAMEBUFFER_CONSOLE_ROTATION
config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER config FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
bool "Framebuffer Console Deferred Takeover" bool "Framebuffer Console Deferred Takeover"
depends on FRAMEBUFFER_CONSOLE=y && DUMMY_CONSOLE=y depends on FB=y && FRAMEBUFFER_CONSOLE && DUMMY_CONSOLE
help help
If enabled this defers the framebuffer console taking over the If enabled this defers the framebuffer console taking over the
console from the dummy console until the first text is displayed on console from the dummy console until the first text is displayed on
......
...@@ -38,13 +38,11 @@ void dummycon_register_output_notifier(struct notifier_block *nb) ...@@ -38,13 +38,11 @@ void dummycon_register_output_notifier(struct notifier_block *nb)
if (dummycon_putc_called) if (dummycon_putc_called)
nb->notifier_call(nb, 0, NULL); nb->notifier_call(nb, 0, NULL);
} }
EXPORT_SYMBOL_GPL(dummycon_register_output_notifier);
void dummycon_unregister_output_notifier(struct notifier_block *nb) void dummycon_unregister_output_notifier(struct notifier_block *nb)
{ {
raw_notifier_chain_unregister(&dummycon_output_nh, nb); raw_notifier_chain_unregister(&dummycon_output_nh, nb);
} }
EXPORT_SYMBOL_GPL(dummycon_unregister_output_notifier);
static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos) static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos)
{ {
......
...@@ -112,6 +112,11 @@ EXPORT_SYMBOL(vgacon_text_force); ...@@ -112,6 +112,11 @@ EXPORT_SYMBOL(vgacon_text_force);
static int __init text_mode(char *str) static int __init text_mode(char *str)
{ {
vgacon_text_mode_force = true; vgacon_text_mode_force = true;
pr_warning("You have booted with nomodeset. This means your GPU drivers are DISABLED\n");
pr_warning("Any video related functionality will be severely degraded, and you may not even be able to suspend the system properly\n");
pr_warning("Unless you actually understand what nomodeset does, you should reboot without enabling it\n");
return 1; return 1;
} }
......
...@@ -2303,7 +2303,7 @@ static void ami_build_copper(struct fb_info *info) ...@@ -2303,7 +2303,7 @@ static void ami_build_copper(struct fb_info *info)
ami_rebuild_copper(info->par); ami_rebuild_copper(info->par);
} }
#ifndef MODULE
static void __init amifb_setup_mcap(char *spec) static void __init amifb_setup_mcap(char *spec)
{ {
char *p; char *p;
...@@ -2368,7 +2368,7 @@ static int __init amifb_setup(char *options) ...@@ -2368,7 +2368,7 @@ static int __init amifb_setup(char *options)
return 0; return 0;
} }
#endif
static int amifb_check_var(struct fb_var_screeninfo *var, static int amifb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info) struct fb_info *info)
......
...@@ -2234,8 +2234,8 @@ static int fbcon_switch(struct vc_data *vc) ...@@ -2234,8 +2234,8 @@ static int fbcon_switch(struct vc_data *vc)
* *
* info->currcon = vc->vc_num; * info->currcon = vc->vc_num;
*/ */
for (i = 0; i < FB_MAX; i++) { for_each_registered_fb(i) {
if (registered_fb[i] != NULL && registered_fb[i]->fbcon_par) { if (registered_fb[i]->fbcon_par) {
struct fbcon_ops *o = registered_fb[i]->fbcon_par; struct fbcon_ops *o = registered_fb[i]->fbcon_par;
o->currcon = vc->vc_num; o->currcon = vc->vc_num;
...@@ -3124,13 +3124,11 @@ static int fbcon_fb_unregistered(struct fb_info *info) ...@@ -3124,13 +3124,11 @@ static int fbcon_fb_unregistered(struct fb_info *info)
if (idx == info_idx) { if (idx == info_idx) {
info_idx = -1; info_idx = -1;
for (i = 0; i < FB_MAX; i++) { for_each_registered_fb(i) {
if (registered_fb[i] != NULL) {
info_idx = i; info_idx = i;
break; break;
} }
} }
}
if (info_idx != -1) { if (info_idx != -1) {
for (i = first_fb_vc; i <= last_fb_vc; i++) { for (i = first_fb_vc; i <= last_fb_vc; i++) {
...@@ -3594,13 +3592,24 @@ static int fbcon_init_device(void) ...@@ -3594,13 +3592,24 @@ static int fbcon_init_device(void)
} }
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
static void fbcon_register_existing_fbs(struct work_struct *work)
{
int i;
console_lock();
for_each_registered_fb(i)
fbcon_fb_registered(registered_fb[i]);
console_unlock();
}
static struct notifier_block fbcon_output_nb; static struct notifier_block fbcon_output_nb;
static DECLARE_WORK(fbcon_deferred_takeover_work, fbcon_register_existing_fbs);
static int fbcon_output_notifier(struct notifier_block *nb, static int fbcon_output_notifier(struct notifier_block *nb,
unsigned long action, void *data) unsigned long action, void *data)
{ {
int i;
WARN_CONSOLE_UNLOCKED(); WARN_CONSOLE_UNLOCKED();
pr_info("fbcon: Taking over console\n"); pr_info("fbcon: Taking over console\n");
...@@ -3609,45 +3618,37 @@ static int fbcon_output_notifier(struct notifier_block *nb, ...@@ -3609,45 +3618,37 @@ static int fbcon_output_notifier(struct notifier_block *nb,
deferred_takeover = false; deferred_takeover = false;
logo_shown = FBCON_LOGO_DONTSHOW; logo_shown = FBCON_LOGO_DONTSHOW;
for (i = 0; i < FB_MAX; i++) { /* We may get called in atomic context */
if (registered_fb[i]) schedule_work(&fbcon_deferred_takeover_work);
fbcon_fb_registered(registered_fb[i]);
}
return NOTIFY_OK; return NOTIFY_OK;
} }
static void fbcon_register_output_notifier(void)
{
fbcon_output_nb.notifier_call = fbcon_output_notifier;
dummycon_register_output_notifier(&fbcon_output_nb);
}
#else
static inline void fbcon_register_output_notifier(void) {}
#endif #endif
static void fbcon_start(void) static void fbcon_start(void)
{ {
WARN_CONSOLE_UNLOCKED();
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
if (conswitchp != &dummy_con)
deferred_takeover = false;
if (deferred_takeover) { if (deferred_takeover) {
fbcon_register_output_notifier(); fbcon_output_nb.notifier_call = fbcon_output_notifier;
dummycon_register_output_notifier(&fbcon_output_nb);
return; return;
} }
#endif
if (num_registered_fb) { if (num_registered_fb) {
int i; int i;
console_lock(); for_each_registered_fb(i) {
for (i = 0; i < FB_MAX; i++) {
if (registered_fb[i] != NULL) {
info_idx = i; info_idx = i;
break; break;
} }
}
do_fbcon_takeover(0); do_fbcon_takeover(0);
console_unlock();
} }
} }
...@@ -3669,15 +3670,12 @@ static void fbcon_exit(void) ...@@ -3669,15 +3670,12 @@ static void fbcon_exit(void)
kfree((void *)softback_buf); kfree((void *)softback_buf);
softback_buf = 0UL; softback_buf = 0UL;
for (i = 0; i < FB_MAX; i++) { for_each_registered_fb(i) {
int pending = 0; int pending = 0;
mapped = 0; mapped = 0;
info = registered_fb[i]; info = registered_fb[i];
if (info == NULL)
continue;
if (info->queue.func) if (info->queue.func)
pending = cancel_work_sync(&info->queue); pending = cancel_work_sync(&info->queue);
DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" : DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" :
...@@ -3733,8 +3731,8 @@ void __init fb_console_init(void) ...@@ -3733,8 +3731,8 @@ void __init fb_console_init(void)
for (i = 0; i < MAX_NR_CONSOLES; i++) for (i = 0; i < MAX_NR_CONSOLES; i++)
con2fb_map[i] = -1; con2fb_map[i] = -1;
console_unlock();
fbcon_start(); fbcon_start();
console_unlock();
} }
#ifdef MODULE #ifdef MODULE
......
...@@ -1347,6 +1347,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, ...@@ -1347,6 +1347,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd,
case FBIOGET_CON2FBMAP: case FBIOGET_CON2FBMAP:
case FBIOPUT_CON2FBMAP: case FBIOPUT_CON2FBMAP:
arg = (unsigned long) compat_ptr(arg); arg = (unsigned long) compat_ptr(arg);
/* fall through */
case FBIOBLANK: case FBIOBLANK:
ret = do_fb_ioctl(info, cmd, arg); ret = do_fb_ioctl(info, cmd, arg);
break; break;
...@@ -1593,10 +1594,8 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a, ...@@ -1593,10 +1594,8 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
int i, ret; int i, ret;
/* check all firmware fbs and kick off if the base addr overlaps */ /* check all firmware fbs and kick off if the base addr overlaps */
for (i = 0 ; i < FB_MAX; i++) { for_each_registered_fb(i) {
struct apertures_struct *gen_aper; struct apertures_struct *gen_aper;
if (!registered_fb[i])
continue;
if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE)) if (!(registered_fb[i]->flags & FBINFO_MISC_FIRMWARE))
continue; continue;
...@@ -1691,25 +1690,30 @@ static int do_register_framebuffer(struct fb_info *fb_info) ...@@ -1691,25 +1690,30 @@ static int do_register_framebuffer(struct fb_info *fb_info)
event.info = fb_info; event.info = fb_info;
if (!lockless_register_fb) if (!lockless_register_fb)
console_lock(); console_lock();
else
atomic_inc(&ignore_console_lock_warning);
if (!lock_fb_info(fb_info)) { if (!lock_fb_info(fb_info)) {
if (!lockless_register_fb) ret = -ENODEV;
console_unlock(); goto unlock_console;
return -ENODEV;
} }
ret = 0;
fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
unlock_fb_info(fb_info); unlock_fb_info(fb_info);
unlock_console:
if (!lockless_register_fb) if (!lockless_register_fb)
console_unlock(); console_unlock();
return 0; else
atomic_dec(&ignore_console_lock_warning);
return ret;
} }
static int do_unregister_framebuffer(struct fb_info *fb_info) static int unbind_console(struct fb_info *fb_info)
{ {
struct fb_event event; struct fb_event event;
int i, ret = 0; int ret;
int i = fb_info->node;
i = fb_info->node;
if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
return -EINVAL; return -EINVAL;
...@@ -1724,17 +1728,29 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) ...@@ -1724,17 +1728,29 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
unlock_fb_info(fb_info); unlock_fb_info(fb_info);
console_unlock(); console_unlock();
return ret;
}
static int __unlink_framebuffer(struct fb_info *fb_info);
static int do_unregister_framebuffer(struct fb_info *fb_info)
{
struct fb_event event;
int ret;
ret = unbind_console(fb_info);
if (ret) if (ret)
return -EINVAL; return -EINVAL;
pm_vt_switch_unregister(fb_info->dev); pm_vt_switch_unregister(fb_info->dev);
unlink_framebuffer(fb_info); __unlink_framebuffer(fb_info);
if (fb_info->pixmap.addr && if (fb_info->pixmap.addr &&
(fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
kfree(fb_info->pixmap.addr); kfree(fb_info->pixmap.addr);
fb_destroy_modelist(&fb_info->modelist); fb_destroy_modelist(&fb_info->modelist);
registered_fb[i] = NULL; registered_fb[fb_info->node] = NULL;
num_registered_fb--; num_registered_fb--;
fb_cleanup_device(fb_info); fb_cleanup_device(fb_info);
event.info = fb_info; event.info = fb_info;
...@@ -1747,7 +1763,7 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) ...@@ -1747,7 +1763,7 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
return 0; return 0;
} }
int unlink_framebuffer(struct fb_info *fb_info) static int __unlink_framebuffer(struct fb_info *fb_info)
{ {
int i; int i;
...@@ -1759,6 +1775,20 @@ int unlink_framebuffer(struct fb_info *fb_info) ...@@ -1759,6 +1775,20 @@ int unlink_framebuffer(struct fb_info *fb_info)
device_destroy(fb_class, MKDEV(FB_MAJOR, i)); device_destroy(fb_class, MKDEV(FB_MAJOR, i));
fb_info->dev = NULL; fb_info->dev = NULL;
} }
return 0;
}
int unlink_framebuffer(struct fb_info *fb_info)
{
int ret;
ret = __unlink_framebuffer(fb_info);
if (ret)
return ret;
unbind_console(fb_info);
return 0; return 0;
} }
EXPORT_SYMBOL(unlink_framebuffer); EXPORT_SYMBOL(unlink_framebuffer);
......
...@@ -642,9 +642,12 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, ...@@ -642,9 +642,12 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
* @default_mode fails, all modes in the video mode database will * @default_mode fails, all modes in the video mode database will
* be tried. * be tried.
* *
* Valid mode specifiers for @mode_option: * Valid mode specifiers for @mode_option::
*
* <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][p][m]
*
* or ::
* *
* <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or
* <name>[-<bpp>][@<refresh>] * <name>[-<bpp>][@<refresh>]
* *
* with <xres>, <yres>, <bpp> and <refresh> decimal numbers and * with <xres>, <yres>, <bpp> and <refresh> decimal numbers and
...@@ -653,10 +656,10 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, ...@@ -653,10 +656,10 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
* If 'M' is present after yres (and before refresh/bpp if present), * If 'M' is present after yres (and before refresh/bpp if present),
* the function will compute the timings using VESA(tm) Coordinated * the function will compute the timings using VESA(tm) Coordinated
* Video Timings (CVT). If 'R' is present after 'M', will compute with * Video Timings (CVT). If 'R' is present after 'M', will compute with
* reduced blanking (for flatpanels). If 'i' is present, compute * reduced blanking (for flatpanels). If 'i' or 'p' are present, compute
* interlaced mode. If 'm' is present, add margins equal to 1.8% * interlaced or progressive mode. If 'm' is present, add margins equal
* of xres rounded down to 8 pixels, and 1.8% of yres. The char * to 1.8% of xres rounded down to 8 pixels, and 1.8% of yres. The char
* 'i' and 'm' must be after 'M' and 'R'. Example: * 'i', 'p' and 'm' must be after 'M' and 'R'. Example::
* *
* 1024x768MR-8@60m - Reduced blank with margins at 60Hz. * 1024x768MR-8@60m - Reduced blank with margins at 60Hz.
* *
...@@ -666,7 +669,6 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info, ...@@ -666,7 +669,6 @@ static int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
* Returns zero for failure, 1 if using specified @mode_option, * Returns zero for failure, 1 if using specified @mode_option,
* 2 if using specified @mode_option with an ignored refresh rate, * 2 if using specified @mode_option with an ignored refresh rate,
* 3 if default mode is used, 4 if fall back to any valid mode. * 3 if default mode is used, 4 if fall back to any valid mode.
*
*/ */
int fb_find_mode(struct fb_var_screeninfo *var, int fb_find_mode(struct fb_var_screeninfo *var,
...@@ -697,7 +699,8 @@ int fb_find_mode(struct fb_var_screeninfo *var, ...@@ -697,7 +699,8 @@ int fb_find_mode(struct fb_var_screeninfo *var,
unsigned int namelen = strlen(name); unsigned int namelen = strlen(name);
int res_specified = 0, bpp_specified = 0, refresh_specified = 0; int res_specified = 0, bpp_specified = 0, refresh_specified = 0;
unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0; unsigned int xres = 0, yres = 0, bpp = default_bpp, refresh = 0;
int yres_specified = 0, cvt = 0, rb = 0, interlace = 0; int yres_specified = 0, cvt = 0, rb = 0;
int interlace_specified = 0, interlace = 0;
int margins = 0; int margins = 0;
u32 best, diff, tdiff; u32 best, diff, tdiff;
...@@ -748,9 +751,17 @@ int fb_find_mode(struct fb_var_screeninfo *var, ...@@ -748,9 +751,17 @@ int fb_find_mode(struct fb_var_screeninfo *var,
if (!cvt) if (!cvt)
margins = 1; margins = 1;
break; break;
case 'p':
if (!cvt) {
interlace = 0;
interlace_specified = 1;
}
break;
case 'i': case 'i':
if (!cvt) if (!cvt) {
interlace = 1; interlace = 1;
interlace_specified = 1;
}
break; break;
default: default:
goto done; goto done;
...@@ -819,11 +830,21 @@ int fb_find_mode(struct fb_var_screeninfo *var, ...@@ -819,11 +830,21 @@ int fb_find_mode(struct fb_var_screeninfo *var,
if ((name_matches(db[i], name, namelen) || if ((name_matches(db[i], name, namelen) ||
(res_specified && res_matches(db[i], xres, yres))) && (res_specified && res_matches(db[i], xres, yres))) &&
!fb_try_mode(var, info, &db[i], bpp)) { !fb_try_mode(var, info, &db[i], bpp)) {
if (refresh_specified && db[i].refresh == refresh) const int db_interlace = (db[i].vmode &
FB_VMODE_INTERLACED ? 1 : 0);
int score = abs(db[i].refresh - refresh);
if (interlace_specified)
score += abs(db_interlace - interlace);
if (!interlace_specified ||
db_interlace == interlace)
if (refresh_specified &&
db[i].refresh == refresh)
return 1; return 1;
if (abs(db[i].refresh - refresh) < diff) { if (score < diff) {
diff = abs(db[i].refresh - refresh); diff = score;
best = i; best = i;
} }
} }
......
...@@ -9,16 +9,39 @@ ...@@ -9,16 +9,39 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/efi.h> #include <linux/efi.h>
#include <linux/efi-bgrt.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/screen_info.h> #include <linux/screen_info.h>
#include <video/vga.h> #include <video/vga.h>
#include <asm/efi.h> #include <asm/efi.h>
#include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */ #include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */
#include <drm/drm_connector.h> /* For DRM_MODE_PANEL_ORIENTATION_* */ #include <drm/drm_connector.h> /* For DRM_MODE_PANEL_ORIENTATION_* */
struct bmp_file_header {
u16 id;
u32 file_size;
u32 reserved;
u32 bitmap_offset;
} __packed;
struct bmp_dib_header {
u32 dib_header_size;
s32 width;
s32 height;
u16 planes;
u16 bpp;
u32 compression;
u32 bitmap_size;
u32 horz_resolution;
u32 vert_resolution;
u32 colors_used;
u32 colors_important;
} __packed;
static bool request_mem_succeeded = false; static bool request_mem_succeeded = false;
static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC; static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC;
...@@ -66,6 +89,164 @@ static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -66,6 +89,164 @@ static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green,
return 0; return 0;
} }
/*
* If fbcon deffered console takeover is configured, the intent is for the
* framebuffer to show the boot graphics (e.g. vendor logo) until there is some
* (error) message to display. But the boot graphics may have been destroyed by
* e.g. option ROM output, detect this and restore the boot graphics.
*/
#if defined CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER && \
defined CONFIG_ACPI_BGRT
static void efifb_copy_bmp(u8 *src, u32 *dst, int width, struct screen_info *si)
{
u8 r, g, b;
while (width--) {
b = *src++;
g = *src++;
r = *src++;
*dst++ = (r << si->red_pos) |
(g << si->green_pos) |
(b << si->blue_pos);
}
}
#ifdef CONFIG_X86
/*
* On x86 some firmwares use a low non native resolution for the display when
* they have shown some text messages. While keeping the bgrt filled with info
* for the native resolution. If the bgrt image intended for the native
* resolution still fits, it will be displayed very close to the right edge of
* the display looking quite bad. This function checks for this.
*/
static bool efifb_bgrt_sanity_check(struct screen_info *si, u32 bmp_width)
{
static const int default_resolutions[][2] = {
{ 800, 600 },
{ 1024, 768 },
{ 1280, 1024 },
};
u32 i, right_margin;
for (i = 0; i < ARRAY_SIZE(default_resolutions); i++) {
if (default_resolutions[i][0] == si->lfb_width &&
default_resolutions[i][1] == si->lfb_height)
break;
}
/* If not a default resolution used for textmode, this should be fine */
if (i >= ARRAY_SIZE(default_resolutions))
return true;
/* If the right margin is 5 times smaller then the left one, reject */
right_margin = si->lfb_width - (bgrt_tab.image_offset_x + bmp_width);
if (right_margin < (bgrt_tab.image_offset_x / 5))
return false;
return true;
}
#else
static bool efifb_bgrt_sanity_check(struct screen_info *si, u32 bmp_width)
{
return true;
}
#endif
static void efifb_show_boot_graphics(struct fb_info *info)
{
u32 bmp_width, bmp_height, bmp_pitch, screen_pitch, dst_x, y, src_y;
struct screen_info *si = &screen_info;
struct bmp_file_header *file_header;
struct bmp_dib_header *dib_header;
void *bgrt_image = NULL;
u8 *dst = info->screen_base;
if (!bgrt_tab.image_address) {
pr_info("efifb: No BGRT, not showing boot graphics\n");
return;
}
/* Avoid flashing the logo if we're going to print std probe messages */
if (console_loglevel > CONSOLE_LOGLEVEL_QUIET)
return;
/* bgrt_tab.status is unreliable, so we don't check it */
if (si->lfb_depth != 32) {
pr_info("efifb: not 32 bits, not showing boot graphics\n");
return;
}
bgrt_image = memremap(bgrt_tab.image_address, bgrt_image_size,
MEMREMAP_WB);
if (!bgrt_image) {
pr_warn("efifb: Ignoring BGRT: failed to map image memory\n");
return;
}
if (bgrt_image_size < (sizeof(*file_header) + sizeof(*dib_header)))
goto error;
file_header = bgrt_image;
if (file_header->id != 0x4d42 || file_header->reserved != 0)
goto error;
dib_header = bgrt_image + sizeof(*file_header);
if (dib_header->dib_header_size != 40 || dib_header->width < 0 ||
dib_header->planes != 1 || dib_header->bpp != 24 ||
dib_header->compression != 0)
goto error;
bmp_width = dib_header->width;
bmp_height = abs(dib_header->height);
bmp_pitch = round_up(3 * bmp_width, 4);
screen_pitch = si->lfb_linelength;
if ((file_header->bitmap_offset + bmp_pitch * bmp_height) >
bgrt_image_size)
goto error;
if ((bgrt_tab.image_offset_x + bmp_width) > si->lfb_width ||
(bgrt_tab.image_offset_y + bmp_height) > si->lfb_height)
goto error;
if (!efifb_bgrt_sanity_check(si, bmp_width))
goto error;
pr_info("efifb: showing boot graphics\n");
for (y = 0; y < si->lfb_height; y++, dst += si->lfb_linelength) {
/* Only background? */
if (y < bgrt_tab.image_offset_y ||
y >= (bgrt_tab.image_offset_y + bmp_height)) {
memset(dst, 0, 4 * si->lfb_width);
continue;
}
src_y = y - bgrt_tab.image_offset_y;
/* Positive header height means upside down row order */
if (dib_header->height > 0)
src_y = (bmp_height - 1) - src_y;
memset(dst, 0, bgrt_tab.image_offset_x * 4);
dst_x = bgrt_tab.image_offset_x;
efifb_copy_bmp(bgrt_image + file_header->bitmap_offset +
src_y * bmp_pitch,
(u32 *)dst + dst_x, bmp_width, si);
dst_x += bmp_width;
memset((u32 *)dst + dst_x, 0, (si->lfb_width - dst_x) * 4);
}
memunmap(bgrt_image);
return;
error:
memunmap(bgrt_image);
pr_warn("efifb: Ignoring BGRT: unexpected or invalid BMP data\n");
}
#else
static inline void efifb_show_boot_graphics(struct fb_info *info) {}
#endif
static void efifb_destroy(struct fb_info *info) static void efifb_destroy(struct fb_info *info)
{ {
if (info->screen_base) { if (info->screen_base) {
...@@ -311,6 +492,8 @@ static int efifb_probe(struct platform_device *dev) ...@@ -311,6 +492,8 @@ static int efifb_probe(struct platform_device *dev)
goto err_release_fb; goto err_release_fb;
} }
efifb_show_boot_graphics(info);
pr_info("efifb: framebuffer at 0x%lx, using %dk, total %dk\n", pr_info("efifb: framebuffer at 0x%lx, using %dk, total %dk\n",
efifb_fix.smem_start, size_remap/1024, size_total/1024); efifb_fix.smem_start, size_remap/1024, size_total/1024);
pr_info("efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n", pr_info("efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
......
...@@ -360,6 +360,10 @@ struct mfb_info { ...@@ -360,6 +360,10 @@ struct mfb_info {
* @ad[]: Area Descriptors for each real AOI * @ad[]: Area Descriptors for each real AOI
* @gamma: gamma color table * @gamma: gamma color table
* @cursor: hardware cursor data * @cursor: hardware cursor data
* @blank_cursor: blank cursor for hiding cursor
* @next_cursor: scratch space to build load cursor
* @edid_data: EDID information buffer
* @has_edid: whether or not the EDID buffer is valid
* *
* This data structure must be allocated with 32-byte alignment, so that the * This data structure must be allocated with 32-byte alignment, so that the
* internal fields can be aligned properly. * internal fields can be aligned properly.
...@@ -381,6 +385,8 @@ struct fsl_diu_data { ...@@ -381,6 +385,8 @@ struct fsl_diu_data {
__le16 cursor[MAX_CURS * MAX_CURS] __aligned(32); __le16 cursor[MAX_CURS * MAX_CURS] __aligned(32);
/* Blank cursor data -- used to hide the cursor */ /* Blank cursor data -- used to hide the cursor */
__le16 blank_cursor[MAX_CURS * MAX_CURS] __aligned(32); __le16 blank_cursor[MAX_CURS * MAX_CURS] __aligned(32);
/* Scratch cursor data -- used to build new cursor */
__le16 next_cursor[MAX_CURS * MAX_CURS] __aligned(32);
uint8_t edid_data[EDID_LENGTH]; uint8_t edid_data[EDID_LENGTH];
bool has_edid; bool has_edid;
} __aligned(32); } __aligned(32);
...@@ -1056,13 +1062,17 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1056,13 +1062,17 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor)
* FB_CUR_SETSHAPE - the cursor bitmask has changed * FB_CUR_SETSHAPE - the cursor bitmask has changed
*/ */
if (cursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP | FB_CUR_SETIMAGE)) { if (cursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP | FB_CUR_SETIMAGE)) {
/*
* Determine the size of the cursor image data. Normally,
* it's 8x16.
*/
unsigned int image_size = unsigned int image_size =
DIV_ROUND_UP(cursor->image.width, 8) * cursor->image.height; DIV_ROUND_UP(cursor->image.width, 8) *
cursor->image.height;
unsigned int image_words = unsigned int image_words =
DIV_ROUND_UP(image_size, sizeof(uint32_t)); DIV_ROUND_UP(image_size, sizeof(uint32_t));
unsigned int bg_idx = cursor->image.bg_color; unsigned int bg_idx = cursor->image.bg_color;
unsigned int fg_idx = cursor->image.fg_color; unsigned int fg_idx = cursor->image.fg_color;
uint8_t buffer[image_size];
uint32_t *image, *source, *mask; uint32_t *image, *source, *mask;
uint16_t fg, bg; uint16_t fg, bg;
unsigned int i; unsigned int i;
...@@ -1070,13 +1080,6 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1070,13 +1080,6 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor)
if (info->state != FBINFO_STATE_RUNNING) if (info->state != FBINFO_STATE_RUNNING)
return 0; return 0;
/*
* Determine the size of the cursor image data. Normally,
* it's 8x16.
*/
image_size = DIV_ROUND_UP(cursor->image.width, 8) *
cursor->image.height;
bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
((info->cmap.green[bg_idx] & 0xf8) << 2) | ((info->cmap.green[bg_idx] & 0xf8) << 2) |
((info->cmap.blue[bg_idx] & 0xf8) >> 3) | ((info->cmap.blue[bg_idx] & 0xf8) >> 3) |
...@@ -1088,7 +1091,7 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -1088,7 +1091,7 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor)
1 << 15; 1 << 15;
/* Use 32-bit operations on the data to improve performance */ /* Use 32-bit operations on the data to improve performance */
image = (uint32_t *)buffer; image = (uint32_t *)data->next_cursor;
source = (uint32_t *)cursor->image.data; source = (uint32_t *)cursor->image.data;
mask = (uint32_t *)cursor->mask; mask = (uint32_t *)cursor->mask;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/acpi.h>
enum { enum {
FB_GET_WIDTH = 0x00, FB_GET_WIDTH = 0x00,
...@@ -124,6 +125,7 @@ static int goldfish_fb_check_var(struct fb_var_screeninfo *var, ...@@ -124,6 +125,7 @@ static int goldfish_fb_check_var(struct fb_var_screeninfo *var,
static int goldfish_fb_set_par(struct fb_info *info) static int goldfish_fb_set_par(struct fb_info *info)
{ {
struct goldfish_fb *fb = container_of(info, struct goldfish_fb, fb); struct goldfish_fb *fb = container_of(info, struct goldfish_fb, fb);
if (fb->rotation != fb->fb.var.rotate) { if (fb->rotation != fb->fb.var.rotate) {
info->fix.line_length = info->var.xres * 2; info->fix.line_length = info->var.xres * 2;
fb->rotation = fb->fb.var.rotate; fb->rotation = fb->fb.var.rotate;
...@@ -148,13 +150,14 @@ static int goldfish_fb_pan_display(struct fb_var_screeninfo *var, ...@@ -148,13 +150,14 @@ static int goldfish_fb_pan_display(struct fb_var_screeninfo *var,
wait_event_timeout(fb->wait, wait_event_timeout(fb->wait,
fb->base_update_count != base_update_count, HZ / 15); fb->base_update_count != base_update_count, HZ / 15);
if (fb->base_update_count == base_update_count) if (fb->base_update_count == base_update_count)
pr_err("goldfish_fb_pan_display: timeout waiting for base update\n"); pr_err("%s: timeout waiting for base update\n", __func__);
return 0; return 0;
} }
static int goldfish_fb_blank(int blank, struct fb_info *info) static int goldfish_fb_blank(int blank, struct fb_info *info)
{ {
struct goldfish_fb *fb = container_of(info, struct goldfish_fb, fb); struct goldfish_fb *fb = container_of(info, struct goldfish_fb, fb);
switch (blank) { switch (blank) {
case FB_BLANK_NORMAL: case FB_BLANK_NORMAL:
writel(1, fb->reg_base + FB_SET_BLANK); writel(1, fb->reg_base + FB_SET_BLANK);
...@@ -234,7 +237,7 @@ static int goldfish_fb_probe(struct platform_device *pdev) ...@@ -234,7 +237,7 @@ static int goldfish_fb_probe(struct platform_device *pdev)
fb->fb.var.activate = FB_ACTIVATE_NOW; fb->fb.var.activate = FB_ACTIVATE_NOW;
fb->fb.var.height = readl(fb->reg_base + FB_GET_PHYS_HEIGHT); fb->fb.var.height = readl(fb->reg_base + FB_GET_PHYS_HEIGHT);
fb->fb.var.width = readl(fb->reg_base + FB_GET_PHYS_WIDTH); fb->fb.var.width = readl(fb->reg_base + FB_GET_PHYS_WIDTH);
fb->fb.var.pixclock = 10000; fb->fb.var.pixclock = 0;
fb->fb.var.red.offset = 11; fb->fb.var.red.offset = 11;
fb->fb.var.red.length = 5; fb->fb.var.red.length = 5;
...@@ -301,6 +304,7 @@ static int goldfish_fb_remove(struct platform_device *pdev) ...@@ -301,6 +304,7 @@ static int goldfish_fb_remove(struct platform_device *pdev)
dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base, dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base,
fb->fb.fix.smem_start); fb->fb.fix.smem_start);
iounmap(fb->reg_base); iounmap(fb->reg_base);
kfree(fb);
return 0; return 0;
} }
...@@ -310,12 +314,19 @@ static const struct of_device_id goldfish_fb_of_match[] = { ...@@ -310,12 +314,19 @@ static const struct of_device_id goldfish_fb_of_match[] = {
}; };
MODULE_DEVICE_TABLE(of, goldfish_fb_of_match); MODULE_DEVICE_TABLE(of, goldfish_fb_of_match);
static const struct acpi_device_id goldfish_fb_acpi_match[] = {
{ "GFSH0004", 0 },
{ },
};
MODULE_DEVICE_TABLE(acpi, goldfish_fb_acpi_match);
static struct platform_driver goldfish_fb_driver = { static struct platform_driver goldfish_fb_driver = {
.probe = goldfish_fb_probe, .probe = goldfish_fb_probe,
.remove = goldfish_fb_remove, .remove = goldfish_fb_remove,
.driver = { .driver = {
.name = "goldfish_fb", .name = "goldfish_fb",
.of_match_table = goldfish_fb_of_match, .of_match_table = goldfish_fb_of_match,
.acpi_match_table = ACPI_PTR(goldfish_fb_acpi_match),
} }
}; };
......
...@@ -429,6 +429,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var, ...@@ -429,6 +429,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,
break; break;
case 9 ... 15: case 9 ... 15:
bpp = 15; bpp = 15;
/* fall through */
case 16: case 16:
if ((1000000 / var->pixclock) > DACSPEED16) { if ((1000000 / var->pixclock) > DACSPEED16) {
dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 15/16bpp)\n", dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 15/16bpp)\n",
......
...@@ -233,7 +233,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t, ...@@ -233,7 +233,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t,
/* check temperature range table checksum */ /* check temperature range table checksum */
cksum_idx = sizeof(*wfm_hdr) + wfm_hdr->trc + 1; cksum_idx = sizeof(*wfm_hdr) + wfm_hdr->trc + 1;
if (cksum_idx > size) if (cksum_idx >= size)
return -EINVAL; return -EINVAL;
cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem); cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem);
if (cksum != mem[cksum_idx]) { if (cksum != mem[cksum_idx]) {
...@@ -245,7 +245,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t, ...@@ -245,7 +245,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t,
/* check waveform mode table address checksum */ /* check waveform mode table address checksum */
wmta = get_unaligned_le32(wfm_hdr->wmta) & 0x00FFFFFF; wmta = get_unaligned_le32(wfm_hdr->wmta) & 0x00FFFFFF;
cksum_idx = wmta + m*4 + 3; cksum_idx = wmta + m*4 + 3;
if (cksum_idx > size) if (cksum_idx >= size)
return -EINVAL; return -EINVAL;
cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem);
if (cksum != mem[cksum_idx]) { if (cksum != mem[cksum_idx]) {
...@@ -257,7 +257,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t, ...@@ -257,7 +257,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t,
/* check waveform temperature table address checksum */ /* check waveform temperature table address checksum */
tta = get_unaligned_le32(mem + wmta + m * 4) & 0x00FFFFFF; tta = get_unaligned_le32(mem + wmta + m * 4) & 0x00FFFFFF;
cksum_idx = tta + trn*4 + 3; cksum_idx = tta + trn*4 + 3;
if (cksum_idx > size) if (cksum_idx >= size)
return -EINVAL; return -EINVAL;
cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem);
if (cksum != mem[cksum_idx]) { if (cksum != mem[cksum_idx]) {
...@@ -270,7 +270,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t, ...@@ -270,7 +270,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t,
metromem buffer. this does runlength decoding of the waveform */ metromem buffer. this does runlength decoding of the waveform */
wfm_idx = get_unaligned_le32(mem + tta + trn * 4) & 0x00FFFFFF; wfm_idx = get_unaligned_le32(mem + tta + trn * 4) & 0x00FFFFFF;
owfm_idx = wfm_idx; owfm_idx = wfm_idx;
if (wfm_idx > size) if (wfm_idx >= size)
return -EINVAL; return -EINVAL;
while (wfm_idx < size) { while (wfm_idx < size) {
unsigned char rl; unsigned char rl;
...@@ -292,7 +292,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t, ...@@ -292,7 +292,7 @@ static int load_waveform(u8 *mem, size_t size, int m, int t,
} }
cksum_idx = wfm_idx; cksum_idx = wfm_idx;
if (cksum_idx > size) if (cksum_idx >= size)
return -EINVAL; return -EINVAL;
cksum = calc_cksum(owfm_idx, cksum_idx, mem); cksum = calc_cksum(owfm_idx, cksum_idx, mem);
if (cksum != mem[cksum_idx]) { if (cksum != mem[cksum_idx]) {
......
...@@ -958,7 +958,7 @@ int omapfb_register_client(struct omapfb_notifier_block *omapfb_nb, ...@@ -958,7 +958,7 @@ int omapfb_register_client(struct omapfb_notifier_block *omapfb_nb,
{ {
int r; int r;
if ((unsigned)omapfb_nb->plane_idx > OMAPFB_PLANE_NUM) if ((unsigned)omapfb_nb->plane_idx >= OMAPFB_PLANE_NUM)
return -EINVAL; return -EINVAL;
if (!notifier_inited) { if (!notifier_inited) {
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
obj-$(CONFIG_OMAP2_VRFB) += vrfb.o obj-$(CONFIG_OMAP2_VRFB) += vrfb.o
obj-y += dss/ obj-y += dss/
obj-y += displays/ obj-y += displays/
obj-$(CONFIG_FB_OMAP2) += omapfb.o obj-$(CONFIG_FB_OMAP2) += omap2fb.o
omapfb-y := omapfb-main.o omapfb-sysfs.o omapfb-ioctl.o omap2fb-y := omapfb-main.o omapfb-sysfs.o omapfb-ioctl.o
...@@ -219,7 +219,7 @@ static int tpd_probe_of(struct platform_device *pdev) ...@@ -219,7 +219,7 @@ static int tpd_probe_of(struct platform_device *pdev)
static int tpd_probe(struct platform_device *pdev) static int tpd_probe(struct platform_device *pdev)
{ {
struct omap_dss_device *in, *dssdev; struct omap_dss_device *dssdev;
struct panel_drv_data *ddata; struct panel_drv_data *ddata;
int r; int r;
struct gpio_desc *gpio; struct gpio_desc *gpio;
...@@ -238,25 +238,30 @@ static int tpd_probe(struct platform_device *pdev) ...@@ -238,25 +238,30 @@ static int tpd_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0, gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0,
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(gpio)) if (IS_ERR(gpio)) {
r = PTR_ERR(gpio);
goto err_gpio; goto err_gpio;
}
ddata->ct_cp_hpd_gpio = gpio; ddata->ct_cp_hpd_gpio = gpio;
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1, gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1,
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(gpio)) if (IS_ERR(gpio)) {
r = PTR_ERR(gpio);
goto err_gpio; goto err_gpio;
}
ddata->ls_oe_gpio = gpio; ddata->ls_oe_gpio = gpio;
gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2, gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2,
GPIOD_IN); GPIOD_IN);
if (IS_ERR(gpio)) if (IS_ERR(gpio)) {
r = PTR_ERR(gpio);
goto err_gpio; goto err_gpio;
}
ddata->hpd_gpio = gpio; ddata->hpd_gpio = gpio;
...@@ -268,8 +273,6 @@ static int tpd_probe(struct platform_device *pdev) ...@@ -268,8 +273,6 @@ static int tpd_probe(struct platform_device *pdev)
dssdev->owner = THIS_MODULE; dssdev->owner = THIS_MODULE;
dssdev->port_num = 1; dssdev->port_num = 1;
in = ddata->in;
r = omapdss_register_output(dssdev); r = omapdss_register_output(dssdev);
if (r) { if (r) {
dev_err(&pdev->dev, "Failed to register output\n"); dev_err(&pdev->dev, "Failed to register output\n");
......
...@@ -1905,6 +1905,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, ...@@ -1905,6 +1905,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
if (color_mode == OMAP_DSS_COLOR_YUV2 || if (color_mode == OMAP_DSS_COLOR_YUV2 ||
color_mode == OMAP_DSS_COLOR_UYVY) color_mode == OMAP_DSS_COLOR_UYVY)
width = width >> 1; width = width >> 1;
/* fall through */
case OMAP_DSS_ROT_90: case OMAP_DSS_ROT_90:
case OMAP_DSS_ROT_270: case OMAP_DSS_ROT_270:
*offset1 = 0; *offset1 = 0;
...@@ -1927,6 +1928,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror, ...@@ -1927,6 +1928,7 @@ static void calc_vrfb_rotation_offset(u8 rotation, bool mirror,
if (color_mode == OMAP_DSS_COLOR_YUV2 || if (color_mode == OMAP_DSS_COLOR_YUV2 ||
color_mode == OMAP_DSS_COLOR_UYVY) color_mode == OMAP_DSS_COLOR_UYVY)
width = width >> 1; width = width >> 1;
/* fall through */
case OMAP_DSS_ROT_90 + 4: case OMAP_DSS_ROT_90 + 4:
case OMAP_DSS_ROT_270 + 4: case OMAP_DSS_ROT_270 + 4:
*offset1 = 0; *offset1 = 0;
......
...@@ -893,6 +893,7 @@ int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl, ...@@ -893,6 +893,7 @@ int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
/ (var->bits_per_pixel >> 2); / (var->bits_per_pixel >> 2);
break; break;
} }
/* fall through */
default: default:
screen_width = fix->line_length / (var->bits_per_pixel >> 3); screen_width = fix->line_length / (var->bits_per_pixel >> 3);
break; break;
......
...@@ -233,8 +233,10 @@ static u32 to3264(u32 timing, int bpp, int is64) ...@@ -233,8 +233,10 @@ static u32 to3264(u32 timing, int bpp, int is64)
switch (bpp) { switch (bpp) {
case 24: case 24:
timing *= 3; timing *= 3;
/* fall through */
case 8: case 8:
timing >>= 1; timing >>= 1;
/* fall through */
case 16: case 16:
timing >>= 1; timing >>= 1;
case 32: case 32:
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h>
#include "pxa3xx-gcu.h" #include "pxa3xx-gcu.h"
...@@ -703,11 +704,20 @@ static int pxa3xx_gcu_remove(struct platform_device *pdev) ...@@ -703,11 +704,20 @@ static int pxa3xx_gcu_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_OF
static const struct of_device_id pxa3xx_gcu_of_match[] = {
{ .compatible = "marvell,pxa300-gcu", },
{ }
};
MODULE_DEVICE_TABLE(of, pxa3xx_gcu_of_match);
#endif
static struct platform_driver pxa3xx_gcu_driver = { static struct platform_driver pxa3xx_gcu_driver = {
.probe = pxa3xx_gcu_probe, .probe = pxa3xx_gcu_probe,
.remove = pxa3xx_gcu_remove, .remove = pxa3xx_gcu_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.of_match_table = of_match_ptr(pxa3xx_gcu_of_match),
}, },
}; };
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <video/of_display_timing.h> #include <video/of_display_timing.h>
#include <video/videomode.h> #include <video/videomode.h>
...@@ -1423,6 +1424,21 @@ static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on) ...@@ -1423,6 +1424,21 @@ static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on)
if (fbi->lcd_power) if (fbi->lcd_power)
fbi->lcd_power(on, &fbi->fb.var); fbi->lcd_power(on, &fbi->fb.var);
if (fbi->lcd_supply && fbi->lcd_supply_enabled != on) {
int ret;
if (on)
ret = regulator_enable(fbi->lcd_supply);
else
ret = regulator_disable(fbi->lcd_supply);
if (ret < 0)
pr_warn("Unable to %s LCD supply regulator: %d\n",
on ? "enable" : "disable", ret);
else
fbi->lcd_supply_enabled = on;
}
} }
static void pxafb_enable_controller(struct pxafb_info *fbi) static void pxafb_enable_controller(struct pxafb_info *fbi)
...@@ -1799,19 +1815,17 @@ static struct pxafb_info *pxafb_init_fbinfo(struct device *dev, ...@@ -1799,19 +1815,17 @@ static struct pxafb_info *pxafb_init_fbinfo(struct device *dev,
void *addr; void *addr;
/* Alloc the pxafb_info and pseudo_palette in one step */ /* Alloc the pxafb_info and pseudo_palette in one step */
fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); fbi = devm_kzalloc(dev, sizeof(struct pxafb_info) + sizeof(u32) * 16,
GFP_KERNEL);
if (!fbi) if (!fbi)
return NULL; return ERR_PTR(-ENOMEM);
memset(fbi, 0, sizeof(struct pxafb_info));
fbi->dev = dev; fbi->dev = dev;
fbi->inf = inf; fbi->inf = inf;
fbi->clk = clk_get(dev, NULL); fbi->clk = devm_clk_get(dev, NULL);
if (IS_ERR(fbi->clk)) { if (IS_ERR(fbi->clk))
kfree(fbi); return ERR_CAST(fbi->clk);
return NULL;
}
strcpy(fbi->fb.fix.id, PXA_NAME); strcpy(fbi->fb.fix.id, PXA_NAME);
...@@ -2128,8 +2142,9 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp, ...@@ -2128,8 +2142,9 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
return -EINVAL; return -EINVAL;
ret = -ENOMEM; ret = -ENOMEM;
info->modes = kmalloc_array(timings->num_timings, info->modes = devm_kcalloc(dev, timings->num_timings,
sizeof(info->modes[0]), GFP_KERNEL); sizeof(info->modes[0]),
GFP_KERNEL);
if (!info->modes) if (!info->modes)
goto out; goto out;
info->num_modes = timings->num_timings; info->num_modes = timings->num_timings;
...@@ -2288,10 +2303,9 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2288,10 +2303,9 @@ static int pxafb_probe(struct platform_device *dev)
} }
fbi = pxafb_init_fbinfo(&dev->dev, inf); fbi = pxafb_init_fbinfo(&dev->dev, inf);
if (!fbi) { if (IS_ERR(fbi)) {
/* only reason for pxafb_init_fbinfo to fail is kmalloc */
dev_err(&dev->dev, "Failed to initialize framebuffer device\n"); dev_err(&dev->dev, "Failed to initialize framebuffer device\n");
ret = -ENOMEM; ret = PTR_ERR(fbi);
goto failed; goto failed;
} }
...@@ -2301,25 +2315,26 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2301,25 +2315,26 @@ static int pxafb_probe(struct platform_device *dev)
fbi->backlight_power = inf->pxafb_backlight_power; fbi->backlight_power = inf->pxafb_backlight_power;
fbi->lcd_power = inf->pxafb_lcd_power; fbi->lcd_power = inf->pxafb_lcd_power;
fbi->lcd_supply = devm_regulator_get_optional(&dev->dev, "lcd");
if (IS_ERR(fbi->lcd_supply)) {
if (PTR_ERR(fbi->lcd_supply) == -EPROBE_DEFER)
return -EPROBE_DEFER;
fbi->lcd_supply = NULL;
}
r = platform_get_resource(dev, IORESOURCE_MEM, 0); r = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (r == NULL) { if (r == NULL) {
dev_err(&dev->dev, "no I/O memory resource defined\n"); dev_err(&dev->dev, "no I/O memory resource defined\n");
ret = -ENODEV; ret = -ENODEV;
goto failed_fbi; goto failed;
}
r = request_mem_region(r->start, resource_size(r), dev->name);
if (r == NULL) {
dev_err(&dev->dev, "failed to request I/O memory\n");
ret = -EBUSY;
goto failed_fbi;
} }
fbi->mmio_base = ioremap(r->start, resource_size(r)); fbi->mmio_base = devm_ioremap_resource(&dev->dev, r);
if (fbi->mmio_base == NULL) { if (IS_ERR(fbi->mmio_base)) {
dev_err(&dev->dev, "failed to map I/O memory\n"); dev_err(&dev->dev, "failed to get I/O memory\n");
ret = -EBUSY; ret = -EBUSY;
goto failed_free_res; goto failed;
} }
fbi->dma_buff_size = PAGE_ALIGN(sizeof(struct pxafb_dma_buff)); fbi->dma_buff_size = PAGE_ALIGN(sizeof(struct pxafb_dma_buff));
...@@ -2328,7 +2343,7 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2328,7 +2343,7 @@ static int pxafb_probe(struct platform_device *dev)
if (fbi->dma_buff == NULL) { if (fbi->dma_buff == NULL) {
dev_err(&dev->dev, "failed to allocate memory for DMA\n"); dev_err(&dev->dev, "failed to allocate memory for DMA\n");
ret = -ENOMEM; ret = -ENOMEM;
goto failed_free_io; goto failed;
} }
ret = pxafb_init_video_memory(fbi); ret = pxafb_init_video_memory(fbi);
...@@ -2345,7 +2360,7 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2345,7 +2360,7 @@ static int pxafb_probe(struct platform_device *dev)
goto failed_free_mem; goto failed_free_mem;
} }
ret = request_irq(irq, pxafb_handle_irq, 0, "LCD", fbi); ret = devm_request_irq(&dev->dev, irq, pxafb_handle_irq, 0, "LCD", fbi);
if (ret) { if (ret) {
dev_err(&dev->dev, "request_irq failed: %d\n", ret); dev_err(&dev->dev, "request_irq failed: %d\n", ret);
ret = -EBUSY; ret = -EBUSY;
...@@ -2355,7 +2370,7 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2355,7 +2370,7 @@ static int pxafb_probe(struct platform_device *dev)
ret = pxafb_smart_init(fbi); ret = pxafb_smart_init(fbi);
if (ret) { if (ret) {
dev_err(&dev->dev, "failed to initialize smartpanel\n"); dev_err(&dev->dev, "failed to initialize smartpanel\n");
goto failed_free_irq; goto failed_free_mem;
} }
/* /*
...@@ -2365,13 +2380,13 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2365,13 +2380,13 @@ static int pxafb_probe(struct platform_device *dev)
ret = pxafb_check_var(&fbi->fb.var, &fbi->fb); ret = pxafb_check_var(&fbi->fb.var, &fbi->fb);
if (ret) { if (ret) {
dev_err(&dev->dev, "failed to get suitable mode\n"); dev_err(&dev->dev, "failed to get suitable mode\n");
goto failed_free_irq; goto failed_free_mem;
} }
ret = pxafb_set_par(&fbi->fb); ret = pxafb_set_par(&fbi->fb);
if (ret) { if (ret) {
dev_err(&dev->dev, "Failed to set parameters\n"); dev_err(&dev->dev, "Failed to set parameters\n");
goto failed_free_irq; goto failed_free_mem;
} }
platform_set_drvdata(dev, fbi); platform_set_drvdata(dev, fbi);
...@@ -2404,20 +2419,11 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2404,20 +2419,11 @@ static int pxafb_probe(struct platform_device *dev)
failed_free_cmap: failed_free_cmap:
if (fbi->fb.cmap.len) if (fbi->fb.cmap.len)
fb_dealloc_cmap(&fbi->fb.cmap); fb_dealloc_cmap(&fbi->fb.cmap);
failed_free_irq:
free_irq(irq, fbi);
failed_free_mem: failed_free_mem:
free_pages_exact(fbi->video_mem, fbi->video_mem_size); free_pages_exact(fbi->video_mem, fbi->video_mem_size);
failed_free_dma: failed_free_dma:
dma_free_coherent(&dev->dev, fbi->dma_buff_size, dma_free_coherent(&dev->dev, fbi->dma_buff_size,
fbi->dma_buff, fbi->dma_buff_phys); fbi->dma_buff, fbi->dma_buff_phys);
failed_free_io:
iounmap(fbi->mmio_base);
failed_free_res:
release_mem_region(r->start, resource_size(r));
failed_fbi:
clk_put(fbi->clk);
kfree(fbi);
failed: failed:
return ret; return ret;
} }
...@@ -2425,8 +2431,6 @@ static int pxafb_probe(struct platform_device *dev) ...@@ -2425,8 +2431,6 @@ static int pxafb_probe(struct platform_device *dev)
static int pxafb_remove(struct platform_device *dev) static int pxafb_remove(struct platform_device *dev)
{ {
struct pxafb_info *fbi = platform_get_drvdata(dev); struct pxafb_info *fbi = platform_get_drvdata(dev);
struct resource *r;
int irq;
struct fb_info *info; struct fb_info *info;
if (!fbi) if (!fbi)
...@@ -2442,22 +2446,11 @@ static int pxafb_remove(struct platform_device *dev) ...@@ -2442,22 +2446,11 @@ static int pxafb_remove(struct platform_device *dev)
if (fbi->fb.cmap.len) if (fbi->fb.cmap.len)
fb_dealloc_cmap(&fbi->fb.cmap); fb_dealloc_cmap(&fbi->fb.cmap);
irq = platform_get_irq(dev, 0);
free_irq(irq, fbi);
free_pages_exact(fbi->video_mem, fbi->video_mem_size); free_pages_exact(fbi->video_mem, fbi->video_mem_size);
dma_free_wc(&dev->dev, fbi->dma_buff_size, fbi->dma_buff, dma_free_wc(&dev->dev, fbi->dma_buff_size, fbi->dma_buff,
fbi->dma_buff_phys); fbi->dma_buff_phys);
iounmap(fbi->mmio_base);
r = platform_get_resource(dev, IORESOURCE_MEM, 0);
release_mem_region(r->start, resource_size(r));
clk_put(fbi->clk);
kfree(fbi);
return 0; return 0;
} }
......
...@@ -165,6 +165,9 @@ struct pxafb_info { ...@@ -165,6 +165,9 @@ struct pxafb_info {
struct notifier_block freq_policy; struct notifier_block freq_policy;
#endif #endif
struct regulator *lcd_supply;
bool lcd_supply_enabled;
void (*lcd_power)(int, struct fb_var_screeninfo *); void (*lcd_power)(int, struct fb_var_screeninfo *);
void (*backlight_power)(int); void (*backlight_power)(int);
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#include <linux/platform_data/simplefb.h> #include <linux/platform_data/simplefb.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_clk.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
......
...@@ -522,6 +522,7 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -522,6 +522,7 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
case 32: case 32:
var->transp.offset = 24; var->transp.offset = 24;
var->transp.length = 8; var->transp.length = 8;
/* fall through */
case 24: case 24:
var->red.offset = 16; var->red.offset = 16;
var->green.offset = 8; var->green.offset = 8;
......
...@@ -777,9 +777,6 @@ static int get_nativex(struct tridentfb_par *par) ...@@ -777,9 +777,6 @@ static int get_nativex(struct tridentfb_par *par)
case 3: case 3:
x = 800; y = 600; x = 800; y = 600;
break; break;
case 4:
x = 1400; y = 1050;
break;
case 1: case 1:
default: default:
x = 640; y = 480; x = 640; y = 480;
......
This diff is collapsed.
...@@ -758,6 +758,7 @@ static void set_lcd_output_path(int set_iga, int output_interface) ...@@ -758,6 +758,7 @@ static void set_lcd_output_path(int set_iga, int output_interface)
viaparinfo->chip_info->gfx_chip_name)) viaparinfo->chip_info->gfx_chip_name))
viafb_write_reg_mask(CR97, VIACR, 0x84, viafb_write_reg_mask(CR97, VIACR, 0x84,
BIT7 + BIT2 + BIT1 + BIT0); BIT7 + BIT2 + BIT1 + BIT0);
/* fall through */
case INTERFACE_DVP0: case INTERFACE_DVP0:
case INTERFACE_DVP1: case INTERFACE_DVP1:
case INTERFACE_DFP_HIGH: case INTERFACE_DFP_HIGH:
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include <linux/compiler.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -1468,7 +1469,7 @@ static const struct file_operations viafb_vt1636_proc_fops = { ...@@ -1468,7 +1469,7 @@ static const struct file_operations viafb_vt1636_proc_fops = {
#endif /* CONFIG_FB_VIA_DIRECT_PROCFS */ #endif /* CONFIG_FB_VIA_DIRECT_PROCFS */
static int viafb_sup_odev_proc_show(struct seq_file *m, void *v) static int __maybe_unused viafb_sup_odev_proc_show(struct seq_file *m, void *v)
{ {
via_odev_to_seq(m, supported_odev_map[ via_odev_to_seq(m, supported_odev_map[
viaparinfo->shared->chip_info.gfx_chip_name]); viaparinfo->shared->chip_info.gfx_chip_name]);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#ifndef _LINUX_CONSOLE_H_ #ifndef _LINUX_CONSOLE_H_
#define _LINUX_CONSOLE_H_ 1 #define _LINUX_CONSOLE_H_ 1
#include <linux/atomic.h>
#include <linux/types.h> #include <linux/types.h>
struct vc_data; struct vc_data;
...@@ -201,11 +202,14 @@ void vcs_make_sysfs(int index); ...@@ -201,11 +202,14 @@ void vcs_make_sysfs(int index);
void vcs_remove_sysfs(int index); void vcs_remove_sysfs(int index);
/* Some debug stub to catch some of the obvious races in the VT code */ /* Some debug stub to catch some of the obvious races in the VT code */
#if 1 #define WARN_CONSOLE_UNLOCKED() \
#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress) WARN_ON(!atomic_read(&ignore_console_lock_warning) && \
#else !is_console_locked() && !oops_in_progress)
#define WARN_CONSOLE_UNLOCKED() /*
#endif * Increment ignore_console_lock_warning if you need to quiet
* WARN_CONSOLE_UNLOCKED() for debugging purposes.
*/
extern atomic_t ignore_console_lock_warning;
/* VESA Blanking Levels */ /* VESA Blanking Levels */
#define VESA_NO_BLANKING 0 #define VESA_NO_BLANKING 0
......
...@@ -126,7 +126,7 @@ struct fb_cursor_user { ...@@ -126,7 +126,7 @@ struct fb_cursor_user {
/* The resolution of the passed in fb_info about to change */ /* The resolution of the passed in fb_info about to change */
#define FB_EVENT_MODE_CHANGE 0x01 #define FB_EVENT_MODE_CHANGE 0x01
/* The display on this fb_info is beeing suspended, no access to the /* The display on this fb_info is being suspended, no access to the
* framebuffer is allowed any more after that call returns * framebuffer is allowed any more after that call returns
*/ */
#define FB_EVENT_SUSPEND 0x02 #define FB_EVENT_SUSPEND 0x02
...@@ -159,9 +159,9 @@ struct fb_cursor_user { ...@@ -159,9 +159,9 @@ struct fb_cursor_user {
#define FB_EVENT_FB_UNBIND 0x0E #define FB_EVENT_FB_UNBIND 0x0E
/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
/* A hardware display blank early change occured */ /* A hardware display blank early change occurred */
#define FB_EARLY_EVENT_BLANK 0x10 #define FB_EARLY_EVENT_BLANK 0x10
/* A hardware display blank revert early change occured */ /* A hardware display blank revert early change occurred */
#define FB_R_EARLY_EVENT_BLANK 0x11 #define FB_R_EARLY_EVENT_BLANK 0x11
struct fb_event { struct fb_event {
...@@ -650,6 +650,10 @@ extern struct fb_info *registered_fb[FB_MAX]; ...@@ -650,6 +650,10 @@ extern struct fb_info *registered_fb[FB_MAX];
extern int num_registered_fb; extern int num_registered_fb;
extern struct class *fb_class; extern struct class *fb_class;
#define for_each_registered_fb(i) \
for (i = 0; i < FB_MAX; i++) \
if (!registered_fb[i]) {} else
extern int lock_fb_info(struct fb_info *info); extern int lock_fb_info(struct fb_info *info);
static inline void unlock_fb_info(struct fb_info *info) static inline void unlock_fb_info(struct fb_info *info)
......
...@@ -20,7 +20,6 @@ struct dloarea { ...@@ -20,7 +20,6 @@ struct dloarea {
struct urb_node { struct urb_node {
struct list_head entry; struct list_head entry;
struct dlfb_data *dlfb; struct dlfb_data *dlfb;
struct delayed_work release_urb_work;
struct urb *urb; struct urb *urb;
}; };
...@@ -52,11 +51,14 @@ struct dlfb_data { ...@@ -52,11 +51,14 @@ struct dlfb_data {
int base8; int base8;
u32 pseudo_palette[256]; u32 pseudo_palette[256];
int blank_mode; /*one of FB_BLANK_ */ int blank_mode; /*one of FB_BLANK_ */
struct fb_ops ops;
/* blit-only rendering path metrics, exposed through sysfs */ /* blit-only rendering path metrics, exposed through sysfs */
atomic_t bytes_rendered; /* raw pixel-bytes driver asked to render */ atomic_t bytes_rendered; /* raw pixel-bytes driver asked to render */
atomic_t bytes_identical; /* saved effort with backbuffer comparison */ atomic_t bytes_identical; /* saved effort with backbuffer comparison */
atomic_t bytes_sent; /* to usb, after compression including overhead */ atomic_t bytes_sent; /* to usb, after compression including overhead */
atomic_t cpu_kcycles_used; /* transpired during pixel processing */ atomic_t cpu_kcycles_used; /* transpired during pixel processing */
struct fb_var_screeninfo current_mode;
struct list_head deferred_free;
}; };
#define NR_USB_REQUEST_I2C_SUB_IO 0x02 #define NR_USB_REQUEST_I2C_SUB_IO 0x02
...@@ -87,7 +89,7 @@ struct dlfb_data { ...@@ -87,7 +89,7 @@ struct dlfb_data {
#define MIN_RAW_PIX_BYTES 2 #define MIN_RAW_PIX_BYTES 2
#define MIN_RAW_CMD_BYTES (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES) #define MIN_RAW_CMD_BYTES (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES)
#define DL_DEFIO_WRITE_DELAY 5 /* fb_deferred_io.delay in jiffies */ #define DL_DEFIO_WRITE_DELAY msecs_to_jiffies(HZ <= 300 ? 4 : 10) /* optimal value for 720p video */
#define DL_DEFIO_WRITE_DISABLE (HZ*60) /* "disable" with long delay */ #define DL_DEFIO_WRITE_DISABLE (HZ*60) /* "disable" with long delay */
/* remove these once align.h patch is taken into kernel */ /* remove these once align.h patch is taken into kernel */
......
...@@ -66,6 +66,9 @@ int console_printk[4] = { ...@@ -66,6 +66,9 @@ int console_printk[4] = {
CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */ CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */
}; };
atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
EXPORT_SYMBOL(ignore_console_lock_warning);
/* /*
* Low level drivers may need that to know if they can schedule in * Low level drivers may need that to know if they can schedule in
* their unblank() callback or not. So let's export it. * their unblank() callback or not. So let's export it.
......
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