Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/next/external/patch/misc/0011-bootsplash.patch
Views: 3959
diff --git a/Documentation/ABI/testing/sysfs-platform-bootsplash b/Documentation/ABI/testing/sysfs-platform-bootsplash1index 742c7b035ded..f8f4b259220e 1006442--- a/Documentation/ABI/testing/sysfs-platform-bootsplash3+++ b/Documentation/ABI/testing/sysfs-platform-bootsplash4@@ -9,3 +9,35 @@ Description:51: Splash is shown whenever fbcon would show a text console6(i.e. no graphical application is running), and a splash7file is loaded.8+9+What: /sys/devices/platform/bootsplash.0/drop_splash10+Date: Oct 201711+KernelVersion: 4.1412+Contact: Max Staudt <[email protected]>13+Description:14+ Can only be set.15+16+ Any value written will cause the current splash theme file17+ to be unloaded and the text console to be redrawn.18+19+What: /sys/devices/platform/bootsplash.0/load_file20+Date: Oct 201721+KernelVersion: 4.1422+Contact: Max Staudt <[email protected]>23+Description:24+ Can only be set.25+26+ Any value written will cause the splash to be disabled and27+ internal memory structures to be freed.28+29+ A firmware path written will cause a new theme file to be30+ loaded and the current bootsplash to be replaced.31+ The current enabled/disabled status is not touched.32+ If the splash is already active, it will be redrawn.33+34+ The path has to be a path in /lib/firmware since35+ request_firmware() is used to fetch the data.36+37+ When setting the splash from the shell, echo -n has to be38+ used as any trailing '\n' newline will be interpreted as39+ part of the path.40diff --git a/Documentation/bootsplash.rst b/Documentation/bootsplash.rst41index 611f0c558925..b35aba5093e8 10064442--- a/Documentation/bootsplash.rst43+++ b/Documentation/bootsplash.rst44@@ -67,6 +67,14 @@ sysfs run-time configuration45a splash theme file is also loaded.464748+``/sys/devices/platform/bootsplash.0/drop_splash``49+ Unload splash data and free memory.50+51+``/sys/devices/platform/bootsplash.0/load_file``52+ Load a splash file from ``/lib/firmware/``.53+ Note that trailing newlines will be interpreted as part of the file name.54+55+5657Kconfig58=======59diff --git a/drivers/video/fbdev/core/bootsplash.c b/drivers/video/fbdev/core/bootsplash.c60index 13fcaabbc2ca..16cb0493629d 10064461--- a/drivers/video/fbdev/core/bootsplash.c62+++ b/drivers/video/fbdev/core/bootsplash.c63@@ -251,11 +251,65 @@ static ssize_t splash_store_enabled(struct device *device,64return count;65}6667+static ssize_t splash_store_drop_splash(struct device *device,68+ struct device_attribute *attr,69+ const char *buf, size_t count)70+{71+ struct splash_file_priv *fp;72+73+ if (!buf || !count || !splash_state.file)74+ return count;75+76+ mutex_lock(&splash_state.data_lock);77+ fp = splash_state.file;78+ splash_state.file = NULL;79+ mutex_unlock(&splash_state.data_lock);80+81+ /* Redraw the text console */82+ schedule_work(&splash_state.work_redraw_vc);83+84+ bootsplash_free_file(fp);85+86+ return count;87+}88+89+static ssize_t splash_store_load_file(struct device *device,90+ struct device_attribute *attr,91+ const char *buf, size_t count)92+{93+ struct splash_file_priv *fp, *fp_old;94+95+ if (!count)96+ return 0;97+98+ fp = bootsplash_load_firmware(&splash_state.splash_device->dev,99+ buf);100+101+ if (!fp)102+ return -ENXIO;103+104+ mutex_lock(&splash_state.data_lock);105+ fp_old = splash_state.file;106+ splash_state.splash_fb = NULL;107+ splash_state.file = fp;108+ mutex_unlock(&splash_state.data_lock);109+110+ /* Update the splash or text console */111+ schedule_work(&splash_state.work_redraw_vc);112+113+ bootsplash_free_file(fp_old);114+ return count;115+}116+117static DEVICE_ATTR(enabled, 0644, splash_show_enabled, splash_store_enabled);118+static DEVICE_ATTR(drop_splash, 0200, NULL, splash_store_drop_splash);119+static DEVICE_ATTR(load_file, 0200, NULL, splash_store_load_file);120121122static struct attribute *splash_dev_attrs[] = {123&dev_attr_enabled.attr,124+ &dev_attr_drop_splash.attr,125+ &dev_attr_load_file.attr,126NULL127};128129130131