misc: ipts: handle gfx event in a separate context
This commit is contained in:
parent
12c53f1ecb
commit
bb5ba49137
|
@ -36,23 +36,9 @@ static void gfx_processing_complete(void *data)
|
||||||
static void notify_gfx_status(u32 status, void *data)
|
static void notify_gfx_status(u32 status, void *data)
|
||||||
{
|
{
|
||||||
ipts_info_t *ipts = data;
|
ipts_info_t *ipts = data;
|
||||||
ipts_state_t state;
|
|
||||||
|
|
||||||
ipts_dbg(ipts, "notify gfx status : %d\n", status);
|
ipts->gfx_status = status;
|
||||||
|
schedule_work(&ipts->gfx_status_work);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int connect_gfx(ipts_info_t *ipts)
|
static int connect_gfx(ipts_info_t *ipts)
|
||||||
|
@ -81,9 +67,13 @@ static void disconnect_gfx(ipts_info_t *ipts)
|
||||||
intel_ipts_disconnect(ipts->gfx_info.gfx_handle);
|
intel_ipts_disconnect(ipts->gfx_info.gfx_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RUN_DBG_THREAD
|
||||||
|
|
||||||
#ifdef RUN_DBG_THREAD
|
#ifdef RUN_DBG_THREAD
|
||||||
#include "../mei/mei_dev.h"
|
#include "../mei/mei_dev.h"
|
||||||
|
|
||||||
|
static struct task_struct *dbg_thread;
|
||||||
|
|
||||||
static void ipts_print_dbg_info(ipts_info_t* ipts)
|
static void ipts_print_dbg_info(ipts_info_t* ipts)
|
||||||
{
|
{
|
||||||
char fw_sts_str[MEI_FW_STATUS_STR_SZ];
|
char fw_sts_str[MEI_FW_STATUS_STR_SZ];
|
||||||
|
@ -104,22 +94,24 @@ static void ipts_print_dbg_info(ipts_info_t* ipts)
|
||||||
|
|
||||||
static int ipts_dbg_thread(void *data)
|
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) {
|
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);
|
msleep(5000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipts_print_dbg_info(ipts);
|
ipts_print_dbg_info(ipts);
|
||||||
|
|
||||||
msleep(3000);
|
msleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -141,7 +133,7 @@ int ipts_open_gpu(ipts_info_t *ipts)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RUN_DBG_THREAD
|
#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
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -150,6 +142,10 @@ int ipts_open_gpu(ipts_info_t *ipts)
|
||||||
void ipts_close_gpu(ipts_info_t *ipts)
|
void ipts_close_gpu(ipts_info_t *ipts)
|
||||||
{
|
{
|
||||||
disconnect_gfx(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)
|
intel_ipts_mapbuffer_t *ipts_map_buffer(ipts_info_t *ipts, u32 size, u32 flags)
|
||||||
|
|
|
@ -110,6 +110,29 @@ static void raw_data_work_func(struct work_struct *work)
|
||||||
ipts_handle_processed_data(ipts);
|
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 */
|
/* event loop */
|
||||||
static int ipts_mei_cl_event_thread(void *data)
|
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->init_work, init_work_func);
|
||||||
INIT_WORK(&ipts->raw_data_work, raw_data_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);
|
ret = sysfs_create_group(&cldev->dev.kobj, &ipts_grp);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
@ -215,6 +239,8 @@ static int ipts_mei_cl_remove(struct mei_cl_device *cldev)
|
||||||
|
|
||||||
kthread_stop(ipts->event_loop);
|
kthread_stop(ipts->event_loop);
|
||||||
|
|
||||||
|
pr_info("IPTS removed\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
ret = mei_cldev_send(ipts->cldev, (u8*)&h2m_msg, len);
|
||||||
if (ret < 0) {
|
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;
|
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,
|
ret = ipts_handle_cmd(ipts, TOUCH_SENSOR_QUIESCE_IO_CMD,
|
||||||
&quiesce_io_cmd, cmd_len);
|
&quiesce_io_cmd, cmd_len);
|
||||||
|
|
||||||
return ret;
|
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_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;
|
break;
|
||||||
case TOUCH_SENSOR_HID_READY_FOR_DATA_RSP:
|
case TOUCH_SENSOR_HID_READY_FOR_DATA_RSP:
|
||||||
|
|
|
@ -97,6 +97,7 @@ typedef struct ipts_info {
|
||||||
|
|
||||||
struct work_struct init_work;
|
struct work_struct init_work;
|
||||||
struct work_struct raw_data_work;
|
struct work_struct raw_data_work;
|
||||||
|
struct work_struct gfx_status_work;
|
||||||
|
|
||||||
struct task_struct *event_loop;
|
struct task_struct *event_loop;
|
||||||
|
|
||||||
|
@ -119,6 +120,7 @@ typedef struct ipts_info {
|
||||||
|
|
||||||
ipts_gfx_info_t gfx_info;
|
ipts_gfx_info_t gfx_info;
|
||||||
u64 kernel_handle;
|
u64 kernel_handle;
|
||||||
|
int gfx_status;
|
||||||
bool display_status;
|
bool display_status;
|
||||||
|
|
||||||
bool switch_sensor_mode;
|
bool switch_sensor_mode;
|
||||||
|
|
Loading…
Reference in a new issue