diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-02 22:40:34 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-02 22:40:34 -0400 |
| commit | 20a2078ce7705a6e0722ef5184336eb8657a58d8 (patch) | |
| tree | 5b927c96516380aa0ecd68d8a609f7cd72120ad5 /kernel/power | |
| parent | 0279b3c0ada1d78882f24acf94ac4595bd657a89 (diff) | |
| parent | 307b9c022720f9de90d58e51743e01e9a42aec59 (diff) | |
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie:
"This is the main drm pull request for 3.10.
Wierd bits:
- OMAP drm changes required OMAP dss changes, in drivers/video, so I
took them in here.
- one more fbcon fix for font handover
- VT switch avoidance in pm code
- scatterlist helpers for gpu drivers - have acks from akpm
Highlights:
- qxl kms driver - driver for the spice qxl virtual GPU
Nouveau:
- fermi/kepler VRAM compression
- GK110/nvf0 modesetting support.
Tegra:
- host1x core merged with 2D engine support
i915:
- vt switchless resume
- more valleyview support
- vblank fixes
- modesetting pipe config rework
radeon:
- UVD engine support
- SI chip tiling support
- GPU registers initialisation from golden values.
exynos:
- device tree changes
- fimc block support
Otherwise:
- bunches of fixes all over the place."
* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (513 commits)
qxl: update to new idr interfaces.
drm/nouveau: fix build with nv50->nvc0
drm/radeon: fix handling of v6 power tables
drm/radeon: clarify family checks in pm table parsing
drm/radeon: consolidate UVD clock programming
drm/radeon: fix UPLL_REF_DIV_MASK definition
radeon: add bo tracking debugfs
drm/radeon: add new richland pci ids
drm/radeon: add some new SI PCI ids
drm/radeon: fix scratch reg handling for UVD fence
drm/radeon: allocate SA bo in the requested domain
drm/radeon: fix possible segfault when parsing pm tables
drm/radeon: fix endian bugs in atom_allocate_fb_scratch()
OMAPDSS: TFP410: return EPROBE_DEFER if the i2c adapter not found
OMAPDSS: VENC: Add error handling for venc_probe_pdata
OMAPDSS: HDMI: Add error handling for hdmi_probe_pdata
OMAPDSS: RFBI: Add error handling for rfbi_probe_pdata
OMAPDSS: DSI: Add error handling for dsi_probe_pdata
OMAPDSS: SDI: Add error handling for sdi_probe_pdata
OMAPDSS: DPI: Add error handling for dpi_probe_pdata
...
Diffstat (limited to 'kernel/power')
| -rw-r--r-- | kernel/power/console.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/kernel/power/console.c b/kernel/power/console.c index b1dc456474b5..463aa6736751 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | * Originally from swsusp. | 4 | * Originally from swsusp. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <linux/console.h> | ||
| 7 | #include <linux/vt_kern.h> | 8 | #include <linux/vt_kern.h> |
| 8 | #include <linux/kbd_kern.h> | 9 | #include <linux/kbd_kern.h> |
| 9 | #include <linux/vt.h> | 10 | #include <linux/vt.h> |
| @@ -14,8 +15,120 @@ | |||
| 14 | 15 | ||
| 15 | static int orig_fgconsole, orig_kmsg; | 16 | static int orig_fgconsole, orig_kmsg; |
| 16 | 17 | ||
| 18 | static DEFINE_MUTEX(vt_switch_mutex); | ||
| 19 | |||
| 20 | struct pm_vt_switch { | ||
| 21 | struct list_head head; | ||
| 22 | struct device *dev; | ||
| 23 | bool required; | ||
| 24 | }; | ||
| 25 | |||
| 26 | static LIST_HEAD(pm_vt_switch_list); | ||
| 27 | |||
| 28 | |||
| 29 | /** | ||
| 30 | * pm_vt_switch_required - indicate VT switch at suspend requirements | ||
| 31 | * @dev: device | ||
| 32 | * @required: if true, caller needs VT switch at suspend/resume time | ||
| 33 | * | ||
| 34 | * The different console drivers may or may not require VT switches across | ||
| 35 | * suspend/resume, depending on how they handle restoring video state and | ||
| 36 | * what may be running. | ||
| 37 | * | ||
| 38 | * Drivers can indicate support for switchless suspend/resume, which can | ||
| 39 | * save time and flicker, by using this routine and passing 'false' as | ||
| 40 | * the argument. If any loaded driver needs VT switching, or the | ||
| 41 | * no_console_suspend argument has been passed on the command line, VT | ||
| 42 | * switches will occur. | ||
| 43 | */ | ||
| 44 | void pm_vt_switch_required(struct device *dev, bool required) | ||
| 45 | { | ||
| 46 | struct pm_vt_switch *entry, *tmp; | ||
| 47 | |||
| 48 | mutex_lock(&vt_switch_mutex); | ||
| 49 | list_for_each_entry(tmp, &pm_vt_switch_list, head) { | ||
| 50 | if (tmp->dev == dev) { | ||
| 51 | /* already registered, update requirement */ | ||
| 52 | tmp->required = required; | ||
| 53 | goto out; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); | ||
| 58 | if (!entry) | ||
| 59 | goto out; | ||
| 60 | |||
| 61 | entry->required = required; | ||
| 62 | entry->dev = dev; | ||
| 63 | |||
| 64 | list_add(&entry->head, &pm_vt_switch_list); | ||
| 65 | out: | ||
| 66 | mutex_unlock(&vt_switch_mutex); | ||
| 67 | } | ||
| 68 | EXPORT_SYMBOL(pm_vt_switch_required); | ||
| 69 | |||
| 70 | /** | ||
| 71 | * pm_vt_switch_unregister - stop tracking a device's VT switching needs | ||
| 72 | * @dev: device | ||
| 73 | * | ||
| 74 | * Remove @dev from the vt switch list. | ||
| 75 | */ | ||
| 76 | void pm_vt_switch_unregister(struct device *dev) | ||
| 77 | { | ||
| 78 | struct pm_vt_switch *tmp; | ||
| 79 | |||
| 80 | mutex_lock(&vt_switch_mutex); | ||
| 81 | list_for_each_entry(tmp, &pm_vt_switch_list, head) { | ||
| 82 | if (tmp->dev == dev) { | ||
| 83 | list_del(&tmp->head); | ||
| 84 | break; | ||
| 85 | } | ||
| 86 | } | ||
| 87 | mutex_unlock(&vt_switch_mutex); | ||
| 88 | } | ||
| 89 | EXPORT_SYMBOL(pm_vt_switch_unregister); | ||
| 90 | |||
| 91 | /* | ||
| 92 | * There are three cases when a VT switch on suspend/resume are required: | ||
| 93 | * 1) no driver has indicated a requirement one way or another, so preserve | ||
| 94 | * the old behavior | ||
| 95 | * 2) console suspend is disabled, we want to see debug messages across | ||
| 96 | * suspend/resume | ||
| 97 | * 3) any registered driver indicates it needs a VT switch | ||
| 98 | * | ||
| 99 | * If none of these conditions is present, meaning we have at least one driver | ||
| 100 | * that doesn't need the switch, and none that do, we can avoid it to make | ||
| 101 | * resume look a little prettier (and suspend too, but that's usually hidden, | ||
| 102 | * e.g. when closing the lid on a laptop). | ||
| 103 | */ | ||
| 104 | static bool pm_vt_switch(void) | ||
| 105 | { | ||
| 106 | struct pm_vt_switch *entry; | ||
| 107 | bool ret = true; | ||
| 108 | |||
| 109 | mutex_lock(&vt_switch_mutex); | ||
| 110 | if (list_empty(&pm_vt_switch_list)) | ||
| 111 | goto out; | ||
| 112 | |||
| 113 | if (!console_suspend_enabled) | ||
| 114 | goto out; | ||
| 115 | |||
| 116 | list_for_each_entry(entry, &pm_vt_switch_list, head) { | ||
| 117 | if (entry->required) | ||
| 118 | goto out; | ||
| 119 | } | ||
| 120 | |||
| 121 | ret = false; | ||
| 122 | out: | ||
| 123 | mutex_unlock(&vt_switch_mutex); | ||
| 124 | return ret; | ||
| 125 | } | ||
| 126 | |||
| 17 | int pm_prepare_console(void) | 127 | int pm_prepare_console(void) |
| 18 | { | 128 | { |
| 129 | if (!pm_vt_switch()) | ||
| 130 | return 0; | ||
| 131 | |||
| 19 | orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1); | 132 | orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1); |
| 20 | if (orig_fgconsole < 0) | 133 | if (orig_fgconsole < 0) |
| 21 | return 1; | 134 | return 1; |
| @@ -26,6 +139,9 @@ int pm_prepare_console(void) | |||
| 26 | 139 | ||
| 27 | void pm_restore_console(void) | 140 | void pm_restore_console(void) |
| 28 | { | 141 | { |
| 142 | if (!pm_vt_switch()) | ||
| 143 | return; | ||
| 144 | |||
| 29 | if (orig_fgconsole >= 0) { | 145 | if (orig_fgconsole >= 0) { |
| 30 | vt_move_to_console(orig_fgconsole, 0); | 146 | vt_move_to_console(orig_fgconsole, 0); |
| 31 | vt_kmsg_redirect(orig_kmsg); | 147 | vt_kmsg_redirect(orig_kmsg); |
