Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp52539imm; Wed, 5 Sep 2018 14:50:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbTEjQczWSylV2uk/P5nUJh6gc6RdeHe79BVcR9/AdXyDk9G28E4a80jovgRhKqxLerkOjO X-Received: by 2002:a17:902:280b:: with SMTP id e11-v6mr41327666plb.298.1536184242238; Wed, 05 Sep 2018 14:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536184242; cv=none; d=google.com; s=arc-20160816; b=jxbWqfMB0Lxm9ji7q/U9B+EM34zV4QP7Yh8ITm6RHMPVkvYxXG6ur5upgROrhJqIBk K+rep8zBXWCNQEtFeGJTTowAZg9ZKQcCrRF8v0ugt+/xsP3iRmyLsmEQNlRT9OTt8jy7 YctC+QKtQ6Mhad3FdzCUFhapqif1vkQRAtoRCgDsaGYOVoGjK0atXBUZMeAd1nIvyHh0 oHr34WoXfT8y1LFhvkGyLWzdki8auwtRsmKccyIY9GVxyp+afQ8RY8lxuhf1z4mN05yN kxpoJG+U3aJjcmms95EX/CG10QnrFBhTs0sY/H9YQHe3itg+CdarYBp85JqzeKA5YVYZ zQ3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=8hxCLv3C1oLbNegsgoZ12jQU9j+QmZm6/DKoXz9Sci8=; b=bdWnHqIhRSwOHr7JKmHYq+Obhw4GzJ63UOTOp90vMZf1cGwFD4pXT8QG90dA661p3K aPz4POBg/0mbezdospXShXC5HGEGhynuFojGvZ6BcLkeJ+zAWxIguE8KZy8rf+h/BHmQ zJEl+37Ct3nTjRWpF5yv7HaNskBO1tVYlU6Nf8CeyIUit9wZ5SmShM93kTytNs5IhIlO 6fFnQdK+neFLH6TVsBHSByJiWMn39yCKbmFQrcPOqfkNBIAufBWrSi7HL9A2ACQAW3n4 6ZP3zbbMCdJUA6jJqhw66Ds6WO9h6EhruwCWeRp/S/TICZ/HCcoZvHMzeOtmbuL4IZJe 9HYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Jis1k8j6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si3013699plt.346.2018.09.05.14.50.26; Wed, 05 Sep 2018 14:50:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Jis1k8j6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727740AbeIFCVU (ORCPT + 99 others); Wed, 5 Sep 2018 22:21:20 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33044 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727069AbeIFCVT (ORCPT ); Wed, 5 Sep 2018 22:21:19 -0400 Received: by mail-lj1-f194.google.com with SMTP id s12-v6so7569604ljj.0; Wed, 05 Sep 2018 14:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8hxCLv3C1oLbNegsgoZ12jQU9j+QmZm6/DKoXz9Sci8=; b=Jis1k8j6uTkZZy6HAK62tmAg/1SMvupz0uoqNanm4wXm+Bh4p5I8Zbdy+TtNys3VgL hCRaQHsX268EwkHlvGZ++i0X4/I7xpuE6Xwhm1vY+lPYlBvt9OEXyqbeVyWWn0wmeF9+ Lj71BoSGKxpT5p5XTPJ1kH61i5Up12dtMlTxaGnf/Hk/oWz0d6+OR6tsv8cjfygv9pvb xIECq4G5+JH0Fsg4jnVK6Zz6RHxZFXy8IIeong51UT8v5TM6mP7jAihFh150BgbeJNkc cY0VPQXndmDXok5Ztld58ybIj2iHGD360JY4K5RcrzSUulxbyPAJbx7R2fYetQ4AZf5U 75aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8hxCLv3C1oLbNegsgoZ12jQU9j+QmZm6/DKoXz9Sci8=; b=hbXmnUn3kJUAbba9pbVTCHsiFpeMmVz5N/j9TOEmSuYvn6FBAi/iucFE6xv2k91ps1 ZuQqnUdxHSkioRubHSyrVelXipqFAHPQBJB91wkUBrsWgXeIv1L6XwOpmSHmto/ZQX98 lwORPAd2Ee7mVQzCCMcVX9Lx5QDXW+eHjpK/tFfKximyJb1J/X/e9htekzFHttCVuYeq mh9vIxO6Pb+ab++VlP1P1tgd2ALmMI7V/aqCOxfOdQQz2f+oRIOOTrRGCDXt2etKAbWZ qRaSb6A/C7XlKuqeCjG/ATauA5kd1ZvUpiWlET42TzXOuShvF5k66cYTiM7I4Z/cwxb7 60zA== X-Gm-Message-State: APzg51B3HZ/JEDeJMg+9/LLilpUZFXNWeEc59FCFZ6Qu7Lbbfs62VvVG WYX1+deNj2TXDHDW6VbFnYY= X-Received: by 2002:a2e:9dc7:: with SMTP id x7-v6mr24911017ljj.142.1536184149018; Wed, 05 Sep 2018 14:49:09 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id i2-v6sm491873lfa.78.2018.09.05.14.49.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 14:49:08 -0700 (PDT) From: Janusz Krzysztofik To: Linus Walleij Cc: Jonathan Corbet , Miguel Ojeda Sandonis , Peter Korsgaard , Peter Rosin , Ulf Hansson , Andrew Lunn , Florian Fainelli , "David S. Miller" , Dominik Brodowski , Greg Kroah-Hartman , Kishon Vijay Abraham I , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Jiri Slaby , Willy Tarreau , Geert Uytterhoeven , Sebastien Bourdelin , Lukas Wunner , Rojhalat Ibrahim , Russell King , Tony Lindgren , Yegor Yefremov , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Janusz Krzysztofik , linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 0/4] gpiolib: speed up GPIO array processing Date: Wed, 5 Sep 2018 23:50:04 +0200 Message-Id: <20180905215008.1649-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180902120144.6855-1-jmkrzyszt@gmail.com> References: <20180902120144.6855-1-jmkrzyszt@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The goal is to boost performance of get/set array functions while processing GPIO arrays which represent pins of a signle chip in hardware order. If resulting performance is close to PIO, GPIO API can be used for data I/O without much loss of speed. Created and tested on a low end Amstrad Delta board with NAND driver updated to use GPIO API for data I/O. Performance degrade compared to PIO is much better than before the optimization though not quite satisfactory on my test hardware. Janusz Krzysztofik (4): gpiolib: Pass bitmaps, not integer arrays, to get/set array gpiolib: Identify arrays matching GPIO hardware gpiolib: Pass array info to get/set array functions gpiolib: Implement fast processing path in get/set array Changelog: v8: [PATCH v8 1/4] gpiolib: Pass bitmaps, not integer arrays, to get/set array: - replace *values with values[0] where applicable - suggessted by Geert Uytterhoeven, thanks, - drop !! from 3rd argument of __assign_bit() where applicable - suggested by Lukas Wunner, thanks, drivers/gpio/gpiolib.c: - s/bitnap/bitmap/ - catched by Lukas Wunner, thanks, drivers/phy/motorola/phy-mapphone-mdm6600.c: - assign ddata->status directly from bitmap, not an intermediate 'val' variable, now used only for debugging purposes, include/linux/gpio/consumer.h: - also update API of inline function replacements used if CONFIG_GPIOLIB is not defined - catched by kbuild test robot, [PATCH v8 3/4] gpiolib: Pass array info to get/set array functions: commit message: - s/bulids/builds/ - catched by Geert Uytterhoeven, thanks, drivers/gpio/gpiolib.c: - add information on array_info arguments to array function descriptions - catched by kbuild test robot, include/linux/gpio/consumer.h: - also update API of inline function replacements used if CONFIG_GPIOLIB is not defined - catched by kbuild test robot. v7: - add more people to Cc: - authors and/or those who contributed most to the drivers in scope of the change, [PATCH v7 1/4] gpiolib: Pass bitmaps, not integer arrays, to get/set: - avoid VLAs, use data source type bit number as bitmap size if not constant - great recommendation by Peter Rosin, thanks, - revert names of local variables declared with DECLARE_BITMAP() from 'value_bitmap' to original names of value arrays they replace (but not 'value_array') - inspired by Peter Rosin suggestion - thanks! drivers/gpio/gpio-max3191x.c: - use bitmap_alloc() to be more consistent with DECLARE_BITMAP() pattern used by other consumers, drivers/phy/motorola/phy-mapphone-mdm6600.c: - no need to mask unused bits of val before its assignment to bitmap, passing PHY_MDM6600_NR_CMD_LINES to gpiod_set_array_value() as array/ bitmap size provides sufficient protection. v6: [PATCH v6 1/4] gpiolib: Pass bitmaps, not integer arrays, to get/set - use DECLARE_BITMAP() macro for declaring value_bitmap - great idea by David Laight, thanks! drivers/auxdisplay/hd44780.c: - simplify the code and adjust comments as recommended by Geert Uytterhoeven - thanks!, drivers/i2c/muxes/i2c-mux-gpio.c: - drop .values member of struct gpiomux - details provided by Peter Rosin, thanks!, drivers/mux/gpio.c: - drop .val member of struct mux_gpio - details provided by Peter Rosin, thanks!, drivers/net/phy/mdio-mux-gpio.c: - drop .values member of struct mdio_mux_gpio_state and its processsing. v5: [PATCH v5 1/4] gpiolib: Pass bitmaps, not integer arrays, to get/set - drivers/i2c/muxes/i2c-mux-gpio.c: - drop assigment of values to struct gpiomux.values, as recommended by Peter Rosin - thanks!, - mark the .values member of the structure as obsolete, - drivers/mux/gpio.c: - drop assigment of values to struct mux_gpio.val, also recommended by Peter Rosin - thanks!, - merk the .val member of the structure as obsolete, - drivers/auxdisplay/hd44780.c: - fix incorrect bitmap size, - use >>= operator to simplify notation, both catched by Miguel Ojeda - thanks!, - add Cc: clauses as well as Acked-by: collected so far. [PATCH v5 2/4] gpiolib: Identify arrays matching GPIO hardware - add Cc: clause. [PATCH v5 3/4] gpiolib: Pass array info to get/set array functions - add Cc: clauses as well as Acked-by: collected so far. [PATCH v5 4/4] gpiolib: Implement fast processing path in get/set - add Cc: clause. v4: That series was a follow up of the former "mtd: rawnand: ams-delta: Use gpio-omap accessors for data I/O" which already contained some changes to gpiolib. Those previous attempts were commented by Borris Brezillon who suggested using GPIO API modified to accept bitmaps, and by Linus Walleij who suggested still more great ideas for further immprovement of the proposed API changes - thanks! diffstat: Documentation/driver-api/gpio/board.rst | 15 + Documentation/driver-api/gpio/consumer.rst | 48 +++- drivers/auxdisplay/hd44780.c | 67 ++---- drivers/bus/ts-nbus.c | 20 - drivers/gpio/gpio-max3191x.c | 16 - drivers/gpio/gpiolib.c | 281 ++++++++++++++++++++++------ drivers/gpio/gpiolib.h | 15 + drivers/i2c/muxes/i2c-mux-gpio.c | 16 - drivers/mmc/core/pwrseq_simple.c | 15 - drivers/mux/gpio.c | 16 - drivers/net/phy/mdio-mux-gpio.c | 13 - drivers/pcmcia/soc_common.c | 9 drivers/phy/motorola/phy-mapphone-mdm6600.c | 19 - drivers/staging/iio/adc/ad7606.c | 12 - drivers/tty/serial/serial_mctrl_gpio.c | 9 include/linux/gpio/consumer.h | 59 ++++- 16 files changed, 420 insertions(+), 210 deletions(-)