Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp64593ybb; Thu, 9 Apr 2020 17:20:08 -0700 (PDT) X-Google-Smtp-Source: APiQypJFgo7q0IA+2UidlYJY9K38J2nOcB7sv0QrmGhaGu3x1r6J7Ai74NH6sascR9ZT26LHY80R X-Received: by 2002:ac8:224c:: with SMTP id p12mr2088296qtp.32.1586478008502; Thu, 09 Apr 2020 17:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586478008; cv=none; d=google.com; s=arc-20160816; b=A2vU0iqyqggPCUJboH/FqifECQDQCwZZvNOZYh4ZsknRFU5zxAHGMhCSEM05FO6ubb 2bNFmHUJ+dmwHAdildK/EHFHR4HcDKSSMVwnS4H32kMxORj5crBxRJ35OAbWWo5yn4kw +8OHS0O8XJKVAw3bXVcl9w7svnX1j4heyIbONeyTyIJpknscjrSLGujCeVSmiOmY5azs ReJB+Qr9xxgrmC4xdg6nFKwizbKlyvZqXo963G+b1qjr1FoFDP/62xmJi/DeafL0mGq3 0b7U+3/H+x4OsaHBieBHort0b9On86rb6mvXw4dhxoyg0ao8UHmlhv4wr4zBA7/xmUVS eyzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=X1Y8bnD3QMGmRcwUVI82L0iDUV1q8Fy3GQNmvFYnS2I=; b=vFTmzgA2hWBb4ZDIqAnQDiWojOm2Dqf39fiPasvMXrcy5AAtb2ZWGP7ZDdMOy0ejlx k4gC//4Vr+7PBQWLDhaiOS+romAIRt31TReaLxt15sivZcXqcUulOVQ27yKdlpDc3PNY Qdt7OW311aerCSaIaddLrvZFNiiB1ZxgiLo6200YwhlP8z3Lqo1Rh2t14Th1EJobwlkY jdeqA6KB06+LP+505gWtN1+BvlvCiSeuzEp5UNJmjE/MFdjtozfB2FFrARkGn9OBQfAj mO3uh8AtDhbkb9dHGlcG91xURfAIhsG1wLdNizjxk++9Q6qy9nkUqmZ+FZcYQSPMWr8b A5gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EBxEUf08; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n83si468946qke.296.2020.04.09.17.19.50; Thu, 09 Apr 2020 17:20:08 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EBxEUf08; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbgDIXqa (ORCPT + 99 others); Thu, 9 Apr 2020 19:46:30 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37850 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726726AbgDIXq3 (ORCPT ); Thu, 9 Apr 2020 19:46:29 -0400 Received: by mail-pf1-f193.google.com with SMTP id u65so291667pfb.4; Thu, 09 Apr 2020 16:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=X1Y8bnD3QMGmRcwUVI82L0iDUV1q8Fy3GQNmvFYnS2I=; b=EBxEUf08dMeA2iEQohC5/R3ZVAHRMWWtefrFAHbK3WBKDA3GsxHCGkxIMncKubJ14s ZqP447beS2tDu8NLH1Z44HuydTaUOJwx4UvmH8w9UE66LnWULAeThpHVGv7KL/t1IQ0z nXGlMIXpzqjB9hMb2IcXye17mn11vmGodw94zXUXdpypQtgltIkMQUBpX3lpyQLcQhKs kQI2/Tz08GLv0yr0aet1S8RRQlqzSM7yN+zQ+e+KhdgepQmmcXKW4fxnkQaG1Dt82L0h xYs6faP7szYqAUT2Vq+a4PoC+D7liwiWUMPO1Y6tmyF0KcAKHRiKCImaEY+I5eSH5Prx zO6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=X1Y8bnD3QMGmRcwUVI82L0iDUV1q8Fy3GQNmvFYnS2I=; b=k3dyzjRdfrMbravnNC7lg4kpvJooy29jyo12cVeKxCEmoS3vzkmAVw14WfU7OW2yfo KPX7f9WMvwSsMzcYdNwKHtd0/LwC94g5LiA87rfWPKtbevl/uBe/qfLOr5TsLTejdU17 zCCyjBwhjnnZGlZPG1lZvYNL0GwBHr4J/CIds4kugSQG8E5uRSkH2KMERlrqj9ZE///j uQXdvnAT3Q7OEELy8rR6pSJ+rk2B5nVjEYkJ51oKUhxfcOeQ2UEBb4aFiqoS6rmK12Aq 7pPR6slOjykBp9so88CzHkjWnlebwn9aa+s5/HMFKShF4eVL5NQCBkJNz5QmInh3b1OX 3DvQ== X-Gm-Message-State: AGi0PuZN9pfwlIF0s84F8nh8IhiSLoIpQ8SuXdlQOcLvnvPDYvZ/APzM y0z/J7Vjusud9n7qOW1iqpc= X-Received: by 2002:a62:648f:: with SMTP id y137mr2268339pfb.199.1586475986437; Thu, 09 Apr 2020 16:46:26 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3c2a:73a9:c2cf:7f45]) by smtp.gmail.com with ESMTPSA id w27sm191851pfq.211.2020.04.09.16.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2020 16:46:25 -0700 (PDT) Date: Thu, 9 Apr 2020 16:46:23 -0700 From: Dmitry Torokhov To: Alexandre Belloni 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: <20200409234623.GU75430@dtor-ws> References: <20200406155806.1295169-1-kamel.bouhara@bootlin.com> <20200406155806.1295169-3-kamel.bouhara@bootlin.com> <20200409222115.GT75430@dtor-ws> <20200409223907.GW3628@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409223907.GW3628@piout.net> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > > + > > > + 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? Thanks. -- Dmitry