Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp302666pxk; Fri, 11 Sep 2020 07:21:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbe13yr5Wln+ogbGfC2YwnTqzzh1m7Aw0o3USuLJQ4jOTvYaROnoR4XqHTwdVGT7hUsJlP X-Received: by 2002:a17:906:e24d:: with SMTP id gq13mr2196560ejb.152.1599834112377; Fri, 11 Sep 2020 07:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599834112; cv=none; d=google.com; s=arc-20160816; b=pm+1sVRQ2zk8Gk6bmcXSChUzaEYEOcvhY6/jnaB56i0rztsFDjz6TARWHRrCdjZBVJ 4lcFn33IaWX8qVEvagzRuV+ym6yToxLZA5bp5SnJXPtFgOwtTPqs8ySO3HNPWwWQlb5G vKYlQUwg11OvEEc/TlA64dkaKBa7Z/l/UMWKGGmZRr+VnNURjYe72z5U7noh+1ujdNQP SAx8o1qLyGOn1oTCEISgRa1b0P9ZKRVUB/78Afd7XAJnxFLATG2wUh4/QClPbIRDVVHk NELe6Hi8J4r5CQMF+wZEU+tH7x236kI7iZdkg/5UsVHcIg2Rr3D85MTBmlpzr9GDZF67 YG0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=TgQoed0GxIerQ44x+71MWXYhJbzdbOqc1n5qsFlaJSg=; b=ciqUlwe0rDw/xroMNaBAr/ofuBBz4n8HVUjIgB5eEwCNrWOL+vk/iNkYyD0yN7M4ij o5jY038ZO1z1BiW7mD0Cpj4XXLwn9SYMuP0d17BEvmcRhPBpqtRNOUh2bw38VLd/NzvH cpc5vM2DTWrW0ET21U/NJypUbGZ3eOsINXxT1sGk4ojAPpbARh6LldE/bGSD1XInmzSy SOhu09IQv0pqqpoXeGqDaGgQ1Q8pMGFCqkac6OgR+9NvP+GTGuzBlZX6s5IeFGtoLHEG I1rkZN7ArP8MHUFNUs5ResZUreUtUgsW3P+B2QSiD73I9qqnKwSvpI2IMxYDIntKyHfQ TYlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=EarytBvw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lk17si1375477ejb.188.2020.09.11.07.21.27; Fri, 11 Sep 2020 07:21:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=EarytBvw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726126AbgIKOUP (ORCPT + 99 others); Fri, 11 Sep 2020 10:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbgIKNSP (ORCPT ); Fri, 11 Sep 2020 09:18:15 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BABE7C061795 for ; Fri, 11 Sep 2020 06:07:15 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id l17so9834988edq.12 for ; Fri, 11 Sep 2020 06:07:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TgQoed0GxIerQ44x+71MWXYhJbzdbOqc1n5qsFlaJSg=; b=EarytBvwoQep7qd57VxmLST9JhvldbG08X3Nhqjheaj8MGEJpUXQbQdXO9VsM17+03 b1qLL2NsHvu9J9xBXIZvZarcrQoDu0q+HllUQxkpUyTsxMId3oXHB1Tn07+fRJ1jFTf8 +5jh35x6TyiSpnx7oUljGT0afOX2lXuVBSl4XpEijxq/NGNs1cimpkYYG6C3EEeqHK2G y6OQEZE4nTNaqwyc45DYEJUC/gCELLHgmGL9F+MQmMIvSuaK/TtZRT6Z5yGjJyxMUBTu 2w+2PLGV+qbr3yjE73O+TjHkWTlvHPSQrDWJ0TiBY9Z+RJc/v+2HUd2d/hD2asyZCEaS 6mpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TgQoed0GxIerQ44x+71MWXYhJbzdbOqc1n5qsFlaJSg=; b=Uo6LnrQp48uw2RuWr2VXWzEfbv1mWhP6NtF+PQC9M/DYCov3f5ilXA1vOO/bK+cRr5 ACuxdSUvgmSqxz+YQBh4wThL8NG1oZDQa75I4msCX9j4DuIVXvXc3Uwx3VPiWMtrONzk zK7ayY7iA7d0xuzZelC9s4V/xLooBbBLiaIrBTg/Syl9NaYsWc1biU2+JBc/sRSdz+OJ bpQpJOIV3mZvN9dSlBtwpOqJlzAOt/17N8TCcKM2i8Qjh5YZQdp1e8rKBVGAFfHisK26 htZvJLH6C7uI+fSEzDIz/5SAcOXa6M3GPCnqNgfsOpjQZgKnkV7ziZfeUM7lMMN0EirG 1+UQ== X-Gm-Message-State: AOAM533Uy/L4mPnFOxb/DtLvLhABdYIaJWSiNsFJQVM9hez7MZ/9g+06 xJokyMT9kI42aNPxrnXNcozKJUBmExub76kLtdKVlw== X-Received: by 2002:a50:f687:: with SMTP id d7mr1944285edn.353.1599829633051; Fri, 11 Sep 2020 06:07:13 -0700 (PDT) MIME-Version: 1.0 References: <20200904154547.3836-1-brgl@bgdev.pl> <20200904154547.3836-24-brgl@bgdev.pl> <26ea1683-da8f-30e7-f004-3616e96d56b3@infradead.org> <20200907095932.GU1891694@smile.fi.intel.com> <20200907115310.GA1891694@smile.fi.intel.com> <20200907122238.GA1849893@kroah.com> <20200911125625.GF3758477@kroah.com> In-Reply-To: <20200911125625.GF3758477@kroah.com> From: Bartosz Golaszewski Date: Fri, 11 Sep 2020 15:07:02 +0200 Message-ID: Subject: Re: [PATCH 23/23] Documentation: gpio: add documentation for gpio-mockup To: Greg Kroah-Hartman Cc: Bartosz Golaszewski , Andy Shevchenko , Randy Dunlap , Linus Walleij , Jonathan Corbet , Mika Westerberg , Kent Gibson , linux-gpio , linux-doc , LKML , ACPI Devel Maling List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 11, 2020 at 3:01 PM Greg Kroah-Hartman wrote: > > On Tue, Sep 08, 2020 at 07:03:30PM +0200, Bartosz Golaszewski wrote: > > On Mon, Sep 7, 2020 at 2:22 PM Greg Kroah-Hartman > > wrote: > > > > > > On Mon, Sep 07, 2020 at 02:06:15PM +0200, Bartosz Golaszewski wrote: > > > > On Mon, Sep 7, 2020 at 1:53 PM Andy Shevchenko > > > > wrote: > > > > > > > > > > On Mon, Sep 07, 2020 at 12:26:34PM +0200, Bartosz Golaszewski wrote: > > > > > > On Mon, Sep 7, 2020 at 11:59 AM Andy Shevchenko > > > > > > wrote: > > > > > > > > > > > > > > On Fri, Sep 04, 2020 at 08:15:59PM -0700, Randy Dunlap wrote: > > > > > > > > On 9/4/20 8:45 AM, Bartosz Golaszewski wrote: > > > > > > > > > > > > > > ... > > > > > > > > > > > > > > > > +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. > > > > > > > > > > > > > > Actually sounds like a good idea. > > > > > > > > > > > > > > > > > > > Well, then we can go on and write an entirely new mockup driver > > > > > > (ditching module params and dropping any backwards compatibility) > > > > > > because we're already using debugfs for line values. > > > > > > > > > > > > How would we pass the device properties to configfs created GPIO chips > > > > > > anyway? Devices seem to only be created using mkdir. Am I missing > > > > > > something? > > > > > > > > > > Same way how USB composite works, no? > > > > > > > > > > > > > OK, so create a new chip directory in configfs, configure it using > > > > some defined configfs attributes and then finally instantiate it from > > > > sysfs? > > > > > > > > Makes sense and is probably the right way to go. Now the question is: > > > > is it fine to just entirely remove the previous gpio-mockup? Should we > > > > keep some backwards compatibility? Should we introduce an entirely new > > > > module and have a transition period before removing previous > > > > gpio-mockup? > > > > > > > > Also: this is a testing module so to me debugfs is just fine. Is > > > > configfs considered stable ABI like sysfs? > > > > > > Yes it is. Or at least until you fix all existing users so that if you > > > do change it, no one notices it happening :) > > > > > > > Got it. One more question: the current debugfs interface we're using > > in gpio-mockup exists to allow to read current values of GPIO lines in > > output mode (check how the user drives dummy lines) and to set their > > simulated pull-up/pull-down resistors (what values the user reads in > > input mode). > > > > This works like this: in /sys/kernel/debug/gpio-mockup every dummy > > chip creates its own directory (e.g. > > /sys/kernel/debug/gpio-mockup/gpiochip0) and inside this directory > > there's an attribute per line named after the line's offset (e.g. > > /sys/kernel/debug/gpio-mockup/gpiochip0/4). Writing 0 or 1 to this > > attribute sets the pull resistor. Reading from it yields the current > > value (0 or 1 as well). > > > > This is pretty non-standard so I proposed to put it in debugfs. If we > > were to use configfs - is this where something like this should go? Or > > rather sysfs? Is it even suitable/acceptable for sysfs? > > That sounds like it would work in sysfs just fine as-is, why don't you > all want to use that? configfs is good for "set a bunch of attributes > to different values and then do a 'create/go/work'" type action. > I've started looking into it. I need to first implement committable items for configfs because mockup GPIO chips need to be configured before they're instantiated. It'll be configfs to configure and instantiate each chip and a set of sysfs attributes to manipulate existing chips. Bartosz