From 20a3694d6fcae508a860923f9de4f71235e3c2d4 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Thu, 12 Apr 2012 18:18:24 +0100 Subject: [PATCH] --- yaml --- r: 305482 b: refs/heads/master c: d2aa37411b8e65d57d2c5ae36f0222274292020d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/platform/olpc/olpc-xo1-sci.c | 26 +++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index c6c8039b8b35..d7da38b4891a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 83125a3a189ec34fb22a04e8efad69ae6d52674a +refs/heads/master: d2aa37411b8e65d57d2c5ae36f0222274292020d diff --git a/trunk/arch/x86/platform/olpc/olpc-xo1-sci.c b/trunk/arch/x86/platform/olpc/olpc-xo1-sci.c index 1d4c783d7325..4b93ff46cec3 100644 --- a/trunk/arch/x86/platform/olpc/olpc-xo1-sci.c +++ b/trunk/arch/x86/platform/olpc/olpc-xo1-sci.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -83,8 +84,12 @@ static void send_ebook_state(void) return; } + if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state) + return; /* Nothing new to report. */ + input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state); input_sync(ebook_switch_idev); + pm_wakeup_event(&ebook_switch_idev->dev, 0); } static void flip_lid_inverter(void) @@ -123,8 +128,12 @@ static void detect_lid_state(void) /* Report current lid switch state through input layer */ static void send_lid_state(void) { + if (!!test_bit(SW_LID, lid_switch_idev->sw) == !lid_open) + return; /* Nothing new to report. */ + input_report_switch(lid_switch_idev, SW_LID, !lid_open); input_sync(lid_switch_idev); + pm_wakeup_event(&lid_switch_idev->dev, 0); } static ssize_t lid_wake_mode_show(struct device *dev, @@ -213,11 +222,18 @@ static irqreturn_t xo1_sci_intr(int irq, void *dev_id) dev_dbg(&pdev->dev, "sts %x gpe %x\n", sts, gpe); - if (sts & CS5536_PWRBTN_FLAG && !(sts & CS5536_WAK_FLAG)) { - input_report_key(power_button_idev, KEY_POWER, 1); - input_sync(power_button_idev); - input_report_key(power_button_idev, KEY_POWER, 0); - input_sync(power_button_idev); + if (sts & CS5536_PWRBTN_FLAG) { + if (!(sts & CS5536_WAK_FLAG)) { + /* Only report power button input when it was pressed + * during regular operation (as opposed to when it + * was used to wake the system). */ + input_report_key(power_button_idev, KEY_POWER, 1); + input_sync(power_button_idev); + input_report_key(power_button_idev, KEY_POWER, 0); + input_sync(power_button_idev); + } + /* Report the wakeup event in all cases. */ + pm_wakeup_event(&power_button_idev->dev, 0); } if (gpe & CS5536_GPIOM7_PME_FLAG) { /* EC GPIO */