linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
To: linux-gpio@vger.kernel.org
Cc: linus.walleij@linaro.org, broonie@kernel.org,
	Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Subject: [PATCH RFD 0/3] Add gpio test framework
Date: Sat, 14 Nov 2015 16:51:34 +0800	[thread overview]
Message-ID: <1447491097-14799-1-git-send-email-bamvor.zhangjian@linaro.org> (raw)

These series of patches try to add support for testing of gpio
subsystem based on the proposal from Linus Walleij.

The basic idea is implement a virtual gpio device(gpio-mockup) base
on gpiolib. Tester could test the gpiolib by manipulating gpio-mockup
device through sysfs and check the result from debugfs. Both sysfs
and debugfs are provided by gpiolib. Reference the following figure:

   sysfs  debugfs
     |       |
  gpiolib---/
     |
 gpio-mockup

Find two issues with my patch series[1]

Futher work and discussion:
1.  Test other code path(if exists).

2   Add pinctrl and interrupt support(Linus suggest trying the
    eventfd) in next steps.

3.  I feel that we could rework the debugfs in other gpiolib based
    drivers to the code in gpiolib.c with generic gpiolib_dbg_show or
    chip->dbg_show.

4.  Currently, gpio-mockup does not support the device tree. There are
    pros and cons if we do not support device tree:
    Pros: do not need to mix with the real hardware dts.
    Cons: could not test the dt_gpio_count, of_find_gpio which rely on
    device tree. And other function such like gpiod_get_index which
    rely on the correctness of the above functions.

    If we want to test the above functions, we could provide a
    dedicated device tree for gpio-mockup device which could be
    included by other device tree. And we could use device tree
    overlay to provide multiple device tree testcases.

5.  Given that this gpio test framework is based on sysfs and debugfs.
    I feel that it could be a generic gpio test script other then a
    dedicated script for gpio-mockup driver. Although, my script only
    support gpio-mockup driver at this monment.

[1] http://article.gmane.org/gmane.linux.kernel.gpio/11878

Bamvor Jian Zhang (3):
  gpio/mockup: add virtual gpio device
  selftest/gpio: add gpio test case
  gpio: MAINTAINERS: Add an entry for GPIO mockup driver

 MAINTAINERS                          |   9 ++
 drivers/gpio/Kconfig                 |   9 ++
 drivers/gpio/Makefile                |   1 +
 drivers/gpio/gpio-mockup.c           | 216 +++++++++++++++++++++++++++++++
 tools/testing/selftests/Makefile     |   1 +
 tools/testing/selftests/gpio/gpio.sh | 238 +++++++++++++++++++++++++++++++++++
 6 files changed, 474 insertions(+)
 create mode 100644 drivers/gpio/gpio-mockup.c
 create mode 100755 tools/testing/selftests/gpio/gpio.sh

-- 
2.1.4


             reply	other threads:[~2015-11-14  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-14  8:51 Bamvor Jian Zhang [this message]
2015-11-14  8:51 ` [PATCH RFD 1/3] gpio/mockup: add virtual gpio device Bamvor Jian Zhang
2015-11-26  9:34   ` Linus Walleij
2015-11-26 14:54     ` Bamvor Jian Zhang
2015-11-14  8:51 ` [PATCH RFD 2/3] selftest/gpio: add gpio test case Bamvor Jian Zhang
2015-11-26  9:50   ` Linus Walleij
2015-11-26 16:18     ` Bamvor Jian Zhang
2015-11-14  8:51 ` [PATCH RFD 3/3] gpio: MAINTAINERS: Add an entry for GPIO mockup driver Bamvor Jian Zhang

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=1447491097-14799-1-git-send-email-bamvor.zhangjian@linaro.org \
    --to=bamvor.zhangjian@linaro.org \
    --cc=broonie@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).