Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2801112pxb; Fri, 12 Feb 2021 01:25:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlXMy5Uf2tm+li0fSgp0Mq2eXwEiFoyhynKmnOjQ8pPT5uIWFcbZ+aMzmhaqELm7QxulD1 X-Received: by 2002:a50:8b66:: with SMTP id l93mr2334269edl.384.1613121912642; Fri, 12 Feb 2021 01:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613121912; cv=none; d=google.com; s=arc-20160816; b=diYCfd1Q5OsjXu5MvwgPqYVpJxJhxgWo4p5KKBTKghNQDv+GxXf/EXkmuzs0CzFiop FwYE8pjp163egIg4upSDo2l+9ccVDM72QSTlQge5QHTBoyF0IvyFiW3C35wmSc9nGuxy KA+4b9et1BBwNp3f4f9qecIvb536WGrVKL365/jcyhtKluKBeDjTO9b41ehIt0QkS65X DT6cz5zRHfpzu7xoYLQAPl7N5KwZ6z9S/xFm8K8w47WRrgQkX2dhKzYanJaCutFmrbRJ G3lWNtbsp67U0+x08s4GRiVJsUDTlyBLh2NVIe6kvJZBPIWdjZ3o/rvBDtfRzhE2/60Q 66jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0qh8Pdw9qka2TYE2ZgoHexsZ5dGrw0h903IxKKwLo7w=; b=Iuves2RFnDunsmUfhZb8xsAZIEwAlk7+n4Bwr6GL1m3V7TPWY1fVrewX089oIxXSAU XTfiJmDhHdCfJhWnKL1D+lwszsS9euuY2hrpfDtyE/YCnG4vTFKsqw1jYXzJj8ilQeOv nhUiTzfoxOTv9TACvl+q+0mBFSxWU4VPUgE5fdrcIC7kh+rw14rGu3lGV5G2BopJyitt DZ+pCRycJvT997Fa46KlBGXHvyH284JCSIBpggo8zz4OnjFNULqvieRCBA9C1IUYuIqD dQJv1Xn3MCiV8Gseahpb51hV5qN3m5puY1eon4k1aRt07XTZDwwzEBUoVhGW8bU7WwfN 5iSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fa3Fe7P9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si6914465eds.434.2021.02.12.01.24.49; Fri, 12 Feb 2021 01:25:12 -0800 (PST) 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=@linaro.org header.s=google header.b=Fa3Fe7P9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbhBLJX5 (ORCPT + 99 others); Fri, 12 Feb 2021 04:23:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229983AbhBLJXj (ORCPT ); Fri, 12 Feb 2021 04:23:39 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E06FEC0613D6 for ; Fri, 12 Feb 2021 01:22:58 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id v30so11797994lfq.6 for ; Fri, 12 Feb 2021 01:22:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0qh8Pdw9qka2TYE2ZgoHexsZ5dGrw0h903IxKKwLo7w=; b=Fa3Fe7P9ew+sbMFs79guYw2cPpaCCLJiiFVkJwqgHaMj0sGMSjLfZutWZ0Ja7Yxnh/ RBbooQsjB6f9xB8Yih70bYFqnkabOj+9G0uoPD56BJLOVSDna1oJ5+By8wWYHvw5qAL/ xLsY3HpEcA9pFN+wkH8fwiRqRDBp105I3xgVoSmdVkvgNt7oeqNW+5nCjJhpD1kOK+Iu VbN9SWvxE2JI4TJtpIT95Z8weUmBO7xxO3OxFppWrHj7+HkD5ZOe9PjbaQndcdJfojtM xZMN5zHu06UGDsL99wop9QduCoau+e0Kz2/6j7w7pAopTWdaWnYE0vKlKcJQT+rpXdVO v50Q== 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=0qh8Pdw9qka2TYE2ZgoHexsZ5dGrw0h903IxKKwLo7w=; b=fqmY4lwP/pO1JixAeiz+VCBREL5ozLpT3JnSnYRd5CLjzwxvXGasKPAH4DnmoLA55z aZfI1nuEUX2ZjKF39HNxiAr81z75c7HKTrEnJ/liQyCd9Eds01skh1zh3wZEIe1OGnkM PzUyK2AtJuNxYFrxS/EDHV6PB0TollMmJbwOEK/xfdcgWW+GAxc97p4oDN5VFf6Z904k Y8Sk5bBHlYyzchRvwc8CyM1YckUvJfFpz0PuPlLX8QGouxzJOkepTYuKpBi1oJh5IBv9 Mx9pNSGuhCnwar4Oc2TXT1gRyZHRqeJdIBsoIePpMucjvXslh3+dyq9LorHEdJJjuiBL E/bw== X-Gm-Message-State: AOAM532JYE8Lts1Ge50uzvXgJFfQkHnx1RD2vizLi85JXol+x++DG6Ip QfmUuDgb6JOf5J4VaMQH3Q4AyAAaAl02R8Ai4bdgBQ== X-Received: by 2002:a19:8bc6:: with SMTP id n189mr1061111lfd.291.1613121777318; Fri, 12 Feb 2021 01:22:57 -0800 (PST) MIME-Version: 1.0 References: <20210208135347.18494-1-o.rempel@pengutronix.de> <20210208135347.18494-2-o.rempel@pengutronix.de> <20210210184138.GA2504266@robh.at.kernel.org> In-Reply-To: <20210210184138.GA2504266@robh.at.kernel.org> From: Linus Walleij Date: Fri, 12 Feb 2021 10:22:46 +0100 Message-ID: Subject: Re: [PATCH v5 1/2] dt-bindings: counter: add event-counter binding To: Rob Herring Cc: Oleksij Rempel , William Breathitt Gray , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" , Pengutronix Kernel Team , David Jander , Robin van der Gracht , linux-iio , Jonathan Cameron Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 7:41 PM Rob Herring wrote: > On Mon, Feb 08, 2021 at 02:53:46PM +0100, Oleksij Rempel wrote: > > + interrupts: > > + maxItems: 1 > > + > > + gpios: > > + description: Optional diagnostic interface to measure signal level > > This description seems wrong in the case of only having a GPIO. > > Also, a GPIO only implies polled mode because if the GPIO is interrupt > capable, 'interrupts' should be required. For gpio-keys, we split the > compatible strings in this case. I leave it to you if you want to make > it more explicit. Ouch. This is a bit of semantic confusion where I see different things if I put my Linux hat on than if I put my DT hat on ... :/ Linux (or some other OS I suppose) has the ability to look up an interrupt resource for a GPIO line and that is used quite extensively. In this case it is certainly possible to write a Linux driver that only take a GPIO resource and looks up a corresponding interrupt without the involvement of any DT interrupt resources. This happens a lot. A typical example is cd-gpios in Documentation/devicetree/bindings/mmc/mmc-controller.yaml The operating system will take cd-gpios and infer the corresponding IRQ from the GPIO hardware by OS-internal mechanisms (in the Linux case simply using irqdomain) in almost cases, and that is how that is used today. It is an hardware interrupt that gets allocated and used but the DT is blissfully ignorant about. The reason is that GPIO is "general purpose" so they don't have very specific use cases and the interrupts are general purpose as well. A certain GPIO line may not even have a certain interrupt associated with it: there exist GPIO controllers with e.g. 32 GPIO lines but only 8 interrupts that can be assigned to GPIO lines on a first-come-first-serve basis so there could not be anything like a cell in the bindings pointing to a certain interrupt: it has to be resolved by software, at runtime. In many cases the corresponsing GPIO hardware will have both gpio-controller and interrupt-controller flags, but I bet there exist cases that are only flagged with gpio-controller and then the drivers in the OS goes and implement interrupts using its abstractions and assign them anyway. I don't know if this can be solved in a generic way (solved as in DT needs to know all about the systems interrupt resources, and the OS should not be handing out interrupts behind the back of the DT description for things that are not flagged as interrupt-controller) or if this ambiguity around GPIO chips just has to stay around forever. I think it may be one of those cases where DT bindings can't be all that imperialistic about controlling every resource, but there may be other views on this. Yours, Linus Walleij