Re: [PATCH 2/3] Input: rotary-encoder-counter: add DT bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <kamel.bouhara@xxxxxxxxxxx>
> > > ---
> > >  .../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 <kamel.bouhara@xxxxxxxxxxx>
> > > +
> > > +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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux