Browse Source

Merge "touch: add DRM for raydium for kernel 5.15"

qctecmdr 2 years ago
parent
commit
302815ce7e

+ 11 - 0
Android.mk

@@ -66,6 +66,17 @@ ifeq ($(TOUCH_DLKM_ENABLE),  true)
 	include $(DLKM_DIR)/Build_external_kernelmodule.mk
 	###########################################################
 
+        ###########################################################
+        include $(CLEAR_VARS)
+        LOCAL_SRC_FILES   := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)
+        LOCAL_MODULE              := raydium_ts.ko
+        LOCAL_MODULE_KBUILD_NAME  := raydium_ts.ko
+        LOCAL_MODULE_TAGS         := optional
+        #LOCAL_MODULE_DEBUG_ENABLE := true
+        LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
+        include $(DLKM_DIR)/Build_external_kernelmodule.mk
+        ###########################################################
+
 	###########################################################
 	include $(CLEAR_VARS)
 	LOCAL_SRC_FILES   := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)

+ 27 - 0
Kbuild

@@ -136,6 +136,33 @@ ifeq ($(CONFIG_TOUCHSCREEN_DUMMY), y)
 	obj-$(CONFIG_MSM_TOUCH) += dummy_ts.o
 endif
 
+ifeq ($(CONFIG_TOUCHSCREEN_RM_TS), y)
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/Config.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/drv_interface.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/rad_fw_image_30.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/raydium_driver.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/raydium_selftest.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/tpselftest_30.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/chip_raydium/f303_ic_control.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/chip_raydium/f303_ic_reg.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/chip_raydium/f303_ic_test.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/chip_raydium/ic_drv_global.h
+        LINUX_INC += -include $(TOUCH_ROOT)/raydium/chip_raydium/ic_drv_interface.h
+
+         raydium_ts-y := \
+                 ./raydium/drv_interface.o \
+                 ./raydium/raydium_driver.o \
+                 ./raydium/raydium_fw_update.o \
+                 ./raydium/raydium_selftest.o \
+                 ./raydium/raydium_sysfs.o \
+                 ./raydium/chip_raydium/f303_ic_control.o \
+                 ./raydium/chip_raydium/f303_ic_test.o \
+                 ./raydium/chip_raydium/ic_drv_global.o \
+                 ./raydium/chip_raydium/ic_drv_interface.o
+
+        obj-$(CONFIG_MSM_TOUCH) += raydium_ts.o
+endif
+
 ifeq ($(CONFIG_TOUCHSCREEN_SYNAPTICS_TCM), y)
 	synaptics_tcm_ts-y := \
 		 ./synaptics_tcm/synaptics_tcm_core.o \

+ 48 - 0
NOTICE

@@ -3,6 +3,54 @@
  * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 */
 
+/*
+ *
+ * Raydium TouchScreen driver.
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ * Qualcomm Innovation Center, Inc. chooses to use it under GPLv2
+ * Copyright (c) 2021  Raydium tech Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name of Google Inc. or Linaro Ltd. nor the names of
+ *    its contributors may be used to endorse or promote products
+ *    derived from this software without specific prior written
+ *    permission.
+ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 /*
  *
  * Parade TouchScreen driver.

+ 1 - 0
config/gki_monacotouch.conf

@@ -3,3 +3,4 @@ export CONFIG_TOUCHSCREEN_PARADE=y
 export CONFIG_TOUCHSCREEN_PARADE_DEVICETREE_SUPPORT=y
 export CONFIG_TOUCHSCREEN_PARADE_I2C=y
 export CONFIG_TOUCHSCREEN_PARADE_DEVICE_ACCESS=y
+export CONFIG_TOUCHSCREEN_RM_TS=y

+ 1 - 0
config/gki_monacotouchconf.h

@@ -4,3 +4,4 @@
 #define CONFIG_TOUCHSCREEN_PARADE_DEVICE_ACCESS 1
 #define CONFIG_TOUCHSCREEN_PARADE_BUTTON 1
 #define CONFIG_TOUCHSCREEN_PARADE_PROXIMITY 1
+#define CONFIG_TOUCHSCREEN_RM_TS 1

+ 1 - 1
raydium/chip_raydium/f303_ic_control.c

@@ -31,7 +31,7 @@
 #include <stdlib.h>
 #endif
 
-#include "drv_interface.h"
+#include "../drv_interface.h"
 #include "ic_drv_global.h"
 #include "ic_drv_interface.h"
 #include "f303_ic_control.h"

+ 5 - 5
raydium/chip_raydium/f303_ic_test.c

@@ -31,7 +31,7 @@
 #endif
 
 #define RM_F303_MAX_STR_LENGTH		8
-#include "drv_interface.h"
+#include "../drv_interface.h"
 #include "ic_drv_global.h"
 #include "ic_drv_interface.h"
 #include "f303_ic_control.h"
@@ -1193,7 +1193,7 @@ STATUS ft_raw_data_checksum_check_3x(unsigned short *u16_buffer)
 
 	if (u16_buffer[48] != 0x55AA) {
 		DEBUGOUT("u16_buffer[34]:%x\r\n", u16_buffer[48]);
-		DEBUGOUT("[RDCSC] Pattern NG! [0x%x](0x%x)\r\n", (int)u16_buffer, u16_buffer[48]);
+		DEBUGOUT("[RDCSC] Pattern NG! [0x%p](0x%x)\n", u16_buffer, u16_buffer[48]);
 		return ERROR;
 	}
 
@@ -1202,7 +1202,7 @@ STATUS ft_raw_data_checksum_check_3x(unsigned short *u16_buffer)
 		u16_sum += u16_buffer[u8_i];
 
 	if (u16_buffer[49] != u16_sum) {
-		DEBUGOUT("[RDCSC] Check SUM NG! [0x%x](0x%x:0x%x)\r\n", (int)u16_buffer, u16_sum, u16_buffer[49]);
+		DEBUGOUT("[RDCSC] Check SUM NG! [0x%p](0x%x:0x%x)\n", u16_buffer, u16_sum, u16_buffer[49]);
 		return ERROR;
 	}
 
@@ -1217,7 +1217,7 @@ STATUS ft_test_result_checksum_check_3x(unsigned char *u8_buffer)
 	unsigned char u8_sum = 0;
 
 	if (u8_buffer[48] != 0x5A) {
-		DEBUGOUT("[TRCSC] Pattern NG! [0x%x](0x%x:0x%x)\r\n", (int)u8_buffer, u8_buffer[48], u8_buffer[49]);
+		DEBUGOUT("[TRCSC] Pattern NG! [0x%p](0x%x:0x%x)\n", u8_buffer, u8_buffer[48], u8_buffer[49]);
 		return ERROR;
 	}
 
@@ -1226,7 +1226,7 @@ STATUS ft_test_result_checksum_check_3x(unsigned char *u8_buffer)
 		u8_sum += u8_buffer[u8_i];
 
 	if (u8_buffer[49] != u8_sum) {
-		DEBUGOUT("[TRCSC] Check SUM NG! [0x%x](0x%x:0x%x)\r\n", (int)u8_buffer, u8_sum, u8_buffer[49]);
+		DEBUGOUT("[TRCSC] Check SUM NG! [0x%p](0x%x:0x%x)\n", u8_buffer, u8_sum, u8_buffer[49]);
 		return ERROR;
 	}
 

+ 2 - 2
raydium/chip_raydium/ic_drv_global.c

@@ -16,7 +16,7 @@
  *
  */
 
-#include <Config.h>
+#include "../Config.h"
 #include "ic_drv_global.h"
 #include "ic_drv_interface.h"
 #ifdef __KERNEL__
@@ -30,7 +30,7 @@
 #include <asm/uaccess.h>
 #endif
 
-#include "drv_interface.h"
+#include "../drv_interface.h"
 
 
 

+ 1 - 1
raydium/chip_raydium/ic_drv_global.h

@@ -18,7 +18,7 @@
 
 #ifndef _DRVGLOBAL_H_
 #define _DRVGLOBAL_H_
-#include <Config.h>
+#include "../Config.h"
 #ifdef __KERNEL__
 #include <linux/types.h>
 #else

+ 1 - 1
raydium/chip_raydium/ic_drv_interface.c

@@ -29,7 +29,7 @@
 #include <string.h>
 #endif
 #include "ic_drv_interface.h"
-#include "drv_interface.h"
+#include "../drv_interface.h"
 #include "ic_drv_global.h"
 #if SELFTEST_2X
 #include "f302_ic_control.h"

+ 34 - 3
raydium/drv_interface.c

@@ -2,6 +2,9 @@
  *
  * Raydium TouchScreen driver.
  *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ * Qualcomm Innovation Center, Inc. chooses to use it under GPLv2
  * Copyright (c) 2021  Raydium tech Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -14,9 +17,37 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
+ * BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name of Google Inc. or Linaro Ltd. nor the names of
+ *    its contributors may be used to endorse or promote products
+ *    derived from this software without specific prior written
+ *    permission.
+ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <linux/timer.h>
+#include <linux/ktime.h>
 #include <linux/delay.h>
 #include <linux/unistd.h>
 #include <linux/string.h>
@@ -29,7 +60,6 @@
 #include "raydium_driver.h"
 #include "chip_raydium/f303_ic_control.h"
 
-struct timeval timer;
 unsigned char g_u8_m_buf[2][128];
 unsigned char g_u8_ini_flash[0x400];
 struct raydium_ts_data *ts;
@@ -127,14 +157,15 @@ unsigned char read_flash_data(unsigned int u32_addr, unsigned short u16_lenth)
 unsigned int get_system_time(void)
 {
 /*	unsigned int u32_timer;
+ *	struct timeval timer;
  *	do_gettimeofday(&timer);
  *	u32_timer = (timer.tv_sec % 1000) * 1000 + (timer.tv_usec / 1000);
  *	return u32_timer;
  */
 	#if (KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE)
-	struct timespec ts;
+	struct timespec64 ts;
 
-	getnstimeofday(&ts);
+	ktime_get_ts64(&ts);
 	return (ts.tv_sec*1000 + ts.tv_nsec/1000000);
 	#else
 	struct timeval tv;

+ 43 - 63
raydium/raydium_driver.c

@@ -38,6 +38,7 @@
 #include <linux/of_gpio.h>
 #include <linux/err.h>
 #include <linux/of_device.h>
+#include <linux/soc/qcom/panel_event_notifier.h>
 
 #if defined(CONFIG_FB)
 #include <linux/notifier.h>
@@ -695,7 +696,7 @@ void raydium_irq_control(bool enable)
 		}
 
 		/* Clear interrupts first */
-		if (g_raydium_ts->blank != DRM_PANEL_BLANK_POWERDOWN) {
+		if (g_raydium_ts->blank != DRM_PANEL_EVENT_BLANK_LP) {
 			if (g_u8_i2c_mode == PDA2_MODE) {
 				mutex_lock(&g_raydium_ts->lock);
 				if (raydium_i2c_pda2_set_page(g_raydium_ts->client,
@@ -1202,8 +1203,8 @@ static void raydium_work_handler(struct work_struct *work)
 		}
 	}
 
-	if (g_raydium_ts->blank == DRM_PANEL_BLANK_LP ||
-	g_raydium_ts->blank == DRM_PANEL_BLANK_POWERDOWN || g_raydium_ts->fb_state == FB_OFF) {
+	if (g_raydium_ts->blank == DRM_PANEL_EVENT_BLANK_LP||
+	g_raydium_ts->blank == DRM_PANEL_EVENT_BLANK_LP || g_raydium_ts->fb_state == FB_OFF) {
 		LOGD(LOG_DEBUG, "[touch] elseif u8_tp_status:%x\n", u8_tp_status[POS_GES_STATUS]);
 		/*need check small area*/
 		/*if (u8_tp_status[POS_GES_STATUS] == RAD_WAKE_UP */
@@ -1220,7 +1221,7 @@ static void raydium_work_handler(struct work_struct *work)
 		}
 	}
 	/*when display on can use palm to suspend*/
-	else if (g_raydium_ts->blank == DRM_PANEL_BLANK_UNBLANK) {
+	else if (g_raydium_ts->blank == DRM_PANEL_EVENT_UNBLANK) {
 		if (u8_tp_status[POS_GES_STATUS] == RAD_PALM_ENABLE) {
 			if (g_raydium_ts->is_palm == 0) {
 				/* release all touches*/
@@ -1571,54 +1572,36 @@ static int raydium_ts_resume(struct device *dev)
 
 
 #if defined(CONFIG_DRM)
-/*******************************************************************************
- * FUNCTION: drm_notifier_callback
- *
- * SUMMARY: Call back function for DRM notifier to allow to call
- * resume/suspend attention list.
- *
- * RETURN:
- *   0 = success
- *
- * PARAMETERS:
- * self   - pointer to notifier_block structure
- * event  - event type of fb notifier
- * data   - pointer to fb_event structure
- ******************************************************************************/
-static int drm_notifier_callback(struct notifier_block *self,
-			unsigned long event, void *data)
+static void drm_notifier_callback(enum panel_event_notifier_tag tag,
+		struct panel_event_notification *notification, void *client_data)
 {
-	struct raydium_ts_data *g_raydium_ts =
-		container_of(self, struct raydium_ts_data, fb_notif);
-	struct drm_panel_notifier *evdata = data;
-	int *blank;
-
-	LOGD(LOG_INFO, "%s: DRM notifier called!\n", __func__);
 
-	if (!evdata)
-		goto exit;
+	struct raydium_ts_data *g_raydium_ts = client_data;
+	if(!notification)
+	{
+		LOGD(LOG_INFO, "%s: Invalid notification\n", __func__);
+		return ;
+	}
 
-	if (!(event == DRM_PANEL_EARLY_EVENT_BLANK ||
-			event == DRM_PANEL_EVENT_BLANK)) {
-		LOGD(LOG_INFO, "%s: Event(%lu) do not need process\n",
-			__func__, event);
+	LOGD(LOG_INFO, "%s: DRM notifier called!\n", __func__);
+	if (!(notification->notif_type == DRM_PANEL_EVENT_BLANK)){
+		LOGD(LOG_INFO, "%s: Event(%d do not need process\n",
+			__func__, notification->notif_type);
 		goto exit;
 	}
 
-	blank = evdata->data;
-	g_raydium_ts->blank = (*blank);
-	LOGD(LOG_INFO, "%s: DRM event:%lu,blank:%d fb_state %d ",
-		__func__, event, *blank, g_raydium_ts->fb_state);
-	LOGD(LOG_INFO, "%s: DRM Power - %s - FB state %d ",
-		__func__, (*blank == DRM_PANEL_BLANK_UNBLANK)?"UP":"DOWN", g_raydium_ts->fb_state);
+	LOGD(LOG_INFO, "%s: DRM event:%d fb_state %d ",
+		__func__, notification->notif_type, g_raydium_ts->fb_state);
+	LOGD(LOG_INFO, "%s: DRM Power - %d- FB state %d ",
+		__func__, (notification->notif_type == DRM_PANEL_EVENT_UNBLANK)?"UP":"DOWN", g_raydium_ts->fb_state);
 
-	if (*blank == DRM_PANEL_BLANK_UNBLANK) {
+	if (notification->notif_type == DRM_PANEL_EVENT_UNBLANK) {
 		LOGD(LOG_INFO, "%s: UNBLANK!\n", __func__);
 
-		if (event == DRM_PANEL_EARLY_EVENT_BLANK) {
-			LOGD(LOG_INFO, "%s: resume: event = %lu, not care\n",
-				__func__, event);
-		} else if (event == DRM_PANEL_EVENT_BLANK) {
+		if (notification->notif_type == DRM_PANEL_EVENT_BLANK) {
+			LOGD(LOG_INFO, "%s: resume: event = %d not care\n",
+				__func__, notification->notif_type);
+		} else if (notification->notif_type == DRM_PANEL_EVENT_BLANK) {
 			if (g_raydium_ts->fb_state != FB_ON) {
 				LOGD(LOG_INFO, "%s: Resume notifier called!\n",
 					__func__);
@@ -1634,10 +1617,10 @@ static int drm_notifier_callback(struct notifier_block *self,
 			LOGD(LOG_INFO, "%s: Resume notified!\n", __func__);
 			}
 		}
-	} else if (*blank == DRM_PANEL_BLANK_LP || *blank == DRM_PANEL_BLANK_POWERDOWN
-		|| *blank == DRM_PANEL_BLANK_FPS_CHANGE) {
+	} else if (notification->notif_type == DRM_PANEL_EVENT_BLANK_LP ||
+		notification->notif_type == DRM_PANEL_EVENT_FPS_CHANGE) {
 		LOGD(LOG_INFO, "%s: LOWPOWER!\n", __func__);
-		if (event == DRM_PANEL_EARLY_EVENT_BLANK) {
+		if (notification->notif_type == DRM_PANEL_EVENT_BLANK) {
 			if (g_raydium_ts->fb_state != FB_OFF) {
 				LOGD(LOG_INFO, "%s: Suspend notifier called!\n",
 					__func__);
@@ -1652,16 +1635,16 @@ static int drm_notifier_callback(struct notifier_block *self,
 				g_raydium_ts->fb_state = FB_OFF;
 				LOGD(LOG_INFO, "%s: Suspend notified!\n", __func__);
 			}
-		} else if (event == DRM_PANEL_EVENT_BLANK) {
-			LOGD(LOG_INFO, "%s: suspend: event = %lu, not care\n",
-				__func__, event);
+		} else if (notification->notif_type == DRM_PANEL_EVENT_BLANK) {
+			LOGD(LOG_INFO, "%s: suspend: event = %d not care\n",
+				__func__, notification->notif_type);
 		}
 	} else {
 		LOGD(LOG_INFO, "%s: DRM BLANK(%d) do not need process\n",
-			__func__, *blank);
+			__func__, notification->notif_type);
 	}
 exit:
-	return 0;
+	return ;
 }
 
 /*******************************************************************************
@@ -1674,16 +1657,13 @@ exit:
  *******************************************************************************/
 static void raydium_setup_drm_notifier(struct raydium_ts_data *g_raydium_ts)
 {
-	g_raydium_ts->fb_state = FB_ON;
-	g_raydium_ts->fb_notif.notifier_call = drm_notifier_callback;
-	LOGD(LOG_INFO, "[touch]%s: Setting up drm notifier\n", __func__);
-
+	void *cookie = NULL;
 	if (!active_panel)
-		LOGD(LOG_ERR, "[touch]%s: Active panel not registered!\n", __func__);
+                LOGD(LOG_ERR, "[touch]%s: Active panel not registered!\n", __func__);
 
-	if (active_panel && drm_panel_notifier_register(active_panel,
-		&g_raydium_ts->fb_notif) < 0)
-		LOGD(LOG_ERR, "[touch]%s: Register notifier failed!\n", __func__);
+	cookie = panel_event_notifier_register(PANEL_EVENT_NOTIFICATION_PRIMARY,
+			PANEL_EVENT_NOTIFIER_CLIENT_PRIMARY_TOUCH,
+			active_panel,&drm_notifier_callback, g_raydium_ts);
 }
 #endif /*end of CONFIG_DRM*/
 
@@ -2400,8 +2380,8 @@ void raydium_ts_shutdown(struct i2c_client *client)
 #elif defined(CONFIG_HAS_EARLYSUSPEND)
 	unregister_early_suspend(&g_raydium_ts->early_suspend);
 #elif defined(CONFIG_DRM)
-	if (active_panel)
-		drm_panel_notifier_unregister(active_panel, &g_raydium_ts->fb_notifier);
+if (active_panel)
+	panel_event_notifier_unregister(&g_raydium_ts->fb_notif);
 #endif/*end of CONFIG_FB*/
 	input_unregister_device(g_raydium_ts->input_dev);
 	input_free_device(g_raydium_ts->input_dev);
@@ -2436,8 +2416,8 @@ static int raydium_ts_remove(struct i2c_client *client)
 #elif defined(CONFIG_HAS_EARLYSUSPEND)
 	unregister_early_suspend(&g_raydium_ts->early_suspend);
 #elif defined(CONFIG_DRM)
-	if (active_panel)
-		drm_panel_notifier_unregister(active_panel, &g_raydium_ts->fb_notifier);
+if (active_panel)
+        panel_event_notifier_unregister(&g_raydium_ts->fb_notif);
 #endif/*end of CONFIG_FB*/
 	input_unregister_device(g_raydium_ts->input_dev);
 	input_free_device(g_raydium_ts->input_dev);

+ 34 - 5
raydium/raydium_selftest.c

@@ -2,6 +2,9 @@
  *
  * Raydium TouchScreen driver.
  *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ * Qualcomm Innovation Center, Inc. chooses to use it under GPLv2
  * Copyright (c) 2021  Raydium tech Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -14,8 +17,36 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
+ * BSD LICENSE
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name of Google Inc. or Linaro Ltd. nor the names of
+ *    its contributors may be used to endorse or promote products
+ *    derived from this software without specific prior written
+ *    permission.
+ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+
 #include <linux/delay.h>
 #include <linux/mutex.h>
 #include <linux/unistd.h>
@@ -69,17 +100,15 @@ int self_test_save_to_file(char *file_name, char *p_string, short len)
 	struct file *filp = NULL;
 	mm_segment_t old_fs;
 
-	filp = filp_open(file_name, O_RDWR | O_CREAT | O_APPEND, 0666);
+	filp = filp_open_block(file_name, O_RDWR | O_CREAT | O_APPEND, 0666);
 	if (IS_ERR(filp)) {
 		DEBUGOUT("can't open file:%s\n", RM_SELF_TEST_LOGFILE);
 		return 0;
 	}
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
+	old_fs = force_uaccess_begin();
 	filp->f_op->write(filp, p_string, len, &filp->f_pos);
-	set_fs(old_fs);
+	force_uaccess_end(old_fs);
 	filp_close(filp, NULL);
-
 	return 1;
 }
 

+ 2 - 1
touch_driver_board.mk

@@ -20,7 +20,8 @@ ifeq ($(TOUCH_DLKM_ENABLE),  true)
 					$(KERNEL_MODULES_OUT)/synaptics_tcm_ts.ko \
 					$(KERNEL_MODULES_OUT)/pt_ts.ko \
 					$(KERNEL_MODULES_OUT)/pt_i2c.ko \
-					$(KERNEL_MODULES_OUT)/pt_device_access.ko
+					$(KERNEL_MODULES_OUT)/pt_device_access.ko \
+					$(KERNEL_MODULES_OUT)/raydium_ts.ko
 			endif # pineapple
 		endif
 	endif

+ 2 - 1
touch_driver_product.mk

@@ -18,6 +18,7 @@ ifeq ($(TOUCH_DLKM_ENABLE),  true)
 			$(KERNEL_MODULES_OUT)/synaptics_tcm_ts.ko \
 			$(KERNEL_MODULES_OUT)/pt_ts.ko \
 			$(KERNEL_MODULES_OUT)/pt_i2c.ko \
-			$(KERNEL_MODULES_OUT)/pt_device_access.ko
+			$(KERNEL_MODULES_OUT)/pt_device_access.ko \
+			$(KERNEL_MODULES_OUT)/raydium_ts.ko
 	endif # pineapple
 endif