Loading drivers/input/touchscreen/Kconfig +8 −0 Original line number Original line Diff line number Diff line Loading @@ -1444,4 +1444,12 @@ config TOUCHSCREEN_EKTF3XXX_CHIPSET If unusre, say N. If unusre, say N. config TOUCHSCREEN_RAYDIUM_CHIPSET bool "Raydium WT030 touchpanel CHIPSET" depends on I2C help Say Y here if you have a Raydium WT030 CHIPSET touchscreen. If unsure, say N. endif endif drivers/input/touchscreen/Makefile +1 −0 Original line number Original line Diff line number Diff line Loading @@ -108,3 +108,4 @@ obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_touch/ obj-$(CONFIG_TOUCHSCREEN_GT9XX_v28) += gt9xx_v2.8/ obj-$(CONFIG_TOUCHSCREEN_GT9XX_v28) += gt9xx_v2.8/ obj-$(CONFIG_TOUCHSCREEN_HIMAX_CHIPSET) += hxchipset/ obj-$(CONFIG_TOUCHSCREEN_HIMAX_CHIPSET) += hxchipset/ obj-$(CONFIG_TOUCHSCREEN_EKTF3XXX_CHIPSET) += ektf3xxx/ obj-$(CONFIG_TOUCHSCREEN_EKTF3XXX_CHIPSET) += ektf3xxx/ obj-$(CONFIG_TOUCHSCREEN_RAYDIUM_CHIPSET) += raydium_wt030/ drivers/input/touchscreen/raydium_wt030/Makefile +1 −3 Original line number Original line Diff line number Diff line # # # Makefile for the touchscreen raydium drivers. # Makefile for the touchscreen raydium drivers. # # obj-$(CONFIG_TOUCHSCREEN_RM_TS) += raydium_driver.o raydium_sysfs.o raydium_fw_update.o obj-$(CONFIG_TOUCHSCREEN_RAYDIUM_CHIPSET) += raydium_driver.o raydium_sysfs.o raydium_fw_update.o obj-$(CONFIG_TOUCHSCREEN_RM_TS_SELFTEST) += drv_interface.o raydium_selftest.o chip_raydium/ic_drv_global.o chip_raydium/ic_drv_interface.o drv_interface.o chip_raydium/f302_ic_control.o chip_raydium/f302_ic_test.o drivers/input/touchscreen/raydium_wt030/raydium_driver.c +192 −164 Original line number Original line Diff line number Diff line Loading @@ -53,10 +53,6 @@ struct raydium_slot_status { struct raydium_slot_status gst_slot[MAX_TOUCH_NUM * 2]; struct raydium_slot_status gst_slot[MAX_TOUCH_NUM * 2]; struct raydium_slot_status gst_slot_init = {0xFF, 0, 0}; struct raydium_slot_status gst_slot_init = {0xFF, 0, 0}; #if (defined(CONFIG_RM_SYSFS_DEBUG)) const struct attribute_group raydium_attr_group; #endif /*end of CONFIG_RM_SYSFS_DEBUG*/ unsigned char g_u8_addr; unsigned char g_u8_addr; unsigned char g_u8_raydium_flag; unsigned char g_u8_raydium_flag; unsigned char g_u8_i2c_mode; unsigned char g_u8_i2c_mode; Loading @@ -81,13 +77,14 @@ unsigned char g_u8_palm_flag; unsigned long timeout; unsigned long timeout; #endif #endif struct raydium_ts_data *g_raydium_ts; struct raydium_ts_data *g_raydium_ts; /******************************************************************************* /***************************************************************************** * Name: raydium_variable_init * Name: raydium_variable_init * Brief: * Brief: * Input: * Input: * Output: * Output: * Return: * Return: *******************************************************************************/ *****************************************************************************/ static void raydium_variable_init(void) static void raydium_variable_init(void) { { g_u8_addr = RAYDIUM_PDA2_PDA_CFG_ADDR; g_u8_addr = RAYDIUM_PDA2_PDA_CFG_ADDR; Loading Loading @@ -120,15 +117,13 @@ static void raydium_variable_init(void) #endif #endif } } /***************************************************************************** /******************************************************************************* * Name: raydium_gpio_configure * Name: raydium_gpio_configure * Brief: * Brief: * Input: * Input: * Output: * Output: * Return: * Return: *******************************************************************************/ *****************************************************************************/ static int raydium_gpio_configure(bool on) static int raydium_gpio_configure(bool on) { { int i32_err = 0; int i32_err = 0; Loading Loading @@ -159,7 +154,8 @@ static int raydium_gpio_configure(bool on) goto err_irq_gpio_req; goto err_irq_gpio_req; } } i32_err = gpio_direction_output(g_raydium_ts->rst_gpio, 1); i32_err = gpio_direction_output(g_raydium_ts->rst_gpio, 1); if (i32_err) { if (i32_err) { dev_err(&g_raydium_ts->client->dev, dev_err(&g_raydium_ts->client->dev, "[touch]set_direction for irq gpio failed\n"); "[touch]set_direction for irq gpio failed\n"); Loading @@ -170,7 +166,9 @@ static int raydium_gpio_configure(bool on) if (gpio_is_valid(g_raydium_ts->irq_gpio)) if (gpio_is_valid(g_raydium_ts->irq_gpio)) gpio_free(g_raydium_ts->irq_gpio); gpio_free(g_raydium_ts->irq_gpio); } } return 0; return 0; err_rst_gpio_dir: err_rst_gpio_dir: if (gpio_is_valid(g_raydium_ts->rst_gpio)) if (gpio_is_valid(g_raydium_ts->rst_gpio)) gpio_free(g_raydium_ts->rst_gpio); gpio_free(g_raydium_ts->rst_gpio); Loading @@ -182,13 +180,13 @@ static int raydium_gpio_configure(bool on) return i32_err; return i32_err; } } /******************************************************************************* /***************************************************************************** * Name: raydium_ts_pinctrl_init * Name: raydium_ts_pinctrl_init * Brief: * Brief: * Input: * Input: * Output: * Output: * Return: * Return: *******************************************************************************/ *****************************************************************************/ #ifdef MSM_NEW_VER #ifdef MSM_NEW_VER static int raydium_ts_pinctrl_init(void) static int raydium_ts_pinctrl_init(void) { { Loading @@ -203,7 +201,8 @@ static int raydium_ts_pinctrl_init(void) } } g_raydium_ts->pinctrl_state_active g_raydium_ts->pinctrl_state_active = pinctrl_lookup_state(g_raydium_ts->ts_pinctrl, PINCTRL_STATE_ACTIVE); = pinctrl_lookup_state(g_raydium_ts->ts_pinctrl, PINCTRL_STATE_ACTIVE); if (IS_ERR_OR_NULL(g_raydium_ts->pinctrl_state_active)) { if (IS_ERR_OR_NULL(g_raydium_ts->pinctrl_state_active)) { i32_ret = PTR_ERR(g_raydium_ts->pinctrl_state_active); i32_ret = PTR_ERR(g_raydium_ts->pinctrl_state_active); pr_err("[touch]Can not lookup %s pinstate %d\n", pr_err("[touch]Can not lookup %s pinstate %d\n", Loading Loading @@ -239,12 +238,39 @@ static int raydium_ts_pinctrl_init(void) return i32_ret; return i32_ret; } } #endif/*end of MSM_NEW_VER*/ #endif/*end of MSM_NEW_VER*/ int wait_irq_state(struct i2c_client *client, unsigned int retry_time, unsigned int u32_delay_us) { int i32_ret = SUCCESS; unsigned int u32_retry; unsigned int u32_irq_value; unsigned int u32_min_delay_us = u32_delay_us - 500; unsigned int u32_max_delay_us = u32_delay_us + 500; u32_retry = retry_time; u32_irq_value = 0; while (u32_retry != 0 && u32_irq_value != 1) { u32_irq_value = gpio_get_value(g_raydium_ts->irq_gpio); usleep_range(u32_min_delay_us, u32_max_delay_us); u32_retry--; } pr_debug("[touch]irq_value is %d\n", u32_irq_value); if (u32_retry == 0) { pr_err("[touch]%s, FW not ready, retry error!\n", __func__); i32_ret = ERROR; } return i32_ret; } #ifdef ESD_SOLUTION_EN #ifdef ESD_SOLUTION_EN static int raydium_hw_reset_fun(struct i2c_client *client) static int raydium_hw_reset_fun(struct i2c_client *client) { { int i32_ret = SUCCESS; int i32_ret = SUCCESS; pr_info("[touch]HW reset\n"); pr_debug("[touch]HW reset\n"); if ((g_u8_raydium_flag & ENG_MODE) == 0) if ((g_u8_raydium_flag & ENG_MODE) == 0) raydium_irq_control(DISABLE); raydium_irq_control(DISABLE); Loading @@ -258,14 +284,13 @@ static int raydium_hw_reset_fun(struct i2c_client *client) g_u8_i2c_mode = PDA2_MODE; g_u8_i2c_mode = PDA2_MODE; i32_ret = wait_irq_state(client, 300, 2000); i32_ret = wait_irq_state(client, 300, 2000); if (i32_ret != ERROR) { if (i32_ret != ERROR) msleep(25); msleep(25); } if ((g_u8_raydium_flag & ENG_MODE) == 0) if ((g_u8_raydium_flag & ENG_MODE) == 0) raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); pr_info("[touch]Raydium HW reset : %d\n", i32_ret); pr_debug("[touch]Raydium HW reset : %d\n", i32_ret); return i32_ret; return i32_ret; } } #endif #endif Loading Loading @@ -392,7 +417,6 @@ int raydium_i2c_pda_write(struct i2c_client *client, i32_ret = raydium_i2c_pda_set_address(u32_addr, u8_mode); i32_ret = raydium_i2c_pda_set_address(u32_addr, u8_mode); if (i32_ret != RAD_I2C_PDA_ADDRESS_LENGTH) if (i32_ret != RAD_I2C_PDA_ADDRESS_LENGTH) goto exit; goto exit; //usleep_range(50, 80); for (u8_retry = 0; u8_retry < SYN_I2C_RETRY_TIMES; u8_retry++) { for (u8_retry = 0; u8_retry < SYN_I2C_RETRY_TIMES; u8_retry++) { if (i2c_transfer(client->adapter, msg, 1) == 1) { if (i2c_transfer(client->adapter, msg, 1) == 1) { Loading Loading @@ -444,7 +468,7 @@ int raydium_i2c_pda2_set_page(struct i2c_client *client, usleep_range(2000, 5000); usleep_range(2000, 5000); } } if (0 == u8_ret) { if (u8_ret == 0) { pr_err("[touch]%s: I2C write over retry limit\n", __func__); pr_err("[touch]%s: I2C write over retry limit\n", __func__); i32_ret = -EIO; i32_ret = -EIO; } } Loading Loading @@ -542,8 +566,8 @@ void raydium_irq_control(bool enable) } } /* Clear interrupts first */ /* Clear interrupts first */ if (g_raydium_ts->blank != FB_BLANK_POWERDOWN) { if (g_raydium_ts->blank != FB_BLANK_POWERDOWN && if (g_u8_i2c_mode == PDA2_MODE) { g_u8_i2c_mode == PDA2_MODE) { mutex_lock(&g_raydium_ts->lock); mutex_lock(&g_raydium_ts->lock); if (raydium_i2c_pda2_set_page(g_raydium_ts->client, if (raydium_i2c_pda2_set_page(g_raydium_ts->client, g_raydium_ts->is_suspend, g_raydium_ts->is_suspend, Loading @@ -553,19 +577,18 @@ void raydium_irq_control(bool enable) mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); usleep_range(500, 1500); usleep_range(500, 1500); } } } while (g_raydium_ts->irq_desc->depth > 0) { while (g_raydium_ts->irq_desc->depth > 0) { pr_info("[touch]irq enable\n"); pr_debug("[touch]irq enable\n"); g_raydium_ts->irq_enabled = true; g_raydium_ts->irq_enabled = true; enable_irq(g_raydium_ts->irq); enable_irq(g_raydium_ts->irq); } } } else { } else { if (g_raydium_ts->irq_enabled) { if (g_raydium_ts->irq_enabled && if (g_raydium_ts->irq_desc->depth == 0) { g_raydium_ts->irq_desc->depth == 0) { disable_irq(g_raydium_ts->irq); disable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; pr_info("[touch]irq disable\n"); pr_debug("[touch]irq disable\n"); } } } } } } } Loading @@ -579,16 +602,18 @@ int raydium_i2c_mode_control(struct i2c_client *client, switch (u8_mode) { switch (u8_mode) { case 0: /* Disable INT flag */ case 0: /* Disable INT flag */ pr_info("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); pr_debug("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); disable_irq(g_raydium_ts->irq); disable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; pr_info("[touch]RAD irq disable\n"); pr_debug("[touch]RAD irq disable\n"); break; break; case 1: /* Enable INT flag */ case 1: /* Enable INT flag */ pr_info("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); pr_debug("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); enable_irq(g_raydium_ts->irq); enable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = true; g_raydium_ts->irq_enabled = true; pr_info("[touch]RAD irq enable\n"); pr_debug("[touch]RAD irq enable\n"); break; break; case 2: /* Disable INT by raydium_irq_control */ case 2: /* Disable INT by raydium_irq_control */ raydium_irq_control(DISABLE); raydium_irq_control(DISABLE); Loading @@ -597,13 +622,14 @@ int raydium_i2c_mode_control(struct i2c_client *client, raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); break; break; case 4: /* Show RAD INT depth */ case 4: /* Show RAD INT depth */ pr_info("[touch]RAD INT depth : %d\n", g_raydium_ts->irq_desc->depth); pr_debug("[touch]RAD INT depth : %d\n", g_raydium_ts->irq_desc->depth); break; break; case 7: case 7: raydium_i2c_pda2_set_page(client, raydium_i2c_pda2_set_page(client, g_raydium_ts->is_suspend, RAYDIUM_PDA2_2_PDA); g_raydium_ts->is_suspend, RAYDIUM_PDA2_2_PDA); g_u8_i2c_mode = PDA_MODE; g_u8_i2c_mode = PDA_MODE; pr_info("[touch]Disable PDA2_MODE\n"); pr_debug("[touch]Disable PDA2_MODE\n"); break; break; case 8: case 8: raydium_i2c_pda_read(client, RAD_PDA2_CTRL_CMD, u8_buf, 4); raydium_i2c_pda_read(client, RAD_PDA2_CTRL_CMD, u8_buf, 4); Loading @@ -612,14 +638,14 @@ int raydium_i2c_mode_control(struct i2c_client *client, raydium_i2c_pda_set_address(0x50000628, DISABLE); raydium_i2c_pda_set_address(0x50000628, DISABLE); g_u8_i2c_mode = PDA2_MODE; g_u8_i2c_mode = PDA2_MODE; pr_info("[touch]Enable PDA2_MODE\n"); pr_debug("[touch]Enable PDA2_MODE\n"); break; break; } } return 0; return 0; } } const struct attribute_group raydium_attr_group = { static const struct attribute_group raydium_attr_group = { .attrs = raydium_attributes .attrs = raydium_attributes }; }; Loading @@ -634,7 +660,7 @@ static int raydium_create_sysfs(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &raydium_attr_group); sysfs_remove_group(&client->dev.kobj, &raydium_attr_group); ret = -EIO; ret = -EIO; } else { } else { pr_info("[touch]create raydium sysfs attr_group successful\n"); pr_debug("[touch]create raydium sysfs attr_group successful\n"); } } return ret; return ret; } } Loading Loading @@ -696,7 +722,7 @@ int raydium_esd_check(void) } } exit: exit: mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); pr_info("[touch] raydium_esd_check\n"); pr_debug("[touch] raydium_esd_check\n"); return i32_ret; return i32_ret; } } #endif #endif Loading @@ -716,7 +742,7 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) unsigned char u8_i, u8_j, u8_k; unsigned char u8_i, u8_j, u8_k; char write_string[1000]; char write_string[1000]; pr_info("[touch] %s -> type:%d\n", __func__, u8_type); pr_debug("[touch] %s -> type:%d\n", __func__, u8_type); for (u8_i = 0; u8_i < u8_frame; u8_i++) { for (u8_i = 0; u8_i < u8_frame; u8_i++) { Loading Loading @@ -752,7 +778,7 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) if (i32_retry == 5) { if (i32_retry == 5) { i32_ret = -EAGAIN; i32_ret = -EAGAIN; pr_info("[touch] %s -> flag timeout\n", __func__); pr_err("[touch] %s -> flag timeout\n", __func__); } } u32_offset = 0; u32_offset = 0; Loading Loading @@ -791,10 +817,9 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) goto exit_i2c_error; goto exit_i2c_error; i32_ret = raydium_i2c_pda2_read(g_raydium_ts->client, i32_ret = raydium_i2c_pda2_read(g_raydium_ts->client, (unsigned char)(u32_target_addr & MASK_8BIT), (unsigned char)(u32_target_addr u8_rbuffer, & MASK_8BIT), u8_rbuffer, u16_read_length); u16_read_length); if (i32_ret < 0) if (i32_ret < 0) goto exit_flag_error; goto exit_flag_error; Loading @@ -804,17 +829,17 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) u32_offset += u16_read_length; u32_offset += u16_read_length; } } pr_info("[touch] frame%d\n", u8_i); pr_debug("[touch] frame%d\n", u8_i); #if DATA_MAP_5_5 #if DATA_MAP_5_5 for (u8_j = 0; u8_j < 25; u8_j += 5) { for (u8_j = 0; u8_j < 25; u8_j += 5) { pr_info("[touch] %4d, %4d, %4d, %4d, %4d\r\n", pr_debug("[touch] %4d, %4d, %4d, %4d, %4d\r\n", i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+4]); i16_data_buffer[u8_j+4]); } } #else #else for (u8_j = 0; u8_j < 36; u8_j += 6) { for (u8_j = 0; u8_j < 36; u8_j += 6) { pr_info("[touch] %4d, %4d, %4d, %4d, %4d, %4d\r\n", pr_debug("[touch] %4d, %4d, %4d, %4d, %4d, %4d\r\n", i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+4], i16_data_buffer[u8_j+5]); i16_data_buffer[u8_j+4], i16_data_buffer[u8_j+5]); Loading @@ -832,7 +857,7 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) } } return 0; return 0; exit_i2c_error: exit_i2c_error: pr_info("%s exit_i2c_error return %d\r\n", __func__, i32_ret); pr_err("%s exit_i2c_error return %d\r\n", __func__, i32_ret); exit_flag_error: exit_flag_error: return i32_ret; return i32_ret; } } Loading @@ -846,7 +871,7 @@ static void raydium_dump_data_work(struct work_struct *work) /* set mode */ /* set mode */ memset(u8_w_data, 0x00, RAYDIUM_FT_CMD_LENGTH); memset(u8_w_data, 0x00, RAYDIUM_FT_CMD_LENGTH); pr_info("[touch] raydium_dump_data_work\n"); pr_debug("[touch] raydium_dump_data_work\n"); disable_irq_nosync(g_raydium_ts->irq); disable_irq_nosync(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; Loading @@ -864,7 +889,7 @@ static void raydium_dump_data_work(struct work_struct *work) u8_w_data, 1); u8_w_data, 1); if (i32_ret < 0) if (i32_ret < 0) goto exit_error; goto exit_error; pr_info("[touch] RAYDIUM_HOST_CMD_FT_MODE\n"); pr_debug("[touch] RAYDIUM_HOST_CMD_FT_MODE\n"); /*baseline*/ /*baseline*/ u8_data_type = 0x02; u8_data_type = 0x02; Loading Loading @@ -894,10 +919,9 @@ static void raydium_dump_data_work(struct work_struct *work) if (i32_ret < 0) if (i32_ret < 0) goto exit_error; goto exit_error; exit_error: enable_irq(g_raydium_ts->irq); enable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = true; g_raydium_ts->irq_enabled = true; exit_error: return; } } #endif #endif Loading Loading @@ -933,14 +957,15 @@ int raydium_notify_function(unsigned short u16_display_mode) u8_rbuffer[0] = RAYDIUM_HOST_CMD_DISPLAY_MODE; u8_rbuffer[0] = RAYDIUM_HOST_CMD_DISPLAY_MODE; u8_rbuffer[2] = (unsigned char) (u16_display_mode & 0x00ff); u8_rbuffer[2] = (unsigned char) (u16_display_mode & 0x00ff); u8_rbuffer[3] = (unsigned char) ((u16_display_mode & 0xff00) >> 8); u8_rbuffer[3] = (unsigned char) ((u16_display_mode & 0xff00) >> 8); pr_info("[touch] display mode %d %d %d\r\n",u16_display_mode,u8_rbuffer[2],u8_rbuffer[3]); pr_debug("[touch] display mode %d %d %d\r\n", u16_display_mode, u8_rbuffer[2], u8_rbuffer[3]); i32_ret = raydium_i2c_pda2_write(g_raydium_ts->client, i32_ret = raydium_i2c_pda2_write(g_raydium_ts->client, RAYDIUM_PDA2_HOST_CMD_ADDR, RAYDIUM_PDA2_HOST_CMD_ADDR, u8_rbuffer, 4); u8_rbuffer, 4); } } exit: exit: mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); pr_info("[touch] raydium_notify_function\n"); pr_debug("[touch] raydium_notify_function\n"); return i32_ret; return i32_ret; } } #endif #endif Loading Loading @@ -979,7 +1004,7 @@ static int raydium_touch_report(unsigned char *p_u8_buf, gst_slot[u8_j].pt_id = u8_pt_id; gst_slot[u8_j].pt_id = u8_pt_id; gst_slot[u8_j].need_update = 1; gst_slot[u8_j].need_update = 1; gst_slot[u8_j].pt_report_offset = u8_i; gst_slot[u8_j].pt_report_offset = u8_i; pr_info("[touch]x:%d,y:%d\n", pr_debug("[touch]x:%d,y:%d\n", p_u8_buf[POS_X_L + u8_offset] | p_u8_buf[POS_X_L + u8_offset] | p_u8_buf[POS_X_H + u8_offset] << 8, p_u8_buf[POS_X_H + u8_offset] << 8, p_u8_buf[POS_Y_L + u8_offset] | p_u8_buf[POS_Y_L + u8_offset] | Loading Loading @@ -1125,7 +1150,8 @@ static int raydium_touch_report(unsigned char *p_u8_buf, #endif #endif return 0; return 0; } } int raydium_read_touchdata(unsigned char *p_u8_tp_status, unsigned char *p_u8_buf) int raydium_read_touchdata(unsigned char *p_u8_tp_status, unsigned char *p_u8_buf) { { int i32_ret = 0; int i32_ret = 0; unsigned char u8_points_amount; unsigned char u8_points_amount; Loading Loading @@ -1249,14 +1275,17 @@ static void raydium_work_handler(struct work_struct *work) input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_report_slot_state(g_raydium_ts->input_dev, input_mt_report_slot_state(g_raydium_ts->input_dev, MT_TOOL_FINGER, 1); MT_TOOL_FINGER, 1); input_report_abs(g_raydium_ts->input_dev, ABS_MT_POSITION_X, 100); input_report_abs(g_raydium_ts->input_dev, input_report_abs(g_raydium_ts->input_dev, ABS_MT_POSITION_Y, 100); ABS_MT_POSITION_X, 100); input_report_abs(g_raydium_ts->input_dev, ABS_MT_POSITION_Y, 100); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); usleep_range(9500, 10500); usleep_range(9500, 10500); input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_report_slot_state(g_raydium_ts->input_dev, input_mt_report_slot_state(g_raydium_ts->input_dev, MT_TOOL_FINGER, 0); MT_TOOL_FINGER, 0); input_mt_report_pointer_emulation(g_raydium_ts->input_dev, false); input_mt_report_pointer_emulation(g_raydium_ts->input_dev, false); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); input_report_key(g_raydium_ts->input_dev, KEY_POWER, true); input_report_key(g_raydium_ts->input_dev, KEY_POWER, true); usleep_range(9500, 10500); usleep_range(9500, 10500); Loading @@ -1267,13 +1296,13 @@ static void raydium_work_handler(struct work_struct *work) #ifdef ESD_SOLUTION_EN #ifdef ESD_SOLUTION_EN g_u8_checkflag = true; g_u8_checkflag = true; #endif #endif pr_info("[touch]display wake up with g_u8_resetflag false\n"); pr_debug("[touch]display wake up with g_u8_resetflag false\n"); } else { } else { if (g_u8_i2c_mode == PDA2_MODE) { if (g_u8_i2c_mode == PDA2_MODE) { i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); if (i32_ret < 0) { if (i32_ret < 0) { pr_info("[touch]%s, read_touchdata error, ret:%d\n", pr_err("[touch]%s, read_touchdata error, ret:%d\n", __func__, i32_ret); __func__, i32_ret); return; return; } } Loading @@ -1299,7 +1328,7 @@ static void raydium_work_handler(struct work_struct *work) KEY_SLEEP, true); KEY_SLEEP, true); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); pr_info("[touch]palm_status = %d.\n", pr_debug("[touch]palm_status = %d.\n", u8_tp_status[POS_GES_STATUS]); u8_tp_status[POS_GES_STATUS]); g_raydium_ts->is_palm = 1; g_raydium_ts->is_palm = 1; Loading @@ -1308,7 +1337,7 @@ static void raydium_work_handler(struct work_struct *work) } else if ((u8_tp_status[POS_GES_STATUS] } else if ((u8_tp_status[POS_GES_STATUS] == RAD_PALM_DISABLE) == RAD_PALM_DISABLE) && (g_raydium_ts->is_palm == 1)) { && (g_raydium_ts->is_palm == 1)) { pr_info("[touch]leave palm mode.\n"); pr_debug("[touch]leave palm mode.\n"); input_report_key(g_raydium_ts->input_dev, input_report_key(g_raydium_ts->input_dev, KEY_SLEEP, false); KEY_SLEEP, false); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); Loading Loading @@ -1341,9 +1370,10 @@ static void raydium_work_handler(struct work_struct *work) usleep_range(9500, 10500); usleep_range(9500, 10500); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); input_report_key(g_raydium_ts->input_dev, KEY_POWER, false); input_report_key(g_raydium_ts->input_dev, KEY_POWER, false); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); pr_info("[touch]display wake up with g_u8_resetflag true\n"); pr_debug("[touch]display wake up with g_u8_resetflag true\n"); /*goto exit;*/ /*goto exit;*/ } } } } Loading @@ -1352,7 +1382,7 @@ static void raydium_work_handler(struct work_struct *work) if (g_u8_i2c_mode == PDA2_MODE) { if (g_u8_i2c_mode == PDA2_MODE) { i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); if (i32_ret < 0) { if (i32_ret < 0) { pr_info("[touch]%s, read_touchdata error, ret:%d\n", pr_err("[touch]%s, read_touchdata error, ret:%d\n", __func__, i32_ret); __func__, i32_ret); } } } } Loading @@ -1370,33 +1400,28 @@ static irqreturn_t raydium_ts_interrupt(int irq, void *dev_id) if ((g_u8_raydium_flag & ENG_MODE) != 0) { if ((g_u8_raydium_flag & ENG_MODE) != 0) { disable_irq_nosync(g_raydium_ts->irq); disable_irq_nosync(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; pr_info("[touch]RAD_ENG_MODE\n"); pr_debug("[touch]RAD_ENG_MODE\n"); g_u8_raydium_flag |= INT_FLAG; g_u8_raydium_flag |= INT_FLAG; } else { } else { if (!work_pending(&g_raydium_ts->work)) { if (!work_pending(&g_raydium_ts->work)) { /* Clear interrupts*/ /* Clear interrupts*/ result = queue_work(g_raydium_ts->workqueue, result = queue_work(g_raydium_ts->workqueue, &g_raydium_ts->work); &g_raydium_ts->work); if (result == false) { if (result == false) { /*queue_work fail*/ /*queue_work fail*/ pr_err("[touch]queue_work fail.\n"); pr_err("[touch]queue_work fail.\n"); } } } else { } else { /*work pending*/ /*work pending*/ mutex_lock(&g_raydium_ts->lock); mutex_lock(&g_raydium_ts->lock); if (raydium_i2c_pda2_set_page(g_raydium_ts->client, if (raydium_i2c_pda2_set_page(g_raydium_ts->client, g_raydium_ts->is_suspend, g_raydium_ts->is_suspend, RAYDIUM_PDA2_PAGE_0) < 0) { RAYDIUM_PDA2_PAGE_0) < 0) { pr_err("[touch]%s: failed to set page in work_pending\n", pr_err("[touch]%s: failed to set page in work_pending\n", __func__); __func__); } } mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); pr_debug("[touch]work_pending\n"); pr_info("[touch]work_pending\n"); } } } } return IRQ_HANDLED; return IRQ_HANDLED; Loading Loading @@ -1440,7 +1465,7 @@ static int raydium_check_i2c_ready(unsigned short *u16_i2c_data) if (i32_ret < 0) if (i32_ret < 0) goto exit_error; goto exit_error; if (u8_buf[3] != 0xF3) { if (u8_buf[3] != 0xF3) { pr_info("[touch]PDA2 read i2c fail\n"); pr_err("[touch]PDA2 read i2c fail\n"); g_u8_i2c_mode = PDA_MODE; g_u8_i2c_mode = PDA_MODE; i32_ret = raydium_i2c_pda_read(g_raydium_ts->client, i32_ret = raydium_i2c_pda_read(g_raydium_ts->client, RAD_CHK_I2C_CMD, u8_buf, RAD_CHK_I2C_CMD, u8_buf, Loading @@ -1460,7 +1485,7 @@ static int raydium_check_i2c_ready(unsigned short *u16_i2c_data) *u16_i2c_data = u8_buf[3] << 8 | u8_buf[2]; *u16_i2c_data = u8_buf[3] << 8 | u8_buf[2]; pr_info("[touch]RAD check I2C : 0x%02X%02X\n", u8_buf[3], u8_buf[2]); pr_debug("[touch]RAD check I2C : 0x%02X%02X\n", u8_buf[3], u8_buf[2]); exit_error: exit_error: mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); Loading @@ -1471,6 +1496,7 @@ static int raydium_check_i2c_ready(unsigned short *u16_i2c_data) static void raydium_ts_do_suspend(void) static void raydium_ts_do_suspend(void) { { unsigned char u8_i = 0; unsigned char u8_i = 0; g_u8_resetflag = false; g_u8_resetflag = false; if (g_raydium_ts->is_suspend == 1) { if (g_raydium_ts->is_suspend == 1) { pr_info("[touch]Already in suspend state\n"); pr_info("[touch]Already in suspend state\n"); Loading @@ -1485,7 +1511,7 @@ static void raydium_ts_do_suspend(void) if (!cancel_work_sync(&g_raydium_ts->work)) if (!cancel_work_sync(&g_raydium_ts->work)) pr_info("[touch]workqueue is empty!\n"); pr_info("[touch]workqueue is empty!\n"); pr_info("[touch]%s.\n", __func__); pr_debug("[touch]%s.\n", __func__); /* release all touches */ /* release all touches */ for (u8_i = 0; u8_i < g_raydium_ts->u8_max_touchs; u8_i++) { for (u8_i = 0; u8_i < g_raydium_ts->u8_max_touchs; u8_i++) { Loading Loading @@ -1513,12 +1539,12 @@ static void raydium_ts_do_suspend(void) #ifdef GESTURE_EN #ifdef GESTURE_EN if (device_may_wakeup(&g_raydium_ts->client->dev)) { if (device_may_wakeup(&g_raydium_ts->client->dev)) { pr_info("[touch]Device may wakeup\n"); pr_debug("[touch]Device may wakeup\n"); if (!enable_irq_wake(g_raydium_ts->irq)) if (!enable_irq_wake(g_raydium_ts->irq)) g_raydium_ts->irq_wake = 1; g_raydium_ts->irq_wake = 1; } else } else pr_info("[touch]Device not wakeup\n"); pr_debug("[touch]Device not wakeup\n"); raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); #endif #endif Loading @@ -1533,7 +1559,7 @@ static void raydium_ts_do_resume(void) #endif #endif unsigned char u8_w_data[4]; unsigned char u8_w_data[4]; pr_info("[touch]%s, %d.\n", __func__, g_raydium_ts->is_suspend); pr_debug("[touch]%s, %d.\n", __func__, g_raydium_ts->is_suspend); if (g_raydium_ts->is_suspend == 0) { if (g_raydium_ts->is_suspend == 0) { pr_info("[touch]Already in resume state\n"); pr_info("[touch]Already in resume state\n"); return; return; Loading Loading @@ -1588,13 +1614,13 @@ static void raydium_ts_do_resume(void) #endif #endif #ifdef GESTURE_EN #ifdef GESTURE_EN if (device_may_wakeup(&g_raydium_ts->client->dev)) { if (device_may_wakeup(&g_raydium_ts->client->dev)) { pr_info("[touch]Device may wakeup\n"); pr_debug("[touch]Device may wakeup\n"); if (g_raydium_ts->irq_wake) { if (g_raydium_ts->irq_wake) { disable_irq_wake(g_raydium_ts->irq); disable_irq_wake(g_raydium_ts->irq); g_raydium_ts->irq_wake = 0; g_raydium_ts->irq_wake = 0; } } } else } else pr_info("[touch]Device not wakeup\n"); pr_debug("[touch]Device not wakeup\n"); #endif #endif g_raydium_ts->is_suspend = 0; g_raydium_ts->is_suspend = 0; Loading Loading @@ -1624,9 +1650,9 @@ static int raydium_ts_open(struct input_dev *input_dev) { { int i32_ret = 0; int i32_ret = 0; pr_info("[touch]%s()+\n", __func__); pr_debug("[touch]%s()+\n", __func__); pr_info("[touch]ts->blank:%x\n", g_raydium_ts->blank); pr_debug("[touch]ts->blank:%x\n", g_raydium_ts->blank); if (g_raydium_ts->is_sleep == 1) { if (g_raydium_ts->is_sleep == 1) { mutex_lock(&g_raydium_ts->lock); mutex_lock(&g_raydium_ts->lock); Loading @@ -1643,7 +1669,7 @@ static int raydium_ts_open(struct input_dev *input_dev) mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); g_raydium_ts->is_sleep = 0; g_raydium_ts->is_sleep = 0; pr_info("[touch]disable touch lock.\n"); pr_debug("[touch]disable touch lock.\n"); } } return i32_ret; return i32_ret; } } Loading @@ -1654,10 +1680,10 @@ static void raydium_ts_close(struct input_dev *input_dev) unsigned char u8_i = 0; unsigned char u8_i = 0; unsigned char u8_wbuffer[1]; unsigned char u8_wbuffer[1]; pr_info("[touch]%s()+\n", __func__); pr_debug("[touch]%s()+\n", __func__); if (g_raydium_ts->is_sleep == 1) { if (g_raydium_ts->is_sleep == 1) { pr_info("[touch]touch lock already enabled.\n"); pr_debug("[touch]touch lock already enabled.\n"); return; return; } } Loading Loading @@ -1690,7 +1716,7 @@ static void raydium_ts_close(struct input_dev *input_dev) mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); g_raydium_ts->is_sleep = 1; g_raydium_ts->is_sleep = 1; pr_info("[touch]enable touch lock.\n"); pr_debug("[touch]enable touch lock.\n"); return; return; exit_i2c_error: exit_i2c_error: Loading Loading @@ -1726,7 +1752,7 @@ static int fb_notifier_callback(struct notifier_block *self, /*screen on*/ /*screen on*/ case FB_BLANK_UNBLANK: case FB_BLANK_UNBLANK: pr_info("[touch]FB_BLANK_UNBLANK\n"); pr_debug("[touch]FB_BLANK_UNBLANK\n"); #ifdef GESTURE_EN #ifdef GESTURE_EN /* clear palm status */ /* clear palm status */ Loading @@ -1741,7 +1767,7 @@ static int fb_notifier_callback(struct notifier_block *self, /*screen off*/ /*screen off*/ case FB_BLANK_POWERDOWN: case FB_BLANK_POWERDOWN: pr_info("[touch]FB_BLANK_POWERDOWN\n"); pr_debug("[touch]FB_BLANK_POWERDOWN\n"); #ifdef GESTURE_EN #ifdef GESTURE_EN /* clear palm status */ /* clear palm status */ Loading @@ -1756,7 +1782,7 @@ static int fb_notifier_callback(struct notifier_block *self, /*ambient mode*/ /*ambient mode*/ case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_VSYNC_SUSPEND: pr_info("[touch]FB_BLANK_VSYNC_SUSPEND\n"); pr_debug("[touch]FB_BLANK_VSYNC_SUSPEND\n"); #ifdef GESTURE_EN #ifdef GESTURE_EN /* clear palm status */ /* clear palm status */ Loading Loading @@ -1931,7 +1957,7 @@ static void raydium_input_set(struct input_dev *input_dev) __set_bit(EV_ABS, input_dev->evbit); __set_bit(EV_ABS, input_dev->evbit); __set_bit(BTN_TOUCH, input_dev->keybit); __set_bit(BTN_TOUCH, input_dev->keybit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); pr_info("[touch]set abs prarams x[%d], y[%d]\n", pr_debug("[touch]set abs prarams x[%d], y[%d]\n", g_raydium_ts->x_max, g_raydium_ts->y_max); g_raydium_ts->x_max, g_raydium_ts->y_max); /* Multitouch input params setup */ /* Multitouch input params setup */ Loading Loading @@ -1977,7 +2003,7 @@ static int raydium_set_resolution(void) u32_x = u8_buf[3] << 8 | u8_buf[2]; u32_x = u8_buf[3] << 8 | u8_buf[2]; u32_y = u8_buf[1] << 8 | u8_buf[0]; u32_y = u8_buf[1] << 8 | u8_buf[0]; pr_info("[touch]RAD display info x:%d, y:%d\n", u32_x, u32_y); pr_debug("[touch]RAD display info x:%d, y:%d\n", u32_x, u32_y); if (u32_x > 300 && u32_y > 300 && if (u32_x > 300 && u32_y > 300 && u32_x < 600 && u32_y < 600) { u32_x < 600 && u32_y < 600) { Loading @@ -2000,7 +2026,7 @@ static int raydium_ts_probe(struct i2c_client *client, unsigned short u16_i2c_data; unsigned short u16_i2c_data; int ret = 0; int ret = 0; pr_info("[touch] probe\n"); pr_debug("[touch] probe\n"); if (client->dev.of_node) { if (client->dev.of_node) { pdata = devm_kzalloc(&client->dev, pdata = devm_kzalloc(&client->dev, Loading Loading @@ -2135,8 +2161,8 @@ static int raydium_ts_probe(struct i2c_client *client, INIT_DELAYED_WORK(&g_raydium_ts->dump_work, raydium_dump_data_work); INIT_DELAYED_WORK(&g_raydium_ts->dump_work, raydium_dump_data_work); #endif #endif /*irq_gpio = 13 irqflags = 108*/ /*irq_gpio = 13 irqflags = 108*/ pr_info("[touch]pdata irq : %d\n", g_raydium_ts->irq_gpio); pr_debug("[touch]pdata irq : %d\n", g_raydium_ts->irq_gpio); pr_info("[touch]client irq : %d, pdata flags : %d\n", pr_debug("[touch]client irq : %d, pdata flags : %d\n", client->irq, pdata->irqflags); client->irq, pdata->irqflags); g_raydium_ts->irq = gpio_to_irq(pdata->irq_gpio); g_raydium_ts->irq = gpio_to_irq(pdata->irq_gpio); Loading @@ -2158,6 +2184,7 @@ static int raydium_ts_probe(struct i2c_client *client, pr_info("[touch]RAD Touch driver ver :0x%X\n", g_u32_driver_version); pr_info("[touch]RAD Touch driver ver :0x%X\n", g_u32_driver_version); #ifdef FW_UPDATE_EN /*fw update check*/ /*fw update check*/ ret = raydium_fw_update_check(u16_i2c_data); ret = raydium_fw_update_check(u16_i2c_data); if (ret < 0) { if (ret < 0) { Loading @@ -2165,6 +2192,7 @@ static int raydium_ts_probe(struct i2c_client *client, ret = -ENODEV; ret = -ENODEV; goto exit_irq_request_failed; goto exit_irq_request_failed; } } #endif return 0; return 0; exit_irq_request_failed: exit_irq_request_failed: Loading Loading @@ -2249,7 +2277,7 @@ static const struct i2c_device_id raydium_ts_id[] = { MODULE_DEVICE_TABLE(i2c, raydium_ts_id); MODULE_DEVICE_TABLE(i2c, raydium_ts_id); #ifdef CONFIG_OF #ifdef CONFIG_OF static struct of_device_id raydium_match_table[] = { static const struct of_device_id raydium_match_table[] = { { .compatible = "raydium,raydium-ts",}, { .compatible = "raydium,raydium-ts",}, { }, { }, }; }; Loading drivers/input/touchscreen/raydium_wt030/raydium_driver.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,7 @@ #define RAD_MINOR_VERSION 0x07 #define RAD_MINOR_VERSION 0x07 #define RAD_CUSTOMER_VERSION 0x0100 #define RAD_CUSTOMER_VERSION 0x0100 #if defined(CONFIG_TOUCHSCREEN_RM_TS) #if defined(CONFIG_TOUCHSCREEN_RAYDIUM_CHIPSET) /* IC timing control arguments */ /* IC timing control arguments */ #define RAYDIUM_POWERON_DELAY_USEC 500 #define RAYDIUM_POWERON_DELAY_USEC 500 #define RAYDIUM_RESET_INTERVAL_MSEC 5 #define RAYDIUM_RESET_INTERVAL_MSEC 5 Loading Loading @@ -164,6 +164,8 @@ #define AMBIENT_MODE 0x01 #define AMBIENT_MODE 0x01 #define SLEEP_MODE 0x02 #define SLEEP_MODE 0x02 #define RAD_20 0x2209 /* Enable sysfs */ /* Enable sysfs */ #define CONFIG_RM_SYSFS_DEBUG #define CONFIG_RM_SYSFS_DEBUG Loading Loading @@ -348,7 +350,6 @@ extern int raydium_do_selftest(void); int raydium_esd_check(void); int raydium_esd_check(void); extern struct attribute *raydium_attributes[]; extern struct attribute *raydium_attributes[]; extern const struct attribute_group raydium_attr_group; extern unsigned char g_u8_raydium_flag; extern unsigned char g_u8_raydium_flag; extern unsigned char g_u8_addr; extern unsigned char g_u8_addr; Loading Loading
drivers/input/touchscreen/Kconfig +8 −0 Original line number Original line Diff line number Diff line Loading @@ -1444,4 +1444,12 @@ config TOUCHSCREEN_EKTF3XXX_CHIPSET If unusre, say N. If unusre, say N. config TOUCHSCREEN_RAYDIUM_CHIPSET bool "Raydium WT030 touchpanel CHIPSET" depends on I2C help Say Y here if you have a Raydium WT030 CHIPSET touchscreen. If unsure, say N. endif endif
drivers/input/touchscreen/Makefile +1 −0 Original line number Original line Diff line number Diff line Loading @@ -108,3 +108,4 @@ obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_touch/ obj-$(CONFIG_TOUCHSCREEN_GT9XX_v28) += gt9xx_v2.8/ obj-$(CONFIG_TOUCHSCREEN_GT9XX_v28) += gt9xx_v2.8/ obj-$(CONFIG_TOUCHSCREEN_HIMAX_CHIPSET) += hxchipset/ obj-$(CONFIG_TOUCHSCREEN_HIMAX_CHIPSET) += hxchipset/ obj-$(CONFIG_TOUCHSCREEN_EKTF3XXX_CHIPSET) += ektf3xxx/ obj-$(CONFIG_TOUCHSCREEN_EKTF3XXX_CHIPSET) += ektf3xxx/ obj-$(CONFIG_TOUCHSCREEN_RAYDIUM_CHIPSET) += raydium_wt030/
drivers/input/touchscreen/raydium_wt030/Makefile +1 −3 Original line number Original line Diff line number Diff line # # # Makefile for the touchscreen raydium drivers. # Makefile for the touchscreen raydium drivers. # # obj-$(CONFIG_TOUCHSCREEN_RM_TS) += raydium_driver.o raydium_sysfs.o raydium_fw_update.o obj-$(CONFIG_TOUCHSCREEN_RAYDIUM_CHIPSET) += raydium_driver.o raydium_sysfs.o raydium_fw_update.o obj-$(CONFIG_TOUCHSCREEN_RM_TS_SELFTEST) += drv_interface.o raydium_selftest.o chip_raydium/ic_drv_global.o chip_raydium/ic_drv_interface.o drv_interface.o chip_raydium/f302_ic_control.o chip_raydium/f302_ic_test.o
drivers/input/touchscreen/raydium_wt030/raydium_driver.c +192 −164 Original line number Original line Diff line number Diff line Loading @@ -53,10 +53,6 @@ struct raydium_slot_status { struct raydium_slot_status gst_slot[MAX_TOUCH_NUM * 2]; struct raydium_slot_status gst_slot[MAX_TOUCH_NUM * 2]; struct raydium_slot_status gst_slot_init = {0xFF, 0, 0}; struct raydium_slot_status gst_slot_init = {0xFF, 0, 0}; #if (defined(CONFIG_RM_SYSFS_DEBUG)) const struct attribute_group raydium_attr_group; #endif /*end of CONFIG_RM_SYSFS_DEBUG*/ unsigned char g_u8_addr; unsigned char g_u8_addr; unsigned char g_u8_raydium_flag; unsigned char g_u8_raydium_flag; unsigned char g_u8_i2c_mode; unsigned char g_u8_i2c_mode; Loading @@ -81,13 +77,14 @@ unsigned char g_u8_palm_flag; unsigned long timeout; unsigned long timeout; #endif #endif struct raydium_ts_data *g_raydium_ts; struct raydium_ts_data *g_raydium_ts; /******************************************************************************* /***************************************************************************** * Name: raydium_variable_init * Name: raydium_variable_init * Brief: * Brief: * Input: * Input: * Output: * Output: * Return: * Return: *******************************************************************************/ *****************************************************************************/ static void raydium_variable_init(void) static void raydium_variable_init(void) { { g_u8_addr = RAYDIUM_PDA2_PDA_CFG_ADDR; g_u8_addr = RAYDIUM_PDA2_PDA_CFG_ADDR; Loading Loading @@ -120,15 +117,13 @@ static void raydium_variable_init(void) #endif #endif } } /***************************************************************************** /******************************************************************************* * Name: raydium_gpio_configure * Name: raydium_gpio_configure * Brief: * Brief: * Input: * Input: * Output: * Output: * Return: * Return: *******************************************************************************/ *****************************************************************************/ static int raydium_gpio_configure(bool on) static int raydium_gpio_configure(bool on) { { int i32_err = 0; int i32_err = 0; Loading Loading @@ -159,7 +154,8 @@ static int raydium_gpio_configure(bool on) goto err_irq_gpio_req; goto err_irq_gpio_req; } } i32_err = gpio_direction_output(g_raydium_ts->rst_gpio, 1); i32_err = gpio_direction_output(g_raydium_ts->rst_gpio, 1); if (i32_err) { if (i32_err) { dev_err(&g_raydium_ts->client->dev, dev_err(&g_raydium_ts->client->dev, "[touch]set_direction for irq gpio failed\n"); "[touch]set_direction for irq gpio failed\n"); Loading @@ -170,7 +166,9 @@ static int raydium_gpio_configure(bool on) if (gpio_is_valid(g_raydium_ts->irq_gpio)) if (gpio_is_valid(g_raydium_ts->irq_gpio)) gpio_free(g_raydium_ts->irq_gpio); gpio_free(g_raydium_ts->irq_gpio); } } return 0; return 0; err_rst_gpio_dir: err_rst_gpio_dir: if (gpio_is_valid(g_raydium_ts->rst_gpio)) if (gpio_is_valid(g_raydium_ts->rst_gpio)) gpio_free(g_raydium_ts->rst_gpio); gpio_free(g_raydium_ts->rst_gpio); Loading @@ -182,13 +180,13 @@ static int raydium_gpio_configure(bool on) return i32_err; return i32_err; } } /******************************************************************************* /***************************************************************************** * Name: raydium_ts_pinctrl_init * Name: raydium_ts_pinctrl_init * Brief: * Brief: * Input: * Input: * Output: * Output: * Return: * Return: *******************************************************************************/ *****************************************************************************/ #ifdef MSM_NEW_VER #ifdef MSM_NEW_VER static int raydium_ts_pinctrl_init(void) static int raydium_ts_pinctrl_init(void) { { Loading @@ -203,7 +201,8 @@ static int raydium_ts_pinctrl_init(void) } } g_raydium_ts->pinctrl_state_active g_raydium_ts->pinctrl_state_active = pinctrl_lookup_state(g_raydium_ts->ts_pinctrl, PINCTRL_STATE_ACTIVE); = pinctrl_lookup_state(g_raydium_ts->ts_pinctrl, PINCTRL_STATE_ACTIVE); if (IS_ERR_OR_NULL(g_raydium_ts->pinctrl_state_active)) { if (IS_ERR_OR_NULL(g_raydium_ts->pinctrl_state_active)) { i32_ret = PTR_ERR(g_raydium_ts->pinctrl_state_active); i32_ret = PTR_ERR(g_raydium_ts->pinctrl_state_active); pr_err("[touch]Can not lookup %s pinstate %d\n", pr_err("[touch]Can not lookup %s pinstate %d\n", Loading Loading @@ -239,12 +238,39 @@ static int raydium_ts_pinctrl_init(void) return i32_ret; return i32_ret; } } #endif/*end of MSM_NEW_VER*/ #endif/*end of MSM_NEW_VER*/ int wait_irq_state(struct i2c_client *client, unsigned int retry_time, unsigned int u32_delay_us) { int i32_ret = SUCCESS; unsigned int u32_retry; unsigned int u32_irq_value; unsigned int u32_min_delay_us = u32_delay_us - 500; unsigned int u32_max_delay_us = u32_delay_us + 500; u32_retry = retry_time; u32_irq_value = 0; while (u32_retry != 0 && u32_irq_value != 1) { u32_irq_value = gpio_get_value(g_raydium_ts->irq_gpio); usleep_range(u32_min_delay_us, u32_max_delay_us); u32_retry--; } pr_debug("[touch]irq_value is %d\n", u32_irq_value); if (u32_retry == 0) { pr_err("[touch]%s, FW not ready, retry error!\n", __func__); i32_ret = ERROR; } return i32_ret; } #ifdef ESD_SOLUTION_EN #ifdef ESD_SOLUTION_EN static int raydium_hw_reset_fun(struct i2c_client *client) static int raydium_hw_reset_fun(struct i2c_client *client) { { int i32_ret = SUCCESS; int i32_ret = SUCCESS; pr_info("[touch]HW reset\n"); pr_debug("[touch]HW reset\n"); if ((g_u8_raydium_flag & ENG_MODE) == 0) if ((g_u8_raydium_flag & ENG_MODE) == 0) raydium_irq_control(DISABLE); raydium_irq_control(DISABLE); Loading @@ -258,14 +284,13 @@ static int raydium_hw_reset_fun(struct i2c_client *client) g_u8_i2c_mode = PDA2_MODE; g_u8_i2c_mode = PDA2_MODE; i32_ret = wait_irq_state(client, 300, 2000); i32_ret = wait_irq_state(client, 300, 2000); if (i32_ret != ERROR) { if (i32_ret != ERROR) msleep(25); msleep(25); } if ((g_u8_raydium_flag & ENG_MODE) == 0) if ((g_u8_raydium_flag & ENG_MODE) == 0) raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); pr_info("[touch]Raydium HW reset : %d\n", i32_ret); pr_debug("[touch]Raydium HW reset : %d\n", i32_ret); return i32_ret; return i32_ret; } } #endif #endif Loading Loading @@ -392,7 +417,6 @@ int raydium_i2c_pda_write(struct i2c_client *client, i32_ret = raydium_i2c_pda_set_address(u32_addr, u8_mode); i32_ret = raydium_i2c_pda_set_address(u32_addr, u8_mode); if (i32_ret != RAD_I2C_PDA_ADDRESS_LENGTH) if (i32_ret != RAD_I2C_PDA_ADDRESS_LENGTH) goto exit; goto exit; //usleep_range(50, 80); for (u8_retry = 0; u8_retry < SYN_I2C_RETRY_TIMES; u8_retry++) { for (u8_retry = 0; u8_retry < SYN_I2C_RETRY_TIMES; u8_retry++) { if (i2c_transfer(client->adapter, msg, 1) == 1) { if (i2c_transfer(client->adapter, msg, 1) == 1) { Loading Loading @@ -444,7 +468,7 @@ int raydium_i2c_pda2_set_page(struct i2c_client *client, usleep_range(2000, 5000); usleep_range(2000, 5000); } } if (0 == u8_ret) { if (u8_ret == 0) { pr_err("[touch]%s: I2C write over retry limit\n", __func__); pr_err("[touch]%s: I2C write over retry limit\n", __func__); i32_ret = -EIO; i32_ret = -EIO; } } Loading Loading @@ -542,8 +566,8 @@ void raydium_irq_control(bool enable) } } /* Clear interrupts first */ /* Clear interrupts first */ if (g_raydium_ts->blank != FB_BLANK_POWERDOWN) { if (g_raydium_ts->blank != FB_BLANK_POWERDOWN && if (g_u8_i2c_mode == PDA2_MODE) { g_u8_i2c_mode == PDA2_MODE) { mutex_lock(&g_raydium_ts->lock); mutex_lock(&g_raydium_ts->lock); if (raydium_i2c_pda2_set_page(g_raydium_ts->client, if (raydium_i2c_pda2_set_page(g_raydium_ts->client, g_raydium_ts->is_suspend, g_raydium_ts->is_suspend, Loading @@ -553,19 +577,18 @@ void raydium_irq_control(bool enable) mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); usleep_range(500, 1500); usleep_range(500, 1500); } } } while (g_raydium_ts->irq_desc->depth > 0) { while (g_raydium_ts->irq_desc->depth > 0) { pr_info("[touch]irq enable\n"); pr_debug("[touch]irq enable\n"); g_raydium_ts->irq_enabled = true; g_raydium_ts->irq_enabled = true; enable_irq(g_raydium_ts->irq); enable_irq(g_raydium_ts->irq); } } } else { } else { if (g_raydium_ts->irq_enabled) { if (g_raydium_ts->irq_enabled && if (g_raydium_ts->irq_desc->depth == 0) { g_raydium_ts->irq_desc->depth == 0) { disable_irq(g_raydium_ts->irq); disable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; pr_info("[touch]irq disable\n"); pr_debug("[touch]irq disable\n"); } } } } } } } Loading @@ -579,16 +602,18 @@ int raydium_i2c_mode_control(struct i2c_client *client, switch (u8_mode) { switch (u8_mode) { case 0: /* Disable INT flag */ case 0: /* Disable INT flag */ pr_info("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); pr_debug("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); disable_irq(g_raydium_ts->irq); disable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; pr_info("[touch]RAD irq disable\n"); pr_debug("[touch]RAD irq disable\n"); break; break; case 1: /* Enable INT flag */ case 1: /* Enable INT flag */ pr_info("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); pr_debug("[touch]RAD INT flag : %d\n", g_raydium_ts->irq_enabled); enable_irq(g_raydium_ts->irq); enable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = true; g_raydium_ts->irq_enabled = true; pr_info("[touch]RAD irq enable\n"); pr_debug("[touch]RAD irq enable\n"); break; break; case 2: /* Disable INT by raydium_irq_control */ case 2: /* Disable INT by raydium_irq_control */ raydium_irq_control(DISABLE); raydium_irq_control(DISABLE); Loading @@ -597,13 +622,14 @@ int raydium_i2c_mode_control(struct i2c_client *client, raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); break; break; case 4: /* Show RAD INT depth */ case 4: /* Show RAD INT depth */ pr_info("[touch]RAD INT depth : %d\n", g_raydium_ts->irq_desc->depth); pr_debug("[touch]RAD INT depth : %d\n", g_raydium_ts->irq_desc->depth); break; break; case 7: case 7: raydium_i2c_pda2_set_page(client, raydium_i2c_pda2_set_page(client, g_raydium_ts->is_suspend, RAYDIUM_PDA2_2_PDA); g_raydium_ts->is_suspend, RAYDIUM_PDA2_2_PDA); g_u8_i2c_mode = PDA_MODE; g_u8_i2c_mode = PDA_MODE; pr_info("[touch]Disable PDA2_MODE\n"); pr_debug("[touch]Disable PDA2_MODE\n"); break; break; case 8: case 8: raydium_i2c_pda_read(client, RAD_PDA2_CTRL_CMD, u8_buf, 4); raydium_i2c_pda_read(client, RAD_PDA2_CTRL_CMD, u8_buf, 4); Loading @@ -612,14 +638,14 @@ int raydium_i2c_mode_control(struct i2c_client *client, raydium_i2c_pda_set_address(0x50000628, DISABLE); raydium_i2c_pda_set_address(0x50000628, DISABLE); g_u8_i2c_mode = PDA2_MODE; g_u8_i2c_mode = PDA2_MODE; pr_info("[touch]Enable PDA2_MODE\n"); pr_debug("[touch]Enable PDA2_MODE\n"); break; break; } } return 0; return 0; } } const struct attribute_group raydium_attr_group = { static const struct attribute_group raydium_attr_group = { .attrs = raydium_attributes .attrs = raydium_attributes }; }; Loading @@ -634,7 +660,7 @@ static int raydium_create_sysfs(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &raydium_attr_group); sysfs_remove_group(&client->dev.kobj, &raydium_attr_group); ret = -EIO; ret = -EIO; } else { } else { pr_info("[touch]create raydium sysfs attr_group successful\n"); pr_debug("[touch]create raydium sysfs attr_group successful\n"); } } return ret; return ret; } } Loading Loading @@ -696,7 +722,7 @@ int raydium_esd_check(void) } } exit: exit: mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); pr_info("[touch] raydium_esd_check\n"); pr_debug("[touch] raydium_esd_check\n"); return i32_ret; return i32_ret; } } #endif #endif Loading @@ -716,7 +742,7 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) unsigned char u8_i, u8_j, u8_k; unsigned char u8_i, u8_j, u8_k; char write_string[1000]; char write_string[1000]; pr_info("[touch] %s -> type:%d\n", __func__, u8_type); pr_debug("[touch] %s -> type:%d\n", __func__, u8_type); for (u8_i = 0; u8_i < u8_frame; u8_i++) { for (u8_i = 0; u8_i < u8_frame; u8_i++) { Loading Loading @@ -752,7 +778,7 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) if (i32_retry == 5) { if (i32_retry == 5) { i32_ret = -EAGAIN; i32_ret = -EAGAIN; pr_info("[touch] %s -> flag timeout\n", __func__); pr_err("[touch] %s -> flag timeout\n", __func__); } } u32_offset = 0; u32_offset = 0; Loading Loading @@ -791,10 +817,9 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) goto exit_i2c_error; goto exit_i2c_error; i32_ret = raydium_i2c_pda2_read(g_raydium_ts->client, i32_ret = raydium_i2c_pda2_read(g_raydium_ts->client, (unsigned char)(u32_target_addr & MASK_8BIT), (unsigned char)(u32_target_addr u8_rbuffer, & MASK_8BIT), u8_rbuffer, u16_read_length); u16_read_length); if (i32_ret < 0) if (i32_ret < 0) goto exit_flag_error; goto exit_flag_error; Loading @@ -804,17 +829,17 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) u32_offset += u16_read_length; u32_offset += u16_read_length; } } pr_info("[touch] frame%d\n", u8_i); pr_debug("[touch] frame%d\n", u8_i); #if DATA_MAP_5_5 #if DATA_MAP_5_5 for (u8_j = 0; u8_j < 25; u8_j += 5) { for (u8_j = 0; u8_j < 25; u8_j += 5) { pr_info("[touch] %4d, %4d, %4d, %4d, %4d\r\n", pr_debug("[touch] %4d, %4d, %4d, %4d, %4d\r\n", i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+4]); i16_data_buffer[u8_j+4]); } } #else #else for (u8_j = 0; u8_j < 36; u8_j += 6) { for (u8_j = 0; u8_j < 36; u8_j += 6) { pr_info("[touch] %4d, %4d, %4d, %4d, %4d, %4d\r\n", pr_debug("[touch] %4d, %4d, %4d, %4d, %4d, %4d\r\n", i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j], i16_data_buffer[u8_j+1], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+2], i16_data_buffer[u8_j+3], i16_data_buffer[u8_j+4], i16_data_buffer[u8_j+5]); i16_data_buffer[u8_j+4], i16_data_buffer[u8_j+5]); Loading @@ -832,7 +857,7 @@ int raydium_dump_data(unsigned char u8_frame, unsigned char u8_type) } } return 0; return 0; exit_i2c_error: exit_i2c_error: pr_info("%s exit_i2c_error return %d\r\n", __func__, i32_ret); pr_err("%s exit_i2c_error return %d\r\n", __func__, i32_ret); exit_flag_error: exit_flag_error: return i32_ret; return i32_ret; } } Loading @@ -846,7 +871,7 @@ static void raydium_dump_data_work(struct work_struct *work) /* set mode */ /* set mode */ memset(u8_w_data, 0x00, RAYDIUM_FT_CMD_LENGTH); memset(u8_w_data, 0x00, RAYDIUM_FT_CMD_LENGTH); pr_info("[touch] raydium_dump_data_work\n"); pr_debug("[touch] raydium_dump_data_work\n"); disable_irq_nosync(g_raydium_ts->irq); disable_irq_nosync(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; Loading @@ -864,7 +889,7 @@ static void raydium_dump_data_work(struct work_struct *work) u8_w_data, 1); u8_w_data, 1); if (i32_ret < 0) if (i32_ret < 0) goto exit_error; goto exit_error; pr_info("[touch] RAYDIUM_HOST_CMD_FT_MODE\n"); pr_debug("[touch] RAYDIUM_HOST_CMD_FT_MODE\n"); /*baseline*/ /*baseline*/ u8_data_type = 0x02; u8_data_type = 0x02; Loading Loading @@ -894,10 +919,9 @@ static void raydium_dump_data_work(struct work_struct *work) if (i32_ret < 0) if (i32_ret < 0) goto exit_error; goto exit_error; exit_error: enable_irq(g_raydium_ts->irq); enable_irq(g_raydium_ts->irq); g_raydium_ts->irq_enabled = true; g_raydium_ts->irq_enabled = true; exit_error: return; } } #endif #endif Loading Loading @@ -933,14 +957,15 @@ int raydium_notify_function(unsigned short u16_display_mode) u8_rbuffer[0] = RAYDIUM_HOST_CMD_DISPLAY_MODE; u8_rbuffer[0] = RAYDIUM_HOST_CMD_DISPLAY_MODE; u8_rbuffer[2] = (unsigned char) (u16_display_mode & 0x00ff); u8_rbuffer[2] = (unsigned char) (u16_display_mode & 0x00ff); u8_rbuffer[3] = (unsigned char) ((u16_display_mode & 0xff00) >> 8); u8_rbuffer[3] = (unsigned char) ((u16_display_mode & 0xff00) >> 8); pr_info("[touch] display mode %d %d %d\r\n",u16_display_mode,u8_rbuffer[2],u8_rbuffer[3]); pr_debug("[touch] display mode %d %d %d\r\n", u16_display_mode, u8_rbuffer[2], u8_rbuffer[3]); i32_ret = raydium_i2c_pda2_write(g_raydium_ts->client, i32_ret = raydium_i2c_pda2_write(g_raydium_ts->client, RAYDIUM_PDA2_HOST_CMD_ADDR, RAYDIUM_PDA2_HOST_CMD_ADDR, u8_rbuffer, 4); u8_rbuffer, 4); } } exit: exit: mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); pr_info("[touch] raydium_notify_function\n"); pr_debug("[touch] raydium_notify_function\n"); return i32_ret; return i32_ret; } } #endif #endif Loading Loading @@ -979,7 +1004,7 @@ static int raydium_touch_report(unsigned char *p_u8_buf, gst_slot[u8_j].pt_id = u8_pt_id; gst_slot[u8_j].pt_id = u8_pt_id; gst_slot[u8_j].need_update = 1; gst_slot[u8_j].need_update = 1; gst_slot[u8_j].pt_report_offset = u8_i; gst_slot[u8_j].pt_report_offset = u8_i; pr_info("[touch]x:%d,y:%d\n", pr_debug("[touch]x:%d,y:%d\n", p_u8_buf[POS_X_L + u8_offset] | p_u8_buf[POS_X_L + u8_offset] | p_u8_buf[POS_X_H + u8_offset] << 8, p_u8_buf[POS_X_H + u8_offset] << 8, p_u8_buf[POS_Y_L + u8_offset] | p_u8_buf[POS_Y_L + u8_offset] | Loading Loading @@ -1125,7 +1150,8 @@ static int raydium_touch_report(unsigned char *p_u8_buf, #endif #endif return 0; return 0; } } int raydium_read_touchdata(unsigned char *p_u8_tp_status, unsigned char *p_u8_buf) int raydium_read_touchdata(unsigned char *p_u8_tp_status, unsigned char *p_u8_buf) { { int i32_ret = 0; int i32_ret = 0; unsigned char u8_points_amount; unsigned char u8_points_amount; Loading Loading @@ -1249,14 +1275,17 @@ static void raydium_work_handler(struct work_struct *work) input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_report_slot_state(g_raydium_ts->input_dev, input_mt_report_slot_state(g_raydium_ts->input_dev, MT_TOOL_FINGER, 1); MT_TOOL_FINGER, 1); input_report_abs(g_raydium_ts->input_dev, ABS_MT_POSITION_X, 100); input_report_abs(g_raydium_ts->input_dev, input_report_abs(g_raydium_ts->input_dev, ABS_MT_POSITION_Y, 100); ABS_MT_POSITION_X, 100); input_report_abs(g_raydium_ts->input_dev, ABS_MT_POSITION_Y, 100); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); usleep_range(9500, 10500); usleep_range(9500, 10500); input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_slot(g_raydium_ts->input_dev, 0); input_mt_report_slot_state(g_raydium_ts->input_dev, input_mt_report_slot_state(g_raydium_ts->input_dev, MT_TOOL_FINGER, 0); MT_TOOL_FINGER, 0); input_mt_report_pointer_emulation(g_raydium_ts->input_dev, false); input_mt_report_pointer_emulation(g_raydium_ts->input_dev, false); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); input_report_key(g_raydium_ts->input_dev, KEY_POWER, true); input_report_key(g_raydium_ts->input_dev, KEY_POWER, true); usleep_range(9500, 10500); usleep_range(9500, 10500); Loading @@ -1267,13 +1296,13 @@ static void raydium_work_handler(struct work_struct *work) #ifdef ESD_SOLUTION_EN #ifdef ESD_SOLUTION_EN g_u8_checkflag = true; g_u8_checkflag = true; #endif #endif pr_info("[touch]display wake up with g_u8_resetflag false\n"); pr_debug("[touch]display wake up with g_u8_resetflag false\n"); } else { } else { if (g_u8_i2c_mode == PDA2_MODE) { if (g_u8_i2c_mode == PDA2_MODE) { i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); if (i32_ret < 0) { if (i32_ret < 0) { pr_info("[touch]%s, read_touchdata error, ret:%d\n", pr_err("[touch]%s, read_touchdata error, ret:%d\n", __func__, i32_ret); __func__, i32_ret); return; return; } } Loading @@ -1299,7 +1328,7 @@ static void raydium_work_handler(struct work_struct *work) KEY_SLEEP, true); KEY_SLEEP, true); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); pr_info("[touch]palm_status = %d.\n", pr_debug("[touch]palm_status = %d.\n", u8_tp_status[POS_GES_STATUS]); u8_tp_status[POS_GES_STATUS]); g_raydium_ts->is_palm = 1; g_raydium_ts->is_palm = 1; Loading @@ -1308,7 +1337,7 @@ static void raydium_work_handler(struct work_struct *work) } else if ((u8_tp_status[POS_GES_STATUS] } else if ((u8_tp_status[POS_GES_STATUS] == RAD_PALM_DISABLE) == RAD_PALM_DISABLE) && (g_raydium_ts->is_palm == 1)) { && (g_raydium_ts->is_palm == 1)) { pr_info("[touch]leave palm mode.\n"); pr_debug("[touch]leave palm mode.\n"); input_report_key(g_raydium_ts->input_dev, input_report_key(g_raydium_ts->input_dev, KEY_SLEEP, false); KEY_SLEEP, false); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); Loading Loading @@ -1341,9 +1370,10 @@ static void raydium_work_handler(struct work_struct *work) usleep_range(9500, 10500); usleep_range(9500, 10500); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); input_report_key(g_raydium_ts->input_dev, KEY_POWER, false); input_report_key(g_raydium_ts->input_dev, KEY_POWER, false); input_sync(g_raydium_ts->input_dev); input_sync(g_raydium_ts->input_dev); pr_info("[touch]display wake up with g_u8_resetflag true\n"); pr_debug("[touch]display wake up with g_u8_resetflag true\n"); /*goto exit;*/ /*goto exit;*/ } } } } Loading @@ -1352,7 +1382,7 @@ static void raydium_work_handler(struct work_struct *work) if (g_u8_i2c_mode == PDA2_MODE) { if (g_u8_i2c_mode == PDA2_MODE) { i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); i32_ret = raydium_read_touchdata(u8_tp_status, u8_buf); if (i32_ret < 0) { if (i32_ret < 0) { pr_info("[touch]%s, read_touchdata error, ret:%d\n", pr_err("[touch]%s, read_touchdata error, ret:%d\n", __func__, i32_ret); __func__, i32_ret); } } } } Loading @@ -1370,33 +1400,28 @@ static irqreturn_t raydium_ts_interrupt(int irq, void *dev_id) if ((g_u8_raydium_flag & ENG_MODE) != 0) { if ((g_u8_raydium_flag & ENG_MODE) != 0) { disable_irq_nosync(g_raydium_ts->irq); disable_irq_nosync(g_raydium_ts->irq); g_raydium_ts->irq_enabled = false; g_raydium_ts->irq_enabled = false; pr_info("[touch]RAD_ENG_MODE\n"); pr_debug("[touch]RAD_ENG_MODE\n"); g_u8_raydium_flag |= INT_FLAG; g_u8_raydium_flag |= INT_FLAG; } else { } else { if (!work_pending(&g_raydium_ts->work)) { if (!work_pending(&g_raydium_ts->work)) { /* Clear interrupts*/ /* Clear interrupts*/ result = queue_work(g_raydium_ts->workqueue, result = queue_work(g_raydium_ts->workqueue, &g_raydium_ts->work); &g_raydium_ts->work); if (result == false) { if (result == false) { /*queue_work fail*/ /*queue_work fail*/ pr_err("[touch]queue_work fail.\n"); pr_err("[touch]queue_work fail.\n"); } } } else { } else { /*work pending*/ /*work pending*/ mutex_lock(&g_raydium_ts->lock); mutex_lock(&g_raydium_ts->lock); if (raydium_i2c_pda2_set_page(g_raydium_ts->client, if (raydium_i2c_pda2_set_page(g_raydium_ts->client, g_raydium_ts->is_suspend, g_raydium_ts->is_suspend, RAYDIUM_PDA2_PAGE_0) < 0) { RAYDIUM_PDA2_PAGE_0) < 0) { pr_err("[touch]%s: failed to set page in work_pending\n", pr_err("[touch]%s: failed to set page in work_pending\n", __func__); __func__); } } mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); pr_debug("[touch]work_pending\n"); pr_info("[touch]work_pending\n"); } } } } return IRQ_HANDLED; return IRQ_HANDLED; Loading Loading @@ -1440,7 +1465,7 @@ static int raydium_check_i2c_ready(unsigned short *u16_i2c_data) if (i32_ret < 0) if (i32_ret < 0) goto exit_error; goto exit_error; if (u8_buf[3] != 0xF3) { if (u8_buf[3] != 0xF3) { pr_info("[touch]PDA2 read i2c fail\n"); pr_err("[touch]PDA2 read i2c fail\n"); g_u8_i2c_mode = PDA_MODE; g_u8_i2c_mode = PDA_MODE; i32_ret = raydium_i2c_pda_read(g_raydium_ts->client, i32_ret = raydium_i2c_pda_read(g_raydium_ts->client, RAD_CHK_I2C_CMD, u8_buf, RAD_CHK_I2C_CMD, u8_buf, Loading @@ -1460,7 +1485,7 @@ static int raydium_check_i2c_ready(unsigned short *u16_i2c_data) *u16_i2c_data = u8_buf[3] << 8 | u8_buf[2]; *u16_i2c_data = u8_buf[3] << 8 | u8_buf[2]; pr_info("[touch]RAD check I2C : 0x%02X%02X\n", u8_buf[3], u8_buf[2]); pr_debug("[touch]RAD check I2C : 0x%02X%02X\n", u8_buf[3], u8_buf[2]); exit_error: exit_error: mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); Loading @@ -1471,6 +1496,7 @@ static int raydium_check_i2c_ready(unsigned short *u16_i2c_data) static void raydium_ts_do_suspend(void) static void raydium_ts_do_suspend(void) { { unsigned char u8_i = 0; unsigned char u8_i = 0; g_u8_resetflag = false; g_u8_resetflag = false; if (g_raydium_ts->is_suspend == 1) { if (g_raydium_ts->is_suspend == 1) { pr_info("[touch]Already in suspend state\n"); pr_info("[touch]Already in suspend state\n"); Loading @@ -1485,7 +1511,7 @@ static void raydium_ts_do_suspend(void) if (!cancel_work_sync(&g_raydium_ts->work)) if (!cancel_work_sync(&g_raydium_ts->work)) pr_info("[touch]workqueue is empty!\n"); pr_info("[touch]workqueue is empty!\n"); pr_info("[touch]%s.\n", __func__); pr_debug("[touch]%s.\n", __func__); /* release all touches */ /* release all touches */ for (u8_i = 0; u8_i < g_raydium_ts->u8_max_touchs; u8_i++) { for (u8_i = 0; u8_i < g_raydium_ts->u8_max_touchs; u8_i++) { Loading Loading @@ -1513,12 +1539,12 @@ static void raydium_ts_do_suspend(void) #ifdef GESTURE_EN #ifdef GESTURE_EN if (device_may_wakeup(&g_raydium_ts->client->dev)) { if (device_may_wakeup(&g_raydium_ts->client->dev)) { pr_info("[touch]Device may wakeup\n"); pr_debug("[touch]Device may wakeup\n"); if (!enable_irq_wake(g_raydium_ts->irq)) if (!enable_irq_wake(g_raydium_ts->irq)) g_raydium_ts->irq_wake = 1; g_raydium_ts->irq_wake = 1; } else } else pr_info("[touch]Device not wakeup\n"); pr_debug("[touch]Device not wakeup\n"); raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); #endif #endif Loading @@ -1533,7 +1559,7 @@ static void raydium_ts_do_resume(void) #endif #endif unsigned char u8_w_data[4]; unsigned char u8_w_data[4]; pr_info("[touch]%s, %d.\n", __func__, g_raydium_ts->is_suspend); pr_debug("[touch]%s, %d.\n", __func__, g_raydium_ts->is_suspend); if (g_raydium_ts->is_suspend == 0) { if (g_raydium_ts->is_suspend == 0) { pr_info("[touch]Already in resume state\n"); pr_info("[touch]Already in resume state\n"); return; return; Loading Loading @@ -1588,13 +1614,13 @@ static void raydium_ts_do_resume(void) #endif #endif #ifdef GESTURE_EN #ifdef GESTURE_EN if (device_may_wakeup(&g_raydium_ts->client->dev)) { if (device_may_wakeup(&g_raydium_ts->client->dev)) { pr_info("[touch]Device may wakeup\n"); pr_debug("[touch]Device may wakeup\n"); if (g_raydium_ts->irq_wake) { if (g_raydium_ts->irq_wake) { disable_irq_wake(g_raydium_ts->irq); disable_irq_wake(g_raydium_ts->irq); g_raydium_ts->irq_wake = 0; g_raydium_ts->irq_wake = 0; } } } else } else pr_info("[touch]Device not wakeup\n"); pr_debug("[touch]Device not wakeup\n"); #endif #endif g_raydium_ts->is_suspend = 0; g_raydium_ts->is_suspend = 0; Loading Loading @@ -1624,9 +1650,9 @@ static int raydium_ts_open(struct input_dev *input_dev) { { int i32_ret = 0; int i32_ret = 0; pr_info("[touch]%s()+\n", __func__); pr_debug("[touch]%s()+\n", __func__); pr_info("[touch]ts->blank:%x\n", g_raydium_ts->blank); pr_debug("[touch]ts->blank:%x\n", g_raydium_ts->blank); if (g_raydium_ts->is_sleep == 1) { if (g_raydium_ts->is_sleep == 1) { mutex_lock(&g_raydium_ts->lock); mutex_lock(&g_raydium_ts->lock); Loading @@ -1643,7 +1669,7 @@ static int raydium_ts_open(struct input_dev *input_dev) mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); raydium_irq_control(ENABLE); raydium_irq_control(ENABLE); g_raydium_ts->is_sleep = 0; g_raydium_ts->is_sleep = 0; pr_info("[touch]disable touch lock.\n"); pr_debug("[touch]disable touch lock.\n"); } } return i32_ret; return i32_ret; } } Loading @@ -1654,10 +1680,10 @@ static void raydium_ts_close(struct input_dev *input_dev) unsigned char u8_i = 0; unsigned char u8_i = 0; unsigned char u8_wbuffer[1]; unsigned char u8_wbuffer[1]; pr_info("[touch]%s()+\n", __func__); pr_debug("[touch]%s()+\n", __func__); if (g_raydium_ts->is_sleep == 1) { if (g_raydium_ts->is_sleep == 1) { pr_info("[touch]touch lock already enabled.\n"); pr_debug("[touch]touch lock already enabled.\n"); return; return; } } Loading Loading @@ -1690,7 +1716,7 @@ static void raydium_ts_close(struct input_dev *input_dev) mutex_unlock(&g_raydium_ts->lock); mutex_unlock(&g_raydium_ts->lock); g_raydium_ts->is_sleep = 1; g_raydium_ts->is_sleep = 1; pr_info("[touch]enable touch lock.\n"); pr_debug("[touch]enable touch lock.\n"); return; return; exit_i2c_error: exit_i2c_error: Loading Loading @@ -1726,7 +1752,7 @@ static int fb_notifier_callback(struct notifier_block *self, /*screen on*/ /*screen on*/ case FB_BLANK_UNBLANK: case FB_BLANK_UNBLANK: pr_info("[touch]FB_BLANK_UNBLANK\n"); pr_debug("[touch]FB_BLANK_UNBLANK\n"); #ifdef GESTURE_EN #ifdef GESTURE_EN /* clear palm status */ /* clear palm status */ Loading @@ -1741,7 +1767,7 @@ static int fb_notifier_callback(struct notifier_block *self, /*screen off*/ /*screen off*/ case FB_BLANK_POWERDOWN: case FB_BLANK_POWERDOWN: pr_info("[touch]FB_BLANK_POWERDOWN\n"); pr_debug("[touch]FB_BLANK_POWERDOWN\n"); #ifdef GESTURE_EN #ifdef GESTURE_EN /* clear palm status */ /* clear palm status */ Loading @@ -1756,7 +1782,7 @@ static int fb_notifier_callback(struct notifier_block *self, /*ambient mode*/ /*ambient mode*/ case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_VSYNC_SUSPEND: pr_info("[touch]FB_BLANK_VSYNC_SUSPEND\n"); pr_debug("[touch]FB_BLANK_VSYNC_SUSPEND\n"); #ifdef GESTURE_EN #ifdef GESTURE_EN /* clear palm status */ /* clear palm status */ Loading Loading @@ -1931,7 +1957,7 @@ static void raydium_input_set(struct input_dev *input_dev) __set_bit(EV_ABS, input_dev->evbit); __set_bit(EV_ABS, input_dev->evbit); __set_bit(BTN_TOUCH, input_dev->keybit); __set_bit(BTN_TOUCH, input_dev->keybit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); pr_info("[touch]set abs prarams x[%d], y[%d]\n", pr_debug("[touch]set abs prarams x[%d], y[%d]\n", g_raydium_ts->x_max, g_raydium_ts->y_max); g_raydium_ts->x_max, g_raydium_ts->y_max); /* Multitouch input params setup */ /* Multitouch input params setup */ Loading Loading @@ -1977,7 +2003,7 @@ static int raydium_set_resolution(void) u32_x = u8_buf[3] << 8 | u8_buf[2]; u32_x = u8_buf[3] << 8 | u8_buf[2]; u32_y = u8_buf[1] << 8 | u8_buf[0]; u32_y = u8_buf[1] << 8 | u8_buf[0]; pr_info("[touch]RAD display info x:%d, y:%d\n", u32_x, u32_y); pr_debug("[touch]RAD display info x:%d, y:%d\n", u32_x, u32_y); if (u32_x > 300 && u32_y > 300 && if (u32_x > 300 && u32_y > 300 && u32_x < 600 && u32_y < 600) { u32_x < 600 && u32_y < 600) { Loading @@ -2000,7 +2026,7 @@ static int raydium_ts_probe(struct i2c_client *client, unsigned short u16_i2c_data; unsigned short u16_i2c_data; int ret = 0; int ret = 0; pr_info("[touch] probe\n"); pr_debug("[touch] probe\n"); if (client->dev.of_node) { if (client->dev.of_node) { pdata = devm_kzalloc(&client->dev, pdata = devm_kzalloc(&client->dev, Loading Loading @@ -2135,8 +2161,8 @@ static int raydium_ts_probe(struct i2c_client *client, INIT_DELAYED_WORK(&g_raydium_ts->dump_work, raydium_dump_data_work); INIT_DELAYED_WORK(&g_raydium_ts->dump_work, raydium_dump_data_work); #endif #endif /*irq_gpio = 13 irqflags = 108*/ /*irq_gpio = 13 irqflags = 108*/ pr_info("[touch]pdata irq : %d\n", g_raydium_ts->irq_gpio); pr_debug("[touch]pdata irq : %d\n", g_raydium_ts->irq_gpio); pr_info("[touch]client irq : %d, pdata flags : %d\n", pr_debug("[touch]client irq : %d, pdata flags : %d\n", client->irq, pdata->irqflags); client->irq, pdata->irqflags); g_raydium_ts->irq = gpio_to_irq(pdata->irq_gpio); g_raydium_ts->irq = gpio_to_irq(pdata->irq_gpio); Loading @@ -2158,6 +2184,7 @@ static int raydium_ts_probe(struct i2c_client *client, pr_info("[touch]RAD Touch driver ver :0x%X\n", g_u32_driver_version); pr_info("[touch]RAD Touch driver ver :0x%X\n", g_u32_driver_version); #ifdef FW_UPDATE_EN /*fw update check*/ /*fw update check*/ ret = raydium_fw_update_check(u16_i2c_data); ret = raydium_fw_update_check(u16_i2c_data); if (ret < 0) { if (ret < 0) { Loading @@ -2165,6 +2192,7 @@ static int raydium_ts_probe(struct i2c_client *client, ret = -ENODEV; ret = -ENODEV; goto exit_irq_request_failed; goto exit_irq_request_failed; } } #endif return 0; return 0; exit_irq_request_failed: exit_irq_request_failed: Loading Loading @@ -2249,7 +2277,7 @@ static const struct i2c_device_id raydium_ts_id[] = { MODULE_DEVICE_TABLE(i2c, raydium_ts_id); MODULE_DEVICE_TABLE(i2c, raydium_ts_id); #ifdef CONFIG_OF #ifdef CONFIG_OF static struct of_device_id raydium_match_table[] = { static const struct of_device_id raydium_match_table[] = { { .compatible = "raydium,raydium-ts",}, { .compatible = "raydium,raydium-ts",}, { }, { }, }; }; Loading
drivers/input/touchscreen/raydium_wt030/raydium_driver.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -25,7 +25,7 @@ #define RAD_MINOR_VERSION 0x07 #define RAD_MINOR_VERSION 0x07 #define RAD_CUSTOMER_VERSION 0x0100 #define RAD_CUSTOMER_VERSION 0x0100 #if defined(CONFIG_TOUCHSCREEN_RM_TS) #if defined(CONFIG_TOUCHSCREEN_RAYDIUM_CHIPSET) /* IC timing control arguments */ /* IC timing control arguments */ #define RAYDIUM_POWERON_DELAY_USEC 500 #define RAYDIUM_POWERON_DELAY_USEC 500 #define RAYDIUM_RESET_INTERVAL_MSEC 5 #define RAYDIUM_RESET_INTERVAL_MSEC 5 Loading Loading @@ -164,6 +164,8 @@ #define AMBIENT_MODE 0x01 #define AMBIENT_MODE 0x01 #define SLEEP_MODE 0x02 #define SLEEP_MODE 0x02 #define RAD_20 0x2209 /* Enable sysfs */ /* Enable sysfs */ #define CONFIG_RM_SYSFS_DEBUG #define CONFIG_RM_SYSFS_DEBUG Loading Loading @@ -348,7 +350,6 @@ extern int raydium_do_selftest(void); int raydium_esd_check(void); int raydium_esd_check(void); extern struct attribute *raydium_attributes[]; extern struct attribute *raydium_attributes[]; extern const struct attribute_group raydium_attr_group; extern unsigned char g_u8_raydium_flag; extern unsigned char g_u8_raydium_flag; extern unsigned char g_u8_addr; extern unsigned char g_u8_addr; Loading