[PATCH v3 0/7] selftests: gpio: rework and port to GPIO uAPI v2

2021-01-19 Thread Kent Gibson
ention or mitigation including the wait in release_line, the retries in assert_mock, the assert_mock in set_mock, and the sleep in set_line Kent Gibson (7): selftests: gpio: rework and simplify test implementation selftests: gpio: remove obsolete gpio-mockup-chardev.c selftests:

[PATCH v3 3/7] selftests: remove obsolete build restriction for gpio

2021-01-19 Thread Kent Gibson
Build restrictions related to the gpio-mockup-chardev helper are no longer relevant so remove them. Signed-off-by: Kent Gibson Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- tools/testing/selftests/Makefile | 9 - 1 file changed, 9 deletions(-) diff --git a/tools

[PATCH v3 1/7] selftests: gpio: rework and simplify test implementation

2021-01-19 Thread Kent Gibson
broken since the device created in the multiple gpiochip case was split into separate devices. Fixes: 8a39f597bcfd ("gpio: mockup: rework device probing") Signed-off-by: Kent Gibson Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- tools/testing/selftests/gpio/Makefile

[PATCH v3 4/7] selftests: remove obsolete gpio references from kselftest_deps.sh

2021-01-19 Thread Kent Gibson
GPIO Makefile has been greatly simplified so remove references to lines which no longer exist. Signed-off-by: Kent Gibson Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- tools/testing/selftests/kselftest_deps.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git

[PATCH v3 2/7] selftests: gpio: remove obsolete gpio-mockup-chardev.c

2021-01-19 Thread Kent Gibson
GPIO selftests have changed to new gpio-mockup-cdev helper, so remove old gpio-mockup-chardev helper. Signed-off-by: Kent Gibson Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- .../selftests/gpio/gpio-mockup-chardev.c | 323 -- 1 file changed, 323 deletions

[PATCH v3 6/7] selftests: gpio: port to GPIO uAPI v2

2021-01-19 Thread Kent Gibson
Add a port to the GPIO uAPI v2 interface and make it the default. Signed-off-by: Kent Gibson Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- .../testing/selftests/gpio/gpio-mockup-cdev.c | 75 +-- tools/testing/selftests/gpio/gpio-mockup.sh | 11 ++- 2 files

[PATCH v3 7/7] selftests: gpio: add CONFIG_GPIO_CDEV to config

2021-01-19 Thread Kent Gibson
GPIO CDEV is now optional and required for the selftests so add it to the config. Signed-off-by: Kent Gibson Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- tools/testing/selftests/gpio/config | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/gpio/config

[PATCH v3 5/7] tools: gpio: remove uAPI v1 code no longer used by selftests

2021-01-19 Thread Kent Gibson
gpio-mockup-chardev helper has been obsoleted and removed, so also remove the tools/gpio code that it, and nothing else, was using. Signed-off-by: Kent Gibson Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- tools/gpio/gpio-utils.c | 89

[PATCH] gpiolib: cdev: clear debounce period if line set to output

2021-01-21 Thread Kent Gibson
(). Fixed: 65cff7047640 ("gpiolib: cdev: support setting debounce") Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 12b679ca552c..3551aaf5a361 100644 --- a/dr

Re: [PATCH v2 1/7] selftests: gpio: rework and simplify test implementation

2021-01-17 Thread Kent Gibson
On Thu, Jan 07, 2021 at 10:57:25AM +0800, Kent Gibson wrote: > The GPIO mockup selftests are overly complicated with separate > implementations of the tests for sysfs and cdev uAPI, and with the cdev > implementation being dependent on tools/gpio and libmount. > > Rework the test

Re: linux-next: Fixes tags need some work in the gpio-brgl-fixes tree

2021-01-17 Thread Kent Gibson
On Mon, Jan 18, 2021 at 08:21:09AM +1100, Stephen Rothwell wrote: > Hi all, > > In commit > > ec6c3364b816 ("tools: gpio: fix %llu warning in gpio-watch.c") > > Fixes tag > > Fixes: commit 33f0c47b8fb4 ("tools: gpio: implement gpio-watch") > > has these problem(s): > > - leading word

[PATCH] gpio: uapi: fix line info flags description

2021-01-19 Thread Kent Gibson
o clarify and to be consistent with other struct gpio_v2_line_info fields. Fixes: 2cc522d3931b ("gpio: uapi: kernel-doc formatting improvements") Signed-off-by: Kent Gibson --- include/uapi/linux/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/

Re: [PATCH v2 0/7] selftests: gpio: rework and port to GPIO uAPI v2

2021-01-19 Thread Kent Gibson
On Tue, Jan 19, 2021 at 11:37:46AM +0100, Bartosz Golaszewski wrote: > On Tue, Jan 19, 2021 at 1:35 AM Kent Gibson wrote: > > > > On Mon, Jan 18, 2021 at 04:04:51PM +0100, Linus Walleij wrote: > > > On Thu, Jan 7, 2021 at 3:58 AM Kent Gibson wrote: > > >

Re: [PATCH v2 0/7] selftests: gpio: rework and port to GPIO uAPI v2

2021-01-19 Thread Kent Gibson
On Tue, Jan 19, 2021 at 12:02:13PM +0100, Bartosz Golaszewski wrote: > On Tue, Jan 19, 2021 at 11:59 AM Kent Gibson wrote: > > > > On Tue, Jan 19, 2021 at 11:37:46AM +0100, Bartosz Golaszewski wrote: > > > On Tue, Jan 19, 2021 at 1:35 AM Kent Gibson wrote: > > &g

[PATCH v2 0/7] selftests: gpio: rework and port to GPIO uAPI v2

2021-01-06 Thread Kent Gibson
ock in set_mock, and the sleep in set_line Kent Gibson (7): selftests: gpio: rework and simplify test implementation selftests: gpio: remove obsolete gpio-mockup-chardev.c selftests: remove obsolete build restriction for gpio selftests: remove obsolete gpio references from kselftest_deps

[PATCH v2 5/7] tools: gpio: remove uAPI v1 code no longer used by selftests

2021-01-06 Thread Kent Gibson
gpio-mockup-chardev helper has been obsoleted and removed, so also remove the tools/gpio code that it, and nothing else, was using. Signed-off-by: Kent Gibson Acked-by: Linus Walleij --- tools/gpio/gpio-utils.c | 89 - tools/gpio/gpio-utils.h | 6 --- 2

[PATCH v2 7/7] selftests: gpio: add CONFIG_GPIO_CDEV to config

2021-01-06 Thread Kent Gibson
GPIO CDEV is now optional and required for the selftests so add it to the config. Signed-off-by: Kent Gibson Acked-by: Linus Walleij --- tools/testing/selftests/gpio/config | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/gpio/config b/tools/testing/selftests/gpio

[PATCH v2 3/7] selftests: remove obsolete build restriction for gpio

2021-01-06 Thread Kent Gibson
Build restrictions related to the gpio-mockup-chardev helper are no longer relevant so remove them. Signed-off-by: Kent Gibson Acked-by: Linus Walleij --- tools/testing/selftests/Makefile | 9 - 1 file changed, 9 deletions(-) diff --git a/tools/testing/selftests/Makefile b/tools

[PATCH v2 1/7] selftests: gpio: rework and simplify test implementation

2021-01-06 Thread Kent Gibson
broken since the device created in the multiple gpiochip case was split into separate devices. Fixes: commit 8a39f597bcfd ("gpio: mockup: rework device probing") Signed-off-by: Kent Gibson Acked-by: Linus Walleij --- tools/testing/selftests/gpio/Makefile | 26 +- .../testing/self

[PATCH v2 4/7] selftests: remove obsolete gpio references from kselftest_deps.sh

2021-01-06 Thread Kent Gibson
GPIO Makefile has been greatly simplified so remove references to lines which no longer exist. Signed-off-by: Kent Gibson Acked-by: Linus Walleij --- tools/testing/selftests/kselftest_deps.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/testing/selftests

[PATCH v2 6/7] selftests: gpio: port to GPIO uAPI v2

2021-01-06 Thread Kent Gibson
Add a port to the GPIO uAPI v2 interface and make it the default. Signed-off-by: Kent Gibson Acked-by: Linus Walleij --- .../testing/selftests/gpio/gpio-mockup-cdev.c | 75 +-- tools/testing/selftests/gpio/gpio-mockup.sh | 11 ++- 2 files changed, 76 insertions(+), 10

[PATCH v2 2/7] selftests: gpio: remove obsolete gpio-mockup-chardev.c

2021-01-06 Thread Kent Gibson
GPIO selftests have changed to new gpio-mockup-cdev helper, so remove old gpio-mockup-chardev helper. Signed-off-by: Kent Gibson Acked-by: Linus Walleij --- .../selftests/gpio/gpio-mockup-chardev.c | 323 -- 1 file changed, 323 deletions(-) delete mode 100644 tools

[PATCH 0/2] tools: gpio: fix %llu warnings

2021-01-06 Thread Kent Gibson
Fix a couple of warnings that I ran across while testing selftest changes. Sorry about the repetition in the checkin comments, but as the problem was introduced to the two files separately it seemed more appropriate than tying their history together. Cheers, Kent. Kent Gibson (2): tools: gpio

[PATCH 1/2] tools: gpio: fix %llu warning in gpio-event-mon.c

2021-01-06 Thread Kent Gibson
ent.offset, event.line_seqno, |~~ | | | __u64 {aka long unsigned int} Replace the %llu with PRIu64 and cast the argument to uint64_t. Fixes: commit 03fd11b03362 ("tools/gpio/gpio-event-mon: fix warning") Signed-off-by: Kent Gibson

[PATCH 2/2] tools: gpio: fix %llu warning in gpio-watch.c

2021-01-06 Thread Kent Gibson
ment gpio-watch") Signed-off-by: Kent Gibson --- tools/gpio/gpio-watch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/gpio/gpio-watch.c b/tools/gpio/gpio-watch.c index f229ec62301b..41e76d244192 100644 --- a/tools/gpio/gpio-watch.c +++ b/tools/gpio/gpio-wa

Re: [PATCH v2 0/7] selftests: gpio: rework and port to GPIO uAPI v2

2021-01-18 Thread Kent Gibson
On Mon, Jan 18, 2021 at 04:04:51PM +0100, Linus Walleij wrote: > On Thu, Jan 7, 2021 at 3:58 AM Kent Gibson wrote: > > > selftests: gpio: rework and simplify test implementation > > selftests: gpio: remove obsolete gpio-mockup-chardev.c > > selftests: remove ob

Re: [PATCH 5/5] gpio: uapi: clarify the meaning of 'empty' char arrays

2020-10-05 Thread Kent Gibson
On Mon, Oct 05, 2020 at 02:01:22PM +0300, Andy Shevchenko wrote: > On Mon, Oct 5, 2020 at 10:07 AM Kent Gibson wrote: > > > > Clarify that a char array containing a string is considered 'empty' if > > the first character is the null terminator. The remaining characters

Re: [PATCH v2 05/18] gpiolib: cdev: support GPIO_GET_LINE_IOCTL and GPIOLINE_GET_VALUES_IOCTL

2020-08-04 Thread Kent Gibson
On Tue, Aug 04, 2020 at 07:47:43PM +0200, Bartosz Golaszewski wrote: > On Tue, Aug 4, 2020 at 1:01 AM Kent Gibson wrote: > > > > [snip] > > > > > > Also: I just started going through the patches - nice idea with the > > > GPIO attributes, I really li

Re: [PATCH v2 02/18] gpio: uapi: define uAPI v2

2020-08-04 Thread Kent Gibson
On Tue, Aug 04, 2020 at 07:42:34PM +0200, Bartosz Golaszewski wrote: > On Sat, Jul 25, 2020 at 6:20 AM Kent Gibson wrote: > > > > Add a new version of the uAPI to address existing 32/64-bit alignment > > issues, add support for debounce and event sequence numbers, and pr

Re: [PATCH v2 02/18] gpio: uapi: define uAPI v2

2020-08-05 Thread Kent Gibson
On Wed, Aug 05, 2020 at 07:47:57PM +0200, Bartosz Golaszewski wrote: > On Wed, Aug 5, 2020 at 7:19 AM Kent Gibson wrote: > > > > [snip] > > > > > > > > > +/* > > > > + * Maximum number of requested lines. > > > > + * > >

Re: [PATCH v2 02/18] gpio: uapi: define uAPI v2

2020-08-05 Thread Kent Gibson
On Wed, Aug 05, 2020 at 01:18:53PM +0800, Kent Gibson wrote: > On Tue, Aug 04, 2020 at 07:42:34PM +0200, Bartosz Golaszewski wrote: > > On Sat, Jul 25, 2020 at 6:20 AM Kent Gibson wrote: [snip] > > > config, info, info_changed and event structs receive updated versions, &

Re: [PATCH 6/6] docs: gpio: add a new document to its index.rst

2020-10-02 Thread Kent Gibson
On Fri, Oct 02, 2020 at 07:49:50AM +0200, Mauro Carvalho Chehab wrote: > There's now a new ReST file. Add it to the index.rst file. > > Fixes: ce7a2f77f976 ("docs: gpio: Add GPIO Aggregator documentation") Shouldn't that be: Fixes: fd1abe99e5fb ("Documentation: gpio: add documentation for

[PATCH] gpiolib: cdev: switch from kstrdup() to kstrndup()

2020-10-05 Thread Kent Gibson
is one less than the array. This is consistent with the previous behaviour. Suggested-by: Andy Shevchenko Signed-off-by: Kent Gibson --- The change to kstrndup() was suggested by Andy as part of the review of the uAPI v2. This patch is my initial interpretion of that suggestion, applied

[PATCH 0/5] gpio: uapi: documentation improvements

2020-10-05 Thread Kent Gibson
that I've made along the way. Hopefully nothing controversial - mainly formatting improvements, and a couple of minor wording changes. Cheers, Kent. Kent Gibson (5): gpio: uapi: fix kernel-doc warnings gpio: uapi: comment consistency gpio: uapi: kernel-doc formatting improvements gpio: uapi

[PATCH 1/5] gpio: uapi: fix kernel-doc warnings

2020-10-05 Thread Kent Gibson
Fix kernel-doc warnings, specifically gpioline_info_changed.padding is not documented and 'GPIO event types' describes defines, which are not documented by kernel-doc. Signed-off-by: Kent Gibson --- include/uapi/linux/gpio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH 4/5] gpio: uapi: remove whitespace

2020-10-05 Thread Kent Gibson
Remove leading whitespace in ABI v1 comment. Signed-off-by: Kent Gibson --- include/uapi/linux/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h index 32dd18f238c3..ad3f56dd87ec 100644 --- a/include/uapi/linux/gpio.h

[PATCH 2/5] gpio: uapi: comment consistency

2020-10-05 Thread Kent Gibson
Make debounce_period_us field documentation consistent with other fields in the union. Signed-off-by: Kent Gibson --- include/uapi/linux/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h index b0d5e7a1c693

[PATCH 5/5] gpio: uapi: clarify the meaning of 'empty' char arrays

2020-10-05 Thread Kent Gibson
Clarify that a char array containing a string is considered 'empty' if the first character is the null terminator. The remaining characters are not relevant to this determination. Signed-off-by: Kent Gibson --- include/uapi/linux/gpio.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions

[PATCH 3/5] gpio: uapi: kernel-doc formatting improvements

2020-10-05 Thread Kent Gibson
Add kernel-doc formatting to all references to structs, enums, fields and constants, and move deprecation warnings into the Note section of the deprecated struct. Replace 'OR:ed' with 'added', as the former looks odd. Signed-off-by: Kent Gibson --- The replacement of 'OR:ed' should strictly

[PATCH v3 02/18] gpio: uapi: define uAPI v2

2020-08-09 Thread Kent Gibson
and extension of v1, so userspace code, particularly libgpiod, should readily port to it. Signed-off-by: Kent Gibson --- Changes since v2: - relocated commentary into commit description - hard limit max requested lines to 64 so bitmaps always fit in a single u64. - prefix all v2 symbols

[PATCH v3 04/18] gpiolib: add build option for CDEV v1 ABI

2020-08-09 Thread Kent Gibson
Add a build option to allow the removal of the CDEV v1 ABI. Suggested-by: Bartosz Golaszewski Signed-off-by: Kent Gibson --- This patch is before the v2 implementation, and is non-functional until that patch, as some parts of that patch would be written slightly differently if removing v1

[PATCH v3 05/18] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL

2020-08-09 Thread Kent Gibson
Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL. Signed-off-by: Kent Gibson --- The struct line implementation is based on the v1 struct linehandle implementation. The line_ioctl() is a simple wrapper

[PATCH v3 00/18] gpio: cdev: add uAPI v2

2020-08-09 Thread Kent Gibson
into a separate series. - split implementation patch into a patch for each ioctl or major feature. - split tool port patch into a patch per tool. - rework uAPI to allow requested lines with different configurations. Kent Gibson (18): gpio: uapi: define GPIO_MAX_NAME_SIZE for array sizes gpio: uapi

[PATCH v3 06/18] gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL

2020-08-09 Thread Kent Gibson
Add support for GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL. Signed-off-by: Kent Gibson --- The core of this change is the event kfifo switching to contain struct gpioline_info_changed_v2, instead of v1 as v2 is richer. The two uAPI versions are mostly independent - other

[PATCH v3 01/18] gpio: uapi: define GPIO_MAX_NAME_SIZE for array sizes

2020-08-09 Thread Kent Gibson
Replace constant array sizes with a macro constant to clarify the source of array sizes, provide a place to document any constraints on the size, and to simplify array sizing in userspace if constructing structs from their composite fields. Signed-off-by: Kent Gibson --- include/uapi/linux

[PATCH v3 03/18] gpiolib: make cdev a build option

2020-08-09 Thread Kent Gibson
Signed-off-by: Kent Gibson --- drivers/gpio/Kconfig| 17 +++-- drivers/gpio/Makefile | 2 +- drivers/gpio/gpiolib-cdev.h | 15 +++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 8030fd91a3cc

[PATCH v3 10/18] gpiolib: cdev: support setting debounce

2020-08-09 Thread Kent Gibson
Add support for setting debounce on a line via the GPIO uAPI. Where debounce is not supported by hardware, a software debounce is provided. Signed-off-by: Kent Gibson --- The implementation of the software debouncer waits for the line to be stable for the debounce period before determining

[PATCH v3 11/18] gpio: uapi: document uAPI v1 as deprecated

2020-08-09 Thread Kent Gibson
Update uAPI documentation to deprecate v1 structs and ioctls. Signed-off-by: Kent Gibson --- include/uapi/linux/gpio.h | 26 ++ 1 file changed, 26 insertions(+) diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h index 82e8744b8c3b..286f5522378c 100644

[PATCH v3 07/18] gpiolib: cdev: support edge detection for uAPI v2

2020-08-09 Thread Kent Gibson
Add support for edge detection to lines requested using GPIO_V2_GET_LINE_IOCTL. Signed-off-by: Kent Gibson --- The edge_detector implementation is based on the v1 lineevent implementation. drivers/gpio/gpiolib-cdev.c | 316 +++- drivers/gpio/gpiolib.c

[PATCH v3 12/18] tools: gpio: port lsgpio to v2 uAPI

2020-08-09 Thread Kent Gibson
Port the lsgpio tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/lsgpio.c | 60 - 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c index b08d7a5e779b..deda38244026 100644

[PATCH v3 14/18] tools: gpio: rename nlines to num_lines

2020-08-09 Thread Kent Gibson
Rename nlines to num_lines to be consistent with other usage for fields describing the number of entries in an array. Signed-off-by: Kent Gibson --- tools/gpio/gpio-hammer.c | 26 +- tools/gpio/gpio-utils.c | 20 ++-- tools/gpio/gpio-utils.h | 6

[PATCH v3 13/18] tools: gpio: port gpio-watch to v2 uAPI

2020-08-09 Thread Kent Gibson
Port the gpio-watch tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/gpio-watch.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/gpio/gpio-watch.c b/tools/gpio/gpio-watch.c index 5cea24fddfa7..6f048350a27e 100644 --- a/tools

[PATCH v3 08/18] gpiolib: cdev: support GPIO_V2_LINE_SET_CONFIG_IOCTL

2020-08-09 Thread Kent Gibson
Add support for GPIO_V2_LINE_SET_CONFIG_IOCTL, the uAPI v2 line set config ioctl. Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 92 + 1 file changed, 92 insertions(+) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index

[PATCH v3 09/18] gpiolib: cdev: support GPIO_V2_LINE_SET_VALUES_IOCTL

2020-08-09 Thread Kent Gibson
Add support for the GPIO_V2_LINE_SET_VALUES_IOCTL. Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 67 + 1 file changed, 67 insertions(+) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index d34dad50a048..2f5cc835133c

[PATCH v3 17/18] tools: gpio: add multi-line monitoring to gpio-event-mon

2020-08-09 Thread Kent Gibson
Extend gpio-event-mon to support monitoring multiple lines. This would require multiple lineevent requests to implement using uAPI v1, but can be performed with a single line request using uAPI v2. Signed-off-by: Kent Gibson --- tools/gpio/gpio-event-mon.c | 45

[PATCH v3 18/18] tools: gpio: add debounce support to gpio-event-mon

2020-08-09 Thread Kent Gibson
Add support for debouncing monitored lines to gpio-event-mon. Signed-off-by: Kent Gibson --- tools/gpio/gpio-event-mon.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c index e50bb107ea3a

[PATCH v3 16/18] tools: gpio: port gpio-event-mon to v2 uAPI

2020-08-09 Thread Kent Gibson
Port the gpio-event-mon tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/gpio-event-mon.c | 91 +++-- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c index

[PATCH v3 15/18] tools: gpio: port gpio-hammer to v2 uAPI

2020-08-09 Thread Kent Gibson
Port the gpio-hammer tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/gpio-hammer.c | 32 +++ tools/gpio/gpio-utils.c | 119 ++- tools/gpio/gpio-utils.h | 50 +--- 3 files changed, 128 insertions(+), 73 deletions

Re: [PATCH v3 05/18] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL

2020-08-10 Thread Kent Gibson
On Sun, Aug 09, 2020 at 09:25:16PM +0800, Kent Gibson wrote: > Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and > returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL. > > Signed-off-by: Kent Gibson > --- > [snip] > +static long line_g

Re: [PATCH 1/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME

2020-10-14 Thread Kent Gibson
On Wed, Oct 14, 2020 at 02:27:38PM +0800, Kent Gibson wrote: > Using CLOCK_REALTIME as the source for event timestamps is crucial for > some specific applications, particularly those requiring timetamps > relative to a PTP clock, so provide an option to switch the event > timestamp

[PATCH v2 3/3] tools: gpio: add option to report wall-clock time to gpio-event-mon

2020-10-14 Thread Kent Gibson
Add support for selecting the realtime clock for events. Signed-off-by: Kent Gibson --- tools/gpio/gpio-event-mon.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c index 90c3155f05b1..cacd66ad7926 100644

[PATCH v2 1/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME

2020-10-14 Thread Kent Gibson
. Suggested-by: Jack Winch Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 21 ++--- drivers/gpio/gpiolib.h | 1 + include/uapi/linux/gpio.h | 12 +--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers

[PATCH v2 0/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME

2020-10-14 Thread Kent Gibson
to 32bits on 32bit platforms. - fix the line spacing after line_event_timestamp() Kent Gibson (3): gpiolib: cdev: allow edge event timestamps to be configured as REALTIME tools: gpio: add support for reporting realtime event clock to lsgpio tools: gpio: add option to report wall-clock

[PATCH v2 2/3] tools: gpio: add support for reporting realtime event clock to lsgpio

2020-10-14 Thread Kent Gibson
Add support for reporting if a line is configured to report realtime timestamps in events. Signed-off-by: Kent Gibson --- tools/gpio/lsgpio.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c index 5a05a454d0c9..c61d061247e1 100644 --- a/tools

Re: [PATCH 0/5] gpio: uapi: documentation improvements

2020-10-14 Thread Kent Gibson
On Wed, Oct 14, 2020 at 08:14:20PM +0300, Andy Shevchenko wrote: > On Tue, Oct 13, 2020 at 7:34 PM Kent Gibson wrote: > > On Tue, Oct 13, 2020 at 03:21:47PM +0200, Linus Walleij wrote: > > > On Thu, Oct 8, 2020 at 5:46 PM Bartosz Golaszewski > > > wrote: > > .

[PATCH v5 17/20] tools: gpio: port gpio-hammer to v2 uAPI

2020-08-27 Thread Kent Gibson
Port the gpio-hammer tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/gpio-hammer.c | 32 +++ tools/gpio/gpio-utils.c | 119 ++- tools/gpio/gpio-utils.h | 50 +--- 3 files changed, 128 insertions(+), 73 deletions

[PATCH v5 16/20] tools: gpio: rename nlines to num_lines

2020-08-27 Thread Kent Gibson
Rename nlines to num_lines to be consistent with other usage for fields describing the number of entries in an array. Signed-off-by: Kent Gibson --- tools/gpio/gpio-hammer.c | 26 +- tools/gpio/gpio-utils.c | 20 ++-- tools/gpio/gpio-utils.h | 6

[PATCH v5 20/20] tools: gpio: add debounce support to gpio-event-mon

2020-08-27 Thread Kent Gibson
Add support for debouncing monitored lines to gpio-event-mon. Signed-off-by: Kent Gibson --- tools/gpio/gpio-event-mon.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c index e50bb107ea3a

[PATCH v5 18/20] tools: gpio: port gpio-event-mon to v2 uAPI

2020-08-27 Thread Kent Gibson
Port the gpio-event-mon tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/gpio-event-mon.c | 91 +++-- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c index

[PATCH v5 15/20] tools: gpio: port gpio-watch to v2 uAPI

2020-08-27 Thread Kent Gibson
Port the gpio-watch tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/gpio-watch.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/gpio/gpio-watch.c b/tools/gpio/gpio-watch.c index 5cea24fddfa7..6f048350a27e 100644 --- a/tools

[PATCH v5 19/20] tools: gpio: add multi-line monitoring to gpio-event-mon

2020-08-27 Thread Kent Gibson
Extend gpio-event-mon to support monitoring multiple lines. This would require multiple lineevent requests to implement using uAPI v1, but can be performed with a single line request using uAPI v2. Signed-off-by: Kent Gibson --- tools/gpio/gpio-event-mon.c | 45

[PATCH v5 00/20] gpio: cdev: add uAPI v2

2020-08-27 Thread Kent Gibson
debounce to multiple monitored lines Changes for v2: - split out cleanup patches into a separate series. - split implementation patch into a patch for each ioctl or major feature. - split tool port patch into a patch per tool. - rework uAPI to allow requested lines with different configuratio

[PATCH v5 03/20] gpio: uapi: define GPIO_MAX_NAME_SIZE for array sizes

2020-08-27 Thread Kent Gibson
Replace constant array sizes with a macro constant to clarify the source of array sizes, provide a place to document any constraints on the size, and to simplify array sizing in userspace if constructing structs from their composite fields. Signed-off-by: Kent Gibson --- include/uapi/linux

[PATCH v5 02/20] gpiolib: cdev: replace strncpy with strscpy

2020-08-27 Thread Kent Gibson
-by: Kent Gibson --- The memset in gpio_desc_to_lineinfo(), in conjunction with the strscpy, is necessary as strncpy zero pads the remainder of the destination. It also guarantees that the info cannot leak kernel stack to userspace. This is useful here, but is even more important for the v2 info

[PATCH v5 01/20] gpiolib: cdev: desc_to_lineinfo should set info offset

2020-08-27 Thread Kent Gibson
Set the value of the line info offset in desc_to_lineinfo, rather than relying on it being passed in the info. This makes the function behave as you would expect from the name - it generates the line info corresponding to a given GPIO desc. Signed-off-by: Kent Gibson --- There are some

[PATCH v5 13/20] gpio: uapi: document uAPI v1 as deprecated

2020-08-27 Thread Kent Gibson
Update uAPI documentation to deprecate v1 structs and ioctls. Signed-off-by: Kent Gibson --- include/uapi/linux/gpio.h | 26 ++ 1 file changed, 26 insertions(+) diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h index 0eb1f53b47e0..4af67415d73e 100644

[PATCH v5 14/20] tools: gpio: port lsgpio to v2 uAPI

2020-08-27 Thread Kent Gibson
Port the lsgpio tool to the latest GPIO uAPI. Signed-off-by: Kent Gibson --- tools/gpio/lsgpio.c | 60 - 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c index b08d7a5e779b..deda38244026 100644

[PATCH v5 12/20] gpiolib: cdev: support setting debounce

2020-08-27 Thread Kent Gibson
with edge detection enabled is a very unlikely use case, so it is preferable to disallow it rather than complicate the code to allow it. Should the user wish to alter the debounce value in such cases they will need to release and re-request the line. Signed-off-by: Kent Gibson --- Changes for v5

[PATCH v5 11/20] gpiolib: cdev: support GPIO_V2_LINE_SET_VALUES_IOCTL

2020-08-27 Thread Kent Gibson
Add support for the GPIO_V2_LINE_SET_VALUES_IOCTL. Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 59 + 1 file changed, 59 insertions(+) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 9c1e3f5f01af..3d2d9eefdfa0

[PATCH v5 10/20] gpiolib: cdev: support GPIO_V2_LINE_SET_CONFIG_IOCTL

2020-08-27 Thread Kent Gibson
Add support for GPIO_V2_LINE_SET_CONFIG_IOCTL, the uAPI v2 line set config ioctl. Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 92 + 1 file changed, 92 insertions(+) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index

[PATCH v5 06/20] gpiolib: add build option for CDEV v1 ABI

2020-08-27 Thread Kent Gibson
Add a build option to allow the removal of the CDEV v1 ABI. Suggested-by: Bartosz Golaszewski Signed-off-by: Kent Gibson --- This patch is before the v2 implementation, and is non-functional until that patch, as some parts of that patch would be written slightly differently if removing v1

[PATCH v5 04/20] gpio: uapi: define uAPI v2

2020-08-27 Thread Kent Gibson
and extension of v1, so userspace code, particularly libgpiod, should readily port to it. Signed-off-by: Kent Gibson --- Changes for v4: - clarify bitmap width in GPIO_V2_LINES_MAX description Changes for v3: - relocated commentary into commit description - hard limit max requested lines to 64

[PATCH v5 09/20] gpiolib: cdev: support edge detection for uAPI v2

2020-08-27 Thread Kent Gibson
Add support for edge detection to lines requested using GPIO_V2_GET_LINE_IOCTL. The edge_detector implementation is based on the v1 lineevent implementation. Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 290 +++- drivers/gpio/gpiolib.c | 2

[PATCH v5 08/20] gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL

2020-08-27 Thread Kent Gibson
info change struct to the read. The version supported on that fd locks to that version on the first watch request, so subsequent watches from that process must use the same uAPI version. Signed-off-by: Kent Gibson --- Changes for v5: - as per cover letter Changes for v4: - replace strncpy

[PATCH v5 05/20] gpiolib: make cdev a build option

2020-08-27 Thread Kent Gibson
Signed-off-by: Kent Gibson --- drivers/gpio/Kconfig| 17 +++-- drivers/gpio/Makefile | 2 +- drivers/gpio/gpiolib-cdev.h | 15 +++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 8030fd91a3cc

[PATCH v5 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL

2020-08-27 Thread Kent Gibson
Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL. The struct linereq implementation is based on the v1 struct linehandle implementation. Signed-off-by: Kent Gibson --- The linereq_ioctl() is a simple

Re: [PATCH v5 00/20] gpio: cdev: add uAPI v2

2020-08-27 Thread Kent Gibson
On Thu, Aug 27, 2020 at 06:02:03PM +0200, Bartosz Golaszewski wrote: > On Thu, Aug 27, 2020 at 5:53 PM Linus Walleij > wrote: > > > > On Thu, Aug 27, 2020 at 4:00 PM Kent Gibson wrote: > > > > > This patchset defines and implements a new version of the > &g

Re: [PATCH v3 02/18] gpio: uapi: define uAPI v2

2020-08-11 Thread Kent Gibson
On Tue, Aug 11, 2020 at 09:11:41PM +0200, Bartosz Golaszewski wrote: > On Sun, Aug 9, 2020 at 3:26 PM Kent Gibson wrote: > > [snip] > > > > +/* > > + * Maximum number of requested lines. > > + * > > + * Must be no greater than 64 as bitmaps are limited

Re: [PATCH v3 06/18] gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL

2020-08-11 Thread Kent Gibson
On Sun, Aug 09, 2020 at 09:25:17PM +0800, Kent Gibson wrote: > Add support for GPIO_V2_GET_LINEINFO_IOCTL and > GPIO_V2_GET_LINEINFO_WATCH_IOCTL. > > Signed-off-by: Kent Gibson > --- > [snip] > > if (copy_from_user(, ip, sizeof(lineinfo))) >

[PATCH v4 00/20] gpio: cdev: add uAPI v2

2020-08-13 Thread Kent Gibson
. - split implementation patch into a patch for each ioctl or major feature. - split tool port patch into a patch per tool. - rework uAPI to allow requested lines with different configurations. Kent Gibson (20): gpiolib: cdev: desc_to_lineinfo should set info offset gpiolib: cdev: replace

[PATCH v4 01/20] gpiolib: cdev: desc_to_lineinfo should set info offset

2020-08-13 Thread Kent Gibson
Set the value of the line info offset in desc_to_lineinfo, rather than relying on it being passed in the info. This makes the function behave as you would expect from the name - it generates the line info corresponding to a given GPIO desc. Signed-off-by: Kent Gibson --- There are some

[PATCH v4 06/20] gpiolib: add build option for CDEV v1 ABI

2020-08-13 Thread Kent Gibson
Add a build option to allow the removal of the CDEV v1 ABI. Suggested-by: Bartosz Golaszewski Signed-off-by: Kent Gibson --- This patch is before the v2 implementation, and is non-functional until that patch, as some parts of that patch would be written slightly differently if removing v1

[PATCH v4 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL

2020-08-13 Thread Kent Gibson
Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL. Signed-off-by: Kent Gibson --- The struct line implementation is based on the v1 struct linehandle implementation. The line_ioctl() is a simple wrapper

[PATCH v4 03/20] gpio: uapi: define GPIO_MAX_NAME_SIZE for array sizes

2020-08-13 Thread Kent Gibson
Replace constant array sizes with a macro constant to clarify the source of array sizes, provide a place to document any constraints on the size, and to simplify array sizing in userspace if constructing structs from their composite fields. Signed-off-by: Kent Gibson --- include/uapi/linux

[PATCH v4 05/20] gpiolib: make cdev a build option

2020-08-13 Thread Kent Gibson
Signed-off-by: Kent Gibson --- drivers/gpio/Kconfig| 17 +++-- drivers/gpio/Makefile | 2 +- drivers/gpio/gpiolib-cdev.h | 15 +++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 8030fd91a3cc

[PATCH v4 04/20] gpio: uapi: define uAPI v2

2020-08-13 Thread Kent Gibson
and extension of v1, so userspace code, particularly libgpiod, should readily port to it. Signed-off-by: Kent Gibson --- Changes for v4: - clarify bitmap width in GPIO_V2_LINES_MAX description Changes for v3: - relocated commentary into commit description - hard limit max requested lines to 64

[PATCH v4 02/20] gpiolib: cdev: replace strncpy with strscpy

2020-08-13 Thread Kent Gibson
-by: Kent Gibson --- The memset in gpio_desc_to_lineinfo(), in conjunction with the strscpy, is necessary as strncpy zeroed pads the remainder of the destination. It is also guarantees that the info cannot contain kernel stack that could get leaked to userspace. This is useful here, but is even more

[PATCH v4 08/20] gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL

2020-08-13 Thread Kent Gibson
Add support for GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL. Signed-off-by: Kent Gibson --- The core of this change is the event kfifo switching to contain struct gpioline_info_changed_v2, instead of v1 as v2 is richer. The two uAPI versions are mostly independent - other

[PATCH v4 09/20] gpiolib: cdev: support edge detection for uAPI v2

2020-08-13 Thread Kent Gibson
Add support for edge detection to lines requested using GPIO_V2_GET_LINE_IOCTL. Signed-off-by: Kent Gibson --- The edge_detector implementation is based on the v1 lineevent implementation. drivers/gpio/gpiolib-cdev.c | 316 +++- drivers/gpio/gpiolib.c

[PATCH v4 11/20] gpiolib: cdev: support GPIO_V2_LINE_SET_VALUES_IOCTL

2020-08-13 Thread Kent Gibson
Add support for the GPIO_V2_LINE_SET_VALUES_IOCTL. Signed-off-by: Kent Gibson --- drivers/gpio/gpiolib-cdev.c | 67 + 1 file changed, 67 insertions(+) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 04472c2b6678..de88b7a5ba0f

  1   2   3   4   >