From mboxrd@z Thu Jan 1 00:00:00 1970 From: stigge@antcom.de (Roland Stigge) Date: Fri, 28 Sep 2012 11:52:22 +0200 Subject: [PATCH RFC 1/2] gpio: Add a block GPIO API to gpiolib In-Reply-To: References: <1348780923-27428-1-git-send-email-stigge@antcom.de> Message-ID: <50657356.4010801@antcom.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 09/28/2012 11:14 AM, Linus Walleij wrote: >> @@ -686,6 +731,13 @@ read-only attributes: >> >> "ngpio" ... how many GPIOs this manges (N to N + ngpio - 1) >> >> + "block" ... get/set Block GPIO: >> + * reads: space separated list of GPIO inputs of this chip that >> + are set to 1, e.g. "83 85 87 99" >> + * write: space separated list of GPIO outputs of this chip >> + that are to be set or cleared, e.g. "80 -83 -85" (prefix >> + "-" clears) > > This sort of breaks the sysfs convention of one value per file, > does it not? > > It's not like I have some better idea, just we need to think about > other possible solutions. > > The GPIO sysfs interface is not universally liked. What are the > typical applications you have for this? Industrial control by > bit-banging userspace processes? Yes, I had several projects in the past with the need of setting groups of GPIOs at once (typically, 8 bit busses via GPIO lines), so needed to provide some hacks. Don't want to do this over and over again. :-) Bit-banging in kernel and userspace. It's hard to do the one-value-per-file right for a several-gpios-at-once goal. :-) I originally had a one-value solution: A bit map, continuously hex coded, like in the original kernel API idea (e.g. 0x000F0A0010). Wasn't sure because it encodes GPIO numbers in a weird way. Strictly formally: Isn't a comma-separated list of a GPIO block (e.g. "80,81,85") a singe value in a sense? :-) Or other possibilities? Maybe some node in /proc? Or some kind of new character device node? Otherwise, I need to think about leaving out the sysfs for this purpose. Thanks in advance, Roland From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756714Ab2I1JwZ (ORCPT ); Fri, 28 Sep 2012 05:52:25 -0400 Received: from antcom.de ([188.40.178.216]:40950 "EHLO chuck.antcom.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753858Ab2I1JwY (ORCPT ); Fri, 28 Sep 2012 05:52:24 -0400 Message-ID: <50657356.4010801@antcom.de> Date: Fri, 28 Sep 2012 11:52:22 +0200 From: Roland Stigge Organization: ANTCOM IT Research & Development User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.5) Gecko/20120624 Icedove/10.0.5 MIME-Version: 1.0 To: Linus Walleij CC: Grant Likely , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, w.sang@pengutronix.de, jbe@pengutronix.de, Bill Gatliff , Jean-Christophe PLAGNIOL-VILLARD Subject: Re: [PATCH RFC 1/2] gpio: Add a block GPIO API to gpiolib References: <1348780923-27428-1-git-send-email-stigge@antcom.de> In-Reply-To: X-Enigmail-Version: 1.4 OpenPGP: url=subkeys.pgp.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/28/2012 11:14 AM, Linus Walleij wrote: >> @@ -686,6 +731,13 @@ read-only attributes: >> >> "ngpio" ... how many GPIOs this manges (N to N + ngpio - 1) >> >> + "block" ... get/set Block GPIO: >> + * reads: space separated list of GPIO inputs of this chip that >> + are set to 1, e.g. "83 85 87 99" >> + * write: space separated list of GPIO outputs of this chip >> + that are to be set or cleared, e.g. "80 -83 -85" (prefix >> + "-" clears) > > This sort of breaks the sysfs convention of one value per file, > does it not? > > It's not like I have some better idea, just we need to think about > other possible solutions. > > The GPIO sysfs interface is not universally liked. What are the > typical applications you have for this? Industrial control by > bit-banging userspace processes? Yes, I had several projects in the past with the need of setting groups of GPIOs at once (typically, 8 bit busses via GPIO lines), so needed to provide some hacks. Don't want to do this over and over again. :-) Bit-banging in kernel and userspace. It's hard to do the one-value-per-file right for a several-gpios-at-once goal. :-) I originally had a one-value solution: A bit map, continuously hex coded, like in the original kernel API idea (e.g. 0x000F0A0010). Wasn't sure because it encodes GPIO numbers in a weird way. Strictly formally: Isn't a comma-separated list of a GPIO block (e.g. "80,81,85") a singe value in a sense? :-) Or other possibilities? Maybe some node in /proc? Or some kind of new character device node? Otherwise, I need to think about leaving out the sysfs for this purpose. Thanks in advance, Roland