1 // SPDX-License-Identifier: MIT
3 #include <drm/clients/drm_client_setup.h>
4 #include <drm/drm_device.h>
5 #include <drm/drm_fourcc.h>
6 #include <drm/drm_print.h>
8 #include "drm_client_internal.h"
10 static char drm_client_default[16] = CONFIG_DRM_CLIENT_DEFAULT;
11 module_param_string(active, drm_client_default, sizeof(drm_client_default), 0444);
12 MODULE_PARM_DESC(active,
13 "Choose which drm client to start, default is"
14 CONFIG_DRM_CLIENT_DEFAULT "]");
17 * drm_client_setup() - Setup in-kernel DRM clients
19 * @format: Preferred pixel format for the device. Use NULL, unless
20 * there is clearly a driver-preferred format.
22 * This function sets up the in-kernel DRM clients. Restore, hotplug
23 * events and teardown are all taken care of.
25 * Drivers should call drm_client_setup() after registering the new
26 * DRM device with drm_dev_register(). This function is safe to call
27 * even when there are no connectors present. Setup will be retried
28 * on the next hotplug event.
30 * The clients are destroyed by drm_dev_unregister().
32 void drm_client_setup(struct drm_device *dev, const struct drm_format_info *format)
35 #ifdef CONFIG_DRM_FBDEV_EMULATION
36 if (!strcmp(drm_client_default, "fbdev")) {
39 ret = drm_fbdev_client_setup(dev, format);
41 drm_warn(dev, "Failed to set up DRM client; error %d\n", ret);
46 #ifdef CONFIG_DRM_CLIENT_LOG
47 if (!strcmp(drm_client_default, "log")) {
48 drm_log_register(dev);
52 if (strcmp(drm_client_default, ""))
53 drm_warn(dev, "Unknown DRM client %s\n", drm_client_default);
55 EXPORT_SYMBOL(drm_client_setup);
58 * drm_client_setup_with_fourcc() - Setup in-kernel DRM clients for color mode
60 * @fourcc: Preferred pixel format as 4CC code for the device
62 * This function sets up the in-kernel DRM clients. It is equivalent
63 * to drm_client_setup(), but expects a 4CC code as second argument.
65 void drm_client_setup_with_fourcc(struct drm_device *dev, u32 fourcc)
67 drm_client_setup(dev, drm_format_info(fourcc));
69 EXPORT_SYMBOL(drm_client_setup_with_fourcc);
72 * drm_client_setup_with_color_mode() - Setup in-kernel DRM clients for color mode
74 * @color_mode: Preferred color mode for the device
76 * This function sets up the in-kernel DRM clients. It is equivalent
77 * to drm_client_setup(), but expects a color mode as second argument.
79 * Do not use this function in new drivers. Prefer drm_client_setup() with a
82 void drm_client_setup_with_color_mode(struct drm_device *dev, unsigned int color_mode)
84 u32 fourcc = drm_driver_color_mode_format(dev, color_mode);
86 drm_client_setup_with_fourcc(dev, fourcc);
88 EXPORT_SYMBOL(drm_client_setup_with_color_mode);
90 MODULE_DESCRIPTION("In-kernel DRM clients");
91 MODULE_LICENSE("GPL and additional rights");