mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
Fix parade tma5xx touch driver compiling error
TP: Fix parade tma5xx touch driver compiling error. Change-Id: I3ec84668c807165b3d68eafeefe7a696c1044cd1 Signed-off-by: zhuwg1 <zhuwg1@motorola.com> Reviewed-on: https://gerrit.mot.com/2176441 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
16d4bd3fea
commit
356930680f
5 changed files with 66 additions and 18 deletions
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "cyttsp5_regs.h"
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/i2c.h>
|
||||
|
||||
#define CY_CORE_STARTUP_RETRY_COUNT 3
|
||||
|
||||
|
|
@ -1960,7 +1961,7 @@ exit:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cyttsp5_get_mfg_value_(struct cyttsp5_core_data *cd, u8 *mfg_buffer, u8 mfg_num)
|
||||
static __maybe_unused int cyttsp5_get_mfg_value_(struct cyttsp5_core_data *cd, u8 *mfg_buffer, u8 mfg_num)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
|
@ -3803,6 +3804,21 @@ queue_startup:
|
|||
cyttsp5_start_wd_timer(cd);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)
|
||||
static void cyttsp5_watchdog_timer(struct timer_list *t)
|
||||
{
|
||||
struct cyttsp5_core_data *cd = from_timer(cd, t, watchdog_timer);
|
||||
|
||||
if (!cd)
|
||||
return;
|
||||
|
||||
parade_debug(cd->dev, DEBUG_LEVEL_2, "%s: Watchdog timer triggered\n",
|
||||
__func__);
|
||||
|
||||
if (!work_pending(&cd->watchdog_work))
|
||||
schedule_work(&cd->watchdog_work);
|
||||
}
|
||||
#else
|
||||
static void cyttsp5_watchdog_timer(unsigned long handle)
|
||||
{
|
||||
struct cyttsp5_core_data *cd = (struct cyttsp5_core_data *)handle;
|
||||
|
|
@ -3816,6 +3832,7 @@ static void cyttsp5_watchdog_timer(unsigned long handle)
|
|||
if (!work_pending(&cd->watchdog_work))
|
||||
schedule_work(&cd->watchdog_work);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int cyttsp5_put_device_into_easy_wakeup_(struct cyttsp5_core_data *cd)
|
||||
{
|
||||
|
|
@ -5734,8 +5751,7 @@ static ssize_t cyttsp5_ttdl_restart_store(struct device *dev,
|
|||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
int rc;
|
||||
struct i2c_client *client =
|
||||
(struct i2c_client *)container_of(dev, struct i2c_client, dev);
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
|
||||
if (is_cyttsp5_probe_success) {
|
||||
dev_err(dev, "%s: previous cyttsp5_probe is successful, do nothing\n",
|
||||
|
|
@ -5868,7 +5884,9 @@ int _pt_read_us_file(struct device *dev, u8 *file_path, u8 *buf, int *size)
|
|||
struct inode *inode = NULL;
|
||||
unsigned int file_len = 0;
|
||||
unsigned int read_len = 0;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
|
||||
mm_segment_t oldfs;
|
||||
#endif
|
||||
int rc = 0;
|
||||
|
||||
if (file_path == NULL || buf == NULL) {
|
||||
|
|
@ -5878,8 +5896,10 @@ int _pt_read_us_file(struct device *dev, u8 *file_path, u8 *buf, int *size)
|
|||
|
||||
dev_info(dev, "%s: path = %s\n", __func__, file_path);
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
|
||||
oldfs = get_fs();
|
||||
set_fs(KERNEL_DS);
|
||||
#endif
|
||||
filp = filp_open(file_path, O_RDONLY, S_IRUSR);
|
||||
if (IS_ERR(filp)) {
|
||||
dev_err(dev, "%s: Failed to open %s\n", __func__,
|
||||
|
|
@ -5921,7 +5941,11 @@ int _pt_read_us_file(struct device *dev, u8 *file_path, u8 *buf, int *size)
|
|||
goto exit;
|
||||
}
|
||||
filp->private_data = inode->i_private;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
|
||||
if (vfs_read(filp, buf, read_len, &(filp->f_pos)) != read_len) {
|
||||
#else
|
||||
if (kernel_read(filp, buf, read_len, &(filp->f_pos)) != read_len) {
|
||||
#endif
|
||||
dev_err(dev, "%s: file read error.\n", __func__);
|
||||
rc = -EINVAL;
|
||||
goto exit;
|
||||
|
|
@ -5932,7 +5956,9 @@ exit:
|
|||
if (filp_close(filp, NULL) != 0)
|
||||
dev_err(dev, "%s: file close error.\n", __func__);
|
||||
err:
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
|
||||
set_fs(oldfs);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -6414,8 +6440,13 @@ int cyttsp5_probe(const struct cyttsp5_bus_ops *ops, struct device *dev,
|
|||
}
|
||||
|
||||
/* Setup watchdog timer */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)
|
||||
timer_setup(&cd->watchdog_timer, cyttsp5_watchdog_timer,
|
||||
0);
|
||||
#else
|
||||
setup_timer(&cd->watchdog_timer, cyttsp5_watchdog_timer,
|
||||
(unsigned long)cd);
|
||||
#endif
|
||||
|
||||
rc = cyttsp5_setup_irq_gpio(cd);
|
||||
if (rc < 0) {
|
||||
|
|
|
|||
|
|
@ -1207,11 +1207,11 @@ static int cyttsp5_get_cmcp_info(struct cyttsp5_device_access_data *dad,
|
|||
struct gd_sensor *gd_sensor_row = cmcp_info->gd_sensor_row;
|
||||
struct result *result = dad->result;
|
||||
int32_t cp_btn_cal = 0;
|
||||
int32_t cm_btn_cal = 0;
|
||||
//int32_t cm_btn_cal = 0;
|
||||
int32_t cp_btn_ave = 0;
|
||||
int32_t cm_ave_data_panel = 0;
|
||||
int32_t cm_ave_data_btn = 0;
|
||||
int32_t cm_delta_data_btn = 0;
|
||||
//int32_t cm_delta_data_btn = 0;
|
||||
int32_t cp_tx_ave_data_panel = 0;
|
||||
int32_t cp_rx_ave_data_panel = 0;
|
||||
u8 tmp_buf[3];
|
||||
|
|
@ -1795,7 +1795,7 @@ static ssize_t cyttsp5_cmcp_test_store(struct device *dev,
|
|||
u8 test_item = 0;
|
||||
u8 range_check = 0;
|
||||
u8 force_calibrate = 0;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
static const char * const cmcp_test_case_array[] = {"Full Cm/Cp test",
|
||||
"Cm panel test", "Cp panel test",
|
||||
"Cm button test", "Cp button test"};
|
||||
|
|
@ -1853,8 +1853,9 @@ static ssize_t cyttsp5_cmcp_test_store(struct device *dev,
|
|||
* If it is not all Test, then range_check should be 0
|
||||
* because other test does not has concept of basic check
|
||||
*/
|
||||
if (test_item > 0 && test_item < 5)
|
||||
if (test_item > 0 && test_item < 5) {
|
||||
range_check = 0;
|
||||
}
|
||||
dad->cmcp_test_items = test_item;
|
||||
dad->cmcp_range_check = range_check;
|
||||
dad->cmcp_force_calibrate = force_calibrate;
|
||||
|
|
@ -1901,14 +1902,14 @@ int prepare_print_data(char *out_buf, int32_t *in_buf, int index, int data_num)
|
|||
|
||||
int save_header(char *out_buf, int index, struct result *result)
|
||||
{
|
||||
struct timex txc;
|
||||
struct timespec64 txc;
|
||||
struct rtc_time tm;
|
||||
char time_buf[100] = {0};
|
||||
|
||||
do_gettimeofday(&(txc.time));
|
||||
rtc_time_to_tm(txc.time.tv_sec, &tm);
|
||||
ktime_get_real_ts64(&txc);
|
||||
rtc_time64_to_tm(txc.tv_sec, &tm);
|
||||
scnprintf(time_buf, 100, "%d/%d/%d,TIME,%d:%d:%d,", tm.tm_year+1900,
|
||||
tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
|
||||
index = prepare_print_string(out_buf, ",.header,\n", index);
|
||||
index = prepare_print_string(out_buf, ",DATE,", index);
|
||||
|
|
@ -2074,11 +2075,12 @@ int save_engineering_data(struct device *dev, char *out_buf, int index,
|
|||
index = prepare_print_data(
|
||||
out_buf,
|
||||
&tmp, index, 1);
|
||||
for (j = 1; j < tx_num; j++)
|
||||
for (j = 1; j < tx_num; j++) {
|
||||
index = prepare_print_data(
|
||||
out_buf,
|
||||
&cmcp_info->cm_sensor_column_delta[(j-1)*rx_num+i],
|
||||
index, 1);
|
||||
}
|
||||
index = prepare_print_string(
|
||||
out_buf,
|
||||
"\n", index);
|
||||
|
|
@ -2112,11 +2114,12 @@ int save_engineering_data(struct device *dev, char *out_buf, int index,
|
|||
index = prepare_print_data(
|
||||
out_buf, &i,
|
||||
index, 1);
|
||||
for (j = 0; j < tx_num; j++)
|
||||
for (j = 0; j < tx_num; j++) {
|
||||
index = prepare_print_data(
|
||||
out_buf,
|
||||
&cmcp_info->cm_sensor_row_delta[j*rx_num+i-1],
|
||||
index, 1);
|
||||
}
|
||||
index = prepare_print_string(
|
||||
out_buf,
|
||||
"\n", index);
|
||||
|
|
|
|||
|
|
@ -309,14 +309,24 @@ static int cyttsp5_ldr_prog_row_(struct device *dev,
|
|||
struct cyttsp5_hex_image *row_image)
|
||||
{
|
||||
u16 length = row_image->row_size + 3;
|
||||
u8 data[3 + row_image->row_size];
|
||||
int ret = 0;
|
||||
u8 *data = NULL;
|
||||
u8 offset = 0;
|
||||
|
||||
data = (u8 *) kmalloc(length, GFP_KERNEL);
|
||||
if(!data) {
|
||||
dev_err(dev, "%s: failed to kmalloc\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
data[offset++] = row_image->array_id;
|
||||
data[offset++] = LOW_BYTE(row_image->row_num);
|
||||
data[offset++] = HI_BYTE(row_image->row_num);
|
||||
memcpy(data + 3, row_image->row_data, row_image->row_size);
|
||||
return cmd->nonhid_cmd->prog_and_verify(dev, 0, length, data);
|
||||
ret = cmd->nonhid_cmd->prog_and_verify(dev, 0, length, data);
|
||||
|
||||
kfree(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cyttsp5_ldr_verify_chksum_(struct device *dev)
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ static void cyttsp5_report_event(struct cyttsp5_mt_data *md, int event,
|
|||
input_report_abs(md->input, sig, value);
|
||||
}
|
||||
|
||||
#define CY_MAX_ID 32
|
||||
static void cyttsp5_get_mt_touches(struct cyttsp5_mt_data *md,
|
||||
struct cyttsp5_touch *tch, int num_cur_tch)
|
||||
{
|
||||
|
|
@ -197,7 +198,7 @@ static void cyttsp5_get_mt_touches(struct cyttsp5_mt_data *md,
|
|||
struct cyttsp5_sysinfo *si = md->si;
|
||||
int sig;
|
||||
int i, j, t = 0;
|
||||
DECLARE_BITMAP(ids, si->tch_abs[CY_TCH_T].max);
|
||||
DECLARE_BITMAP(ids, CY_MAX_ID);
|
||||
int mt_sync_count = 0;
|
||||
u8 *tch_addr;
|
||||
|
||||
|
|
|
|||
|
|
@ -927,9 +927,12 @@ struct cyttsp5_features {
|
|||
uint8_t sensor_data;
|
||||
};
|
||||
|
||||
#define NEED_SUSPEND_NOTIFIER \
|
||||
((LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)) \
|
||||
#if ((LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)) \
|
||||
&& defined(CONFIG_PM_SLEEP) && defined(CONFIG_PM_RUNTIME))
|
||||
#define NEED_SUSPEND_NOTIFIER 1
|
||||
#else
|
||||
#define NEED_SUSPEND_NOTIFIER 0
|
||||
#endif
|
||||
|
||||
struct cyttsp5_module {
|
||||
struct list_head node;
|
||||
|
|
|
|||
Loading…
Reference in a new issue