Skip to content

Commit

Permalink
fbcon: add parameter to toggle bind on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
pcercuei authored and mthuurne committed Sep 16, 2013
1 parent 9457fa0 commit ef73228
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
12 changes: 11 additions & 1 deletion Documentation/fb/fbcon.txt
Expand Up @@ -123,7 +123,7 @@ C. Boot options
is typically located on the same video card. Thus, the consoles that
are controlled by the VGA console will be garbled.

4. fbcon=rotate:<n>
5. fbcon=rotate:<n>

This option changes the orientation angle of the console display. The
value 'n' accepts the following:
Expand All @@ -148,6 +148,16 @@ C. Boot options
Actually, the underlying fb driver is totally ignorant of console
rotation.

6. fbcon=bind:<01>

This option controls whether or not the console should be bound to the
terminal when the kernel starts. In any case, the framebuffer console
can be bound / unbound at any time through sysfs.

This parameter can be useful in some cases, for instance when the
bootloader or the video driver display a logo that should be shown
during the whole boot.

C. Attaching, Detaching and Unloading

Before going on on how to attach, detach and unload the framebuffer console, an
Expand Down
3 changes: 2 additions & 1 deletion drivers/tty/vt/vt.c
Expand Up @@ -3473,7 +3473,7 @@ int con_debug_leave(void)
}
EXPORT_SYMBOL_GPL(con_debug_leave);

static int do_register_con_driver(const struct consw *csw, int first, int last)
int do_register_con_driver(const struct consw *csw, int first, int last)
{
struct module *owner = csw->owner;
struct con_driver *con_driver;
Expand Down Expand Up @@ -3540,6 +3540,7 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
module_put(owner);
return retval;
}
EXPORT_SYMBOL_GPL(do_register_con_driver);


/**
Expand Down
18 changes: 15 additions & 3 deletions drivers/video/console/fbcon.c
Expand Up @@ -114,6 +114,7 @@ static int fbcon_is_default = 1;
static int fbcon_has_exited;
static int primary_device = -1;
static int fbcon_has_console_bind;
static unsigned int bind_on_startup = 1;

#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
static int map_override;
Expand Down Expand Up @@ -539,6 +540,14 @@ static int __init fb_console_setup(char *this_opt)
}
continue;
}

if (!strncmp(options, "bind:", 5)) {
options += 5;
ret = kstrtouint(options, 0, &bind_on_startup);
if (ret)
printk(KERN_WARNING "fbcon: bind: incorrect value.\n");
continue;
}
}
return 1;
}
Expand Down Expand Up @@ -581,15 +590,18 @@ static int do_fbcon_takeover(int show_logo)
for (i = first_fb_vc; i <= last_fb_vc; i++)
con2fb_map[i] = info_idx;

err = do_take_over_console(&fb_con, first_fb_vc, last_fb_vc,
fbcon_is_default);
if (bind_on_startup)
err = do_take_over_console(&fb_con, first_fb_vc, last_fb_vc,
fbcon_is_default);
else
err = do_register_con_driver(&fb_con, first_fb_vc, last_fb_vc);

if (err) {
for (i = first_fb_vc; i <= last_fb_vc; i++)
con2fb_map[i] = -1;
info_idx = -1;
} else {
fbcon_has_console_bind = 1;
fbcon_has_console_bind = bind_on_startup;
}

return err;
Expand Down
1 change: 1 addition & 0 deletions include/linux/console.h
Expand Up @@ -75,6 +75,7 @@ extern const struct consw newport_con; /* SGI Newport console */
extern const struct consw prom_con; /* SPARC PROM console */

int con_is_bound(const struct consw *csw);
int do_register_con_driver(const struct consw *csw, int first, int last);
int do_unregister_con_driver(const struct consw *csw);
int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
void give_up_console(const struct consw *sw);
Expand Down

0 comments on commit ef73228

Please sign in to comment.