himax_v2_mmi: Update FW in thread when resume

TP:
Enable FW download function when resume.
Download FW in thread, do not increase screen up time.

Change-Id: Id00af6279b1752ede13b847d2d43e81fd75a0894
Signed-off-by: haojl2 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1385251
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2019-07-12 17:44:30 +08:00 • committed by Jialei Hao
commit d1b6361a13
3 changed files with 42 additions and 1 deletions

View file

@ -3045,6 +3045,14 @@ device_destroy:
return -ENODEV;
}
#if defined(HX_RESUME_SET_FW)
void himax_resume_work_func(struct work_struct *work)
{
struct himax_ts_data *ts = private_ts;
himax_chip_common_resume(ts);
return;
}
#endif
int himax_chip_common_init(void)
{
@ -3199,6 +3207,14 @@ FW_force_upgrade:
queue_delayed_work(ts->himax_0f_update_wq, &ts->work_0f_update, msecs_to_jiffies(2000));
#endif
#ifdef HX_RESUME_SET_FW
ts->ts_int_workqueue = create_singlethread_workqueue("himax_ts_resume_wq");
if (!ts->ts_int_workqueue) {
E("%s: create ts_resume workqueue failed\n", __func__);
goto err_create_ts_resume_wq_failed;
}
INIT_WORK(&ts->ts_int_work, himax_resume_work_func);
#endif
/*Himax Power On and Load Config*/
if (himax_loadSensorConfig(pdata)) {
E("%s: Load Sesnsor configuration failed, unload driver.\n", __func__);
@ -3313,6 +3329,11 @@ err_get_intr_bit_failed:
err_input_register_device_failed:
input_free_device(ts->input_dev);
err_detect_failed:
#ifdef HX_RESUME_SET_FW
cancel_work_sync(&ts->ts_int_work);
destroy_workqueue(ts->ts_int_workqueue);
err_create_ts_resume_wq_failed:
#endif
#ifdef HX_ZERO_FLASH
cancel_delayed_work_sync(&ts->work_0f_update);
destroy_workqueue(ts->himax_0f_update_wq);
@ -3497,10 +3518,13 @@ int himax_chip_common_resume(struct himax_ts_data *ts)
if (ts->pdata->powerOff3V3 && ts->pdata->power)
ts->pdata->power(1);
#ifndef HX_RESUME_SET_FW
#if defined(HX_RST_PIN_FUNC) && defined(HX_RESUME_HW_RESET)
if (g_core_fp.fp_ic_reset != NULL)
g_core_fp.fp_ic_reset(false, false);
#endif
#endif
#if defined(HX_ZERO_FLASH) && defined(HX_RESUME_SET_FW)
#ifdef HX_SMART_WAKEUP
if (!ts->SMWP_enable) {

View file

@ -80,7 +80,7 @@
#define HX_PROTOCOL_B_3PA
/*#define HX_FIX_TOUCH_INFO*/ /* if open, you need to change the touch info in the fix_touch_info*/
/*#define HX_ZERO_FLASH*/
/*#define HX_RESUME_SET_FW*/
#define HX_RESUME_SET_FW
/*#if defined(HX_ZERO_FLASH)*/
/*#define HX_CODE_OVERLAY*/
/*#define HX_EDGE_LIMIT*/
@ -408,6 +408,10 @@ struct himax_ts_data {
struct workqueue_struct *himax_0f_update_wq;
struct delayed_work work_0f_update;
#endif
#ifdef HX_RESUME_SET_FW
struct workqueue_struct *ts_int_workqueue;
struct work_struct ts_int_work;
#endif
struct workqueue_struct *himax_diag_wq;
struct delayed_work himax_diag_delay_wrok;

View file

@ -844,6 +844,15 @@ static int himax_common_suspend(struct device *dev)
return 0;
}
#if defined(HX_RESUME_SET_FW)
void himax_resume_thread_func(void)
{
struct himax_ts_data *ts = private_ts;
I("%s: TP resume from thread\n", __func__);
queue_work(ts->ts_int_workqueue, &ts->ts_int_work);
return;
}
#endif
static int himax_common_resume(struct device *dev)
{
struct himax_ts_data *ts = dev_get_drvdata(dev);
@ -859,7 +868,11 @@ static int himax_common_resume(struct device *dev)
return -ECANCELED;
}
#endif
#if defined(HX_RESUME_SET_FW)
himax_resume_thread_func();
#else
himax_chip_common_resume(ts);
#endif
return 0;
}