Loading drivers/input/touchscreen/gt9xx/gt9xx.c +97 −25 Original line number Diff line number Diff line Loading @@ -97,7 +97,10 @@ static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms); static void gtp_int_sync(struct goodix_ts_data *ts, int ms); static int gtp_i2c_test(struct i2c_client *client); #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_FB) static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data); #elif defined(CONFIG_HAS_EARLYSUSPEND) static void goodix_ts_early_suspend(struct early_suspend *h); static void goodix_ts_late_resume(struct early_suspend *h); #endif Loading Loading @@ -772,7 +775,7 @@ static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms) #endif } #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB) #if GTP_SLIDE_WAKEUP /******************************************************* Function: Loading Loading @@ -877,16 +880,12 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts) GTP_DEBUG_FUNC(); #if GTP_POWER_CTRL_SLEEP while (retry++ < 5) { gtp_reset_guitar(ts, 20); ret = gtp_send_cfg(ts); if (ret > 0) { dev_dbg(&ts->client->dev, "Wakeup sleep send config success."); continue; } dev_dbg(&ts->client->dev, "GTP Wakeup!"); return 1; } #else Loading Loading @@ -927,7 +926,7 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts) dev_err(&ts->client->dev, "GTP wakeup sleep failed.\n"); return ret; } #endif /* !CONFIG_HAS_EARLYSUSPEND */ #endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/ /******************************************************* Function: Loading Loading @@ -1790,6 +1789,20 @@ static int goodix_ts_probe(struct i2c_client *client, goto exit_free_inputdev; } #if defined(CONFIG_FB) ts->fb_notif.notifier_call = fb_notifier_callback; ret = fb_register_client(&ts->fb_notif); if (ret) dev_err(&ts->client->dev, "Unable to register fb_notifier: %d\n", ret); #elif defined(CONFIG_HAS_EARLYSUSPEND) ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; ts->early_suspend.suspend = goodix_ts_early_suspend; ts->early_suspend.resume = goodix_ts_late_resume; register_early_suspend(&ts->early_suspend); #endif ts->goodix_wq = create_singlethread_workqueue("goodix_wq"); INIT_WORK(&ts->work, goodix_ts_work_func); Loading Loading @@ -1817,6 +1830,13 @@ static int goodix_ts_probe(struct i2c_client *client, init_done = true; return 0; exit_free_irq: #if defined(CONFIG_FB) if (fb_unregister_client(&ts->fb_notif)) dev_err(&client->dev, "Error occurred while unregistering fb_notifier.\n"); #elif defined(CONFIG_HAS_EARLYSUSPEND) unregister_early_suspend(&ts->early_suspend); #endif if (ts->use_irq) free_irq(client->irq, ts); else Loading Loading @@ -1860,7 +1880,11 @@ static int goodix_ts_remove(struct i2c_client *client) struct goodix_ts_data *ts = i2c_get_clientdata(client); GTP_DEBUG_FUNC(); #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_FB) if (fb_unregister_client(&ts->fb_notif)) dev_err(&client->dev, "Error occurred while unregistering fb_notifier.\n"); #elif defined(CONFIG_HAS_EARLYSUSPEND) unregister_early_suspend(&ts->early_suspend); #endif Loading Loading @@ -1905,7 +1929,7 @@ static int goodix_ts_remove(struct i2c_client *client) return 0; } #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB) /******************************************************* Function: Early suspend function. Loading @@ -1914,12 +1938,9 @@ Input: Output: None. *******************************************************/ static void goodix_ts_early_suspend(struct early_suspend *h) static void goodix_ts_suspend(struct goodix_ts_data *ts) { struct goodix_ts_data *ts; s8 ret = -1; ts = container_of(h, struct goodix_ts_data, early_suspend); int ret = -1; GTP_DEBUG_FUNC(); Loading Loading @@ -1953,12 +1974,9 @@ Input: Output: None. *******************************************************/ static void goodix_ts_late_resume(struct early_suspend *h) static void goodix_ts_resume(struct goodix_ts_data *ts) { struct goodix_ts_data *ts; s8 ret = -1; ts = container_of(h, struct goodix_ts_data, early_suspend); int ret = -1; GTP_DEBUG_FUNC(); Loading @@ -1969,7 +1987,7 @@ static void goodix_ts_late_resume(struct early_suspend *h) #endif if (ret < 0) dev_err(&ts->client->dev, "GTP later resume failed.\n"); dev_err(&ts->client->dev, "GTP resume failed.\n"); if (ts->use_irq) gtp_irq_enable(ts); Loading @@ -1982,7 +2000,61 @@ static void goodix_ts_late_resume(struct early_suspend *h) gtp_esd_switch(ts->client, SWITCH_ON); #endif } #if defined(CONFIG_FB) static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data) { struct fb_event *evdata = data; int *blank; struct goodix_ts_data *ts = container_of(self, struct goodix_ts_data, fb_notif); if (evdata && evdata->data && event == FB_EVENT_BLANK && ts && ts->client) { blank = evdata->data; if (*blank == FB_BLANK_UNBLANK) goodix_ts_resume(ts); else if (*blank == FB_BLANK_POWERDOWN) goodix_ts_suspend(ts); } return 0; } #elif defined(CONFIG_HAS_EARLYSUSPEND) /******************************************************* Function: Early suspend function. Input: h: early_suspend struct. Output: None. *******************************************************/ static void goodix_ts_early_suspend(struct early_suspend *h) { struct goodix_ts_data *ts; ts = container_of(h, struct goodix_ts_data, early_suspend); goodix_ts_suspend(ts); } /******************************************************* Function: Late resume function. Input: h: early_suspend struct. Output: None. *******************************************************/ static void goodix_ts_late_resume(struct early_suspend *h) { struct goodix_ts_data *ts; ts = container_of(h, struct goodix_ts_data, early_suspend); goodix_ts_late_resume(ts); } #endif #endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/ #if GTP_ESD_PROTECT /******************************************************* Loading drivers/input/touchscreen/gt9xx/gt9xx.h +12 −6 Original line number Diff line number Diff line Loading @@ -36,7 +36,11 @@ #include <linux/regulator/consumer.h> #include <linux/firmware.h> #include <linux/debugfs.h> #if defined(CONFIG_HAS_EARLYSUSPEND) #if defined(CONFIG_FB) #include <linux/notifier.h> #include <linux/fb.h> #elif defined(CONFIG_HAS_EARLYSUSPEND) #include <linux/earlysuspend.h> #define GOODIX_SUSPEND_LEVEL 1 #endif Loading Loading @@ -68,9 +72,6 @@ struct goodix_ts_data { struct hrtimer timer; struct workqueue_struct *goodix_wq; struct work_struct work; #if defined(CONFIG_HAS_EARLYSUSPEND) struct early_suspend early_suspend; #endif s32 irq_is_disabled; s32 use_irq; u16 abs_x_max; Loading @@ -90,6 +91,11 @@ struct goodix_ts_data { struct regulator *avdd; struct regulator *vdd; struct regulator *vcc_i2c; #if defined(CONFIG_FB) struct notifier_block fb_notif; #elif defined(CONFIG_HAS_EARLYSUSPEND) struct early_suspend early_suspend; #endif }; extern u16 show_len; Loading @@ -100,8 +106,8 @@ extern u16 total_len; #define GTP_CHANGE_X2Y 0 #define GTP_DRIVER_SEND_CFG 1 #define GTP_HAVE_TOUCH_KEY 1 #define GTP_POWER_CTRL_SLEEP 1 #define GTP_ICS_SLOT_REPORT 0 #define GTP_POWER_CTRL_SLEEP 0 #define GTP_ICS_SLOT_REPORT 1 /* auto updated by .bin file as default */ #define GTP_AUTO_UPDATE 0 Loading Loading
drivers/input/touchscreen/gt9xx/gt9xx.c +97 −25 Original line number Diff line number Diff line Loading @@ -97,7 +97,10 @@ static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms); static void gtp_int_sync(struct goodix_ts_data *ts, int ms); static int gtp_i2c_test(struct i2c_client *client); #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_FB) static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data); #elif defined(CONFIG_HAS_EARLYSUSPEND) static void goodix_ts_early_suspend(struct early_suspend *h); static void goodix_ts_late_resume(struct early_suspend *h); #endif Loading Loading @@ -772,7 +775,7 @@ static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms) #endif } #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB) #if GTP_SLIDE_WAKEUP /******************************************************* Function: Loading Loading @@ -877,16 +880,12 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts) GTP_DEBUG_FUNC(); #if GTP_POWER_CTRL_SLEEP while (retry++ < 5) { gtp_reset_guitar(ts, 20); ret = gtp_send_cfg(ts); if (ret > 0) { dev_dbg(&ts->client->dev, "Wakeup sleep send config success."); continue; } dev_dbg(&ts->client->dev, "GTP Wakeup!"); return 1; } #else Loading Loading @@ -927,7 +926,7 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts) dev_err(&ts->client->dev, "GTP wakeup sleep failed.\n"); return ret; } #endif /* !CONFIG_HAS_EARLYSUSPEND */ #endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/ /******************************************************* Function: Loading Loading @@ -1790,6 +1789,20 @@ static int goodix_ts_probe(struct i2c_client *client, goto exit_free_inputdev; } #if defined(CONFIG_FB) ts->fb_notif.notifier_call = fb_notifier_callback; ret = fb_register_client(&ts->fb_notif); if (ret) dev_err(&ts->client->dev, "Unable to register fb_notifier: %d\n", ret); #elif defined(CONFIG_HAS_EARLYSUSPEND) ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; ts->early_suspend.suspend = goodix_ts_early_suspend; ts->early_suspend.resume = goodix_ts_late_resume; register_early_suspend(&ts->early_suspend); #endif ts->goodix_wq = create_singlethread_workqueue("goodix_wq"); INIT_WORK(&ts->work, goodix_ts_work_func); Loading Loading @@ -1817,6 +1830,13 @@ static int goodix_ts_probe(struct i2c_client *client, init_done = true; return 0; exit_free_irq: #if defined(CONFIG_FB) if (fb_unregister_client(&ts->fb_notif)) dev_err(&client->dev, "Error occurred while unregistering fb_notifier.\n"); #elif defined(CONFIG_HAS_EARLYSUSPEND) unregister_early_suspend(&ts->early_suspend); #endif if (ts->use_irq) free_irq(client->irq, ts); else Loading Loading @@ -1860,7 +1880,11 @@ static int goodix_ts_remove(struct i2c_client *client) struct goodix_ts_data *ts = i2c_get_clientdata(client); GTP_DEBUG_FUNC(); #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_FB) if (fb_unregister_client(&ts->fb_notif)) dev_err(&client->dev, "Error occurred while unregistering fb_notifier.\n"); #elif defined(CONFIG_HAS_EARLYSUSPEND) unregister_early_suspend(&ts->early_suspend); #endif Loading Loading @@ -1905,7 +1929,7 @@ static int goodix_ts_remove(struct i2c_client *client) return 0; } #ifdef CONFIG_HAS_EARLYSUSPEND #if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_FB) /******************************************************* Function: Early suspend function. Loading @@ -1914,12 +1938,9 @@ Input: Output: None. *******************************************************/ static void goodix_ts_early_suspend(struct early_suspend *h) static void goodix_ts_suspend(struct goodix_ts_data *ts) { struct goodix_ts_data *ts; s8 ret = -1; ts = container_of(h, struct goodix_ts_data, early_suspend); int ret = -1; GTP_DEBUG_FUNC(); Loading Loading @@ -1953,12 +1974,9 @@ Input: Output: None. *******************************************************/ static void goodix_ts_late_resume(struct early_suspend *h) static void goodix_ts_resume(struct goodix_ts_data *ts) { struct goodix_ts_data *ts; s8 ret = -1; ts = container_of(h, struct goodix_ts_data, early_suspend); int ret = -1; GTP_DEBUG_FUNC(); Loading @@ -1969,7 +1987,7 @@ static void goodix_ts_late_resume(struct early_suspend *h) #endif if (ret < 0) dev_err(&ts->client->dev, "GTP later resume failed.\n"); dev_err(&ts->client->dev, "GTP resume failed.\n"); if (ts->use_irq) gtp_irq_enable(ts); Loading @@ -1982,7 +2000,61 @@ static void goodix_ts_late_resume(struct early_suspend *h) gtp_esd_switch(ts->client, SWITCH_ON); #endif } #if defined(CONFIG_FB) static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data) { struct fb_event *evdata = data; int *blank; struct goodix_ts_data *ts = container_of(self, struct goodix_ts_data, fb_notif); if (evdata && evdata->data && event == FB_EVENT_BLANK && ts && ts->client) { blank = evdata->data; if (*blank == FB_BLANK_UNBLANK) goodix_ts_resume(ts); else if (*blank == FB_BLANK_POWERDOWN) goodix_ts_suspend(ts); } return 0; } #elif defined(CONFIG_HAS_EARLYSUSPEND) /******************************************************* Function: Early suspend function. Input: h: early_suspend struct. Output: None. *******************************************************/ static void goodix_ts_early_suspend(struct early_suspend *h) { struct goodix_ts_data *ts; ts = container_of(h, struct goodix_ts_data, early_suspend); goodix_ts_suspend(ts); } /******************************************************* Function: Late resume function. Input: h: early_suspend struct. Output: None. *******************************************************/ static void goodix_ts_late_resume(struct early_suspend *h) { struct goodix_ts_data *ts; ts = container_of(h, struct goodix_ts_data, early_suspend); goodix_ts_late_resume(ts); } #endif #endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/ #if GTP_ESD_PROTECT /******************************************************* Loading
drivers/input/touchscreen/gt9xx/gt9xx.h +12 −6 Original line number Diff line number Diff line Loading @@ -36,7 +36,11 @@ #include <linux/regulator/consumer.h> #include <linux/firmware.h> #include <linux/debugfs.h> #if defined(CONFIG_HAS_EARLYSUSPEND) #if defined(CONFIG_FB) #include <linux/notifier.h> #include <linux/fb.h> #elif defined(CONFIG_HAS_EARLYSUSPEND) #include <linux/earlysuspend.h> #define GOODIX_SUSPEND_LEVEL 1 #endif Loading Loading @@ -68,9 +72,6 @@ struct goodix_ts_data { struct hrtimer timer; struct workqueue_struct *goodix_wq; struct work_struct work; #if defined(CONFIG_HAS_EARLYSUSPEND) struct early_suspend early_suspend; #endif s32 irq_is_disabled; s32 use_irq; u16 abs_x_max; Loading @@ -90,6 +91,11 @@ struct goodix_ts_data { struct regulator *avdd; struct regulator *vdd; struct regulator *vcc_i2c; #if defined(CONFIG_FB) struct notifier_block fb_notif; #elif defined(CONFIG_HAS_EARLYSUSPEND) struct early_suspend early_suspend; #endif }; extern u16 show_len; Loading @@ -100,8 +106,8 @@ extern u16 total_len; #define GTP_CHANGE_X2Y 0 #define GTP_DRIVER_SEND_CFG 1 #define GTP_HAVE_TOUCH_KEY 1 #define GTP_POWER_CTRL_SLEEP 1 #define GTP_ICS_SLOT_REPORT 0 #define GTP_POWER_CTRL_SLEEP 0 #define GTP_ICS_SLOT_REPORT 1 /* auto updated by .bin file as default */ #define GTP_AUTO_UPDATE 0 Loading