@@ -9,6 +9,7 @@
* the GPU in DRM API tests.
*/
+#include "asm-generic/errno-base.h"
#include <linux/device.h>
#include <linux/module.h>
#include <linux/platform_device.h>
@@ -171,12 +172,14 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
dev->mode_config.preferred_depth = 0;
dev->mode_config.helper_private = &vkms_mode_config_helpers;
- return vkms_output_init(vkmsdev, 0);
+ return vkmsdev->is_default ? vkms_output_init_default(vkmsdev) :
+ -EINVAL;
}
static int vkms_platform_probe(struct platform_device *pdev)
{
int ret;
+ struct vkms_device_setup *vkms_device_setup = pdev->dev.platform_data;
struct vkms_device *vkms_device;
void *grp;
@@ -195,6 +198,7 @@ static int vkms_platform_probe(struct platform_device *pdev)
vkms_device->config.cursor = enable_cursor;
vkms_device->config.writeback = enable_writeback;
vkms_device->config.overlay = enable_overlay;
+ vkms_device->is_default = vkms_device_setup->is_default;
ret = dma_coerce_mask_and_coherent(vkms_device->drm.dev,
DMA_BIT_MASK(64));
@@ -258,6 +262,9 @@ static int __init vkms_init(void)
{
int ret;
struct platform_device *pdev;
+ struct vkms_device_setup vkms_device_setup = {
+ .is_default = true,
+ };
ret = platform_driver_register(&vkms_platform_driver);
if (ret) {
@@ -265,8 +272,11 @@ static int __init vkms_init(void)
return ret;
}
- pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
+ pdev = platform_device_register_data(NULL, DRIVER_NAME, 0,
+ &vkms_device_setup,
+ sizeof(vkms_device_setup));
if (IS_ERR(pdev)) {
+ DRM_ERROR("Unable to register default vkms device\n");
platform_driver_unregister(&vkms_platform_driver);
return PTR_ERR(pdev);
}
@@ -132,17 +132,20 @@ struct vkms_output {
struct vkms_plane planes[VKMS_MAX_PLANES];
};
-struct vkms_device;
-
struct vkms_config {
bool writeback;
bool cursor;
bool overlay;
};
+struct vkms_device_setup {
+ bool is_default;
+};
+
struct vkms_device {
struct drm_device drm;
struct platform_device *platform;
+ bool is_default;
struct vkms_output output;
struct vkms_config config;
};
@@ -166,7 +169,7 @@ struct vkms_crtc *vkms_crtc_init(struct vkms_device *vkmsdev,
struct drm_plane *primary,
struct drm_plane *cursor);
-int vkms_output_init(struct vkms_device *vkmsdev, int index);
+int vkms_output_init_default(struct vkms_device *vkmsdev);
struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
enum drm_plane_type type);
@@ -80,7 +80,7 @@ static struct drm_encoder *vkms_encoder_init(struct vkms_device *vkms_device)
return encoder;
}
-int vkms_output_init(struct vkms_device *vkmsdev, int index)
+int vkms_output_init_default(struct vkms_device *vkmsdev)
{
struct vkms_output *output = &vkmsdev->output;
struct drm_device *dev = &vkmsdev->drm;