CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/patch/misc/0011-bootsplash.patch
Views: 3959
1
diff --git a/Documentation/ABI/testing/sysfs-platform-bootsplash b/Documentation/ABI/testing/sysfs-platform-bootsplash
2
index 742c7b035ded..f8f4b259220e 100644
3
--- a/Documentation/ABI/testing/sysfs-platform-bootsplash
4
+++ b/Documentation/ABI/testing/sysfs-platform-bootsplash
5
@@ -9,3 +9,35 @@ Description:
6
1: Splash is shown whenever fbcon would show a text console
7
(i.e. no graphical application is running), and a splash
8
file is loaded.
9
+
10
+What: /sys/devices/platform/bootsplash.0/drop_splash
11
+Date: Oct 2017
12
+KernelVersion: 4.14
13
+Contact: Max Staudt <[email protected]>
14
+Description:
15
+ Can only be set.
16
+
17
+ Any value written will cause the current splash theme file
18
+ to be unloaded and the text console to be redrawn.
19
+
20
+What: /sys/devices/platform/bootsplash.0/load_file
21
+Date: Oct 2017
22
+KernelVersion: 4.14
23
+Contact: Max Staudt <[email protected]>
24
+Description:
25
+ Can only be set.
26
+
27
+ Any value written will cause the splash to be disabled and
28
+ internal memory structures to be freed.
29
+
30
+ A firmware path written will cause a new theme file to be
31
+ loaded and the current bootsplash to be replaced.
32
+ The current enabled/disabled status is not touched.
33
+ If the splash is already active, it will be redrawn.
34
+
35
+ The path has to be a path in /lib/firmware since
36
+ request_firmware() is used to fetch the data.
37
+
38
+ When setting the splash from the shell, echo -n has to be
39
+ used as any trailing '\n' newline will be interpreted as
40
+ part of the path.
41
diff --git a/Documentation/bootsplash.rst b/Documentation/bootsplash.rst
42
index 611f0c558925..b35aba5093e8 100644
43
--- a/Documentation/bootsplash.rst
44
+++ b/Documentation/bootsplash.rst
45
@@ -67,6 +67,14 @@ sysfs run-time configuration
46
a splash theme file is also loaded.
47
48
49
+``/sys/devices/platform/bootsplash.0/drop_splash``
50
+ Unload splash data and free memory.
51
+
52
+``/sys/devices/platform/bootsplash.0/load_file``
53
+ Load a splash file from ``/lib/firmware/``.
54
+ Note that trailing newlines will be interpreted as part of the file name.
55
+
56
+
57
58
Kconfig
59
=======
60
diff --git a/drivers/video/fbdev/core/bootsplash.c b/drivers/video/fbdev/core/bootsplash.c
61
index 13fcaabbc2ca..16cb0493629d 100644
62
--- a/drivers/video/fbdev/core/bootsplash.c
63
+++ b/drivers/video/fbdev/core/bootsplash.c
64
@@ -251,11 +251,65 @@ static ssize_t splash_store_enabled(struct device *device,
65
return count;
66
}
67
68
+static ssize_t splash_store_drop_splash(struct device *device,
69
+ struct device_attribute *attr,
70
+ const char *buf, size_t count)
71
+{
72
+ struct splash_file_priv *fp;
73
+
74
+ if (!buf || !count || !splash_state.file)
75
+ return count;
76
+
77
+ mutex_lock(&splash_state.data_lock);
78
+ fp = splash_state.file;
79
+ splash_state.file = NULL;
80
+ mutex_unlock(&splash_state.data_lock);
81
+
82
+ /* Redraw the text console */
83
+ schedule_work(&splash_state.work_redraw_vc);
84
+
85
+ bootsplash_free_file(fp);
86
+
87
+ return count;
88
+}
89
+
90
+static ssize_t splash_store_load_file(struct device *device,
91
+ struct device_attribute *attr,
92
+ const char *buf, size_t count)
93
+{
94
+ struct splash_file_priv *fp, *fp_old;
95
+
96
+ if (!count)
97
+ return 0;
98
+
99
+ fp = bootsplash_load_firmware(&splash_state.splash_device->dev,
100
+ buf);
101
+
102
+ if (!fp)
103
+ return -ENXIO;
104
+
105
+ mutex_lock(&splash_state.data_lock);
106
+ fp_old = splash_state.file;
107
+ splash_state.splash_fb = NULL;
108
+ splash_state.file = fp;
109
+ mutex_unlock(&splash_state.data_lock);
110
+
111
+ /* Update the splash or text console */
112
+ schedule_work(&splash_state.work_redraw_vc);
113
+
114
+ bootsplash_free_file(fp_old);
115
+ return count;
116
+}
117
+
118
static DEVICE_ATTR(enabled, 0644, splash_show_enabled, splash_store_enabled);
119
+static DEVICE_ATTR(drop_splash, 0200, NULL, splash_store_drop_splash);
120
+static DEVICE_ATTR(load_file, 0200, NULL, splash_store_load_file);
121
122
123
static struct attribute *splash_dev_attrs[] = {
124
&dev_attr_enabled.attr,
125
+ &dev_attr_drop_splash.attr,
126
+ &dev_attr_load_file.attr,
127
NULL
128
};
129
130
131