From patchwork Thu Jul 26 06:11:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benson Leung X-Patchwork-Id: 1240371 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D8DB1DFFCE for ; Thu, 26 Jul 2012 06:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751637Ab2GZGMF (ORCPT ); Thu, 26 Jul 2012 02:12:05 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:52157 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561Ab2GZGME (ORCPT ); Thu, 26 Jul 2012 02:12:04 -0400 Received: by yenl2 with SMTP id l2so1582638yen.19 for ; Wed, 25 Jul 2012 23:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:x-mailer; bh=Gr3HYa78ixOcbvbJRWoWU3Pb6ADHqXBkwzQdyjIkjlw=; b=ZjFnwaPxY3Po50yR7WXx2PeHPISEu68mO30uKxEEYOFZl4Y52o2vRE3VDJsst2OWYb Mg5dQgMn+CZNB9ZoYp8y6IOdwkrNeeBHiy8W1w1loBA8Cgt6/s/TvuhObYUehP6d8asK kE1bF++7KW/KFQCcMQ8KGh0COkDZ/nwX37U+M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=Gr3HYa78ixOcbvbJRWoWU3Pb6ADHqXBkwzQdyjIkjlw=; b=LwUADIYPgw5+8tX43Yyl8HFIvYo3vdxLy2qFoTqrls3stCR4RlAVlQqhTiY9Yz5rYX 8ZW+j1kViaZTjxBgaNu8TC9Ltxkd4WksyK3wEj+Lb6UwUosNrWqoRIfGBugqUBCVKCh5 nTCyH8FZiZ9WgCi8N2eIUGuyohvLJOqPg9lrLGne2YmmPi1zdt/A4uI/nwd93fa1veW+ c/5Pn79qMYNao5IxvUZvB6YlF3/J68IyQi1hSqNaNDvjq2MobxjW1O/uNHQmiUA4jPX3 ZSCcSH+zcqM2bs8nO/0tVyA67+HxY7bjpH8GJu/pCYnblWKYU8J8OO2L62Oa2F5IOzBi zDQg== Received: by 10.68.232.229 with SMTP id tr5mr2308617pbc.101.1343283122728; Wed, 25 Jul 2012 23:12:02 -0700 (PDT) Received: from bleung.mtv.corp.google.com (bleung.mtv.corp.google.com [172.22.72.19]) by mx.google.com with ESMTPS id of1sm15886260pbb.15.2012.07.25.23.12.01 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 23:12:01 -0700 (PDT) From: Benson Leung To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benson Leung Subject: [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup Date: Wed, 25 Jul 2012 23:11:53 -0700 Message-Id: <1343283113-16952-1-git-send-email-bleung@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQmrOiU5QkVQeLOiSb2qpsjw9V14KPYkihXhHUJlTo1mG/F3FUF2P+YoeVPoNtpoyfwqodoE Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org If a button is configured to wake the system, report a pm wakeup event. Signed-off-by: Benson Leung --- drivers/input/keyboard/gpio_keys.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index cbb1add..15a80e2 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -328,9 +328,13 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) { const struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; + struct device *dev = input->dev.parent; unsigned int type = button->type ?: EV_KEY; int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; + if (button->wakeup && device_may_wakeup(dev)) + pm_wakeup_event(dev, 0); + if (type == EV_ABS) { if (state) input_event(input, type, button->code, button->value);