All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Linus Walleij <linus.walleij@linaro.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Kent Gibson <warthog618@gmail.com>
Cc: linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 23/23] Documentation: gpio: add documentation for gpio-mockup
Date: Fri, 4 Sep 2020 20:15:59 -0700	[thread overview]
Message-ID: <26ea1683-da8f-30e7-f004-3616e96d56b3@infradead.org> (raw)
In-Reply-To: <20200904154547.3836-24-brgl@bgdev.pl>

Hi,

On 9/4/20 8:45 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> There's some documentation for gpio-mockup's debugfs interface in the
> driver's source but it's not much. Add proper documentation for this
> testing module.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  .../admin-guide/gpio/gpio-mockup.rst          | 87 +++++++++++++++++++
>  1 file changed, 87 insertions(+)
>  create mode 100644 Documentation/admin-guide/gpio/gpio-mockup.rst
> 
> diff --git a/Documentation/admin-guide/gpio/gpio-mockup.rst b/Documentation/admin-guide/gpio/gpio-mockup.rst
> new file mode 100644
> index 000000000000..1d452ee55f8d
> --- /dev/null
> +++ b/Documentation/admin-guide/gpio/gpio-mockup.rst
> @@ -0,0 +1,87 @@
> +.. 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. There are two ways of configuring the chips exposed
> +by the module. The lines can be accessed using the standard GPIO character
> +device interface as well as manipulated using the dedicated debugfs directory
> +structure.

Could configfs be used for this instead of debugfs?
debugfs is ad hoc.

> +
> +Creating simulated chips using debugfs
> +--------------------------------------
> +
> +When the gpio-mockup module is loaded (or builtin) it creates its own directory
> +in debugfs. Assuming debugfs is mounted at /sys/kernel/debug/, the directory
> +will be located at /sys/kernel/debug/gpio-mockup/. Inside this directory there
> +are two attributes: new_device and delete_device.
> +
> +New chips can be created by writing a single line containing a number of
> +options to "new_device". For example:
> +
> +.. code-block:: sh
> +
> +    $ echo "label=my-mockup num_lines=4 named_lines" > /sys/kernel/debug/gpio-mockup/new_device
> +
> +Supported options:
> +
> +    num_lines=<num_lines> - number of GPIO lines to expose
> +
> +    label=<label> - label of the dummy chip
> +
> +    named_lines - defines whether dummy lines should be named, the names are
> +                  of the form X-Y where X is the chip's label and Y is the
> +                  line's offset
> +
> +Note: only num_lines is mandatory.
> +
> +Chips can be dynamically removed by writing the chip's label to
> +"delete_device". For example:
> +
> +.. code-block:: sh
> +
> +    echo "gpio-mockup.0" > /sys/kernel/debug/gpio-mockup/delete_device
> +
> +Creating simulated chips using module params
> +--------------------------------------------
> +
> +Note: this is an older, now deprecated method kept for backward compatibility
> +for user-space tools.
> +
> +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 the letter associated
> +        with the mockup chip and Y is the line offset.

Where does this 'X' letter associated with the mockup chip come from?

> +
> +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 its pull.

What does "pull" mean here?


thanks.

-- 
~Randy


  parent reply	other threads:[~2020-09-05  3:16 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 15:45 [PATCH 00/23] gpio: mockup: support dynamically created and removed chips Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 01/23] lib: cmdline: export next_arg() Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 02/23] lib: string_helpers: provide kfree_strarray() Bartosz Golaszewski
2020-09-04 16:33   ` Andy Shevchenko
2020-09-04 15:45 ` [PATCH 03/23] lib: uaccess: provide getline_from_user() Bartosz Golaszewski
2020-09-04 16:35   ` Andy Shevchenko
2020-09-07 10:02     ` Bartosz Golaszewski
2020-09-07 10:18       ` Andy Shevchenko
2020-09-07 10:28         ` Bartosz Golaszewski
2020-09-07 11:45           ` Andy Shevchenko
2020-09-07 11:57             ` Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 04/23] gpiolib: generalize devprop_gpiochip_set_names() for device properties Bartosz Golaszewski
2020-09-04 16:38   ` Andy Shevchenko
2020-09-07 10:56     ` Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 05/23] gpiolib: unexport devprop_gpiochip_set_names() Bartosz Golaszewski
2020-09-04 16:40   ` Andy Shevchenko
2020-09-07 10:53     ` Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 06/23] gpiolib: switch to simpler IDA interface Bartosz Golaszewski
2020-09-04 16:41   ` Andy Shevchenko
2020-09-07 10:50     ` Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 07/23] gpio: mockup: drop unneeded includes Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 08/23] gpio: mockup: use pr_fmt() Bartosz Golaszewski
2020-09-04 16:29   ` Andy Shevchenko
2020-09-04 15:45 ` [PATCH 09/23] gpio: mockup: use KBUILD_MODNAME Bartosz Golaszewski
2020-09-04 16:30   ` Andy Shevchenko
2020-09-04 15:45 ` [PATCH 10/23] gpio: mockup: fix resource leak in error path Bartosz Golaszewski
2020-09-04 17:00   ` Andy Shevchenko
2020-09-07 11:04     ` Bartosz Golaszewski
2020-09-07 11:47       ` Andy Shevchenko
2020-09-04 15:45 ` [PATCH 11/23] gpio: mockup: remove the limit on number of dummy chips Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 12/23] gpio: mockup: define a constant for chip label size Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 13/23] gpio: mockup: pass the chip label as device property Bartosz Golaszewski
2020-09-04 16:48   ` Andy Shevchenko
2020-09-07 11:01     ` Bartosz Golaszewski
2020-09-07 11:48       ` Andy Shevchenko
2020-09-04 15:45 ` [PATCH 14/23] gpio: mockup: use the generic 'gpio-line-names' property Bartosz Golaszewski
2020-09-04 16:46   ` Andy Shevchenko
2020-09-07 10:58     ` Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 15/23] gpio: mockup: use dynamic device IDs Bartosz Golaszewski
2020-09-04 16:49   ` Andy Shevchenko
2020-09-07 11:04     ` Bartosz Golaszewski
2020-09-07 11:50       ` Andy Shevchenko
2020-09-07 11:59         ` Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 16/23] gpio: mockup: refactor the module init function Bartosz Golaszewski
2020-09-04 16:50   ` Andy Shevchenko
2020-09-07 11:05     ` Bartosz Golaszewski
2020-09-07 11:51       ` Andy Shevchenko
2020-09-04 15:45 ` [PATCH 17/23] gpio: mockup: rename and move around debugfs callbacks Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 18/23] gpio: mockup: require debugfs to build Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 19/23] gpio: mockup: add a symlink for the per-chip debugfs directory Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 20/23] gpio: mockup: add a lock for dummy device list Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 21/23] gpio: mockup: provide a way to delete dummy chips Bartosz Golaszewski
2020-09-04 16:56   ` Andy Shevchenko
2020-09-04 15:45 ` [PATCH 22/23] gpio: mockup: provide a way to create new " Bartosz Golaszewski
2020-09-04 15:45 ` [PATCH 23/23] Documentation: gpio: add documentation for gpio-mockup Bartosz Golaszewski
2020-09-04 16:58   ` Andy Shevchenko
2020-09-05  3:15   ` Randy Dunlap [this message]
2020-09-07  9:59     ` Andy Shevchenko
2020-09-07 10:26       ` Bartosz Golaszewski
2020-09-07 11:53         ` Andy Shevchenko
2020-09-07 12:06           ` Bartosz Golaszewski
2020-09-07 12:22             ` Greg Kroah-Hartman
2020-09-07 13:49               ` Bartosz Golaszewski
2020-09-07 14:08                 ` Andy Shevchenko
2020-09-07 15:14                   ` Bartosz Golaszewski
2020-09-07 15:23                   ` Geert Uytterhoeven
2020-09-07 16:08                     ` Bartosz Golaszewski
2020-09-08 17:03               ` Bartosz Golaszewski
2020-09-11 12:56                 ` Greg Kroah-Hartman
2020-09-11 13:07                   ` Bartosz Golaszewski
2020-09-07 12:38             ` Andy Shevchenko
2020-09-07 12:57               ` Bartosz Golaszewski
2020-09-07 13:52                 ` Andy Shevchenko
2020-09-07 10:45     ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26ea1683-da8f-30e7-f004-3616e96d56b3@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=brgl@bgdev.pl \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.