From patchwork Tue Aug 30 09:18:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9305123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57D84607F0 for ; Tue, 30 Aug 2016 09:20:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46067287A0 for ; Tue, 30 Aug 2016 09:20:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A19228B55; Tue, 30 Aug 2016 09:20:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A4ADA287A0 for ; Tue, 30 Aug 2016 09:20:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1befBr-0002jt-Pn; Tue, 30 Aug 2016 09:18:43 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1befBn-0002dQ-86 for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2016 09:18:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=TarN23in1XDY7HFA+0g3pyGYiKn21zIb/G2KF2k7wOo=; b=n6A4BML9QorAnNUmkG2TbiSVmTfFGSgvl5hcBOzIAJmevr3qBMZhlGrv0fD2BOU+OoXe6u5gG8/7pSk2HdD/GQITD070ozF7rTYzPVdUXQnGah3yjKCbrnoqr44jg8hddREfdYi7DBc0suQmi+1zEXxcRW4OArGnjIOvLCkTD0Q=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:44027) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1befBL-0003sg-4r; Tue, 30 Aug 2016 10:18:11 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1befBH-000345-FT; Tue, 30 Aug 2016 10:18:07 +0100 Date: Tue, 30 Aug 2016 10:18:06 +0100 From: Russell King - ARM Linux To: Robert Jarzmik Subject: Re: [PATCH 05/33] gpio: add generic single-register fixed-direction GPIO driver Message-ID: <20160830091805.GL1041@n2100.armlinux.org.uk> References: <20160829102328.GA28796@n2100.armlinux.org.uk> <87eg57e54l.fsf@belgarion.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87eg57e54l.fsf@belgarion.home> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160830_021839_629898_8DCA1AF5 X-CRM114-Status: GOOD ( 15.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Courbot , Linus Walleij , linux-pcmcia@lists.infradead.org, Haojian Zhuang , linux-gpio@vger.kernel.org, Kristoffer Ericson , linux-arm-kernel@lists.infradead.org, Daniel Mack Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Aug 29, 2016 at 09:39:54PM +0200, Robert Jarzmik wrote: > Maybe this one would deserve a doxygen comment ? Does this solve it? Reviewed-by: Robert Jarzmik Tested-by: Linus Walleij [for Compaq iPAQ H3600] diff --git a/drivers/gpio/gpio-reg.c b/drivers/gpio/gpio-reg.c index fc7e0a395f9f..b91488ec122c 100644 --- a/drivers/gpio/gpio-reg.c +++ b/drivers/gpio/gpio-reg.c @@ -1,3 +1,12 @@ +/* + * gpio-reg: single register individually fixed-direction GPIOs + * + * Copyright (C) 2016 Russell King + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + */ #include #include #include @@ -87,6 +96,22 @@ static void gpio_reg_set_multiple(struct gpio_chip *gc, unsigned long *mask, spin_unlock_irqrestore(&r->lock, flags); } +/** + * gpio_reg_init - add a fixed in/out register as gpio + * @dev: optional struct device associated with this register + * @base: start gpio number, or -1 to allocate + * @num: number of GPIOs, maximum 32 + * @label: GPIO chip label + * @direction: bitmask of fixed direction, one per GPIO signal, 1 = in + * @def_out: initial GPIO output value + * @names: array of %num strings describing each GPIO signal + * + * Add a single-register GPIO device containing up to 32 GPIO signals, + * where each GPIO has a fixed input or output configuration. Only + * input GPIOs are assumed to be readable from the register, and only + * then after a double-read. Output values are assumed not to be + * readable. + */ struct gpio_chip *gpio_reg_init(struct device *dev, void __iomem *reg, int base, int num, const char *label, u32 direction, u32 def_out, const char *const *names)