1 // SPDX-License-Identifier: MIT
3 #include <drm/drm_client_setup.h>
4 #include <drm/drm_device.h>
5 #include <drm/drm_fbdev_client.h>
6 #include <drm/drm_fourcc.h>
7 #include <drm/drm_print.h>
10 * drm_client_setup() - Setup in-kernel DRM clients
12 * @format: Preferred pixel format for the device. Use NULL, unless
13 * there is clearly a driver-preferred format.
15 * This function sets up the in-kernel DRM clients. Restore, hotplug
16 * events and teardown are all taken care of.
18 * Drivers should call drm_client_setup() after registering the new
19 * DRM device with drm_dev_register(). This function is safe to call
20 * even when there are no connectors present. Setup will be retried
21 * on the next hotplug event.
23 * The clients are destroyed by drm_dev_unregister().
25 void drm_client_setup(struct drm_device *dev, const struct drm_format_info *format)
29 ret = drm_fbdev_client_setup(dev, format);
31 drm_warn(dev, "Failed to set up DRM client; error %d\n", ret);
33 EXPORT_SYMBOL(drm_client_setup);
36 * drm_client_setup_with_fourcc() - Setup in-kernel DRM clients for color mode
38 * @fourcc: Preferred pixel format as 4CC code for the device
40 * This function sets up the in-kernel DRM clients. It is equivalent
41 * to drm_client_setup(), but expects a 4CC code as second argument.
43 void drm_client_setup_with_fourcc(struct drm_device *dev, u32 fourcc)
45 drm_client_setup(dev, drm_format_info(fourcc));
47 EXPORT_SYMBOL(drm_client_setup_with_fourcc);
50 * drm_client_setup_with_color_mode() - Setup in-kernel DRM clients for color mode
52 * @color_mode: Preferred color mode for the device
54 * This function sets up the in-kernel DRM clients. It is equivalent
55 * to drm_client_setup(), but expects a color mode as second argument.
57 * Do not use this function in new drivers. Prefer drm_client_setup() with a
60 void drm_client_setup_with_color_mode(struct drm_device *dev, unsigned int color_mode)
62 u32 fourcc = drm_driver_color_mode_format(dev, color_mode);
64 drm_client_setup_with_fourcc(dev, fourcc);
66 EXPORT_SYMBOL(drm_client_setup_with_color_mode);
68 MODULE_DESCRIPTION("In-kernel DRM clients");
69 MODULE_LICENSE("GPL and additional rights");