summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungwoo Yang <hyungwoo.yang@intel.com>2016-11-07 10:22:47 -0800
committerEdward O'Callaghan <funfunctor@folklore1984.net>2016-12-06 13:01:50 +1100
commitc9b509bf8fc0ac96d824de3cd87c3fc0d2e49986 (patch)
tree9cbf71bc94b20e9e133e306d1e71fdba3d6d6273
parent1fab878a1cb8ef8fd60a8573b247cac702116864 (diff)
misc: ipts: handle gfx event in a separate contextSP4
mei_cldev_send() returns immediately if current thread is signaled. Some contexts sending gfx events(for now, there's only one event) is already signaled and it prevents from sending messages to MEI. This patch moves handling gfx event into a separate work item. Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
-rw-r--r--drivers/misc/ipts/ipts-gfx.c42
-rw-r--r--drivers/misc/ipts/ipts-mei.c26
-rw-r--r--drivers/misc/ipts/ipts-msg-handler.c6
-rw-r--r--drivers/misc/ipts/ipts.h2
4 files changed, 50 insertions, 26 deletions
diff --git a/drivers/misc/ipts/ipts-gfx.c b/drivers/misc/ipts/ipts-gfx.c
index b831c93bae60..51727770e75d 100644
--- a/drivers/misc/ipts/ipts-gfx.c
+++ b/drivers/misc/ipts/ipts-gfx.c
@@ -36,23 +36,9 @@ static void gfx_processing_complete(void *data)
static void notify_gfx_status(u32 status, void *data)
{
ipts_info_t *ipts = data;
- ipts_state_t state;
- ipts_dbg(ipts, "notify gfx status : %d\n", status);
-
- state = ipts_get_state(ipts);
-
- if (state == IPTS_STA_RAW_DATA_STARTED || state == IPTS_STA_HID_STARTED) {
- if (status == IPTS_NOTIFY_STA_BACKLIGHT_ON &&
- ipts->display_status == false) {
- ipts_send_sensor_clear_mem_window_cmd(ipts);
- ipts->display_status = true;
- } else if (status == IPTS_NOTIFY_STA_BACKLIGHT_OFF &&
- ipts->display_status == true) {
- ipts_send_sensor_quiesce_io_cmd(ipts);
- ipts->display_status = false;
- }
- }
+ ipts->gfx_status = status;
+ schedule_work(&ipts->gfx_status_work);
}
static int connect_gfx(ipts_info_t *ipts)
@@ -84,6 +70,8 @@ static void disconnect_gfx(ipts_info_t *ipts)
#ifdef RUN_DBG_THREAD
#include "../mei/mei_dev.h"
+static struct task_struct *dbg_thread;
+
static void ipts_print_dbg_info(ipts_info_t* ipts)
{
char fw_sts_str[MEI_FW_STATUS_STR_SZ];
@@ -104,22 +92,24 @@ static void ipts_print_dbg_info(ipts_info_t* ipts)
static int ipts_dbg_thread(void *data)
{
- ipts_info_t *ipts = (ipts_info_t*)data;
+ ipts_info_t *ipts = (ipts_info_t *)data;
+
+ pr_info(">> start debug thread\n");
- pr_info(">> start debug thread\n");
- while (1) {
+ while (!kthread_should_stop()) {
if (ipts_get_state(ipts) != IPTS_STA_RAW_DATA_STARTED) {
- pr_info("state is not IPTS_STA_RAW_DATA_SATARTED\n");
+ pr_info("state is not IPTS_STA_RAW_DATA_STARTED : %d\n",
+ ipts_get_state(ipts));
msleep(5000);
continue;
}
ipts_print_dbg_info(ipts);
- msleep(3000);
- }
+ msleep(3000);
+ }
- return 0;
+ return 0;
}
#endif
@@ -141,7 +131,7 @@ int ipts_open_gpu(ipts_info_t *ipts)
}
#ifdef RUN_DBG_THREAD
- kthread_run(ipts_dbg_thread, (void*)ipts, "ipts_debug");
+ dbg_thread = kthread_run(ipts_dbg_thread, (void *)ipts, "ipts_debug");
#endif
return 0;
@@ -150,6 +140,10 @@ int ipts_open_gpu(ipts_info_t *ipts)
void ipts_close_gpu(ipts_info_t *ipts)
{
disconnect_gfx(ipts);
+
+#ifdef RUN_DBG_THREAD
+ kthread_stop(dbg_thread);
+#endif
}
intel_ipts_mapbuffer_t *ipts_map_buffer(ipts_info_t *ipts, u32 size, u32 flags)
diff --git a/drivers/misc/ipts/ipts-mei.c b/drivers/misc/ipts/ipts-mei.c
index 8c332ba351b1..39667e75dafd 100644
--- a/drivers/misc/ipts/ipts-mei.c
+++ b/drivers/misc/ipts/ipts-mei.c
@@ -110,6 +110,29 @@ static void raw_data_work_func(struct work_struct *work)
ipts_handle_processed_data(ipts);
}
+static void gfx_status_work_func(struct work_struct *work)
+{
+ ipts_info_t *ipts = container_of(work, ipts_info_t, gfx_status_work);
+ ipts_state_t state;
+ int status = ipts->gfx_status;
+
+ ipts_dbg(ipts, "notify gfx status : %d\n", status);
+
+ state = ipts_get_state(ipts);
+
+ if (state == IPTS_STA_RAW_DATA_STARTED || state == IPTS_STA_HID_STARTED) {
+ if (status == IPTS_NOTIFY_STA_BACKLIGHT_ON &&
+ ipts->display_status == false) {
+ ipts_send_sensor_clear_mem_window_cmd(ipts);
+ ipts->display_status = true;
+ } else if (status == IPTS_NOTIFY_STA_BACKLIGHT_OFF &&
+ ipts->display_status == true) {
+ ipts_send_sensor_quiesce_io_cmd(ipts);
+ ipts->display_status = false;
+ }
+ }
+}
+
/* event loop */
static int ipts_mei_cl_event_thread(void *data)
{
@@ -186,6 +209,7 @@ static int ipts_mei_cl_probe(struct mei_cl_device *cldev,
INIT_WORK(&ipts->init_work, init_work_func);
INIT_WORK(&ipts->raw_data_work, raw_data_work_func);
+ INIT_WORK(&ipts->gfx_status_work, gfx_status_work_func);
ret = sysfs_create_group(&cldev->dev.kobj, &ipts_grp);
if (ret != 0) {
@@ -215,6 +239,8 @@ static int ipts_mei_cl_remove(struct mei_cl_device *cldev)
kthread_stop(ipts->event_loop);
+ pr_info("IPTS removed\n");
+
return 0;
}
diff --git a/drivers/misc/ipts/ipts-msg-handler.c b/drivers/misc/ipts/ipts-msg-handler.c
index e58d1028b85f..b53f668d6e7e 100644
--- a/drivers/misc/ipts/ipts-msg-handler.c
+++ b/drivers/misc/ipts/ipts-msg-handler.c
@@ -20,7 +20,8 @@ int ipts_handle_cmd(ipts_info_t *ipts, u32 cmd, void *data, int data_size)
ret = mei_cldev_send(ipts->cldev, (u8*)&h2m_msg, len);
if (ret < 0) {
- ipts_err(ipts, "mei_cldev_send() error 0x%X:%d\n", cmd, ret);
+ ipts_err(ipts, "mei_cldev_send() error 0x%X:%d\n",
+ cmd, ret);
return ret;
}
@@ -56,6 +57,7 @@ int ipts_send_sensor_quiesce_io_cmd(ipts_info_t *ipts)
ret = ipts_handle_cmd(ipts, TOUCH_SENSOR_QUIESCE_IO_CMD,
&quiesce_io_cmd, cmd_len);
+
return ret;
}
@@ -326,7 +328,7 @@ int ipts_handle_resp(ipts_info_t *ipts, touch_sensor_msg_m2h_t *m2h_msg,
ipts_set_state(ipts, IPTS_STA_RAW_DATA_STARTED);
}
- ipts_dbg(ipts, "touch enabled\n");
+ ipts_err(ipts, "touch enabled %d\n", ipts_get_state(ipts));
break;
case TOUCH_SENSOR_HID_READY_FOR_DATA_RSP:
diff --git a/drivers/misc/ipts/ipts.h b/drivers/misc/ipts/ipts.h
index 8f3b468c5b89..a7a4846ca887 100644
--- a/drivers/misc/ipts/ipts.h
+++ b/drivers/misc/ipts/ipts.h
@@ -97,6 +97,7 @@ typedef struct ipts_info {
struct work_struct init_work;
struct work_struct raw_data_work;
+ struct work_struct gfx_status_work;
struct task_struct *event_loop;
@@ -119,6 +120,7 @@ typedef struct ipts_info {
ipts_gfx_info_t gfx_info;
u64 kernel_handle;
+ int gfx_status;
bool display_status;
bool switch_sensor_mode;