Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp954064imm; Sun, 2 Sep 2018 05:03:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaCNytAS/JQ3W+rAdcXRnm5Fwxrc1cugG8zBw47BlBQ6tAjW0BFHUS0tegnuCpXFsJURpIe X-Received: by 2002:a17:902:127:: with SMTP id 36-v6mr24253784plb.178.1535889796662; Sun, 02 Sep 2018 05:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535889796; cv=none; d=google.com; s=arc-20160816; b=RfHdPc+OPH9sQH9L5BitheQINKzAkEvGOKuVNZDvtSU8r7N9Hs20vz809DZ6d6h7+p wuEUsqt0HGCj86AHdOdc+b46dnMV0WBJt3SOU8DIvVcO5fz+dvwh/pxMQPzjO1xXqROp S40O1ifvTlFDpsvZo3Q8KTvL4YrUPqz+RR19DFbk/9nZ1xc15//4cM2Xjc3x9W9Qwqmx Tsph80+QO6LYpwFvYWVfA7UHGrai0NWWcstZykf4uWtp6r/RcXQ/NhnD2NWsdoAKFfkk zs+y/+Fj+lfPI+qp5DkUwzmSguDPN2kFDa28selEYXa5fWZ9K8dPylPl8LaBOlyhdbvK 4STA== 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:arc-authentication-results; bh=zkxcSX1fd31Ac1/bkMQxVn2eohd4FxaklKfjNOTKHT8=; b=LuIkbzsB5KrvoLXZjeQrs9zmwziM94HWEbO5ELx0af59Z0P/JjmHtnhKWQcKafRWJJ LcwyzijUlWFTufXBmZ2nl9szAf084ECS8ttjgvxdbnUOB3naHR33UOzhDHxO6g233Bpx 1YL7GitKvQYlxZykkET2r/483gCrgC0FKihOp4X2vRl2qL4JlLYRUI3MsS9cmc/cWktn ZfL7G/3rehdKqa5xkU7tTkXfKOnRQoE1sVnKoRUGuyXw1FK0rRR6q0vs1P0/DJ5Yove4 P6uWir0Dx9W6VeBXr9Vm2tBTb65oNTYXib3h6ZN9YhjrYKWjwNdQRJhZnT6mFDha2FJC 9GIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VbCg7NUC; 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 d1-v6si14397673pgj.353.2018.09.02.05.02.50; Sun, 02 Sep 2018 05:03:16 -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=VbCg7NUC; 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 S1726991AbeIBQQa (ORCPT + 99 others); Sun, 2 Sep 2018 12:16:30 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:41466 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbeIBQQa (ORCPT ); Sun, 2 Sep 2018 12:16:30 -0400 Received: by mail-lj1-f194.google.com with SMTP id y17-v6so13283588ljy.8; Sun, 02 Sep 2018 05:00:54 -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=zkxcSX1fd31Ac1/bkMQxVn2eohd4FxaklKfjNOTKHT8=; b=VbCg7NUCtCwgM3+cZ4ykWxgfPP9xFm+TtAr3VAPI3B1FsTzNop/YaS2pUOB6HGcpOp QOodVLCXXMgRI1PJIUFY6JORGEqIZgU33wPcF4V+8oCg3FydEDNhgpICAMwCjmnx8WGT AMD8OTiz0/SO7O10et6qyczcG3Ti98ySpwhZR3lWh4dVweAXeMDWWcx5/qdsqIdprwnZ EAPGMpi+YwLMWwDiBDiauUCyTiQoX/G/Ecg6Crj8pSQfT7j5k3oesEPLLUQCfjPE/eUH iEw2h9gSpcX687HulJeWks9Ik3mGun8+VPFPs39gyZNIIhS6w+EyccqWL3f29sKDPQzi eSYw== 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=zkxcSX1fd31Ac1/bkMQxVn2eohd4FxaklKfjNOTKHT8=; b=PgqBLnO4mZmJjklFejl/VyMag0kXhjJsKaNWgomMnnrES/RDfTLjOYUdLEhuxWI1FD 7IfCj+OSp9ScaI1SmNXZh+i4rImchHTgjVzRjwPds7pd2yHODLNDGBuJZ7e6qJxvEkRT tPxNTidj2l11h5XvBxJkTK3/hRgS1FwUnNEiGyaspkt2ky2NJ/HgNSfpxA8vwSqnzNPt fPjHSzty8y2xqdMUsmgZtc7joNR7i7Sbr2VZp4BWXFP7SR9+P8Bz/5ZSIM5n7SXoTPum D39p7m7G3FDqweGXjNCIo1PoM2hehkqWziLBjhtqDUdaHvJMFajAvzcteZUS5RVWC/Zt ik0Q== X-Gm-Message-State: APzg51DuGocd0IOoRcx1PLntXxeX4wqeX06OKrlDpPWIXIx6fxistvTU GY/6EXYgx9bvs+pxbbvJ+bs= X-Received: by 2002:a2e:5296:: with SMTP id n22-v6mr15856519lje.54.1535889654112; Sun, 02 Sep 2018 05:00:54 -0700 (PDT) Received: from localhost.localdomain (apn-37-248-210-194.dynamic.gprs.plus.pl. [37.248.210.194]) by smtp.gmail.com with ESMTPSA id n3-v6sm2760321lji.96.2018.09.02.05.00.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Sep 2018 05:00:53 -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 , 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, Janusz Krzysztofik , Sebastien Bourdelin , Lukas Wunner , Rojhalat Ibrahim , Russell King , Tony Lindgren , Yegor Yefremov , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH v7 0/4] gpiolib: speed up GPIO array processing Date: Sun, 2 Sep 2018 14:01:40 +0200 Message-Id: <20180902120144.6855-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180831225616.29221-1-jmkrzyszt@gmail.com> References: <20180831225616.29221-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: 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 | 273 ++++++++++++++++++++++------ 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 | 10 - drivers/phy/motorola/phy-mapphone-mdm6600.c | 17 - drivers/staging/iio/adc/ad7606.c | 12 - drivers/tty/serial/serial_mctrl_gpio.c | 9 include/linux/gpio/consumer.h | 35 ++- 16 files changed, 396 insertions(+), 201 deletions(-)