Skip to content

Commit

Permalink
Merge tag 'gpio-v5.10-1' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/linusw/linux-gpio

Pull GPIO updates from Linus Walleij:
 "This time very little driver changes but lots of core changes.

  We have some interesting cooperative work for ARM and Intel alike,
  making the GPIO subsystem more and more suitable for industrial
  systems and the like, in addition to the in-kernel users.

  We touch driver core (device properties) and lib/* by adding one
  simple string array free function, these are authored by Andy
  Shevchenko who is a well known and recognized core helpers maintainers
  so this should be fine.

  We also see some Android GKI-related modularization in the MXC
  drivers.

  Core changes:

   - The big core change is the updated (v2) userspace character device
     API.

     This corrects badly designed 64-bit alignment around the line
     events. We also add the debounce request feature. This echoes the
     often quotes passage from Frederick Brooks "The mythical man-month"
     to always throw one away, which we have seen before in things such
     as V4L2. So we put in a new one and deprecate and obsolete the old
     one.

   - All example tools in tools/gpio/* are migrated to the new API to
     set a good example. The libgpiod userspace library has been
     augmented to use this new API pretty much from day 1.

   - Some misc API hardening by using strn* function calls has been
     added as well.

   - Use the simpler IDA interface for GPIO chip instance enumeration.

   - Add device core function for counting string arrays in device
     properties.

   - Provide a generic library function kfree_strarray() that can be
     used throughout the kernel.

  Driver enhancements:

   - The DesignWare dwapb-gpio driver has been enhanced and now uses the
     IRQ handling in the gpiolib core.

   - The mockup and aggregator drivers have seen some substantial code
     clean-up and now use more of the core kernel inftrastructure.

   - Misc cleanups using dev_err_probe().

   - The MXC drivers (Freescale/NXP) can now be built modularized, which
     makes modularized GKI Android kernels happy"

* tag 'gpio-v5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (73 commits)
  gpiolib: Update header block in gpiolib-cdev.h
  gpiolib: cdev: switch from kstrdup() to kstrndup()
  docs: gpio: add a new document to its index.rst
  gpio: pca953x: Add support for the NXP PCAL9554B/C
  tools: gpio: add debounce support to gpio-event-mon
  tools: gpio: add multi-line monitoring to gpio-event-mon
  tools: gpio: port gpio-event-mon to v2 uAPI
  tools: gpio: port gpio-hammer to v2 uAPI
  tools: gpio: rename nlines to num_lines
  tools: gpio: port gpio-watch to v2 uAPI
  tools: gpio: port lsgpio to v2 uAPI
  gpio: uapi: document uAPI v1 as deprecated
  gpiolib: cdev: support setting debounce
  gpiolib: cdev: support GPIO_V2_LINE_SET_VALUES_IOCTL
  gpiolib: cdev: support GPIO_V2_LINE_SET_CONFIG_IOCTL
  gpiolib: cdev: support edge detection for uAPI v2
  gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL
  gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL
  gpiolib: add build option for CDEV v1 ABI
  gpiolib: make cdev a build option
  ...
  • Loading branch information
torvalds committed Oct 13, 2020
2 parents a996b9c + fc709df commit 0486bea
Show file tree
Hide file tree
Showing 46 changed files with 2,962 additions and 938 deletions.
50 changes: 50 additions & 0 deletions Documentation/admin-guide/gpio/gpio-mockup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. SPDX-License-Identifier: GPL-2.0-only
GPIO Testing Driver
===================

The GPIO Testing Driver (gpio-mockup) provides a way to create simulated GPIO
chips for testing purposes. The lines exposed by these chips can be accessed
using the standard GPIO character device interface as well as manipulated
using the dedicated debugfs directory structure.

Creating simulated chips using module params
--------------------------------------------

When loading the gpio-mockup driver a number of parameters can be passed to the
module.

gpio_mockup_ranges

This parameter takes an argument in the form of an array of integer
pairs. Each pair defines the base GPIO number (if any) and the number
of lines exposed by the chip. If the base GPIO is -1, the gpiolib
will assign it automatically.

Example: gpio_mockup_ranges=-1,8,-1,16,405,4

The line above creates three chips. The first one will expose 8 lines,
the second 16 and the third 4. The base GPIO for the third chip is set
to 405 while for two first chips it will be assigned automatically.

gpio_named_lines

This parameter doesn't take any arguments. It lets the driver know that
GPIO lines exposed by it should be named.

The name format is: gpio-mockup-X-Y where X is mockup chip's ID
and Y is the line offset.

Manipulating simulated lines
----------------------------

Each mockup chip creates its own subdirectory in /sys/kernel/debug/gpio-mockup/.
The directory is named after the chip's label. A symlink is also created, named
after the chip's name, which points to the label directory.

Inside each subdirectory, there's a separate attribute for each GPIO line. The
name of the attribute represents the line's offset in the chip.

Reading from a line attribute returns the current value. Writing to it (0 or 1)
changes the configuration of the simulated pull-up/pull-down resistor
(1 - pull-up, 0 - pull-down).
1 change: 1 addition & 0 deletions Documentation/admin-guide/gpio/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ gpio

gpio-aggregator
sysfs
gpio-mockup

.. only:: subproject and html

Expand Down
55 changes: 49 additions & 6 deletions Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,33 @@ maintainers:

properties:
compatible:
enum:
- fsl,imx1-gpio
- fsl,imx21-gpio
- fsl,imx31-gpio
- fsl,imx35-gpio
- fsl,imx7d-gpio
oneOf:
- enum:
- fsl,imx1-gpio
- fsl,imx21-gpio
- fsl,imx31-gpio
- fsl,imx35-gpio
- fsl,imx7d-gpio
- items:
- const: fsl,imx35-gpio
- const: fsl,imx31-gpio
- items:
- enum:
- fsl,imx50-gpio
- fsl,imx51-gpio
- fsl,imx53-gpio
- fsl,imx6q-gpio
- fsl,imx6sl-gpio
- fsl,imx6sll-gpio
- fsl,imx6sx-gpio
- fsl,imx6ul-gpio
- fsl,imx7d-gpio
- fsl,imx8mm-gpio
- fsl,imx8mn-gpio
- fsl,imx8mp-gpio
- fsl,imx8mq-gpio
- fsl,imx8qxp-gpio
- const: fsl,imx35-gpio

reg:
maxItems: 1
Expand All @@ -41,6 +62,28 @@ properties:
const: 2

gpio-controller: true
gpio-line-names: true
gpio-ranges: true

power-domains:
maxItems: 1

patternProperties:
"^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
type: object
properties:
gpio-hog: true
gpios: true
input: true
output-high: true
output-low: true
line-name: true

required:
- gpio-hog
- gpios

additionalProperties: false

required:
- compatible
Expand Down
58 changes: 0 additions & 58 deletions Documentation/devicetree/bindings/gpio/gpio-max732x.txt

This file was deleted.

90 changes: 0 additions & 90 deletions Documentation/devicetree/bindings/gpio/gpio-pca953x.txt

This file was deleted.

Loading

0 comments on commit 0486bea

Please sign in to comment.