From 3e7eb2d06ea3c9ed3fb314425bac9da6c64f5c6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Spintzyk?= <lukasz.spintzyk@synaptics.com>
Date: Fri, 24 Feb 2023 08:30:13 +0100
Subject: [PATCH] Preliminary support for 6.3 kernel

---
 module/evdi_drm_drv.h | 1 +
 module/evdi_encoder.c | 2 ++
 module/evdi_fb.c      | 9 +++++++++
 module/evdi_gem.c     | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/module/evdi_drm_drv.h b/module/evdi_drm_drv.h
index 3c0cc39..747218b 100644
--- a/module/evdi_drm_drv.h
+++ b/module/evdi_drm_drv.h
@@ -17,6 +17,7 @@
 #include <linux/version.h>
 #include <linux/mutex.h>
 #include <linux/device.h>
+#include <linux/i2c.h>
 #if KERNEL_VERSION(5, 5, 0) <= LINUX_VERSION_CODE || defined(EL8)
 #include <drm/drm_drv.h>
 #include <drm/drm_fourcc.h>
diff --git a/module/evdi_encoder.c b/module/evdi_encoder.c
index 1a2191d..47fd19f 100644
--- a/module/evdi_encoder.c
+++ b/module/evdi_encoder.c
@@ -18,6 +18,8 @@
 #endif
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_encoder.h>
+#include <drm/drm_modeset_helper_vtables.h>
 #include "evdi_drm_drv.h"
 
 /* dummy encoder */
diff --git a/module/evdi_fb.c b/module/evdi_fb.c
index 6b3b867..07ec656 100644
--- a/module/evdi_fb.c
+++ b/module/evdi_fb.c
@@ -500,7 +500,11 @@ int evdi_fbdev_init(struct drm_device *dev)
 		return -ENOMEM;
 
 	evdi->fbdev = efbdev;
+#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
+	drm_fb_helper_prepare(dev, &efbdev->helper, 32, &evdi_fb_helper_funcs);
+#else
 	drm_fb_helper_prepare(dev, &efbdev->helper, &evdi_fb_helper_funcs);
+#endif
 
 #if KERNEL_VERSION(5, 7, 0) <= LINUX_VERSION_CODE || defined(EL8)
 	ret = drm_fb_helper_init(dev, &efbdev->helper);
@@ -517,7 +521,12 @@ int evdi_fbdev_init(struct drm_device *dev)
 	drm_fb_helper_single_add_all_connectors(&efbdev->helper);
 #endif
 
+#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
+	ret = drm_fb_helper_initial_config(&efbdev->helper);
+#else
 	ret = drm_fb_helper_initial_config(&efbdev->helper, 32);
+#endif
+
 	if (ret) {
 		drm_fb_helper_fini(&efbdev->helper);
 		kfree(efbdev);
diff --git a/module/evdi_gem.c b/module/evdi_gem.c
index e5a781b..8283172 100644
--- a/module/evdi_gem.c
+++ b/module/evdi_gem.c
@@ -189,8 +189,12 @@ int evdi_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 	if (ret)
 		return ret;
 
+#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
+	vm_flags_mod(vma, VM_MIXEDMAP, VM_PFNMAP);
+#else
 	vma->vm_flags &= ~VM_PFNMAP;
 	vma->vm_flags |= VM_MIXEDMAP;
+#endif
 
 	return ret;
 }
-- 
2.40.1

