From patchwork Fri Dec 14 16:19:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13592 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 35ED723FB4 for ; Fri, 14 Dec 2012 16:19:59 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id D931AA19D58 for ; Fri, 14 Dec 2012 16:19:58 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so6157688ieb.11 for ; Fri, 14 Dec 2012 08:19:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=0Nfx25vbRHnSqWApmzd/OIhXMiC9Gc6tgXN8gQj/Ca4=; b=pPz/1rJ9JyoGb6/RnaVX9riJeZfy72ld44IRqK/1CLDxLFvVfr0DFhwEdvqiHvXvjf Q4Vi2hS+30V3rYugSRDk6E57uFyAEa7KQEvEHzn7g2X04JRAsqJl2us6EGNOwD9zCdYu DLhAAlp0i+J4hsm91jyoK3cXPlr/d0ZHPcio53nN07AWWAjXE814SDMJDLbSw573Ue2j QrDAeWwFhquZvlyeGOfS6Z8HxVrxE6Mt8dDopeDHrvw4FWeCxASs2oWmwTDihHLEWHBa UPpqWud3OZs77NL+UAf2fKWRoJ7IHCEG7YmOE+tU/3pFnpWXZ419ab00KvgBriP1qsIk cqyA== Received: by 10.43.125.133 with SMTP id gs5mr4937012icc.54.1355501998334; Fri, 14 Dec 2012 08:19:58 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp81585igt; Fri, 14 Dec 2012 08:19:57 -0800 (PST) Received: by 10.180.20.176 with SMTP id o16mr3595683wie.10.1355501997077; Fri, 14 Dec 2012 08:19:57 -0800 (PST) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by mx.google.com with ESMTPS id lm4si3761468wjb.11.2012.12.14.08.19.56 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 08:19:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.173 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.173; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.173 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wi0-f173.google.com with SMTP id hn17so576869wib.0 for ; Fri, 14 Dec 2012 08:19:56 -0800 (PST) Received: by 10.180.78.161 with SMTP id c1mr3621388wix.4.1355501996615; Fri, 14 Dec 2012 08:19:56 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id u6sm8325248wif.2.2012.12.14.08.19.55 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 08:19:55 -0800 (PST) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, Mian Yousaf Kaukab , Lee Jones , Bibek Basu Subject: [PATCH 06/21] gpio: ab8500: Add api to enable pulldown Date: Fri, 14 Dec 2012 16:19:24 +0000 Message-Id: <1355501979-1157-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355501979-1157-1-git-send-email-lee.jones@linaro.org> References: <1355501979-1157-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkoUN+dPU/V1uwv765jmpNVEAaE+XhDZWtnHZ88PFIqtB6Ew1adcQpBq9OP8+BjeuuzUJPO From: Mian Yousaf Kaukab Signed-off-by: Lee Jones Signed-off-by: Bibek Basu Signed-off-by: Mian Yousaf Kaukab Reviewed-by: Jonas ABERG Tested-by: Jonas ABERG --- drivers/gpio/gpio-ab8500.c | 17 +++++++++++++++++ include/linux/mfd/abx500/ab8500-gpio.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/gpio/gpio-ab8500.c b/drivers/gpio/gpio-ab8500.c index dd95cb3..b71bb72 100644 --- a/drivers/gpio/gpio-ab8500.c +++ b/drivers/gpio/gpio-ab8500.c @@ -507,6 +507,23 @@ static int __devexit ab8500_gpio_remove(struct platform_device *pdev) return 0; } +int ab8500_config_pulldown(struct device *dev, + enum ab8500_pin gpio, bool enable) +{ + u8 offset = gpio - AB8500_PIN_GPIO1; + u8 pos = offset % 8; + u8 val = enable ? 0 : 1; + u8 reg = AB8500_GPIO_PUD1_REG + (offset / 8); + int ret; + + ret = abx500_mask_and_set_register_interruptible(dev, + AB8500_MISC, reg, 1 << pos, val << pos); + if (ret < 0) + dev_err(dev, "%s write failed\n", __func__); + return ret; +} +EXPORT_SYMBOL(ab8500_config_pulldown); + /* * ab8500_gpio_config_select() * diff --git a/include/linux/mfd/abx500/ab8500-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h index 94e85ca..48325db 100644 --- a/include/linux/mfd/abx500/ab8500-gpio.h +++ b/include/linux/mfd/abx500/ab8500-gpio.h @@ -67,6 +67,9 @@ enum ab8500_pin { AB8500_PIN_GPIO42, }; +int ab8500_config_pulldown(struct device *dev, + enum ab8500_pin gpio, bool enable); + int ab8500_gpio_config_select(struct device *dev, enum ab8500_pin gpio, bool gpio_select);