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 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html