diff --git a/drivers/input/input.c b/drivers/input/input.c index 312c37c11..33514f0a6 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1119,7 +1119,8 @@ void input_close_device(struct input_handle *handle) mutex_unlock(&dev->mutex); } EXPORT_SYMBOL(input_close_device); -static int input_enable_device(struct input_dev *dev) + +int input_enable_device(struct input_dev *dev) { int retval; @@ -1144,7 +1145,7 @@ out: return retval; } -static int input_disable_device(struct input_dev *dev) +int input_disable_device(struct input_dev *dev) { int retval; diff --git a/drivers/input/touchscreen/sec_ts/sec_ts.c b/drivers/input/touchscreen/sec_ts/sec_ts.c index 5686ffd18..566e5c0fc 100644 --- a/drivers/input/touchscreen/sec_ts/sec_ts.c +++ b/drivers/input/touchscreen/sec_ts/sec_ts.c @@ -39,6 +39,13 @@ static void sec_ts_input_close(struct input_dev *dev); extern void epen_disable_mode(int mode); #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); #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); #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 */ #if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP) 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); free_irq(client->irq, ts); #endif +#ifdef CONFIG_FB + fb_unregister_client(&ts->fb_notif); + +err_fb_client: +#endif err_irq: if (ts->plat_data->support_dex) { 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__); +#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); flush_delayed_work(&ts->work_read_info); @@ -3059,6 +3087,27 @@ static int sec_ts_pm_resume(struct device *dev) 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 #ifdef CONFIG_TRUSTONIC_TRUSTED_UI diff --git a/drivers/input/touchscreen/sec_ts/sec_ts.h b/drivers/input/touchscreen/sec_ts/sec_ts.h index 77dc1e104..6c2dfa73c 100644 --- a/drivers/input/touchscreen/sec_ts/sec_ts.h +++ b/drivers/input/touchscreen/sec_ts/sec_ts.h @@ -39,6 +39,11 @@ #include #include +#if defined(CONFIG_FB) +#include +#include +#endif + #if defined(CONFIG_TRUSTONIC_TRUSTED_UI) #include #endif @@ -653,6 +658,10 @@ struct sec_ts_data { volatile bool input_closed; volatile bool abc_err_flag; +#if defined(CONFIG_FB) + struct notifier_block fb_notif; +#endif + int touch_count; int tx_count; int rx_count;