Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp125728pja; Thu, 9 Apr 2020 15:54:02 -0700 (PDT) X-Google-Smtp-Source: APiQypJemARGhrqpHPS70LCNerYHkn1cXvJE9y+XRbnVaK4sBbEIZGDkjeoDkOgBLHSoqbilJjgj X-Received: by 2002:ae9:f308:: with SMTP id p8mr1291331qkg.81.1586472841946; Thu, 09 Apr 2020 15:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586472841; cv=none; d=google.com; s=arc-20160816; b=lPn9hRN7X8P9tWXSkCoJLP35BfYKgGt0RgN2kzmNHEG7P1Ccv068pGNL6MnSwtYZRn wcBSsa+ICH7lvHiudBIJ/TxzXlvKhuNdwhNV8przocTtI2b4lDnxG8EYWtgortYvhWNE clnVxwlsMk3g+ZPoiN5xseVCVR0vEIPi+Y7+j/SBz6jjj3IlqSrbqYXkEfj+J+SKA9He ykXrXFDnwYaDHnjsuDCwJV2DlkynfMruWTCgKu43j12re3ydHIGnzGxUn2YbXpA1cIuj hrp3vMsONAKqo6nDZSxTQx60QzpCyQznl+lPF9RyPngqGfOkgN8N95zGfactu6mS8L69 ilnQ== 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=UqJ+k0o7JYzB+2IXOVSYXwkP4ftAkEyG7qAIKEW5n28=; b=t3EiBSW38VWXjvGsfdKNaKcOkFYdflgnNyuvGtKFvXIJV7cULgqNnAHGf3dPzu1gmY 7cen6AfhNlab5UTxKPi2ZEuG2kxGrORRW2Cl5l7PpuSQtBu++6nG0rCzutI87g/QuoBm 4TwFnxtMyfS6SCT6qYS8ATGIMwY2r1FWLCf/MAcI4EhTkdgHZOK9gJFEDZIwhWHucA3g d03aMuib2to24O5v2vyRABu6e7azx6M/fQXxqkCxFuWoDZUxME8p3zPS/bX6RJ+ErRoG QPxVhwNF7DE71yqo1RGTZEzcKtXA//ftprbaomKk27N/Lse95xzrcrnOB6atVRsCr3Bd 6MUQ== 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 g197si291378qke.85.2020.04.09.15.53.41; Thu, 09 Apr 2020 15:54:01 -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 S1726892AbgDIWjL (ORCPT + 99 others); Thu, 9 Apr 2020 18:39:11 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:58675 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbgDIWjL (ORCPT ); Thu, 9 Apr 2020 18:39:11 -0400 X-Originating-IP: 86.202.105.35 Received: from localhost (lfbn-lyo-1-9-35.w86-202.abo.wanadoo.fr [86.202.105.35]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 78876FF803; Thu, 9 Apr 2020 22:39:07 +0000 (UTC) Date: Fri, 10 Apr 2020 00:39:07 +0200 From: Alexandre Belloni To: Dmitry Torokhov Cc: Kamel Bouhara , 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: <20200409223907.GW3628@piout.net> References: <20200406155806.1295169-1-kamel.bouhara@bootlin.com> <20200406155806.1295169-3-kamel.bouhara@bootlin.com> <20200409222115.GT75430@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409222115.GT75430@dtor-ws> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ? > > + > > + 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. > > + > > + 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. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com