Forráskód Böngészése

touch: raydium touch driver upgrade

Upgrading raydium tech touch driver code from
kernel 5.4 to kernel 5.15.

Change-Id: I051065cadad60ea9428f38eb18bedbcb3af47797
Signed-off-by: ppadasal <[email protected]>
ppadasal 2 éve
szülő
commit
20a6810dae

+ 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 - 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;

+ 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;
 }