History log of /freebsd-current/usr.sbin/gpioctl/gpioctl.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# ff3468ac 12-Dec-2020 Ian Lepore <ian@FreeBSD.org>

Provide userland notification of gpio pin changes ("userland gpio interrupts").

This is an import of the Google Summer of Code 2018 project completed by
Christian Kramer (and, sadly, ignored by us for two years now). The goals
stated for that project were:

FreeBSD already has support for interrupts implemented in the GPIO
controller drivers of several SoCs, but there are no interfaces to take
advantage of them out of user space yet. The goal of this work is to
implement such an interface by providing descriptors which integrate
with the common I/O system calls and multiplexing mechanisms.

The initial imported code supports the following functionality:

- A kernel driver that provides an interface to the user space; the
existing gpioc(4) driver was enhanced with this functionality.
- Implement support for the most common I/O system calls / multiplexing
mechanisms:
- read() Places the pin number on which the interrupt occurred in the
buffer. Blocking and non-blocking behaviour supported.
- poll()/select()
- kqueue()
- signal driven I/O. Posting SIGIO when the O_ASYNC was set.
- Many-to-many relationship between pins and file descriptors.
- A file descriptor can monitor several GPIO pins.
- A GPIO pin can be monitored by multiple file descriptors.
- Integration with gpioctl and libgpio.

I added some fixes (mostly to locking) and feature enhancements on top of
the original gsoc code. The feature ehancements allow the user to choose
between detailed and summary event reporting. Detailed reporting provides
a record describing each pin change event. Summary reporting provides the
time of the first and last change of each pin, and a count of how many times
it changed state since the last read(2) call. Another enhancement allows
the recording of multiple state change events on multiple pins between each
call to read(2) (the original code would track only a single event at a time).

The phabricator review for these changes timed out without approval, but I
cite it below anyway, because the review contains a series of diffs that
show how I evolved the code from its original state in Christian's github
repo for the gsoc project to what is being commited here. (In effect,
the phab review extends the VC history back to the original code.)

Submitted by: Christian Kramer
Obtained from: https://github.com/ckraemer/freebsd/tree/gsoc2018
Differential Revision: https://reviews.freebsd.org/D27398


# 19602a38 11-Apr-2020 Emmanuel Vadot <manu@FreeBSD.org>

gpioctl: Print interrupts capabilities

GPIO drivers who supports interrupts report them in the caps
(obtain via the getcaps method) but gpioctl doesn't know
how to interpret this and print "UNKNOWN" for each one of them.
Even if we don't have userland gpio interrupts support for now
let gpioctl print the supported caps.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24133


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# e74d991d 12-Mar-2016 Dimitry Andric <dim@FreeBSD.org>

Fix gcc warnings about possibly uninitialized variables in gpioctl.c.

Noticed by: bz


# 3b2bb133 11-Mar-2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Make it possible for operations to refer to GPIO pins by name

- Try to guess what is provided as a pin spec for -t or for get/set
operation: number or name. Fails in case of ambiguity.
- Add -p and -N switches to force pin specification interpretation:
-p forces spec to be pin number, -N forces it to be name

Submitted by: Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision: https://reviews.freebsd.org/D5201


# d752f0f6 07-Mar-2015 Luiz Otavio O Souza <loos@FreeBSD.org>

Add a new ioctl to allow the setting of GPIO pin names.

When a gpiobus child is added, use its name to identify the mapped pin
names.

Make the respective changes to libgpio.

Add a new '-n' flag to gpioctl(8) to set the pin name.

Differential Revision: https://reviews.freebsd.org/D2002
Reviewed by: rpaulo
Requested by: many


# 21bc384a 31-Dec-2014 Luiz Otavio O Souza <loos@FreeBSD.org>

Free the buffer returned by gpio_pin_list() after the use.

Reported by: Coverity Scan
CID: 1257468


# 8366091e 02-Dec-2014 Rui Paulo <rpaulo@FreeBSD.org>

gpioctl: don't print the command line arguments.

PR: 195330
Submitted by: Scott Ellis jumpnowtek at gmail.com
MFC after: 3 days


# 244c371d 01-Dec-2014 Rui Paulo <rpaulo@FreeBSD.org>

Rewrite parts of gpioctl(8) to use the gpio(3) library.


# 22e3858c 17-Sep-2013 Sean Bruno <sbruno@FreeBSD.org>

Assume that the -f argument is /dev/gpioc0 if it is not passed.

hrs@ provided this verison of the patch and showed me where all the needed
changes were to be made outside of gpioctl.c

Approved by: re (hrs)
MFC after: 2 weeks


# bf70bece 19-Oct-2012 Ed Schouten <ed@FreeBSD.org>

More -Wmissing-variable-declarations fixes.

In addition to adding `static' where possible:

- bin/date: Move `retval' into extern.h to make it visible to date.c.
- bin/ed: Move globally used variables into ed.h.
- sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
- usr.bin/calendar: Remove unneeded variables.
- usr.bin/chat: Make `line' local instead of global.
- usr.bin/elfdump: Comment out unneeded function.
- usr.bin/rlogin: Use _Noreturn instead of __dead2.
- usr.bin/tset: Pull `Ospeed' into extern.h.
- usr.sbin/mfiutil: Put global variables in mfiutil.h.
- usr.sbin/pkg: Remove unused `os_corres'.
- usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 968ec6a6 27-Sep-2010 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Add gpioctl(8). Utility for configuring/accessing GPIO pins