Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1447297ybb; Sat, 11 Apr 2020 03:44:55 -0700 (PDT) X-Google-Smtp-Source: APiQypJJ2nDmad8++r4NeQlVewwoeeid6raba/bnjkU7sFP6EED3dSs8Bk62+EsEQbdTmUT5nOIk X-Received: by 2002:a0c:ee43:: with SMTP id m3mr9163084qvs.164.1586601894842; Sat, 11 Apr 2020 03:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586601894; cv=none; d=google.com; s=arc-20160816; b=oXOEHQLSWdjlQaUWnYowyzktQuGpQo4Mrct4xeuzZS/3u06mSkpYc9aQsrr2pqjTYf sL2T2ZKB+X/vdHtNlnVJD8TrNAISF0FecMGuB8ek7K0dDWsk1VBX/3hQtoE9svEsIbho bj6KY1dcQql8f0toeeWiehdb+MwWJHro9FkOdCxlMi++B2CYi1msqFJYNGsUC5jRSrbW GPtIe5Q16HDFTP4VGnixcm+VD7aQfhra/sppWb1RfAigyjpPrAJvDFXFvTFTn1OLQ89q i8jst+43m1YyHNpy2oX2jmE+khXLeoLvXbwXVqqvZcWwdH/8AMqbzvXWvAI6CyF/KnjB 5/pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=RK/AmR962qd3ACD6WdkmkYSjOcR/glqU3bQHdxbjBdA=; b=dX0NUYUW+VQVoQ/B72wLvDGKbw86GWq58xlodAdTUTtNIvtZueB/qMQzWXhc9oNnHJ hGYxFYAogRF6DJJJnfNoiSVMEWeefNffObe2fZ5lhC9IWnJlQMVHdvNar6Vu+zAxxhbp YIU7U4xDNgJTb2rcJyhW2sc8dmd0P/u/ggzCxGvv3PBE6c6Ur51uZJVehbsSWHImizz5 kiOLPZD50B6lm+rVojyzmMgzJrX84SNRALd4nx8fBkfz7X8E4rrPk7igDzZ2unfb+cj/ SkMPfc/akdHB01b123q/FckGnAa6ozZEjcdEchp/77daP9PC+fR3ojjJuzdeFBhxZkfu R0NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si2519639qtd.41.2020.04.11.03.44.40; Sat, 11 Apr 2020 03:44:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726090AbgDKKn6 (ORCPT + 99 others); Sat, 11 Apr 2020 06:43:58 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:40009 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbgDKKn5 (ORCPT ); Sat, 11 Apr 2020 06:43:57 -0400 Received: from kb-xps (unknown [78.193.40.249]) (Authenticated sender: kamel.bouhara@bootlin.com) by relay12.mail.gandi.net (Postfix) with ESMTPSA id AD555200008; Sat, 11 Apr 2020 10:43:54 +0000 (UTC) Date: Sat, 11 Apr 2020 12:43:53 +0200 From: Kamel Bouhara To: Dmitry Torokhov Cc: Alexandre Belloni , William Breathitt Gray , Rob Herring , Mark Rutland , Nicolas Ferre , Ludovic Desroches , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH 2/3] Input: rotary-encoder-counter: add DT bindings Message-ID: <20200411104353.GB161090@kb-xps> References: <20200406155806.1295169-1-kamel.bouhara@bootlin.com> <20200406155806.1295169-3-kamel.bouhara@bootlin.com> <20200409222115.GT75430@dtor-ws> <20200409223907.GW3628@piout.net> <20200409234623.GU75430@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409234623.GU75430@dtor-ws> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 09, 2020 at 04:46:23PM -0700, Dmitry Torokhov wrote: > On Fri, Apr 10, 2020 at 12:39:07AM +0200, Alexandre Belloni wrote: > > Hi Dmitry, > > > > On 09/04/2020 15:21:15-0700, Dmitry Torokhov wrote: > > > On Mon, Apr 06, 2020 at 05:58:05PM +0200, Kamel Bouhara wrote: > > > > Add dt binding for the counter variant of the rotary encoder driver. > > > > > > > > Signed-off-by: Kamel Bouhara > > > > --- > > > > .../input/rotary-encoder-counter.yaml | 67 +++++++++++++++++++ > > > > 1 file changed, 67 insertions(+) > > > > create mode 100644 Documentation/devicetree/bindings/input/rotary-encoder-counter.yaml > > > > > > > > diff --git a/Documentation/devicetree/bindings/input/rotary-encoder-counter.yaml b/Documentation/devicetree/bindings/input/rotary-encoder-counter.yaml > > > > new file mode 100644 > > > > index 000000000000..a59f7c1faf0c > > > > --- /dev/null > > > > +++ b/Documentation/devicetree/bindings/input/rotary-encoder-counter.yaml > > > > @@ -0,0 +1,67 @@ > > > > +# SPDX-License-Identifier: GPL-2.0 > > > > +%YAML 1.2 > > > > +--- > > > > +$id: http://devicetree.org/schemas/input/rotary-encoder-counter.yaml# > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > > + > > > > +title: Rotary Encoder Counter > > > > + > > > > +maintainers: > > > > + - Kamel Bouhara > > > > + > > > > +description: > > > > + Registers a Rotary encoder connected through a counter device. > > > > + > > > > +properties: > > > > + compatible: > > > > + const: rotary-encoder-counter > > > > > > I wonder if a separate driver is really needed. The original driver be > > > taught to use counter device when available? > > > > > > > By the original driver, do you mean drivers/input/misc/rotary_encoder.c > > that is using gpios ? > > Yes. > Well, it could be the case if the counter device could provide such a way to signal interrupts. > > > > > > + > > > > + counter: > > > > + description: Phandle for the counter device providing rotary position. > > > > + > > > > + linux-axis: > > > > + description: The input subsystem axis to map to this rotary encoder. > > > > + type: boolean > > > > + > > > > + qdec-mode: > > > > + description: | > > > > + Quadrature decoder function to set in the counter device. > > > > + 3: x1-PHA > > > > + 4: x1-PHB > > > > + 5: x2-PHA > > > > + 6: x2-PHB > > > > + 7: x4-PHA and PHB > > > > > > Is it really property of the rotary encoder itself or property of the > > > counter device? > > > > > > > The mode the quadrature decoder has to be put in depends on both the > > rotary encoder and the qdec. > > OK. > > > > > > > + > > > > + steps: > > > > + description: Number of steps in a full turnaround of the encoder. > > > > + Only relevant for absolute axis. Defaults to 24 which is a typical > > > > + value for such devices. > > > > + > > > > + relative-axis: > > > > + description: Register a relative axis rather than an absolute one. > > > > + type: boolean > > > > + > > > > + rollover: > > > > + description: Automatic rollover when the rotary value becomes greater > > > > + than the specified steps or smaller than 0. For absolute axis only. > > > > + type: boolean > > > > + > > > > + poll-interval: > > > > + description: Poll interval at which the position is read from the counter > > > > + device (default 500ms). > > > > > > Is there a way found counters to signal an interrupt? > > > > > > > For some counters, there are interrupts available, this is not trivial > > with the counter that is the target of this work but this is on the TODO > > list. Of course, this will also require adding a bit more to the > > in-kernel counter API to allow registering a callback that would be > > called when an interrupt happens. > > Should it be a callback, or can counter create an irqchip so that users > do not need to know how exactly it is wired up? > Maybe for some of them yes but for others the polling is still required. > Thanks. > > -- > Dmitry -- Kamel Bouhara, Bootlin Embedded Linux and kernel engineering https://bootlin.com