All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v10 2/5] gpio: sim: new testing module
Date: Fri, 26 Nov 2021 10:23:34 +0800	[thread overview]
Message-ID: <20211126022334.GA11357@sol> (raw)
In-Reply-To: <CAMRc=MeR4ubyVWUmR_x99dLjovcFn3Bn9FwGKgX88-P0_PeStw@mail.gmail.com>

On Thu, Nov 25, 2021 at 02:14:20PM +0100, Bartosz Golaszewski wrote:
> On Wed, Nov 24, 2021 at 12:43 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > Implement a new, modern GPIO testing module controlled by configfs
> > attributes instead of module parameters. The goal of this driver is
> > to provide a replacement for gpio-mockup that will be easily extensible
> > with new features and doesn't require reloading the module to change
> > the setup.
> >
> > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> > ---
> >  Documentation/admin-guide/gpio/gpio-sim.rst |   80 ++
> >  drivers/gpio/Kconfig                        |    8 +
> >  drivers/gpio/Makefile                       |    1 +
> >  drivers/gpio/gpio-sim.c                     | 1370 +++++++++++++++++++
> >  4 files changed, 1459 insertions(+)
> >  create mode 100644 Documentation/admin-guide/gpio/gpio-sim.rst
> >  create mode 100644 drivers/gpio/gpio-sim.c
> >
> 
> Hi guys!
> 
> I'd like to get your opinion on some parts of the interface.
> 
> Should we allow creating multiple gpiochips per platform device like
> some drivers do? And if so - should the sysfs groups be created for
> each gpiochip device kobject and not the parent?
> 
> Currently we do this:
> 
> # Create the chip (platform device + single gpiochip):
> mkdir /sys/kernel/config/gpio-sim/my-chip
> # Configure it
> echo 8 > /sys/kernel/config/gpio-sim/my-chip/num_lines
> # Enable it
> echo 1 > /sys/kernel/config/gpio-sim/my-chip/live
> 
> What I mean above would make it look like this:
> 
> # Create the platform device
> mkdir /sys/kernel/config/gpio-sim/my-gpio-device
> 
> # what's inside?
> ls /sys/kernel/config/gpio-sim/my-gpio-device
> live
> 
> # Create GPIO chips
> mkdir /sys/kernel/config/gpio-sim/my-gpio-device/chip0
> mkdir /sys/kernel/config/gpio-sim/my-gpio-device/chip1
> 
> # Configure chips
> echo 8 > /sys/kernel/config/gpio-sim/my-gpio-device/chip0/num_lines
> echo 4 > /sys/kernel/config/gpio-sim/my-gpio-device/chip1/num_lines
> echo foobar > /sys/kernel/config/gpio-sim/my-gpio-device/chip1/label
> 
> # Enable both chips
> echo 1 > /sys/kernel/config/gpio-sim/my-gpio-device/live
> 
> And in sysfs instead of current:
> 
> echo pull-up > /sys/devices/platform/gpio-sim.0/sim_line0/pull
> 
> We'd have to do:
> 
> echo pull-up > /sys/devices/platform/gpio-sim.0/gpiochip1/sim_line0/pull
> 
> While I don't see any usefulness of that at this time, if we don't do
> it now, then it'll be hard to extend this module later. What are your
> thoughts?
> 

I might be missing something, but I don't see the platform abstraction
adding anything that can't be easily emulated in userspace using multiple
chips, and it complicates the minimal case as you now have to create a
platform as well as the chip.
So I'd keep it simple and stick with the chip level abstraction.

Cheers,
Kent.


  reply	other threads:[~2021-11-26  2:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 11:42 [PATCH v10 0/5] gpio-sim: configfs-based GPIO simulator Bartosz Golaszewski
2021-11-24 11:42 ` [PATCH v10 1/5] gpiolib: provide gpiod_remove_hogs() Bartosz Golaszewski
2021-11-24 11:42 ` [PATCH v10 2/5] gpio: sim: new testing module Bartosz Golaszewski
2021-11-24 20:29   ` kernel test robot
2021-11-24 20:29     ` kernel test robot
2021-11-25 13:14   ` Bartosz Golaszewski
2021-11-26  2:23     ` Kent Gibson [this message]
2021-11-26 10:26       ` Bartosz Golaszewski
2021-11-26 18:54   ` [RFC PATCH] gpio: sim: gpio_sim_config_hog_item_ops can be static kernel test robot
2021-11-26 19:02   ` [PATCH v10 2/5] gpio: sim: new testing module kernel test robot
2021-11-24 11:42 ` [PATCH v10 3/5] selftests: gpio: provide a helper for reading chip info Bartosz Golaszewski
2021-11-24 11:42 ` [PATCH v10 4/5] selftests: gpio: add a helper for reading GPIO line names Bartosz Golaszewski
2021-11-24 11:42 ` [PATCH v10 5/5] selftests: gpio: add test cases for gpio-sim 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=20211126022334.GA11357@sol \
    --to=warthog618@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=geert@linux-m68k.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.