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: 664061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sNjcQ4nzTz9sBf for ; Tue, 30 Aug 2016 19:18:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=n6A4BML9; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757635AbcH3JST (ORCPT ); Tue, 30 Aug 2016 05:18:19 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:36012 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757571AbcH3JSR (ORCPT ); Tue, 30 Aug 2016 05:18:17 -0400 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 Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-pcmcia@lists.infradead.org, Alexandre Courbot , Daniel Mack , Haojian Zhuang , Kristoffer Ericson , Linus Walleij 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) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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)