From patchwork Fri Sep 13 08:02:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20013 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 348DB20F2F for ; Fri, 13 Sep 2013 08:02:22 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id gd11sf908817vcb.4 for ; Fri, 13 Sep 2013 01:02:21 -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=bF9QlwFGORW7yml8gaFbSy056Vr5Su5Tq6i6H28qzVs=; b=i0lLrYhjJnFXYh1KUnyRbij5nOzeXOKpzwaVAIpK5ORRW+nUaulvS5bfnekGpv9pyt 9UT8h/YoOhxjah9/WxWC3n1PkoB0Y586ncmtWcvEbP9oPHB+ht40QgZjMHHuZDLJDbfU J7VwXp3/K39yoFwftDdZ5zRW1rHERJUwbs/BXJPyYANvESg1qO3p73cCAFMOz/Mx2hQS ZKSwDEipjztI0bL/iWPFfEiDG4c+7Gfg8ApBsefQLSLE4IsNBRa28ondH5Fl5WEJCI2y ebuzSBcVxeWf5ZwNb4wGfyIyam9nIYdwGNzYYD9XiOE0Z0H0F5PPQ6K4T5kQhRWjSE1a 5/BQ== X-Gm-Message-State: ALoCoQl9bc4VGInPcPCYKM5tugNO0Z7qWqEHsBJBmjkGbEX8G1fd/Ygl/7FAG9K4tUAIPs+9x8qA X-Received: by 10.236.13.36 with SMTP id a24mr237637yha.50.1379059341384; Fri, 13 Sep 2013 01:02:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.225 with SMTP id f1ls980423qeo.66.gmail; Fri, 13 Sep 2013 01:02:21 -0700 (PDT) X-Received: by 10.221.32.133 with SMTP id sk5mr432127vcb.27.1379059341162; Fri, 13 Sep 2013 01:02:21 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id se9si2744387vdc.153.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 01:02:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id p13so658581vbe.19 for ; Fri, 13 Sep 2013 01:02:21 -0700 (PDT) X-Received: by 10.52.227.6 with SMTP id rw6mr9056368vdc.19.1379059341029; Fri, 13 Sep 2013 01:02:21 -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 u4csp66572vcz; Fri, 13 Sep 2013 01:02:20 -0700 (PDT) X-Received: by 10.112.64.7 with SMTP id k7mr33214lbs.43.1379059339642; Fri, 13 Sep 2013 01:02:19 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by mx.google.com with ESMTPS id d5si3164512laf.30.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 01:02:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.51 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id lv10so731794lab.10 for ; Fri, 13 Sep 2013 01:02:19 -0700 (PDT) X-Received: by 10.112.51.101 with SMTP id j5mr10784060lbo.17.1379059338913; Fri, 13 Sep 2013 01:02:18 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id n15sm3646321laa.2.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 01:02:18 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lennert Buytenhek , Dan Williams , Mikael Pettersson Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij , Aaro Koskinen Subject: [PATCH 3/8 v2] ARM: iop32x: read N2100 power key using gpiolib Date: Fri, 13 Sep 2013 10:02:07 +0200 Message-Id: <1379059327-12613-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.212.46 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 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 2dba955..dc5addf 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; } @@ -322,6 +322,19 @@ 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); @@ -338,11 +351,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")