Commit d609f60a authored by Maarten Lankhorst's avatar Maarten Lankhorst

Merge branch 'topic/remove-fbcon-notifiers' into drm-misc-next

topic/remove-fbcon-notifiers:
- remove fbdev notifier usage for fbcon, as prep work to clean up the fbcon locking
- assorted locking checks in vt/console code
- assorted notifier and cleanups in fbdev and backlight code

This is the pull request that was sent out, plus the compile fix for
sh4 reported by kbuild.
Acked-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
parents bcb7416e 24430914
...@@ -347,8 +347,17 @@ int __init am200_init(void) ...@@ -347,8 +347,17 @@ int __init am200_init(void)
{ {
int ret; int ret;
/* before anything else, we request notification for any fb /*
* creation events */ * Before anything else, we request notification for any fb
* creation events.
*
* FIXME: This is terrible and needs to be nuked. The notifier is used
* to get at the fb base address from the boot splash fb driver, which
* is then passed to metronomefb. Instaed of metronomfb or this board
* support file here figuring this out on their own.
*
* See also the #ifdef in fbmem.c.
*/
fb_register_client(&am200_fb_notif); fb_register_client(&am200_fb_notif);
pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config));
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/fbcon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pm_domain.h> #include <linux/pm_domain.h>
...@@ -734,14 +735,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) ...@@ -734,14 +735,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
if (!active->driver_power_control) if (!active->driver_power_control)
set_audio_state(active->id, VGA_SWITCHEROO_OFF); set_audio_state(active->id, VGA_SWITCHEROO_OFF);
if (new_client->fb_info) { if (new_client->fb_info)
struct fb_event event; fbcon_remap_all(new_client->fb_info);
console_lock();
event.info = new_client->fb_info;
fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event);
console_unlock();
}
mutex_lock(&vgasr_priv.mux_hw_lock); mutex_lock(&vgasr_priv.mux_hw_lock);
ret = vgasr_priv.handler->switchto(new_client->id); ret = vgasr_priv.handler->switchto(new_client->id);
......
...@@ -1246,11 +1246,7 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p) ...@@ -1246,11 +1246,7 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p)
struct osd_info *oi = itv->osd_info; struct osd_info *oi = itv->osd_info;
if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { unregister_framebuffer(&itv->osd_info->ivtvfb_info);
IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n",
itv->instance);
return 0;
}
IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance); IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance);
itv->ivtvfb_restore = NULL; itv->ivtvfb_restore = NULL;
ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info); ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info);
......
...@@ -891,7 +891,9 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info) ...@@ -891,7 +891,9 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info)
if (par->fbtftops.unregister_backlight) if (par->fbtftops.unregister_backlight)
par->fbtftops.unregister_backlight(par); par->fbtftops.unregister_backlight(par);
fbtft_sysfs_exit(par); fbtft_sysfs_exit(par);
return unregister_framebuffer(fb_info); unregister_framebuffer(fb_info);
return 0;
} }
EXPORT_SYMBOL(fbtft_unregister_framebuffer); EXPORT_SYMBOL(fbtft_unregister_framebuffer);
......
TODO: TODO:
- complete rewrite:
1. The underlying fbdev drivers need to be converted into drm kernel
modesetting drivers.
2. The dcon low-power display mode can then be integrated using the
drm damage tracking and self-refresh helpers.
This bolted-on self-refresh support that digs around in fbdev
internals, but isn't properly integrated, is not the correct solution.
- see if vx855 gpio API can be made similar enough to cs5535 so we can - see if vx855 gpio API can be made similar enough to cs5535 so we can
share more code share more code
- convert all uses of the old GPIO API from <linux/gpio.h> to the - convert all uses of the old GPIO API from <linux/gpio.h> to the
......
...@@ -250,11 +250,7 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank) ...@@ -250,11 +250,7 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank)
int err; int err;
console_lock(); console_lock();
if (!lock_fb_info(dcon->fbinfo)) { lock_fb_info(dcon->fbinfo);
console_unlock();
dev_err(&dcon->client->dev, "unable to lock framebuffer\n");
return false;
}
dcon->ignore_fb_events = true; dcon->ignore_fb_events = true;
err = fb_blank(dcon->fbinfo, err = fb_blank(dcon->fbinfo,
......
...@@ -3822,6 +3822,8 @@ int con_is_bound(const struct consw *csw) ...@@ -3822,6 +3822,8 @@ int con_is_bound(const struct consw *csw)
{ {
int i, bound = 0; int i, bound = 0;
WARN_CONSOLE_UNLOCKED();
for (i = 0; i < MAX_NR_CONSOLES; i++) { for (i = 0; i < MAX_NR_CONSOLES; i++) {
if (con_driver_map[i] == csw) { if (con_driver_map[i] == csw) {
bound = 1; bound = 1;
...@@ -3833,6 +3835,20 @@ int con_is_bound(const struct consw *csw) ...@@ -3833,6 +3835,20 @@ int con_is_bound(const struct consw *csw)
} }
EXPORT_SYMBOL(con_is_bound); EXPORT_SYMBOL(con_is_bound);
/**
* con_is_visible - checks whether the current console is visible
* @vc: virtual console
*
* RETURNS: zero if not visible, nonzero if visible
*/
bool con_is_visible(const struct vc_data *vc)
{
WARN_CONSOLE_UNLOCKED();
return *vc->vc_display_fg == vc;
}
EXPORT_SYMBOL(con_is_visible);
/** /**
* con_debug_enter - prepare the console for the kernel debugger * con_debug_enter - prepare the console for the kernel debugger
* @sw: console driver * @sw: console driver
...@@ -4166,6 +4182,8 @@ void do_blank_screen(int entering_gfx) ...@@ -4166,6 +4182,8 @@ void do_blank_screen(int entering_gfx)
struct vc_data *vc = vc_cons[fg_console].d; struct vc_data *vc = vc_cons[fg_console].d;
int i; int i;
might_sleep();
WARN_CONSOLE_UNLOCKED(); WARN_CONSOLE_UNLOCKED();
if (console_blanked) { if (console_blanked) {
......
...@@ -47,7 +47,7 @@ static int fb_notifier_callback(struct notifier_block *self, ...@@ -47,7 +47,7 @@ static int fb_notifier_callback(struct notifier_block *self,
int fb_blank = 0; int fb_blank = 0;
/* If we aren't interested in this event, skip it immediately ... */ /* If we aren't interested in this event, skip it immediately ... */
if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK) if (event != FB_EVENT_BLANK)
return 0; return 0;
bd = container_of(self, struct backlight_device, fb_notif); bd = container_of(self, struct backlight_device, fb_notif);
......
...@@ -30,18 +30,6 @@ static int fb_notifier_callback(struct notifier_block *self, ...@@ -30,18 +30,6 @@ static int fb_notifier_callback(struct notifier_block *self,
struct lcd_device *ld; struct lcd_device *ld;
struct fb_event *evdata = data; struct fb_event *evdata = data;
/* If we aren't interested in this event, skip it immediately ... */
switch (event) {
case FB_EVENT_BLANK:
case FB_EVENT_MODE_CHANGE:
case FB_EVENT_MODE_CHANGE_ALL:
case FB_EARLY_EVENT_BLANK:
case FB_R_EARLY_EVENT_BLANK:
break;
default:
return 0;
}
ld = container_of(self, struct lcd_device, fb_notif); ld = container_of(self, struct lcd_device, fb_notif);
if (!ld->ops) if (!ld->ops)
return 0; return 0;
......
...@@ -34,6 +34,8 @@ static bool dummycon_putc_called; ...@@ -34,6 +34,8 @@ static bool dummycon_putc_called;
void dummycon_register_output_notifier(struct notifier_block *nb) void dummycon_register_output_notifier(struct notifier_block *nb)
{ {
WARN_CONSOLE_UNLOCKED();
raw_notifier_chain_register(&dummycon_output_nh, nb); raw_notifier_chain_register(&dummycon_output_nh, nb);
if (dummycon_putc_called) if (dummycon_putc_called)
...@@ -42,11 +44,15 @@ void dummycon_register_output_notifier(struct notifier_block *nb) ...@@ -42,11 +44,15 @@ void dummycon_register_output_notifier(struct notifier_block *nb)
void dummycon_unregister_output_notifier(struct notifier_block *nb) void dummycon_unregister_output_notifier(struct notifier_block *nb)
{ {
WARN_CONSOLE_UNLOCKED();
raw_notifier_chain_unregister(&dummycon_output_nh, nb); raw_notifier_chain_unregister(&dummycon_output_nh, nb);
} }
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)
{ {
WARN_CONSOLE_UNLOCKED();
dummycon_putc_called = true; dummycon_putc_called = true;
raw_notifier_call_chain(&dummycon_output_nh, 0, NULL); raw_notifier_call_chain(&dummycon_output_nh, 0, NULL);
} }
......
...@@ -2350,70 +2350,6 @@ static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) ...@@ -2350,70 +2350,6 @@ static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
return -EINVAL; return -EINVAL;
} }
#if 0
/*
* Accelerated functions
*/
static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty,
u_int width, u_int height,
struct fb_info_aty128 *par)
{
u32 save_dp_datatype, save_dp_cntl, dstval;
if (!width || !height)
return;
dstval = depth_to_dst(par->current_par.crtc.depth);
if (dstval == DST_24BPP) {
srcx *= 3;
dstx *= 3;
width *= 3;
} else if (dstval == -EINVAL) {
printk("aty128fb: invalid depth or RGBA\n");
return;
}
wait_for_fifo(2, par);
save_dp_datatype = aty_ld_le32(DP_DATATYPE);
save_dp_cntl = aty_ld_le32(DP_CNTL);
wait_for_fifo(6, par);
aty_st_le32(SRC_Y_X, (srcy << 16) | srcx);
aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT);
aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM);
aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR);
aty_st_le32(DST_Y_X, (dsty << 16) | dstx);
aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width);
par->blitter_may_be_busy = 1;
wait_for_fifo(2, par);
aty_st_le32(DP_DATATYPE, save_dp_datatype);
aty_st_le32(DP_CNTL, save_dp_cntl);
}
/*
* Text mode accelerated functions
*/
static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy,
int dx, int height, int width)
{
sx *= fontwidth(p);
sy *= fontheight(p);
dx *= fontwidth(p);
dy *= fontheight(p);
width *= fontwidth(p);
height *= fontheight(p);
aty128_rectcopy(sx, sy, dx, dy, width, height,
(struct fb_info_aty128 *)p->fb_info);
}
#endif /* 0 */
static void aty128_set_suspend(struct aty128fb_par *par, int suspend) static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
{ {
u32 pmgt; u32 pmgt;
......
...@@ -3916,8 +3916,7 @@ static int atyfb_reboot_notify(struct notifier_block *nb, ...@@ -3916,8 +3916,7 @@ static int atyfb_reboot_notify(struct notifier_block *nb,
if (!reboot_info) if (!reboot_info)
goto out; goto out;
if (!lock_fb_info(reboot_info)) lock_fb_info(reboot_info);
goto out;
par = reboot_info->par; par = reboot_info->par;
......
...@@ -285,11 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) ...@@ -285,11 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
goto out; goto out;
} }
umap.start = cmap->start; umap.start = cmap->start;
if (!lock_fb_info(info)) { lock_fb_info(info);
rc = -ENODEV;
goto out;
}
rc = fb_set_cmap(&umap, info); rc = fb_set_cmap(&umap, info);
unlock_fb_info(info); unlock_fb_info(info);
out: out:
......
This diff is collapsed.
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* low-level frame buffer device * low-level frame buffer device
*/ */
struct display { struct fbcon_display {
/* Filled in by the low-level console driver */ /* Filled in by the low-level console driver */
const u_char *fontdata; const u_char *fontdata;
int userfont; /* != 0 if fontdata kmalloc()ed */ int userfont; /* != 0 if fontdata kmalloc()ed */
...@@ -68,7 +68,7 @@ struct fbcon_ops { ...@@ -68,7 +68,7 @@ struct fbcon_ops {
struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */
struct timer_list cursor_timer; /* Cursor timer */ struct timer_list cursor_timer; /* Cursor timer */
struct fb_cursor cursor_state; struct fb_cursor cursor_state;
struct display *p; struct fbcon_display *p;
struct fb_info *info; struct fb_info *info;
int currcon; /* Current VC. */ int currcon; /* Current VC. */
int cur_blink_jiffies; int cur_blink_jiffies;
...@@ -225,7 +225,7 @@ extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); ...@@ -225,7 +225,7 @@ extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
#define FBCON_ATTRIBUTE_REVERSE 2 #define FBCON_ATTRIBUTE_REVERSE 2
#define FBCON_ATTRIBUTE_BOLD 4 #define FBCON_ATTRIBUTE_BOLD 4
static inline int real_y(struct display *p, int ypos) static inline int real_y(struct fbcon_display *p, int ypos)
{ {
int rows = p->vrows; int rows = p->vrows;
......
This diff is collapsed.
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/fbcon.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -175,10 +176,7 @@ static ssize_t store_modes(struct device *device, ...@@ -175,10 +176,7 @@ static ssize_t store_modes(struct device *device,
return -EINVAL; return -EINVAL;
console_lock(); console_lock();
if (!lock_fb_info(fb_info)) { lock_fb_info(fb_info);
console_unlock();
return -ENODEV;
}
list_splice(&fb_info->modelist, &old_list); list_splice(&fb_info->modelist, &old_list);
fb_videomode_to_modelist((const struct fb_videomode *)buf, i, fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
...@@ -304,12 +302,13 @@ static ssize_t store_blank(struct device *device, ...@@ -304,12 +302,13 @@ static ssize_t store_blank(struct device *device,
{ {
struct fb_info *fb_info = dev_get_drvdata(device); struct fb_info *fb_info = dev_get_drvdata(device);
char *last = NULL; char *last = NULL;
int err; int err, arg;
arg = simple_strtoul(buf, &last, 0);
console_lock(); console_lock();
fb_info->flags |= FBINFO_MISC_USEREVENT; err = fb_blank(fb_info, arg);
err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); /* might again call into fb_blank */
fb_info->flags &= ~FBINFO_MISC_USEREVENT; fbcon_fb_blanked(fb_info, arg);
console_unlock(); console_unlock();
if (err < 0) if (err < 0)
return err; return err;
...@@ -405,10 +404,7 @@ static ssize_t store_fbstate(struct device *device, ...@@ -405,10 +404,7 @@ static ssize_t store_fbstate(struct device *device,
state = simple_strtoul(buf, &last, 0); state = simple_strtoul(buf, &last, 0);
console_lock(); console_lock();
if (!lock_fb_info(fb_info)) { lock_fb_info(fb_info);
console_unlock();
return -ENODEV;
}
fb_set_suspend(fb_info, (int)state); fb_set_suspend(fb_info, (int)state);
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
struct cfb_info { struct cfb_info {
struct fb_info fb; struct fb_info fb;
struct display_switch *dispsw; struct display_switch *dispsw;
struct display *display;
unsigned char __iomem *region; unsigned char __iomem *region;
unsigned char __iomem *regs; unsigned char __iomem *regs;
u_int id; u_int id;
......
...@@ -2122,14 +2122,7 @@ static void neofb_remove(struct pci_dev *dev) ...@@ -2122,14 +2122,7 @@ static void neofb_remove(struct pci_dev *dev)
DBG("neofb_remove"); DBG("neofb_remove");
if (info) { if (info) {
/* unregister_framebuffer(info);
* If unregister_framebuffer fails, then
* we will be leaving hooks that could cause
* oopsen laying around.
*/
if (unregister_framebuffer(info))
printk(KERN_WARNING
"neofb: danger danger! Oopsen imminent!\n");
neo_unmap_video(info); neo_unmap_video(info);
fb_destroy_modedb(info->monspecs.modedb); fb_destroy_modedb(info->monspecs.modedb);
......
...@@ -60,8 +60,7 @@ static ssize_t store_rotate_type(struct device *dev, ...@@ -60,8 +60,7 @@ static ssize_t store_rotate_type(struct device *dev,
if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB) if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB)
return -EINVAL; return -EINVAL;
if (!lock_fb_info(fbi)) lock_fb_info(fbi);
return -ENODEV;
r = 0; r = 0;
if (rot_type == ofbi->rotation_type) if (rot_type == ofbi->rotation_type)
...@@ -112,8 +111,7 @@ static ssize_t store_mirror(struct device *dev, ...@@ -112,8 +111,7 @@ static ssize_t store_mirror(struct device *dev,
if (r) if (r)
return r; return r;
if (!lock_fb_info(fbi)) lock_fb_info(fbi);
return -ENODEV;
ofbi->mirror = mirror; ofbi->mirror = mirror;
...@@ -149,8 +147,7 @@ static ssize_t show_overlays(struct device *dev, ...@@ -149,8 +147,7 @@ static ssize_t show_overlays(struct device *dev,
ssize_t l = 0; ssize_t l = 0;
int t; int t;
if (!lock_fb_info(fbi)) lock_fb_info(fbi);
return -ENODEV;
omapfb_lock(fbdev); omapfb_lock(fbdev);
for (t = 0; t < ofbi->num_overlays; t++) { for (t = 0; t < ofbi->num_overlays; t++) {
...@@ -208,8 +205,7 @@ static ssize_t store_overlays(struct device *dev, struct device_attribute *attr, ...@@ -208,8 +205,7 @@ static ssize_t store_overlays(struct device *dev, struct device_attribute *attr,
if (buf[len - 1] == '\n') if (buf[len - 1] == '\n')
len = len - 1; len = len - 1;
if (!lock_fb_info(fbi)) lock_fb_info(fbi);
return -ENODEV;
omapfb_lock(fbdev); omapfb_lock(fbdev);
if (len > 0) { if (len > 0) {
...@@ -340,8 +336,7 @@ static ssize_t show_overlays_rotate(struct device *dev, ...@@ -340,8 +336,7 @@ static ssize_t show_overlays_rotate(struct device *dev,
ssize_t l = 0; ssize_t l = 0;
int t; int t;
if (!lock_fb_info(fbi)) lock_fb_info(fbi);
return -ENODEV;
for (t = 0; t < ofbi->num_overlays; t++) { for (t = 0; t < ofbi->num_overlays; t++) {
l += snprintf(buf + l, PAGE_SIZE - l, "%s%d", l += snprintf(buf + l, PAGE_SIZE - l, "%s%d",
...@@ -369,8 +364,7 @@ static ssize_t store_overlays_rotate(struct device *dev, ...@@ -369,8 +364,7 @@ static ssize_t store_overlays_rotate(struct device *dev,
if (buf[len - 1] == '\n') if (buf[len - 1] == '\n')
len = len - 1; len = len - 1;
if (!lock_fb_info(fbi)) lock_fb_info(fbi);
return -ENODEV;
if (len > 0) { if (len > 0) {
char *p = (char *)buf; char *p = (char *)buf;
...@@ -453,8 +447,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr, ...@@ -453,8 +447,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr,
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
if (!lock_fb_info(fbi)) lock_fb_info(fbi);
return -ENODEV;
if (display && display->driver->sync) if (display && display->driver->sync)
display->driver->sync(display); display->driver->sync(display);
......
...@@ -974,35 +974,10 @@ static void sa1100fb_task(struct work_struct *w) ...@@ -974,35 +974,10 @@ static void sa1100fb_task(struct work_struct *w)
*/ */
static unsigned int sa1100fb_min_dma_period(struct sa1100fb_info *fbi) static unsigned int sa1100fb_min_dma_period(struct sa1100fb_info *fbi)
{ {
#if 0
unsigned int min_period = (unsigned int)-1;
int i;
for (i = 0; i < MAX_NR_CONSOLES; i++) {
struct display *disp = &fb_display[i];
unsigned int period;
/*
* Do we own this display?
*/
if (disp->fb_info != &fbi->fb)
continue;
/*
* Ok, calculate its DMA period
*/
period = sa1100fb_display_dma_period(&disp->var);
if (period < min_period)
min_period = period;
}
return min_period;
#else
/* /*
* FIXME: we need to verify _all_ consoles. * FIXME: we need to verify _all_ consoles.
*/ */
return sa1100fb_display_dma_period(&fbi->fb.var); return sa1100fb_display_dma_period(&fbi->fb.var);
#endif
} }
/* /*
......
...@@ -2333,14 +2333,7 @@ static void savagefb_remove(struct pci_dev *dev) ...@@ -2333,14 +2333,7 @@ static void savagefb_remove(struct pci_dev *dev)
DBG("savagefb_remove"); DBG("savagefb_remove");
if (info) { if (info) {
/* unregister_framebuffer(info);
* If unregister_framebuffer fails, then
* we will be leaving hooks that could cause
* oopsen laying around.
*/
if (unregister_framebuffer(info))
printk(KERN_WARNING "savagefb: danger danger! "
"Oopsen imminent!\n");
#ifdef CONFIG_FB_SAVAGE_I2C #ifdef CONFIG_FB_SAVAGE_I2C
savagefb_delete_i2c_busses(info); savagefb_delete_i2c_busses(info);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/fbcon.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -213,7 +214,6 @@ struct sh_mobile_lcdc_priv { ...@@ -213,7 +214,6 @@ struct sh_mobile_lcdc_priv {
struct sh_mobile_lcdc_chan ch[2]; struct sh_mobile_lcdc_chan ch[2];
struct sh_mobile_lcdc_overlay overlays[4]; struct sh_mobile_lcdc_overlay overlays[4];
struct notifier_block notifier;
int started; int started;
int forced_fourcc; /* 2 channel LCDC must share fourcc setting */ int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
}; };
...@@ -534,89 +534,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) ...@@ -534,89 +534,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
ch->tx_dev->ops->display_off(ch->tx_dev); ch->tx_dev->ops->display_off(ch->tx_dev);
} }
static bool
sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch,
const struct fb_videomode *new_mode)
{
dev_dbg(ch->info->dev, "Old %ux%u, new %ux%u\n",
ch->display.mode.xres, ch->display.mode.yres,
new_mode->xres, new_mode->yres);
/* It can be a different monitor with an equal video-mode */
if (fb_mode_is_equal(&ch->display.mode, new_mode))
return false;
dev_dbg(ch->info->dev, "Switching %u -> %u lines\n",
ch->display.mode.yres, new_mode->yres);
ch->display.mode = *new_mode;
return true;
}
static int sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var, static int sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var,
struct fb_info *info); struct fb_info *info);
static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
enum sh_mobile_lcdc_entity_event event,
const struct fb_videomode *mode,
const struct fb_monspecs *monspec)
{
struct fb_info *info = ch->info;
struct fb_var_screeninfo var;
int ret = 0;
switch (event) {
case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
/* HDMI plug in */
console_lock();
if (lock_fb_info(info)) {
ch->display.width = monspec->max_x * 10;
ch->display.height = monspec->max_y * 10;
if (!sh_mobile_lcdc_must_reconfigure(ch, mode) &&
info->state == FBINFO_STATE_RUNNING) {
/* First activation with the default monitor.
* Just turn on, if we run a resume here, the
* logo disappears.
*/
info->var.width = ch->display.width;
info->var.height = ch->display.height;
sh_mobile_lcdc_display_on(ch);
} else {
/* New monitor or have to wake up */
fb_set_suspend(info, 0);
}
unlock_fb_info(info);
}
console_unlock();
break;
case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
/* HDMI disconnect */
console_lock();
if (lock_fb_info(info)) {
fb_set_suspend(info, 1);
unlock_fb_info(info);
}
console_unlock();
break;
case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE:
/* Validate a proposed new mode */
fb_videomode_to_var(&var, mode);
var.bits_per_pixel = info->var.bits_per_pixel;
var.grayscale = info->var.grayscale;
ret = sh_mobile_lcdc_check_var(&var, info);
break;
}
return ret;
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Format helpers * Format helpers
*/ */
...@@ -1838,8 +1758,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) ...@@ -1838,8 +1758,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
struct sh_mobile_lcdc_chan *ch = info->par; struct sh_mobile_lcdc_chan *ch = info->par;
struct fb_var_screeninfo var; struct fb_var_screeninfo var;
struct fb_videomode mode; struct fb_videomode mode;
struct fb_event event;
int evnt = FB_EVENT_MODE_CHANGE_ALL;
if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par)) if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par))
/* More framebuffer users are active */ /* More framebuffer users are active */
...@@ -1861,14 +1779,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) ...@@ -1861,14 +1779,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
/* Couldn't reconfigure, hopefully, can continue as before */ /* Couldn't reconfigure, hopefully, can continue as before */
return; return;
/* fbcon_update_vcs(info, true);
* fb_set_var() calls the notifier change internally, only if
* FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a
* user event, we have to call the chain ourselves.
*/
event.info = info;
event.data = &ch->display.mode;
fb_notifier_call_chain(evnt, &event);
} }
/* /*
...@@ -2319,37 +2230,6 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = { ...@@ -2319,37 +2230,6 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = {
* Framebuffer notifier * Framebuffer notifier
*/ */
/* locking: called with info->lock held */
static int sh_mobile_lcdc_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
struct fb_event *event = data;
struct fb_info *info = event->info;
struct sh_mobile_lcdc_chan *ch = info->par;
if (&ch->lcdc->notifier != nb)
return NOTIFY_DONE;
dev_dbg(info->dev, "%s(): action = %lu, data = %p\n",
__func__, action, event->data);
switch(action) {
case FB_EVENT_SUSPEND:
sh_mobile_lcdc_display_off(ch);
sh_mobile_lcdc_stop(ch->lcdc);
break;
case FB_EVENT_RESUME:
mutex_lock(&ch->open_lock);
sh_mobile_fb_reconfig(info);
mutex_unlock(&ch->open_lock);
sh_mobile_lcdc_display_on(ch);
sh_mobile_lcdc_start(ch->lcdc);
}
return NOTIFY_OK;
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Probe/remove and driver init/exit * Probe/remove and driver init/exit
*/ */
...@@ -2377,8 +2257,6 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) ...@@ -2377,8 +2257,6 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
unsigned int i; unsigned int i;
fb_unregister_client(&priv->notifier);
for (i = 0; i < ARRAY_SIZE(priv->overlays); i++) for (i = 0; i < ARRAY_SIZE(priv->overlays); i++)
sh_mobile_lcdc_overlay_fb_unregister(&priv->overlays[i]); sh_mobile_lcdc_overlay_fb_unregister(&priv->overlays[i]);
for (i = 0; i < ARRAY_SIZE(priv->ch); i++) for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
...@@ -2540,8 +2418,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) ...@@ -2540,8 +2418,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch)
unsigned int max_size; unsigned int max_size;
unsigned int i; unsigned int i;
ch->notify = sh_mobile_lcdc_display_notify;
/* Validate the format. */ /* Validate the format. */
format = sh_mobile_format_info(cfg->fourcc); format = sh_mobile_format_info(cfg->fourcc);
if (format == NULL) { if (format == NULL) {
...@@ -2770,10 +2646,6 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev) ...@@ -2770,10 +2646,6 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev)
goto err1; goto err1;
} }
/* Failure ignored */
priv->notifier.notifier_call = sh_mobile_lcdc_notify;
fb_register_client(&priv->notifier);
return 0; return 0;
err1: err1:
sh_mobile_lcdc_remove(pdev); sh_mobile_lcdc_remove(pdev);
......
...@@ -87,11 +87,6 @@ struct sh_mobile_lcdc_chan { ...@@ -87,11 +87,6 @@ struct sh_mobile_lcdc_chan {
unsigned long base_addr_c; unsigned long base_addr_c;
unsigned int line_size; unsigned int line_size;
int (*notify)(struct sh_mobile_lcdc_chan *ch,
enum sh_mobile_lcdc_entity_event event,
const struct fb_videomode *mode,
const struct fb_monspecs *monspec);
/* Backlight */ /* Backlight */
struct backlight_device *bl; struct backlight_device *bl;
unsigned int bl_brightness; unsigned int bl_brightness;
......
...@@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work); ...@@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work);
#define CUR_DEFAULT CUR_UNDERLINE #define CUR_DEFAULT CUR_UNDERLINE
static inline bool con_is_visible(const struct vc_data *vc) bool con_is_visible(const struct vc_data *vc);
{
return *vc->vc_display_fg == vc;
}
#endif /* _LINUX_CONSOLE_STRUCT_H */ #endif /* _LINUX_CONSOLE_STRUCT_H */
...@@ -126,39 +126,15 @@ struct fb_cursor_user { ...@@ -126,39 +126,15 @@ 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 being suspended, no access to the
* framebuffer is allowed any more after that call returns #ifdef CONFIG_GUMSTIX_AM200EPD
*/ /* only used by mach-pxa/am200epd.c */
#define FB_EVENT_SUSPEND 0x02
/* The display on this fb_info was resumed, you can restore the display
* if you own it
*/
#define FB_EVENT_RESUME 0x03
/* An entry from the modelist was removed */
#define FB_EVENT_MODE_DELETE 0x04
/* A driver registered itself */
#define FB_EVENT_FB_REGISTERED 0x05 #define FB_EVENT_FB_REGISTERED 0x05
/* A driver unregistered itself */
#define FB_EVENT_FB_UNREGISTERED 0x06 #define FB_EVENT_FB_UNREGISTERED 0x06
/* CONSOLE-SPECIFIC: get console to framebuffer mapping */ #endif
#define FB_EVENT_GET_CONSOLE_MAP 0x07
/* CONSOLE-SPECIFIC: set console to framebuffer mapping */ /* A display blank is requested */
#define FB_EVENT_SET_CONSOLE_MAP 0x08
/* A hardware display blank change occurred */
#define FB_EVENT_BLANK 0x09 #define FB_EVENT_BLANK 0x09
/* Private modelist is to be replaced */
#define FB_EVENT_NEW_MODELIST 0x0A
/* The resolution of the passed in fb_info about to change and
all vc's should be changed */
#define FB_EVENT_MODE_CHANGE_ALL 0x0B
/* A software display blank change occurred */
#define FB_EVENT_CONBLANK 0x0C
/* Get drawing requirements */
#define FB_EVENT_GET_REQ 0x0D
/* Unbind from the console if possible */
#define FB_EVENT_FB_UNBIND 0x0E
/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
/* A hardware display blank early change occurred */ /* 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 occurred */ /* A hardware display blank revert early change occurred */
...@@ -633,8 +609,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, ...@@ -633,8 +609,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
/* drivers/video/fbmem.c */ /* drivers/video/fbmem.c */
extern int register_framebuffer(struct fb_info *fb_info); extern int register_framebuffer(struct fb_info *fb_info);
extern int unregister_framebuffer(struct fb_info *fb_info); extern void unregister_framebuffer(struct fb_info *fb_info);
extern int unlink_framebuffer(struct fb_info *fb_info); extern void unlink_framebuffer(struct fb_info *fb_info);
extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id,
const char *name); const char *name);
extern int remove_conflicting_framebuffers(struct apertures_struct *a, extern int remove_conflicting_framebuffers(struct apertures_struct *a,
...@@ -660,7 +636,10 @@ extern struct class *fb_class; ...@@ -660,7 +636,10 @@ extern struct class *fb_class;
for (i = 0; i < FB_MAX; i++) \ for (i = 0; i < FB_MAX; i++) \
if (!registered_fb[i]) {} else if (!registered_fb[i]) {} else
extern int lock_fb_info(struct fb_info *info); static inline void lock_fb_info(struct fb_info *info)
{
mutex_lock(&info->lock);
}
static inline void unlock_fb_info(struct fb_info *info) static inline void unlock_fb_info(struct fb_info *info)
{ {
......
...@@ -4,9 +4,39 @@ ...@@ -4,9 +4,39 @@
#ifdef CONFIG_FRAMEBUFFER_CONSOLE #ifdef CONFIG_FRAMEBUFFER_CONSOLE
void __init fb_console_init(void); void __init fb_console_init(void);
void __exit fb_console_exit(void); void __exit fb_console_exit(void);
int fbcon_fb_registered(struct fb_info *info);
void fbcon_fb_unregistered(struct fb_info *info);
void fbcon_fb_unbind(struct fb_info *info);
void fbcon_suspended(struct fb_info *info);
void fbcon_resumed(struct fb_info *info);
int fbcon_mode_deleted(struct fb_info *info,
struct fb_videomode *mode);
void fbcon_new_modelist(struct fb_info *info);
void fbcon_get_requirement(struct fb_info *info,
struct fb_blit_caps *caps);
void fbcon_fb_blanked(struct fb_info *info, int blank);
void fbcon_update_vcs(struct fb_info *info, bool all);
void fbcon_remap_all(struct fb_info *info);
int fbcon_set_con2fb_map_ioctl(void __user *argp);
int fbcon_get_con2fb_map_ioctl(void __user *argp);
#else #else
static inline void fb_console_init(void) {} static inline void fb_console_init(void) {}
static inline void fb_console_exit(void) {} static inline void fb_console_exit(void) {}
static inline int fbcon_fb_registered(struct fb_info *info) { return 0; }
static inline void fbcon_fb_unregistered(struct fb_info *info) {}
static inline void fbcon_fb_unbind(struct fb_info *info) {}
static inline void fbcon_suspended(struct fb_info *info) {}
static inline void fbcon_resumed(struct fb_info *info) {}
static inline int fbcon_mode_deleted(struct fb_info *info,
struct fb_videomode *mode) { return 0; }
static inline void fbcon_new_modelist(struct fb_info *info) {}
static inline void fbcon_get_requirement(struct fb_info *info,
struct fb_blit_caps *caps) {}
static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
static inline void fbcon_remap_all(struct fb_info *info) {}
static inline int fbcon_set_con2fb_map_ioctl(void __user *argp) { return 0; }
static inline int fbcon_get_con2fb_map_ioctl(void __user *argp) { return 0; }
#endif #endif
#endif /* _LINUX_FBCON_H */ #endif /* _LINUX_FBCON_H */
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