From patchwork Fri Sep 20 20:17:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20484 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9E08A25DFC for ; Fri, 20 Sep 2013 20:17:45 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l4sf806770yen.2 for ; Fri, 20 Sep 2013 13:17:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=+knzseKpu0xBI08H0yLRliv5IuDU0APKTwUKwGYhKb4=; b=PcRKooK2sI7oF1wNEMn0RKgRX/fZJ/HFSPTvEmAwYvnBa8GreTtn9kMorxBf942Y0p R72D56RykpFE0ZKXCXHZeezvLdhD6xgxmmThGDQCX5YifoVEOWrnKU0JmYpqKXHvtLjT AdIh/6vjw8hRZTeSXr5y99Tj6xobRZ4Mt+LfLGgWCACtTnqbUQr3UkFoklAIqeG6WePI 6M5kwdQlYNlmTDUhyYEPKt5u2CciUGo8UOkG/KWwdxzJT78M/8wgTbTjPQJRGZuN2BID LrzN0vKpSEnSicRs5j07ZbfWThWMmhYleOgskEqbVAFMalvrg6lmrelZ0qxml4j1lDc8 19SQ== X-Gm-Message-State: ALoCoQmsAvip7/EhoN7XE2/QfKCZvMRcPibeSyKw7xhvQ0/j2qzoJnbf6891ItK+DhUhU66K2qoJ X-Received: by 10.224.7.129 with SMTP id d1mr3166428qad.6.1379708265428; Fri, 20 Sep 2013 13:17:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.84.201 with SMTP id b9ls377596qez.62.gmail; Fri, 20 Sep 2013 13:17:45 -0700 (PDT) X-Received: by 10.52.98.131 with SMTP id ei3mr6770116vdb.4.1379708265180; Fri, 20 Sep 2013 13:17:45 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id ee5si3404075vec.2.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:17:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id oy12so747623veb.13 for ; Fri, 20 Sep 2013 13:17:45 -0700 (PDT) X-Received: by 10.220.13.20 with SMTP id z20mr8062731vcz.0.1379708265051; Fri, 20 Sep 2013 13:17:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp36799vcz; Fri, 20 Sep 2013 13:17:44 -0700 (PDT) X-Received: by 10.14.241.74 with SMTP id f50mr13151824eer.29.1379708264068; Fri, 20 Sep 2013 13:17:44 -0700 (PDT) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) by mx.google.com with ESMTPS id h5si12603740eeg.320.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:17:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.176 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.176; Received: by mail-ea0-f176.google.com with SMTP id q16so481304ead.7 for ; Fri, 20 Sep 2013 13:17:43 -0700 (PDT) X-Received: by 10.14.208.194 with SMTP id q42mr13043504eeo.31.1379708263527; Fri, 20 Sep 2013 13:17:43 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id bn13sm21945802eeb.11.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:17:42 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lennert Buytenhek , Dan Williams , Mikael Pettersson , Aaro Koskinen Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 3/8] ARM: iop32x: read N2100 power key using gpiolib Date: Fri, 20 Sep 2013 22:17:39 +0200 Message-Id: <1379708259-7928-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Refrain from using the custom gpio_line_get() to read the power key on the N2100, use the gpiolib function gpio_get() instead. Also request the line in the GPIOs initicall, and move the poll timer setup to that inicall so the gpio chip is available before we request this GPIO and start to poll it. Cc: Aaro Koskinen Cc: Lennert Buytenhek Cc: Dan Williams Cc: Mikael Pettersson Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Move the setup and poll init into the new GPIO initialization function to avoid probe order problems. --- arch/arm/mach-iop32x/n2100.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 6bace5b..bc40a97 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c @@ -306,7 +306,7 @@ static struct timer_list power_button_poll_timer; static void power_button_poll(unsigned long dummy) { - if (gpio_line_get(N2100_POWER_BUTTON) == 0) { + if (gpio_get_value(N2100_POWER_BUTTON) == 0) { ctrl_alt_del(); return; } @@ -325,6 +325,20 @@ static int __init n2100_request_gpios(void) ret = gpio_request(N2100_HARDWARE_RESET, "reset"); if (ret) pr_err("could not request reset GPIO\n"); + + ret = gpio_request(N2100_POWER_BUTTON, "power"); + if (ret) + pr_err("could not request power GPIO\n"); + else { + ret = gpio_direction_input(N2100_POWER_BUTTON); + if (ret) + pr_err("could not set power GPIO as input\n"); + } + /* Set up power button poll timer */ + init_timer(&power_button_poll_timer); + power_button_poll_timer.function = power_button_poll; + power_button_poll_timer.expires = jiffies + (HZ / 10); + add_timer(&power_button_poll_timer); return 0; } device_initcall(n2100_request_gpios); @@ -341,11 +355,6 @@ static void __init n2100_init_machine(void) ARRAY_SIZE(n2100_i2c_devices)); pm_power_off = n2100_power_off; - - init_timer(&power_button_poll_timer); - power_button_poll_timer.function = power_button_poll; - power_button_poll_timer.expires = jiffies + (HZ / 10); - add_timer(&power_button_poll_timer); } MACHINE_START(N2100, "Thecus N2100")