input: sec_ts: bind input_open/close to display state

Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
This commit is contained in:
Jesse Chan 2018-04-17 16:53:13 -07:00 committed by prashantpaddune
parent 671d649fa8
commit a3103639ca
3 changed files with 61 additions and 2 deletions

View File

@ -1119,7 +1119,8 @@ void input_close_device(struct input_handle *handle)
mutex_unlock(&dev->mutex); mutex_unlock(&dev->mutex);
} }
EXPORT_SYMBOL(input_close_device); EXPORT_SYMBOL(input_close_device);
static int input_enable_device(struct input_dev *dev)
int input_enable_device(struct input_dev *dev)
{ {
int retval; int retval;
@ -1144,7 +1145,7 @@ out:
return retval; return retval;
} }
static int input_disable_device(struct input_dev *dev) int input_disable_device(struct input_dev *dev)
{ {
int retval; int retval;

View File

@ -39,6 +39,13 @@ static void sec_ts_input_close(struct input_dev *dev);
extern void epen_disable_mode(int mode); extern void epen_disable_mode(int mode);
#endif #endif
#if defined(CONFIG_FB)
static int touch_fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data);
extern int input_enable_device(struct input_dev *dev);
extern int input_disable_device(struct input_dev *dev);
#endif
int sec_ts_read_information(struct sec_ts_data *ts); int sec_ts_read_information(struct sec_ts_data *ts);
#ifdef CONFIG_SECURE_TOUCH #ifdef CONFIG_SECURE_TOUCH
@ -2340,6 +2347,16 @@ static int sec_ts_probe(struct i2c_client *client, const struct i2c_device_id *i
__func__, client->irq); __func__, client->irq);
#endif #endif
#ifdef CONFIG_FB
ts->fb_notif.notifier_call = touch_fb_notifier_callback;
ret = fb_register_client(&ts->fb_notif);
if (ret < 0) {
input_err(true, &ts->client->dev, "%s: Failed to register fb client\n",
__func__);
goto err_fb_client;
}
#endif
/* need remove below resource @ remove driver */ /* need remove below resource @ remove driver */
#if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP) #if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP)
sec_ts_raw_device_init(ts); sec_ts_raw_device_init(ts);
@ -2386,6 +2403,11 @@ static int sec_ts_probe(struct i2c_client *client, const struct i2c_device_id *i
sec_ts_fn_remove(ts); sec_ts_fn_remove(ts);
free_irq(client->irq, ts); free_irq(client->irq, ts);
#endif #endif
#ifdef CONFIG_FB
fb_unregister_client(&ts->fb_notif);
err_fb_client:
#endif
err_irq: err_irq:
if (ts->plat_data->support_dex) { if (ts->plat_data->support_dex) {
input_unregister_device(ts->input_dev_pad); input_unregister_device(ts->input_dev_pad);
@ -2818,6 +2840,12 @@ static int sec_ts_remove(struct i2c_client *client)
input_info(true, &ts->client->dev, "%s\n", __func__); input_info(true, &ts->client->dev, "%s\n", __func__);
#if defined(CONFIG_FB)
if (fb_unregister_client(&ts->fb_notif))
input_info(true, &ts->client->dev,
"%s: Error occured while unregistering fb_notifier.\n", __func__);
#endif
cancel_delayed_work_sync(&ts->work_read_info); cancel_delayed_work_sync(&ts->work_read_info);
flush_delayed_work(&ts->work_read_info); flush_delayed_work(&ts->work_read_info);
@ -3059,6 +3087,27 @@ static int sec_ts_pm_resume(struct device *dev)
return 0; return 0;
} }
#if defined(CONFIG_FB)
static int touch_fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data)
{
struct sec_ts_data *ts =
container_of(self, struct sec_ts_data, fb_notif);
struct fb_event *ev = (struct fb_event *)data;
if (ev && ev->data && event == FB_EVENT_BLANK) {
int *blank = (int *)ev->data;
if (*blank == FB_BLANK_UNBLANK)
input_enable_device(ts->input_dev);
else
input_disable_device(ts->input_dev);
}
return 0;
}
#endif
#endif #endif
#ifdef CONFIG_TRUSTONIC_TRUSTED_UI #ifdef CONFIG_TRUSTONIC_TRUSTED_UI

View File

@ -39,6 +39,11 @@
#include <linux/wakelock.h> #include <linux/wakelock.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#if defined(CONFIG_FB)
#include <linux/notifier.h>
#include <linux/fb.h>
#endif
#if defined(CONFIG_TRUSTONIC_TRUSTED_UI) #if defined(CONFIG_TRUSTONIC_TRUSTED_UI)
#include <linux/t-base-tui.h> #include <linux/t-base-tui.h>
#endif #endif
@ -653,6 +658,10 @@ struct sec_ts_data {
volatile bool input_closed; volatile bool input_closed;
volatile bool abc_err_flag; volatile bool abc_err_flag;
#if defined(CONFIG_FB)
struct notifier_block fb_notif;
#endif
int touch_count; int touch_count;
int tx_count; int tx_count;
int rx_count; int rx_count;