Commit c255d844dd73616f23e4b4733edcc2e5fa4042b2

Authored by Pavel Machek
Committed by Linus Torvalds
1 parent 6303dbf570

[PATCH] suspend-to-ram: allow video options to be set at runtime

Currently, acpi video options can only be set on kernel command line.  That's
little inflexible; I'd like userland s2ram application that just works, and
modifying kernel command line according to whitelist is not fun.  It is better
to just allow s2ram application to set video options just before suspend
(according to the whitelist).

This implements sysctl to allow setting suspend video options without reboot.

(akpm: Documentation updates for this new sysctl are pending..)

Signed-off-by: Pavel Machek <pavel@suse.cz>
Cc: "Brown, Len" <len.brown@intel.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 4 changed files with 25 additions and 5 deletions Side-by-side Diff

Documentation/sysctl/kernel.txt
... ... @@ -16,6 +16,7 @@
16 16  
17 17 Currently, these files might (depending on your configuration)
18 18 show up in /proc/sys/kernel:
  19 +- acpi_video_flags
19 20 - acct
20 21 - core_pattern
21 22 - core_uses_pid
... ... @@ -54,6 +55,15 @@
54 55 - tainted
55 56 - threads-max
56 57 - version
  58 +
  59 +==============================================================
  60 +
  61 +acpi_video_flags:
  62 +
  63 +flags
  64 +
  65 +See Doc*/kernel/power/video.txt, it allows mode of video boot to be
  66 +set during run time.
57 67  
58 68 ==============================================================
59 69  
include/linux/acpi.h
... ... @@ -427,7 +427,8 @@
427 427 extern struct acpi_table_mcfg_config *pci_mmcfg_config;
428 428 extern int pci_mmcfg_config_num;
429 429  
430   -extern int sbf_port ;
  430 +extern int sbf_port;
  431 +extern unsigned long acpi_video_flags;
431 432  
432 433 #else /* !CONFIG_ACPI */
433 434  
include/linux/sysctl.h
... ... @@ -146,6 +146,7 @@
146 146 KERN_RANDOMIZE=68, /* int: randomize virtual address space */
147 147 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
148 148 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
  149 + KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
149 150 };
150 151  
151 152  
... ... @@ -44,14 +44,12 @@
44 44 #include <linux/limits.h>
45 45 #include <linux/dcache.h>
46 46 #include <linux/syscalls.h>
  47 +#include <linux/nfs_fs.h>
  48 +#include <linux/acpi.h>
47 49  
48 50 #include <asm/uaccess.h>
49 51 #include <asm/processor.h>
50 52  
51   -#ifdef CONFIG_ROOT_NFS
52   -#include <linux/nfs_fs.h>
53   -#endif
54   -
55 53 #if defined(CONFIG_SYSCTL)
56 54  
57 55 /* External variables not in a header file. */
... ... @@ -652,6 +650,16 @@
652 650 .procname = "spin_retry",
653 651 .data = &spin_retry,
654 652 .maxlen = sizeof (int),
  653 + .mode = 0644,
  654 + .proc_handler = &proc_dointvec,
  655 + },
  656 +#endif
  657 +#ifdef CONFIG_ACPI_SLEEP
  658 + {
  659 + .ctl_name = KERN_ACPI_VIDEO_FLAGS,
  660 + .procname = "acpi_video_flags",
  661 + .data = &acpi_video_flags,
  662 + .maxlen = sizeof (unsigned long),
655 663 .mode = 0644,
656 664 .proc_handler = &proc_dointvec,
657 665 },