summaryrefslogtreecommitdiff
path: root/drivers/input/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/hbtp_input.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/input/misc/hbtp_input.c b/drivers/input/misc/hbtp_input.c
index 6d2e7a569044..21898c308075 100644
--- a/drivers/input/misc/hbtp_input.c
+++ b/drivers/input/misc/hbtp_input.c
@@ -109,10 +109,27 @@ static int fb_notifier_callback(struct notifier_block *self,
{
int blank;
struct fb_event *evdata = data;
+ struct fb_info *fbi = NULL;
struct hbtp_data *hbtp_data =
container_of(self, struct hbtp_data, fb_notif);
- if (evdata && evdata->data && hbtp_data &&
+ if (!evdata) {
+ pr_debug("evdata is NULL");
+ return 0;
+ }
+ fbi = evdata->info;
+
+ /*
+ * Node 0 is the primary display and others are
+ * external displays such as HDMI/DP.
+ * We need to handle only fb event for the primary display.
+ */
+ if (!fbi || fbi->node != 0) {
+ pr_debug("%s: no need to handle the fb event", __func__);
+ return 0;
+ }
+
+ if (evdata->data && hbtp_data &&
(event == FB_EARLY_EVENT_BLANK ||
event == FB_R_EARLY_EVENT_BLANK)) {
blank = *(int *)(evdata->data);
@@ -141,7 +158,7 @@ static int fb_notifier_callback(struct notifier_block *self,
}
}
- if (evdata && evdata->data && hbtp_data &&
+ if (evdata->data && hbtp_data &&
event == FB_EVENT_BLANK) {
blank = *(int *)(evdata->data);
if (blank == FB_BLANK_POWERDOWN) {