From patchwork Wed Nov 25 10:53:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 62748 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAPAru69005845 for ; Wed, 25 Nov 2009 10:53:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758556AbZKYKxn (ORCPT ); Wed, 25 Nov 2009 05:53:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934212AbZKYKxm (ORCPT ); Wed, 25 Nov 2009 05:53:42 -0500 Received: from buzzloop.caiaq.de ([212.112.241.133]:58368 "EHLO buzzloop.caiaq.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934121AbZKYKxk (ORCPT ); Wed, 25 Nov 2009 05:53:40 -0500 Received: from localhost (localhost [127.0.0.1]) by buzzloop.caiaq.de (Postfix) with ESMTP id 6A3A37F407B; Wed, 25 Nov 2009 11:53:45 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at buzzloop.caiaq.de Received: from buzzloop.caiaq.de ([127.0.0.1]) by localhost (buzzloop.caiaq.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ETLg6Sl8ZIee; Wed, 25 Nov 2009 11:53:42 +0100 (CET) Received: from localhost.localdomain (pd95699b2.dip0.t-ipconnect.de [217.86.153.178]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by buzzloop.caiaq.de (Postfix) with ESMTPSA id 40E557F407A; Wed, 25 Nov 2009 11:53:42 +0100 (CET) From: Daniel Mack To: linux-input@vger.kernel.org Cc: Daniel Mack , Dmitry Torokhov , Jani Nikula , Mike Rapoport Subject: [PATCH] input_ gpio_keys: scan gpio state at probe time Date: Wed, 25 Nov 2009 11:53:36 +0100 Message-Id: <1259146416-6713-1-git-send-email-daniel@caiaq.de> X-Mailer: git-send-email 1.6.5.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 77d1309..cb5f862 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -171,6 +171,18 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) goto fail2; } + /* get current state of buttons */ + for (i = 0; i < pdata->nbuttons; i++) { + struct gpio_keys_button *button = &pdata->buttons[i]; + int state = !!gpio_get_value(button->gpio) ^ button->active_low; + + if (state) { + unsigned int type = button->type ?: EV_KEY; + input_event(input, type, button->code, !!state); + input_sync(input); + } + } + device_init_wakeup(&pdev->dev, wakeup); return 0;