input: misc: hbtp-input: Support for FB_BLANK_NORMAL event

Add support for handling FB_BLANK_NORMAL event.

Change-Id: Ifd3c1c1eb2e1101bfcd354252711eb67fc362c57
Signed-off-by: Alex Sarraf <asarraf@codeaurora.org>
This commit is contained in:
Alex Sarraf 2017-04-11 12:54:46 -07:00 committed by Mohan Pallaka
parent 7d78f564eb
commit 94432569a4

View file

@ -62,7 +62,7 @@ struct hbtp_data {
u32 ts_pinctrl_seq_delay; u32 ts_pinctrl_seq_delay;
u32 ddic_pinctrl_seq_delay[HBTP_PINCTRL_DDIC_SEQ_NUM]; u32 ddic_pinctrl_seq_delay[HBTP_PINCTRL_DDIC_SEQ_NUM];
u32 fb_resume_seq_delay; u32 fb_resume_seq_delay;
bool lcd_on; int lcd_state;
bool power_suspended; bool power_suspended;
bool power_sync_enabled; bool power_sync_enabled;
bool power_sig_enabled; bool power_sig_enabled;
@ -108,6 +108,7 @@ static int fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data) unsigned long event, void *data)
{ {
int blank; int blank;
int lcd_state;
struct fb_event *evdata = data; struct fb_event *evdata = data;
struct fb_info *fbi = NULL; struct fb_info *fbi = NULL;
struct hbtp_data *hbtp_data = struct hbtp_data *hbtp_data =
@ -133,27 +134,32 @@ static int fb_notifier_callback(struct notifier_block *self,
(event == FB_EARLY_EVENT_BLANK || (event == FB_EARLY_EVENT_BLANK ||
event == FB_R_EARLY_EVENT_BLANK)) { event == FB_R_EARLY_EVENT_BLANK)) {
blank = *(int *)(evdata->data); blank = *(int *)(evdata->data);
lcd_state = hbtp->lcd_state;
if (event == FB_EARLY_EVENT_BLANK) { if (event == FB_EARLY_EVENT_BLANK) {
if (blank == FB_BLANK_UNBLANK) { if (blank <= FB_BLANK_NORMAL &&
lcd_state == FB_BLANK_POWERDOWN) {
pr_debug("%s: receives EARLY_BLANK:UNBLANK\n", pr_debug("%s: receives EARLY_BLANK:UNBLANK\n",
__func__); __func__);
hbtp_data->lcd_on = true;
hbtp_fb_early_resume(hbtp_data); hbtp_fb_early_resume(hbtp_data);
} else if (blank == FB_BLANK_POWERDOWN) { } else if (blank == FB_BLANK_POWERDOWN &&
lcd_state <= FB_BLANK_NORMAL) {
pr_debug("%s: receives EARLY_BLANK:POWERDOWN\n", pr_debug("%s: receives EARLY_BLANK:POWERDOWN\n",
__func__); __func__);
hbtp_data->lcd_on = false; } else {
pr_debug("%s: receives EARLY_BLANK:%d in %d state\n",
__func__, blank, lcd_state);
} }
} else if (event == FB_R_EARLY_EVENT_BLANK) { } else if (event == FB_R_EARLY_EVENT_BLANK) {
if (blank == FB_BLANK_UNBLANK) { if (blank <= FB_BLANK_NORMAL) {
pr_debug("%s: receives R_EARLY_BALNK:UNBLANK\n", pr_debug("%s: receives R_EARLY_BALNK:UNBLANK\n",
__func__); __func__);
hbtp_data->lcd_on = false;
hbtp_fb_suspend(hbtp_data); hbtp_fb_suspend(hbtp_data);
} else if (blank == FB_BLANK_POWERDOWN) { } else if (blank == FB_BLANK_POWERDOWN) {
pr_debug("%s: receives R_EARLY_BALNK:POWERDOWN\n", pr_debug("%s: receives R_EARLY_BALNK:POWERDOWN\n",
__func__); __func__);
hbtp_data->lcd_on = true; } else {
pr_debug("%s: receives R_EARLY_BALNK:%d in %d state\n",
__func__, blank, lcd_state);
} }
} }
} }
@ -161,13 +167,20 @@ static int fb_notifier_callback(struct notifier_block *self,
if (evdata->data && hbtp_data && if (evdata->data && hbtp_data &&
event == FB_EVENT_BLANK) { event == FB_EVENT_BLANK) {
blank = *(int *)(evdata->data); blank = *(int *)(evdata->data);
if (blank == FB_BLANK_POWERDOWN) { lcd_state = hbtp->lcd_state;
if (blank == FB_BLANK_POWERDOWN &&
lcd_state <= FB_BLANK_NORMAL) {
pr_debug("%s: receives BLANK:POWERDOWN\n", __func__); pr_debug("%s: receives BLANK:POWERDOWN\n", __func__);
hbtp_fb_suspend(hbtp_data); hbtp_fb_suspend(hbtp_data);
} else if (blank == FB_BLANK_UNBLANK) { } else if (blank <= FB_BLANK_NORMAL &&
lcd_state == FB_BLANK_POWERDOWN) {
pr_debug("%s: receives BLANK:UNBLANK\n", __func__); pr_debug("%s: receives BLANK:UNBLANK\n", __func__);
hbtp_fb_resume(hbtp_data); hbtp_fb_resume(hbtp_data);
} else {
pr_debug("%s: receives BLANK:%d in %d state\n",
__func__, blank, lcd_state);
} }
hbtp_data->lcd_state = blank;
} }
return 0; return 0;
} }